You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.4 KiB
68 lines
2.4 KiB
6 years ago
|
From 04a4a100e34e3ce8c34212ebb79e77b92ef8238d Mon Sep 17 00:00:00 2001
|
||
|
From: Carlos Garnacho <carlosg@gnome.org>
|
||
|
Date: Tue, 18 Sep 2018 12:54:29 +0200
|
||
|
Subject: [PATCH] keyboard: Listen to IbusPanelService::focus-in/out to track
|
||
|
focus changes
|
||
|
|
||
|
In X11 there's no input panel state requests, so restore the previous behavior
|
||
|
that focused entries would always toggle the OSK on there.
|
||
|
---
|
||
|
js/misc/ibusManager.js | 6 ++++++
|
||
|
js/ui/keyboard.js | 16 ++++++++++++++++
|
||
|
2 files changed, 22 insertions(+)
|
||
|
|
||
|
diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js
|
||
|
index 6452e492f..e6d4b5aec 100644
|
||
|
--- a/js/misc/ibusManager.js
|
||
|
+++ b/js/misc/ibusManager.js
|
||
|
@@ -119,6 +119,12 @@ var IBusManager = new Lang.Class({
|
||
|
let cursorLocation = { x, y, width: w, height: h };
|
||
|
this.emit('set-cursor-location', cursorLocation);
|
||
|
});
|
||
|
+ this._panelService.connect('focus-in', (panel, path) => {
|
||
|
+ // This is ibus' "no focus" input context, so should be ignored
|
||
|
+ if (!GLib.str_has_suffix(path, '/InputContext_1'))
|
||
|
+ this.emit ('focus-in');
|
||
|
+ });
|
||
|
+ this._panelService.connect('focus-out', () => { this.emit('focus-out'); });
|
||
|
|
||
|
try {
|
||
|
// IBus versions older than 1.5.10 have a bug which
|
||
|
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
|
||
|
index be0146344..491495c57 100644
|
||
|
--- a/js/ui/keyboard.js
|
||
|
+++ b/js/ui/keyboard.js
|
||
|
@@ -519,6 +519,12 @@ var FocusTracker = new Lang.Class({
|
||
|
|
||
|
this._setCurrentRect(rect);
|
||
|
});
|
||
|
+ this._ibusManager.connect('focus-in', () => {
|
||
|
+ this.emit('focus-changed', true);
|
||
|
+ });
|
||
|
+ this._ibusManager.connect('focus-out', () => {
|
||
|
+ this.emit('focus-changed', false);
|
||
|
+ });
|
||
|
},
|
||
|
|
||
|
get currentWindow() {
|
||
|
@@ -590,6 +596,16 @@ var Keyboard = new Lang.Class({
|
||
|
this._animFocusedWindow = null;
|
||
|
this._oskFocusWindow = null;
|
||
|
});
|
||
|
+ this._focusTracker.connect('focus-changed', (tracker, focused) => {
|
||
|
+ // Valid only for X11
|
||
|
+ if (Meta.is_wayland_compositor())
|
||
|
+ return;
|
||
|
+
|
||
|
+ if (focused)
|
||
|
+ this.show(Main.layoutManager.focusIndex);
|
||
|
+ else
|
||
|
+ this.hide();
|
||
|
+ });
|
||
|
|
||
|
Meta.get_backend().connect('last-device-changed',
|
||
|
(backend, deviceId) => {
|
||
|
--
|
||
|
2.19.0
|
||
|
|