[gnome-settings-daemon] wacom: Add getter for the GdkDevice
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Add getter for the GdkDevice
- Date: Mon, 13 Apr 2015 11:27:06 +0000 (UTC)
commit 7b38b7fde54331c87e4a1505e4b512c13df6ec06
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Apr 13 13:20:44 2015 +0200
wacom: Add getter for the GdkDevice
Replace all g_object_get()s for the GdkDevice with this getter, so
it is more obvious that this is transfer none.
https://bugzilla.gnome.org/show_bug.cgi?id=746866
plugins/wacom/gsd-wacom-device.c | 6 ++++++
plugins/wacom/gsd-wacom-device.h | 2 ++
plugins/wacom/gsd-wacom-manager.c | 14 ++++++++------
plugins/wacom/list-wacom.c | 2 +-
4 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index b109444..52d6600 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -2107,6 +2107,12 @@ gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type)
return "none";
}
+GdkDevice *
+gsd_wacom_device_get_gdk_device (GsdWacomDevice *device)
+{
+ return device->priv->gdk_device;
+}
+
GsdWacomDevice *
gsd_wacom_device_create_fake (GsdWacomDeviceType type,
const char *name,
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index dcb5144..374eca9 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -180,6 +180,8 @@ int gsd_wacom_device_get_current_mode (GsdWacomDevice *device,
int group_id);
int gsd_wacom_device_set_next_mode (GsdWacomDevice *device,
GsdWacomTabletButton *button);
+GdkDevice * gsd_wacom_device_get_gdk_device (GsdWacomDevice *device);
+
GsdWacomRotation gsd_wacom_device_rotation_name_to_type (const char *rotation);
const char * gsd_wacom_device_rotation_type_to_name (GsdWacomRotation type);
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index c972620..6fd2113 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -168,7 +168,8 @@ get_device_id (GsdWacomDevice *device)
GdkDevice *gdk_device;
int id;
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
+
if (gdk_device == NULL)
return -1;
g_object_get (gdk_device, "device-id", &id, NULL);
@@ -476,7 +477,8 @@ set_keep_aspect (GsdWacomDevice *device,
/* Get corresponding monitor size */
mapper = gsd_device_mapper_get ();
device_manager = gsd_device_manager_get ();
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
gsd_device = gsd_x11_device_manager_lookup_gdk_device (GSD_X11_DEVICE_MANAGER (device_manager),
gdk_device);
monitor = gsd_device_mapper_get_device_monitor (mapper, gsd_device);
@@ -1339,7 +1341,7 @@ switch_monitor (GsdWacomManager *manager,
if (n_monitors < 2)
return;
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
gsd_device = gsd_x11_device_manager_lookup_gdk_device (GSD_X11_DEVICE_MANAGER
(gsd_device_manager_get ()),
gdk_device);
current_monitor =
@@ -1365,7 +1367,7 @@ notify_osd_for_device (GsdWacomManager *manager,
GdkScreen *screen;
gint monitor_num;
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
gsd_device = gsd_x11_device_manager_lookup_gdk_device (GSD_X11_DEVICE_MANAGER
(gsd_device_manager_get ()),
gdk_device);
monitor_num = gsd_device_mapper_get_device_monitor (manager->priv->device_mapper,
@@ -1596,7 +1598,7 @@ check_need_for_calibration (GsdWacomDevice *device)
screen = gdk_screen_get_default ();
mapper = gsd_device_mapper_get ();
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
gsd_device = gsd_x11_device_manager_lookup_gdk_device (GSD_X11_DEVICE_MANAGER
(gsd_device_manager_get ()),
gdk_device);
monitor = gsd_device_mapper_get_device_monitor (mapper, gsd_device);
@@ -1961,7 +1963,7 @@ gsd_wacom_manager_stop (GsdWacomManager *manager)
if (type == WACOM_TYPE_PAD) {
GdkDevice *gdk_device;
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
grab_button (gdk_x11_device_get_id (gdk_device),
FALSE, manager->priv->screen);
}
diff --git a/plugins/wacom/list-wacom.c b/plugins/wacom/list-wacom.c
index d91c679..fefa133 100644
--- a/plugins/wacom/list-wacom.c
+++ b/plugins/wacom/list-wacom.c
@@ -190,7 +190,7 @@ get_edid (GsdWacomDevice *device)
GSettings *gsd_settings;
char **edid;
- g_object_get (device, "gdk-device", &gdk_device, NULL);
+ gdk_device = gsd_wacom_device_get_gdk_device (device);
if (!gdk_device)
goto bail;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]