[Debian-on-mobile-maintainers] [Git][DebianOnMobile-team/phoc][debian/master] 4 commits: text_input: Don't forward events from unfocused text inputs

Arnaud Ferraris gitlab at salsa.debian.org
Tue Nov 24 10:54:01 GMT 2020



Arnaud Ferraris pushed to branch debian/master at Debian On Mobile / phoc


Commits:
3d66b07e by Dorota Czaplejewicz at 2020-11-18T08:54:53+00:00
text_input: Don't forward events from unfocused text inputs

- - - - -
9fe63674 by Sebastian Krzyszkowiak at 2020-11-19T14:27:36+01:00
Document changes and release 0.5.1

- - - - -
569a280d by Arnaud Ferraris at 2020-11-24T11:46:55+01:00
New upstream version 0.5.1

- - - - -
6b153a7d by Arnaud Ferraris at 2020-11-24T11:47:48+01:00
d/changelog: release version 0.5.1-1

- - - - -


3 changed files:

- debian/changelog
- meson.build
- src/text_input.c


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+phoc (0.5.1-1) unstable; urgency=medium
+
+  * d/gbp.conf: remove 'v' prefix from debian tags
+  * New upstream version 0.5.1
+
+ -- Arnaud Ferraris <arnaud.ferraris at gmail.com>  Tue, 24 Nov 2020 11:47:22 +0100
+
 phoc (0.5.0-1) unstable; urgency=medium
 
   * New upstream version 0.5.0


=====================================
meson.build
=====================================
@@ -1,5 +1,5 @@
 project('phoc', 'c',
-          version: '0.5.0',
+          version: '0.5.1',
           license: 'GPLv3+',
     meson_version: '>= 0.47.0',
   default_options: [


=====================================
src/text_input.c
=====================================
@@ -93,6 +93,12 @@ static void handle_im_destroy(struct wl_listener *listener, void *data) {
 	}
 }
 
+static bool text_input_is_focused(struct wlr_text_input_v3 *text_input) {
+	// roots_input_method_relay_set_focus ensures
+	// that focus sits on the single text input with focused_surface set.
+	return text_input->focused_surface != NULL;
+}
+
 static void relay_send_im_done(struct roots_input_method_relay *relay,
 		struct wlr_text_input_v3 *input) {
 	struct wlr_input_method_v2 *input_method = relay->input_method;
@@ -100,6 +106,10 @@ static void relay_send_im_done(struct roots_input_method_relay *relay,
 		wlr_log(WLR_INFO, "Sending IM_DONE but im is gone");
 		return;
 	}
+	if (!text_input_is_focused(input)) {
+		// Don't let input method know about events from unfocused surfaces.
+		return;
+	}
 	// TODO: only send each of those if they were modified
 	if (input->active_features & WLR_TEXT_INPUT_V3_FEATURE_SURROUNDING_TEXT) {
 		wlr_input_method_v2_send_surrounding_text(input_method,
@@ -137,6 +147,12 @@ static void handle_text_input_enable(struct wl_listener *listener, void *data) {
 	}
 	struct roots_text_input *text_input = text_input_to_roots(relay,
 		(struct wlr_text_input_v3*)data);
+	// relay_send_im_done protects from receiving unfocussed done,
+	// but activate must be prevented too.
+	// TODO: when enter happens?
+	if (!text_input_is_focused(text_input->input)) {
+		return;
+	}
 	wlr_input_method_v2_send_activate(relay->input_method);
 	relay_send_im_done(relay, text_input->input);
 }
@@ -165,6 +181,11 @@ static void relay_disable_text_input(struct roots_input_method_relay *relay,
 		wlr_log(WLR_DEBUG, "Disabling text input, but input method is gone");
 		return;
 	}
+	// relay_send_im_done protects from receiving unfocussed done,
+	// but deactivate must be prevented too
+	if (!text_input_is_focused(text_input->input)) {
+		return;
+	}
 	wlr_input_method_v2_send_deactivate(relay->input_method);
 	relay_send_im_done(relay, text_input->input);
 }



View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/4fbf84232606333e32fd60cd812bde728eb4aa91...6b153a7d51f477441d61a2e6b23c27a07e51ffdb

-- 
View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/4fbf84232606333e32fd60cd812bde728eb4aa91...6b153a7d51f477441d61a2e6b23c27a07e51ffdb
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-on-mobile-maintainers/attachments/20201124/88524705/attachment-0001.html>


More information about the Debian-on-mobile-maintainers mailing list