[gnome-settings-daemon/gnome-3-16] wacom: Ensure to reapply keep-aspect after monitor mapping changes
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-16] wacom: Ensure to reapply keep-aspect after monitor mapping changes
- Date: Tue, 3 Nov 2015 12:05:09 +0000 (UTC)
commit 1f6535682b100ab245ca631a0ba4d1b8b17596d0
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Nov 2 19:51:12 2015 +0100
wacom: Ensure to reapply keep-aspect after monitor mapping changes
Otherwise the mapping may come out wrong if during the initialization
paths it first applies keep-aspect, and later maps to a single monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=753680
plugins/wacom/gsd-wacom-manager.c | 44 +++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index adacebe..6694f76 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -109,6 +109,7 @@ struct GsdWacomManagerPrivate
GsdShell *shell_proxy;
GsdDeviceMapper *device_mapper;
+ guint mapping_changed_id;
/* button capture */
GdkScreen *screen;
@@ -1571,6 +1572,40 @@ gsd_wacom_manager_init (GsdWacomManager *manager)
manager->priv = GSD_WACOM_MANAGER_GET_PRIVATE (manager);
}
+static void
+device_mapping_changed (GsdDeviceMapper *mapper,
+ GsdDevice *gsd_device,
+ GsdWacomManager *manager)
+{
+ guint i, n_gdk_devices;
+ GdkDevice **devices;
+
+ if (gnome_settings_is_wayland ())
+ return;
+
+ devices = gsd_x11_device_manager_get_gdk_devices (GSD_X11_DEVICE_MANAGER
(manager->priv->device_manager),
+ gsd_device, &n_gdk_devices);
+
+ for (i = 0; i < n_gdk_devices; i++) {
+ GsdWacomDevice *wacom_device;
+ GsdWacomDeviceType type;
+ GSettings *settings;
+
+ wacom_device = g_hash_table_lookup (manager->priv->devices, devices[i]);
+
+ if (!wacom_device)
+ continue;
+
+ settings = gsd_wacom_device_get_settings (wacom_device);
+ type = gsd_wacom_device_get_device_type (wacom_device);
+
+ if (type != WACOM_TYPE_TOUCH && type != WACOM_TYPE_PAD)
+ set_keep_aspect (wacom_device, g_settings_get_boolean (settings, KEY_KEEP_ASPECT));
+ }
+
+ g_free (devices);
+}
+
static gboolean
gsd_wacom_manager_idle_cb (GsdWacomManager *manager)
{
@@ -1580,6 +1615,10 @@ gsd_wacom_manager_idle_cb (GsdWacomManager *manager)
manager->priv->device_mapper = gsd_device_mapper_get ();
+ manager->priv->mapping_changed_id =
+ g_signal_connect (manager->priv->device_mapper, "device-changed",
+ G_CALLBACK (device_mapping_changed), manager);
+
manager->priv->warned_devices = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
manager->priv->devices = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
@@ -1832,6 +1871,11 @@ gsd_wacom_manager_finalize (GObject *object)
gsd_wacom_manager_stop (wacom_manager);
+ if (wacom_manager->priv->mapping_changed_id) {
+ g_signal_handler_disconnect (wacom_manager->priv->device_mapper,
+ wacom_manager->priv->mapping_changed_id);
+ }
+
if (wacom_manager->priv->warned_devices) {
g_hash_table_destroy (wacom_manager->priv->warned_devices);
wacom_manager->priv->warned_devices = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]