[gnome-shell] keyboard: Monitor the ShowOSK property of g-s-d
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] keyboard: Monitor the ShowOSK property of g-s-d
- Date: Tue, 2 Sep 2014 20:42:50 +0000 (UTC)
commit 3deaeb4a90adfa9161e1533c73330219de841417
Author: David King <dking redhat com>
Date: Tue Jul 23 16:23:10 2013 +0100
keyboard: Monitor the ShowOSK property of g-s-d
Show the on-screen keyboard if gnome-settings-daemon requests that it
should be shown, such as when using a touchscreen input device. Do this
in addition to monitoring the accessibility setting for the OSK.
https://bugzilla.gnome.org/show_bug.cgi?id=702015
js/ui/keyboard.js | 68 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 63 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index cfce861..fcca323 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -23,6 +23,12 @@ const KEYBOARD_TYPE = 'keyboard-type';
const A11Y_APPLICATIONS_SCHEMA = 'org.gnome.desktop.a11y.applications';
const SHOW_KEYBOARD = 'screen-keyboard-enabled';
+const CURSOR_BUS_NAME = 'org.gnome.SettingsDaemon.Cursor';
+const CURSOR_OBJECT_PATH = '/org/gnome/SettingsDaemon/Cursor';
+
+const CARIBOU_BUS_NAME = 'org.gnome.Caribou.Daemon';
+const CARIBOU_OBJECT_PATH = '/org/gnome/Caribou/Daemon';
+
const CaribouKeyboardIface = '<node> \
<interface name="org.gnome.Caribou.Keyboard"> \
<method name="Show"> \
@@ -47,6 +53,22 @@ const CaribouKeyboardIface = '<node> \
</interface> \
</node>';
+const CaribouDaemonIface = '<node> \
+<interface name="org.gnome.Caribou.Daemon"> \
+<method name="Run" /> \
+<method name="Quit" /> \
+</interface> \
+</node>';
+
+const CursorManagerIface = '<node> \
+<interface name="org.gnome.SettingsDaemon.Cursor"> \
+<property name="ShowOSK" type="b" access="read" /> \
+</interface> \
+</node>';
+
+const CaribouDaemonProxy = Gio.DBusProxy.makeProxyWrapper(CaribouDaemonIface);
+const CursorManagerProxy = Gio.DBusProxy.makeProxyWrapper(CursorManagerIface);
+
const Key = new Lang.Class({
Name: 'Key',
@@ -151,10 +173,32 @@ const Keyboard = new Lang.Class({
this._timestamp = global.display.get_current_time_roundtrip();
this._keyboardSettings = new Gio.Settings({ schema_id: KEYBOARD_SCHEMA });
- this._keyboardSettings.connect('changed', Lang.bind(this, this._settingsChanged));
+ this._keyboardSettings.connect('changed', Lang.bind(this, this._sync));
this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
- this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._settingsChanged));
- this._settingsChanged();
+ this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._sync));
+ this._watchNameId = Gio.bus_watch_name(Gio.BusType.SESSION, CURSOR_BUS_NAME, 0,
+ Lang.bind(this, this._sync),
+ Lang.bind(this, this._sync));
+ this._daemonProxy = new CaribouDaemonProxy(Gio.DBus.session, CARIBOU_BUS_NAME,
+ CARIBOU_OBJECT_PATH,
+ Lang.bind(this, function(proxy, error) {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ }));
+ this._cursorProxy = new CursorManagerProxy(Gio.DBus.session, CURSOR_BUS_NAME,
+ CURSOR_OBJECT_PATH,
+ Lang.bind(this, function(proxy, error) {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ this._cursorProxy.connect('g-properties-changed',
+ Lang.bind(this,
this._sync));
+ this._cursorChanged();
+ }));
+ this._sync();
this._showIdleId = 0;
this._subkeysBoxPointer = null;
@@ -172,8 +216,9 @@ const Keyboard = new Lang.Class({
this._redraw();
},
- _settingsChanged: function (settings, key) {
- this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
+ _sync: function () {
+ this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD) ||
+ this._cursorProxy.ShowOSK;
if (!this._enableKeyboard && !this._keyboard)
return;
if (this._enableKeyboard && this._keyboard &&
@@ -203,9 +248,22 @@ const Keyboard = new Lang.Class({
this.actor = null;
this._destroySource();
+ this._daemonProxy.QuitRemote(function (result, error) {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ });
},
_setupKeyboard: function() {
+ this._daemonProxy.RunRemote(function (result, error) {
+ if (error) {
+ log(error.message);
+ return;
+ }
+ });
+
this.actor = new St.BoxLayout({ name: 'keyboard', vertical: true, reactive: true });
Main.layoutManager.keyboardBox.add_actor(this.actor);
Main.layoutManager.trackChrome(this.actor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]