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