[gimp/gtk3-port: 135/224] app: use GdkDevice accessors
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 135/224] app: use GdkDevice accessors
- Date: Sun, 6 Feb 2011 13:11:30 +0000 (UTC)
commit e805a9d017ff98a72661cf478f45a583705cb729
Author: Michael Natterer <mitch gimp org>
Date: Tue Nov 23 20:31:32 2010 +0100
app: use GdkDevice accessors
app/widgets/gimpdeviceinfo.c | 66 ++++++++++++++++++++++-----------------
app/widgets/gimpdevices.c | 4 +-
app/widgets/gimpdevicestatus.c | 2 +-
app/widgets/gimptoolbox.c | 2 +-
4 files changed, 41 insertions(+), 33 deletions(-)
---
diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c
index d5c2322..a4fd03d 100644
--- a/app/widgets/gimpdeviceinfo.c
+++ b/app/widgets/gimpdeviceinfo.c
@@ -192,11 +192,12 @@ gimp_device_info_constructed (GObject *object)
g_object_set_data (G_OBJECT (info->device), GIMP_DEVICE_INFO_DATA_KEY,
info);
- gimp_object_set_name (GIMP_OBJECT (info), info->device->name);
+ gimp_object_set_name (GIMP_OBJECT (info),
+ gdk_device_get_name (info->device));
- info->mode = info->device->mode;
- info->n_axes = info->device->num_axes;
- info->n_keys = info->device->num_keys;
+ info->mode = gdk_device_get_mode (info->device);
+ info->n_axes = gdk_device_get_n_axes (info->device);
+ info->n_keys = gdk_device_get_n_keys (info->device);
}
gimp_context_define_properties (GIMP_CONTEXT (object),
@@ -294,7 +295,8 @@ gimp_device_info_set_property (GObject *object,
if (device)
{
- n_device_values = MIN (array->n_values, device->num_axes);
+ n_device_values = MIN (array->n_values,
+ gdk_device_get_n_axes (device));
}
else
{
@@ -328,7 +330,8 @@ gimp_device_info_set_property (GObject *object,
if (device)
{
- n_device_values = MIN (array->n_values, device->num_keys);
+ n_device_values = MIN (array->n_values,
+ gdk_device_get_n_keys (device));
}
else
{
@@ -562,7 +565,7 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
g_return_if_fail ((info->device == NULL && GDK_IS_DEVICE (device)) ||
(GDK_IS_DEVICE (info->device) && device == NULL));
g_return_if_fail (device == NULL ||
- strcmp (device->name,
+ strcmp (gdk_device_get_name (device),
gimp_object_get_name (info)) == 0);
if (device)
@@ -574,21 +577,21 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
gimp_device_info_set_mode (info, info->mode);
- if (info->n_axes != device->num_axes)
+ if (info->n_axes != gdk_device_get_n_axes (device))
g_printerr ("%s: stored 'num-axes' for device '%s' doesn't match "
"number of axes present in device\n",
- G_STRFUNC, device->name);
+ G_STRFUNC, gdk_device_get_name (device));
- for (i = 0; i < MIN (info->n_axes, device->num_axes); i++)
+ for (i = 0; i < MIN (info->n_axes, gdk_device_get_n_axes (device)); i++)
gimp_device_info_set_axis_use (info, i,
info->axes[i]);
- if (info->n_keys != device->num_keys)
+ if (info->n_keys != gdk_device_get_n_keys (device))
g_printerr ("%s: stored 'num-keys' for device '%s' doesn't match "
"number of keys present in device\n",
- G_STRFUNC, device->name);
+ G_STRFUNC, gdk_device_get_name (device));
- for (i = 0; i < MIN (info->n_keys, device->num_keys); i++)
+ for (i = 0; i < MIN (info->n_keys, gdk_device_get_n_keys (device)); i++)
gimp_device_info_set_key (info, i,
info->keys[i].keyval,
info->keys[i].modifiers);
@@ -603,24 +606,28 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
g_object_set_data (G_OBJECT (device), GIMP_DEVICE_INFO_DATA_KEY, NULL);
- gimp_device_info_set_mode (info, device->mode);
+ gimp_device_info_set_mode (info, gdk_device_get_mode (device));
- info->n_axes = device->num_axes;
+ info->n_axes = gdk_device_get_n_axes (device);
info->axes = g_renew (GdkAxisUse, info->axes, info->n_axes);
memset (info->axes, 0, info->n_axes * sizeof (GdkAxisUse));
- for (i = 0; i < device->num_axes; i++)
+ for (i = 0; i < gdk_device_get_n_axes (device); i++)
gimp_device_info_set_axis_use (info, i,
- device->axes[i].use);
+ gdk_device_get_axis_use (device, i));
- info->n_keys = device->num_keys;
+ info->n_keys = gdk_device_get_n_keys (device);
info->keys = g_renew (GdkDeviceKey, info->keys, info->n_keys);
memset (info->keys, 0, info->n_keys * sizeof (GdkDeviceKey));
- for (i = 0; i < MIN (info->n_keys, device->num_keys); i++)
- gimp_device_info_set_key (info, i,
- device->keys[i].keyval,
- device->keys[i].modifiers);
+ for (i = 0; i < MIN (info->n_keys, gdk_device_get_n_keys (device)); i++)
+ {
+ guint keyval;
+ GdkModifierType modifiers;
+
+ gdk_device_get_key (device, i, &keyval, &modifiers);
+ gimp_device_info_set_key (info, i, keyval, modifiers);
+ }
}
/* sort order depends on device presence */
@@ -633,7 +640,7 @@ gimp_device_info_get_mode (GimpDeviceInfo *info)
g_return_val_if_fail (GIMP_IS_DEVICE_INFO (info), GDK_MODE_DISABLED);
if (info->device)
- return info->device->mode;
+ return gdk_device_get_mode (info->device);
else
return info->mode;
}
@@ -662,7 +669,7 @@ gimp_device_info_has_cursor (GimpDeviceInfo *info)
g_return_val_if_fail (GIMP_IS_DEVICE_INFO (info), FALSE);
if (info->device)
- return info->device->has_cursor;
+ return gdk_device_get_has_cursor (info->device);
return FALSE;
}
@@ -673,7 +680,7 @@ gimp_device_info_get_n_axes (GimpDeviceInfo *info)
g_return_val_if_fail (GIMP_IS_DEVICE_INFO (info), 0);
if (info->device)
- return info->device->num_axes;
+ return gdk_device_get_n_axes (info->device);
else
return info->n_axes;
}
@@ -687,7 +694,7 @@ gimp_device_info_get_axis_use (GimpDeviceInfo *info,
GDK_AXIS_IGNORE);
if (info->device)
- return info->device->axes[axis].use;
+ return gdk_device_get_axis_use (info->device, axis);
else
return info->axes[axis];
}
@@ -717,7 +724,7 @@ gimp_device_info_get_n_keys (GimpDeviceInfo *info)
g_return_val_if_fail (GIMP_IS_DEVICE_INFO (info), 0);
if (info->device)
- return info->device->num_keys;
+ return gdk_device_get_n_keys (info->device);
else
return info->n_keys;
}
@@ -735,8 +742,9 @@ gimp_device_info_get_key (GimpDeviceInfo *info,
if (info->device)
{
- *keyval = info->device->keys[key].keyval;
- *modifiers = info->device->keys[key].modifiers;
+ gdk_device_get_key (info->device, key,
+ keyval,
+ modifiers);
}
else
{
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 34257fd..8ee33c9 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -521,7 +521,7 @@ gimp_devices_device_added (GdkDeviceManager *gdk_manager,
device_info =
GIMP_DEVICE_INFO (gimp_container_get_child_by_name (manager->device_info_list,
- device->name));
+ gdk_device_get_name (device)));
if (device_info)
{
@@ -545,7 +545,7 @@ gimp_devices_device_removed (GdkDeviceManager *gdk_manager,
device_info =
GIMP_DEVICE_INFO (gimp_container_get_child_by_name (manager->device_info_list,
- device->name));
+ gdk_device_get_name (device)));
if (device_info)
{
diff --git a/app/widgets/gimpdevicestatus.c b/app/widgets/gimpdevicestatus.c
index d8a5222..a6cf246 100644
--- a/app/widgets/gimpdevicestatus.c
+++ b/app/widgets/gimpdevicestatus.c
@@ -416,7 +416,7 @@ gimp_device_status_update_entry (GimpDeviceInfo *device_info,
{
GdkDevice *device = gimp_device_info_get_device (device_info, NULL);
- if (! device || device->mode == GDK_MODE_DISABLED)
+ if (! device || gdk_device_get_mode (device) == GDK_MODE_DISABLED)
{
gtk_widget_hide (entry->table);
}
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 0c4fa34..65ad862 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -305,7 +305,7 @@ gimp_toolbox_constructed (GObject *object)
devices = gdk_device_manager_list_devices (manager, GDK_DEVICE_TYPE_MASTER);
for (list = devices; list; list = g_list_next (list))
- if (! ((GdkDevice *) (list->data))->has_cursor)
+ if (! gdk_device_get_has_cursor (list->data))
break;
g_list_free (devices);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]