From 0008ef70e10ce29ab9236b94e7d6bba9f7b484fb Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 28 Dec 2016 13:03:53 +0100 Subject: [PATCH] windowManager: Use g-s-d wacom dbus helpers to update pad leds/oleds This keeps feedback on the device itself in sync with the overall pad state, a feature we had previously through g-s-d. https://bugzilla.gnome.org/show_bug.cgi?id=776543 --- js/ui/windowManager.js | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 624eb736c..324927f68 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -33,6 +33,25 @@ const UNDIM_TIME = 0.250; const DISPLAY_REVERT_TIMEOUT = 20; // in seconds - keep in sync with mutter const ONE_SECOND = 1000; // in ms +const GSD_WACOM_BUS_NAME = 'org.gnome.SettingsDaemon.Wacom'; +const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom'; + +const GsdWacomIface = ' \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +'; + +const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface); + const DisplayChangeDialog = new Lang.Class({ Name: 'DisplayChangeDialog', Extends: ModalDialog.ModalDialog, @@ -925,6 +944,30 @@ const WindowManager = new Lang.Class({ Main.osdWindowManager.show(monitorIndex, icon, label, null); })); + this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME, + GSD_WACOM_OBJECT_PATH, + Lang.bind(this, function(proxy, error) { + if (error) { + log(error.message); + return; + } + })); + + global.display.connect('pad-mode-switch', Lang.bind(this, function (display, pad, group, mode) { + let labels = []; + + //FIXME: Fix num buttons + for (let i = 0; i < 50; i++) { + let str = display.get_pad_action_label(pad, Meta.PadActionType.BUTTON, i); + labels.push(str ? str: ''); + } + + if (this._gsdWacomProxy) { + this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels); + this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode); + } + })); + Main.overview.connect('showing', Lang.bind(this, function() { for (let i = 0; i < this._dimmedWindows.length; i++) this._undimWindow(this._dimmedWindows[i]);