[gnome-shell/wip/carlosg/osk-updates: 166/180] keyboard: Fill suggestion on button-press-event
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/osk-updates: 166/180] keyboard: Fill suggestion on button-press-event
- Date: Wed, 10 Aug 2022 14:04:37 +0000 (UTC)
commit f50be1b15693e5b5764e5604d6d04813ca5ff34e
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 22 16:19:14 2022 +0200
keyboard: Fill suggestion on button-press-event
Like OSK key buttons, we must avoid the default grabbing behavior
of StButton here. Hook to button-press-event to commit the selected
words, so we get a chance to prevent focus changes on the current
key focus.
Likewise, connect to ::touch-event to handle touch input.
js/ui/keyboard.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 39066057ac..e7b1eae4f6 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -175,7 +175,17 @@ class Suggestions extends St.BoxLayout {
add(word, callback) {
let button = new St.Button({ label: word });
- button.connect('clicked', callback);
+ button.connect('button-press-event', () => {
+ callback();
+ return Clutter.EVENT_STOP;
+ });
+ button.connect('touch-event', (actor, event) => {
+ if (event.type() !== Clutter.EventType.TOUCH_BEGIN)
+ return Clutter.EVENT_PROPAGATE;
+
+ callback();
+ return Clutter.EVENT_STOP;
+ });
this.add_child(button);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]