[gtk+/xi2-for-master] gdkdevicemanager-xi: Use ->priv pointer instead GET_PRIV macro all the time



commit dddef38a57c7b0e234ae28254ba337de74411ab9
Author: Javier Jardón <jjardon gnome org>
Date:   Fri May 21 21:33:50 2010 +0200

    gdkdevicemanager-xi: Use ->priv pointer instead GET_PRIV macro all the time

 gdk/x11/gdkdevicemanager-xi.c |   29 ++++++++++++++++-------------
 gdk/x11/gdkdevicemanager-xi.h |    4 ++++
 2 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c
index 95143a3..c1c3390 100644
--- a/gdk/x11/gdkdevicemanager-xi.c
+++ b/gdk/x11/gdkdevicemanager-xi.c
@@ -27,11 +27,8 @@
 
 #include <X11/extensions/XInput.h>
 
-#define GDK_DEVICE_MANAGER_XI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDK_TYPE_DEVICE_MANAGER_XI, GdkDeviceManagerXIPrivate))
 
-typedef struct GdkDeviceManagerXIPrivate GdkDeviceManagerXIPrivate;
-
-struct GdkDeviceManagerXIPrivate
+struct _GdkDeviceManagerXIPrivate
 {
   GHashTable *id_table;
   gint event_base;
@@ -119,7 +116,10 @@ gdk_device_manager_xi_init (GdkDeviceManagerXI *device_manager)
 {
   GdkDeviceManagerXIPrivate *priv;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (device_manager);
+  device_manager->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device_manager,
+                                                             GDK_TYPE_DEVICE_MANAGER_XI,
+                                                             GdkDeviceManagerXIPrivate);
+
   priv->id_table = g_hash_table_new_full (NULL, NULL, NULL,
                                           (GDestroyNotify) g_object_unref);
 
@@ -258,7 +258,7 @@ gdk_device_manager_xi_constructed (GObject *object)
   gint i, num_devices;
   GdkDisplay *display;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (object);
+  priv = GDK_DEVICE_MANAGER_XI (object)->priv;
   display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
   devices = XListInputDevices(GDK_DISPLAY_XDISPLAY (display), &num_devices);
 
@@ -292,7 +292,7 @@ gdk_device_manager_xi_finalize (GObject *object)
 {
   GdkDeviceManagerXIPrivate *priv;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (object);
+  priv = GDK_DEVICE_MANAGER_XI (object)->priv;
 
   g_list_foreach (priv->devices, (GFunc) g_object_unref, NULL);
   g_list_free (priv->devices);
@@ -312,7 +312,7 @@ gdk_device_manager_xi_set_property (GObject      *object,
 {
   GdkDeviceManagerXIPrivate *priv;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (object);
+  priv = GDK_DEVICE_MANAGER_XI (object)->priv;
 
   switch (prop_id)
     {
@@ -333,7 +333,7 @@ gdk_device_manager_xi_get_property (GObject    *object,
 {
   GdkDeviceManagerXIPrivate *priv;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (object);
+  priv = GDK_DEVICE_MANAGER_XI (object)->priv;
 
   switch (prop_id)
     {
@@ -371,7 +371,7 @@ lookup_device (GdkDeviceManagerXI *device_manager,
   GdkDeviceManagerXIPrivate *priv;
   guint32 device_id;
 
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (device_manager);
+  priv = GDK_DEVICE_MANAGER_XI (device_manager)->priv;
 
   /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
      but it's potentially faster than scanning through the types of
@@ -389,19 +389,21 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator,
                                        XEvent             *xevent)
 {
   GdkDeviceManagerXIPrivate *priv;
+  GdkDeviceManagerXI *device_manager;
   GdkEventTranslatorIface *parent_iface;
   GdkDeviceXI *device_xi;
   GdkDevice *device;
   GdkWindow *window;
 
   parent_iface = g_type_interface_peek_parent (GDK_EVENT_TRANSLATOR_GET_IFACE (translator));
-  priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (translator);
+  device_manager = GDK_DEVICE_MANAGER_XI (translator);
+  priv = device_manager->priv;
 
   if (!priv->ignore_core_events &&
       parent_iface->translate_event (translator, display, event, xevent))
     return TRUE;
 
-  device = lookup_device (GDK_DEVICE_MANAGER_XI (translator), xevent);
+  device = lookup_device (device_manager, xevent);
   device_xi = GDK_DEVICE_XI (device);
 
   if (!device)
@@ -635,11 +637,12 @@ gdk_device_manager_xi_list_devices (GdkDeviceManager *device_manager,
 {
   GdkDeviceManagerXIPrivate *priv;
 
+  priv = GDK_DEVICE_MANAGER_XI (device_manager)->priv;
+
   if (type == GDK_DEVICE_TYPE_MASTER)
     return GDK_DEVICE_MANAGER_CLASS (gdk_device_manager_xi_parent_class)->list_devices (device_manager, type);
   else if (type == GDK_DEVICE_TYPE_FLOATING)
     {
-      priv = GDK_DEVICE_MANAGER_XI_GET_PRIVATE (device_manager);
       return g_list_copy (priv->devices);
     }
   else
diff --git a/gdk/x11/gdkdevicemanager-xi.h b/gdk/x11/gdkdevicemanager-xi.h
index 3b0e976..e2028fd 100644
--- a/gdk/x11/gdkdevicemanager-xi.h
+++ b/gdk/x11/gdkdevicemanager-xi.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 #define GDK_DEVICE_MANAGER_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_XI, GdkDeviceManagerXIClass))
 
 typedef struct _GdkDeviceManagerXI GdkDeviceManagerXI;
+typedef struct _GdkDeviceManagerXIPrivate GdkDeviceManagerXIPrivate;
 typedef struct _GdkDeviceManagerXIClass GdkDeviceManagerXIClass;
 
 struct _GdkDeviceManagerXI
@@ -39,6 +40,9 @@ struct _GdkDeviceManagerXI
   GdkDeviceManagerCore parent_object;
   GdkDevice *core_pointer;
   GdkDevice *core_keyboard;
+
+  /*< private >*/
+  GdkDeviceManagerXIPrivate *priv;
 };
 
 struct _GdkDeviceManagerXIClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]