[gnome-settings-daemon] wacom: Show OSD when remapping device to a monitor through the pad bindings
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Show OSD when remapping device to a monitor through the pad bindings
- Date: Wed, 20 Nov 2013 19:33:51 +0000 (UTC)
commit 32d66150fbe231f0392c82630b5c6dda608ba17c
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Nov 18 14:06:49 2013 +0100
wacom: Show OSD when remapping device to a monitor through the pad bindings
This helps having a clue of which monitor got mapped to the device, other than
waving the pen to check where the pointer ends up. Now gnome-shell is requested
to show an OSD on the monitor the device gets mapped to.
https://bugzilla.gnome.org/show_bug.cgi?id=710373
plugins/wacom/gsd-wacom-manager.c | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index ab777b7..6101747 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -52,6 +52,7 @@
#include "gsd-wacom-device.h"
#include "gsd-wacom-oled.h"
#include "gsd-wacom-osd-window.h"
+#include "gsd-shell-helper.h"
#define GSD_WACOM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_WACOM_MANAGER,
GsdWacomManagerPrivate))
@@ -106,6 +107,8 @@ struct GsdWacomManagerPrivate
GnomeRRScreen *rr_screen;
GHashTable *warned_devices;
+ GsdShell *shell_proxy;
+
/* button capture */
GdkScreen *screen;
int opcode;
@@ -1363,6 +1366,32 @@ switch_monitor (GsdWacomDevice *device)
gsd_wacom_device_set_display (device, current_monitor);
}
+static void
+notify_osd_for_device (GsdWacomManager *manager,
+ GsdWacomDevice *device)
+{
+ GdkScreen *screen;
+ gint monitor_num;
+
+ monitor_num = gsd_wacom_device_get_display_monitor (device);
+
+ if (monitor_num == GSD_WACOM_SET_ALL_MONITORS)
+ return;
+
+ screen = gdk_screen_get_default ();
+
+ if (gdk_screen_get_n_monitors (screen) == 1)
+ return;
+
+ if (manager->priv->shell_proxy == NULL)
+ manager->priv->shell_proxy = gnome_settings_bus_get_shell_proxy ();
+
+ shell_show_osd (manager->priv->shell_proxy,
+ "input-tablet-symbolic",
+ gsd_wacom_device_get_name (device), -1,
+ monitor_num);
+}
+
static const char*
get_direction_name (GsdWacomTabletButtonType type,
GtkDirectionType dir)
@@ -1484,8 +1513,10 @@ filter_button_events (XEvent *xevent,
/* Switch monitor */
if (g_settings_get_enum (wbutton->settings, KEY_ACTION_TYPE) == GSD_WACOM_ACTION_TYPE_SWITCH_MONITOR)
{
- if (xiev->evtype == XI_ButtonRelease)
+ if (xiev->evtype == XI_ButtonRelease) {
switch_monitor (device);
+ notify_osd_for_device (manager, device);
+ }
return GDK_FILTER_REMOVE;
}
@@ -1959,6 +1990,8 @@ gsd_wacom_manager_finalize (GObject *object)
g_source_remove (wacom_manager->priv->notification_timeout_src_id);
remove_notification (wacom_manager);
+ g_clear_object (&wacom_manager->priv->shell_proxy);
+
G_OBJECT_CLASS (gsd_wacom_manager_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]