[gtk+/xi2-for-master] gdkdevice: Use ->priv pointer instead GET_PRIV macro all the time
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/xi2-for-master] gdkdevice: Use ->priv pointer instead GET_PRIV macro all the time
- Date: Fri, 21 May 2010 19:58:44 +0000 (UTC)
commit 1477cb1026dc386ed52a6053b3c968aad6b7ef7c
Author: Javier Jardón <jjardon gnome org>
Date: Fri May 21 20:55:59 2010 +0200
gdkdevice: Use ->priv pointer instead GET_PRIV macro all the time
gdk/gdkdevice.c | 42 +++++++++++++++++++++---------------------
gdk/gdkdevice.h | 4 ++++
2 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 05eebcd..ecb88de 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -24,9 +24,6 @@
#include "gdkinternals.h"
#include "gdkalias.h"
-#define GDK_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDK_TYPE_DEVICE, GdkDevicePrivate))
-
-typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkAxisInfo GdkAxisInfo;
struct _GdkAxisInfo
@@ -233,7 +230,10 @@ gdk_device_init (GdkDevice *device)
{
GdkDevicePrivate *priv;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ device->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device,
+ GDK_TYPE_DEVICE,
+ GdkDevicePrivate);
+
priv->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
}
@@ -244,7 +244,7 @@ gdk_device_dispose (GObject *object)
GdkDevice *device;
device = GDK_DEVICE (object);
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
if (priv->associated)
{
@@ -277,7 +277,7 @@ gdk_device_set_property (GObject *object,
GParamSpec *pspec)
{
GdkDevice *device = GDK_DEVICE (object);
- GdkDevicePrivate *priv = GDK_DEVICE_GET_PRIVATE (object);
+ GdkDevicePrivate *priv = device->priv;
switch (prop_id)
{
@@ -318,7 +318,7 @@ gdk_device_get_property (GObject *object,
GParamSpec *pspec)
{
GdkDevice *device = GDK_DEVICE (object);
- GdkDevicePrivate *priv = GDK_DEVICE_GET_PRIVATE (object);
+ GdkDevicePrivate *priv = device->priv;
switch (prop_id)
{
@@ -681,7 +681,7 @@ gdk_device_set_axis_use (GdkDevice *device,
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index < device->num_axes);
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
info = &g_array_index (priv->axes, GdkAxisInfo, index);
info->use = use;
@@ -724,7 +724,7 @@ gdk_device_get_display (GdkDevice *device)
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
return priv->display;
}
@@ -754,7 +754,7 @@ gdk_device_get_associated_device (GdkDevice *device)
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
return priv->associated;
}
@@ -768,7 +768,7 @@ _gdk_device_set_associated_device (GdkDevice *device,
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (GDK_IS_DEVICE (associated));
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
if (priv->associated == associated)
return;
@@ -800,7 +800,7 @@ gdk_device_get_device_type (GdkDevice *device)
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_MASTER);
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
return priv->type;
}
@@ -841,7 +841,7 @@ gdk_device_list_axes (GdkDevice *device)
GList *axes = NULL;
gint i;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
for (i = 0; i < priv->axes->len; i++)
{
@@ -883,7 +883,7 @@ gdk_device_get_axis_value (GdkDevice *device,
if (axes == NULL)
return FALSE;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
for (i = 0; i < priv->axes->len; i++)
{
@@ -929,7 +929,7 @@ gdk_device_get_axis (GdkDevice *device,
if (axes == NULL)
return FALSE;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
g_return_val_if_fail (priv->axes != NULL, FALSE);
@@ -1084,7 +1084,7 @@ _gdk_device_reset_axes (GdkDevice *device)
GdkDevicePrivate *priv;
gint i;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
for (i = priv->axes->len - 1; i >= 0; i--)
g_array_remove_index (priv->axes, i);
@@ -1108,7 +1108,7 @@ _gdk_device_add_axis (GdkDevice *device,
GdkAxisInfo axis_info;
guint pos;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
axis_info.use = use;
axis_info.label = label_atom;
@@ -1187,7 +1187,7 @@ _gdk_device_get_axis_use (GdkDevice *device,
GdkDevicePrivate *priv;
GdkAxisInfo info;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
info = g_array_index (priv->axes, GdkAxisInfo, index_);
return info.use;
@@ -1212,7 +1212,7 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gint window_width, window_height;
GdkWindowObject *window_private;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
if (index_ >= priv->axes->len)
return FALSE;
@@ -1325,7 +1325,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
if (device->mode != GDK_MODE_SCREEN)
return FALSE;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
if (index_ >= priv->axes->len)
return FALSE;
@@ -1374,7 +1374,7 @@ _gdk_device_translate_axis (GdkDevice *device,
GdkAxisInfo axis_info;
gdouble axis_width, out;
- priv = GDK_DEVICE_GET_PRIVATE (device);
+ priv = device->priv;
if (index_ >= priv->axes->len)
return FALSE;
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 03e058e..7412591 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -33,6 +33,7 @@ G_BEGIN_DECLS
#define GDK_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE))
typedef struct _GdkDevice GdkDevice;
+typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceAxis GdkDeviceAxis;
@@ -203,6 +204,9 @@ struct _GdkDevice
gint GSEAL (num_keys);
GdkDeviceKey *GSEAL (keys);
+
+ /*< private >*/
+ GdkDevicePrivate *priv;
};
GType gdk_device_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]