[Debian-on-mobile-maintainers] [Git][DebianOnMobile-team/phoc][upstream/latest] 2 commits: text_input: Don't forward events from unfocused text inputs
Arnaud Ferraris
gitlab at salsa.debian.org
Tue Nov 24 10:46:10 GMT 2020
Arnaud Ferraris pushed to branch upstream/latest 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
- - - - -
3 changed files:
- debian/changelog
- meson.build
- src/text_input.c
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+phoc (0.5.1) amber-phone; urgency=high
+
+ [ Dorota Czaplejewicz ]
+ * text_input: Don't forward events from unfocused text inputs
+
+ -- Sebastian Krzyszkowiak <sebastian.krzyszkowiak at puri.sm> Wed, 18 Nov 2020 21:20:45 +0100
+
phoc (0.5.0) amber-phone; urgency=high
[ Guido Günther ]
=====================================
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/fd6351c0f4ee7af38ff60c96e211d4ff2a5f3ad9...9fe63674a80268acd97fc7fb7db1a8448243bb1e
--
View it on GitLab: https://salsa.debian.org/DebianOnMobile-team/phoc/-/compare/fd6351c0f4ee7af38ff60c96e211d4ff2a5f3ad9...9fe63674a80268acd97fc7fb7db1a8448243bb1e
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/ddeb115a/attachment-0001.html>
More information about the Debian-on-mobile-maintainers
mailing list