[gtk+/gdk-backend: 35/91] Hide GdkDevice struct



commit 51590f2dcb42b852eabe6af30585f2d875446175
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Dec 10 21:55:56 2010 -0500

    Hide GdkDevice struct
    
    Once its hidden, we can kill the GdkDevicePrivate struct too.

 gdk/gdkdevice.c        |  335 +++++++++++++++++-------------------------------
 gdk/gdkdevice.h        |   42 +++----
 gdk/gdkdeviceprivate.h |   56 ++++++--
 3 files changed, 177 insertions(+), 256 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index e4b7c06..68383b6 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -25,15 +25,6 @@
 #include "gdkdeviceprivate.h"
 #include "gdkintl.h"
 
-
-typedef struct _GdkDeviceKey GdkDeviceKey;
-
-struct _GdkDeviceKey
-{
-  guint keyval;
-  GdkModifierType modifiers;
-};
-
 typedef struct _GdkAxisInfo GdkAxisInfo;
 
 struct _GdkAxisInfo
@@ -49,27 +40,6 @@ struct _GdkAxisInfo
   gdouble resolution;
 };
 
-struct _GdkDevicePrivate
-{
-  gchar *name;
-  GdkInputSource source;
-  GdkInputMode mode;
-  gboolean has_cursor;
-  gint num_keys;
-  GdkDeviceKey *keys;
-  GdkDeviceManager *device_manager;
-  GdkDisplay *display;
-
-  /* Paired master for master,
-   * associated master for slaves
-   */
-  GdkDevice *associated;
-
-  GList *slaves;
-  GdkDeviceType type;
-  GArray *axes;
-};
-
 enum {
   CHANGED,
   LAST_SIGNAL
@@ -122,8 +92,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_DISPLAY,
-				   g_param_spec_object ("display",
+                                   PROP_DISPLAY,
+                                   g_param_spec_object ("display",
                                                         P_("Device Display"),
                                                         P_("Display which the device belongs to"),
                                                         GDK_TYPE_DISPLAY,
@@ -137,8 +107,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_DEVICE_MANAGER,
-				   g_param_spec_object ("device-manager",
+                                   PROP_DEVICE_MANAGER,
+                                   g_param_spec_object ("device-manager",
                                                         P_("Device manager"),
                                                         P_("Device manager which the device belongs to"),
                                                         GDK_TYPE_DEVICE_MANAGER,
@@ -152,8 +122,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_NAME,
-				   g_param_spec_string ("name",
+                                   PROP_NAME,
+                                   g_param_spec_string ("name",
                                                         P_("Device name"),
                                                         P_("Device name"),
                                                         NULL,
@@ -184,8 +154,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_ASSOCIATED_DEVICE,
-				   g_param_spec_object ("associated-device",
+                                   PROP_ASSOCIATED_DEVICE,
+                                   g_param_spec_object ("associated-device",
                                                         P_("Associated device"),
                                                         P_("Associated pointer or keyboard with this device"),
                                                         GDK_TYPE_DEVICE,
@@ -198,8 +168,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_INPUT_SOURCE,
-				   g_param_spec_enum ("input-source",
+                                   PROP_INPUT_SOURCE,
+                                   g_param_spec_enum ("input-source",
                                                       P_("Input source"),
                                                       P_("Source type for the device"),
                                                       GDK_TYPE_INPUT_SOURCE,
@@ -215,7 +185,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
    */
   g_object_class_install_property (object_class,
                                    PROP_INPUT_MODE,
-				   g_param_spec_enum ("input-mode",
+                                   g_param_spec_enum ("input-mode",
                                                       P_("Input mode for the device"),
                                                       P_("Input mode for the device"),
                                                       GDK_TYPE_INPUT_MODE,
@@ -230,8 +200,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_HAS_CURSOR,
-				   g_param_spec_boolean ("has-cursor",
+                                   PROP_HAS_CURSOR,
+                                   g_param_spec_boolean ("has-cursor",
                                                          P_("Whether the device has a cursor"),
                                                          P_("Whether there is a visible cursor following device motion"),
                                                          FALSE,
@@ -245,8 +215,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
    * Since: 3.0
    */
   g_object_class_install_property (object_class,
-				   PROP_N_AXES,
-				   g_param_spec_uint ("n-axes",
+                                   PROP_N_AXES,
+                                   g_param_spec_uint ("n-axes",
                                                       P_("Number of axes in the device"),
                                                       P_("Number of axes in the device"),
                                                       0, G_MAXUINT, 0,
@@ -271,52 +241,40 @@ gdk_device_class_init (GdkDeviceClass *klass)
                   0, NULL, NULL,
                   g_cclosure_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
-
-  g_type_class_add_private (object_class, sizeof (GdkDevicePrivate));
 }
 
 static void
 gdk_device_init (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
-
-  device->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device,
-                                                     GDK_TYPE_DEVICE,
-                                                     GdkDevicePrivate);
-
-  priv->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
+  device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
 }
 
 static void
 gdk_device_dispose (GObject *object)
 {
-  GdkDevicePrivate *priv;
-  GdkDevice *device;
-
-  device = GDK_DEVICE (object);
-  priv = device->priv;
+  GdkDevice *device = GDK_DEVICE (object);
 
-  if (priv->type == GDK_DEVICE_TYPE_SLAVE)
-    _gdk_device_remove_slave (priv->associated, device);
+  if (device->type == GDK_DEVICE_TYPE_SLAVE)
+    _gdk_device_remove_slave (device->associated, device);
 
-  if (priv->associated)
+  if (device->associated)
     {
-      _gdk_device_set_associated_device (priv->associated, NULL);
-      g_object_unref (priv->associated);
-      priv->associated = NULL;
+      _gdk_device_set_associated_device (device->associated, NULL);
+      g_object_unref (device->associated);
+      device->associated = NULL;
     }
 
-  if (priv->axes)
+  if (device->axes)
     {
-      g_array_free (priv->axes, TRUE);
-      priv->axes = NULL;
+      g_array_free (device->axes, TRUE);
+      device->axes = NULL;
     }
 
-  g_free (priv->name);
-  g_free (priv->keys);
+  g_free (device->name);
+  g_free (device->keys);
 
-  priv->name = NULL;
-  priv->keys = NULL;
+  device->name = NULL;
+  device->keys = NULL;
 
   G_OBJECT_CLASS (gdk_device_parent_class)->dispose (object);
 }
@@ -328,33 +286,32 @@ gdk_device_set_property (GObject      *object,
                          GParamSpec   *pspec)
 {
   GdkDevice *device = GDK_DEVICE (object);
-  GdkDevicePrivate *priv = device->priv;
 
   switch (prop_id)
     {
     case PROP_DISPLAY:
-      priv->display = g_value_get_object (value);
+      device->display = g_value_get_object (value);
       break;
     case PROP_DEVICE_MANAGER:
-      priv->device_manager = g_value_get_object (value);
+      device->manager = g_value_get_object (value);
       break;
     case PROP_NAME:
-      if (priv->name)
-        g_free (priv->name);
+      if (device->name)
+        g_free (device->name);
 
-      priv->name = g_value_dup_string (value);
+      device->name = g_value_dup_string (value);
       break;
     case PROP_TYPE:
-      priv->type = g_value_get_enum (value);
+      device->type = g_value_get_enum (value);
       break;
     case PROP_INPUT_SOURCE:
-      priv->source = g_value_get_enum (value);
+      device->source = g_value_get_enum (value);
       break;
     case PROP_INPUT_MODE:
       gdk_device_set_mode (device, g_value_get_enum (value));
       break;
     case PROP_HAS_CURSOR:
-      priv->has_cursor = g_value_get_boolean (value);
+      device->has_cursor = g_value_get_boolean (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -369,36 +326,35 @@ gdk_device_get_property (GObject    *object,
                          GParamSpec *pspec)
 {
   GdkDevice *device = GDK_DEVICE (object);
-  GdkDevicePrivate *priv = device->priv;
 
   switch (prop_id)
     {
     case PROP_DISPLAY:
-      g_value_set_object (value, priv->display);
+      g_value_set_object (value, device->display);
       break;
     case PROP_DEVICE_MANAGER:
-      g_value_set_object (value, priv->device_manager);
+      g_value_set_object (value, device->manager);
       break;
     case PROP_ASSOCIATED_DEVICE:
-      g_value_set_object (value, priv->associated);
+      g_value_set_object (value, device->associated);
       break;
     case PROP_NAME:
-      g_value_set_string (value, priv->name);
+      g_value_set_string (value, device->name);
       break;
     case PROP_TYPE:
-      g_value_set_enum (value, priv->type);
+      g_value_set_enum (value, device->type);
       break;
     case PROP_INPUT_SOURCE:
-      g_value_set_enum (value, priv->source);
+      g_value_set_enum (value, device->source);
       break;
     case PROP_INPUT_MODE:
-      g_value_set_enum (value, priv->mode);
+      g_value_set_enum (value, device->mode);
       break;
     case PROP_HAS_CURSOR:
-      g_value_set_boolean (value, priv->has_cursor);
+      g_value_set_boolean (value, device->has_cursor);
       break;
     case PROP_N_AXES:
-      g_value_set_uint (value, priv->axes->len);
+      g_value_set_uint (value, device->axes->len);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -485,7 +441,7 @@ _gdk_device_allocate_history (GdkDevice *device,
 
   for (i = 0; i < n_events; i++)
     result[i] = g_malloc (sizeof (GdkTimeCoord) -
-			  sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->priv->axes->len));
+                          sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->axes->len));
   return result;
 }
 
@@ -523,7 +479,7 @@ gdk_device_get_name (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
 
-  return device->priv->name;
+  return device->name;
 }
 
 /**
@@ -541,7 +497,7 @@ gdk_device_get_has_cursor (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
 
-  return device->priv->has_cursor;
+  return device->has_cursor;
 }
 
 /**
@@ -559,7 +515,7 @@ gdk_device_get_source (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->source;
+  return device->source;
 }
 
 /**
@@ -571,11 +527,11 @@ gdk_device_get_source (GdkDevice *device)
  **/
 void
 gdk_device_set_source (GdkDevice      *device,
-		       GdkInputSource  source)
+                       GdkInputSource  source)
 {
   g_return_if_fail (GDK_IS_DEVICE (device));
 
-  device->priv->source = source;
+  device->source = source;
   g_object_notify (G_OBJECT (device), "input-source");
 }
 
@@ -594,7 +550,7 @@ gdk_device_get_mode (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->mode;
+  return device->mode;
 }
 
 /**
@@ -614,14 +570,14 @@ gdk_device_set_mode (GdkDevice    *device,
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
 
-  if (device->priv->mode == mode)
+  if (device->mode == mode)
     return TRUE;
 
   if (mode == GDK_MODE_DISABLED &&
       gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
     return FALSE;
 
-  device->priv->mode = mode;
+  device->mode = mode;
   g_object_notify (G_OBJECT (device), "input-mode");
 
   return TRUE;
@@ -642,7 +598,7 @@ gdk_device_get_n_keys (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->num_keys;
+  return device->num_keys;
 }
 
 /**
@@ -666,17 +622,17 @@ gdk_device_get_key (GdkDevice       *device,
                     GdkModifierType *modifiers)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
-  g_return_val_if_fail (index_ < device->priv->num_keys, FALSE);
+  g_return_val_if_fail (index_ < device->num_keys, FALSE);
 
-  if (!device->priv->keys[index_].keyval &&
-      !device->priv->keys[index_].modifiers)
+  if (!device->keys[index_].keyval &&
+      !device->keys[index_].modifiers)
     return FALSE;
 
   if (keyval)
-    *keyval = device->priv->keys[index_].keyval;
+    *keyval = device->keys[index_].keyval;
 
   if (modifiers)
-    *modifiers = device->priv->keys[index_].modifiers;
+    *modifiers = device->keys[index_].modifiers;
 
   return TRUE;
 }
@@ -693,15 +649,15 @@ gdk_device_get_key (GdkDevice       *device,
  **/
 void
 gdk_device_set_key (GdkDevice      *device,
-		    guint           index_,
-		    guint           keyval,
-		    GdkModifierType modifiers)
+                    guint           index_,
+                    guint           keyval,
+                    GdkModifierType modifiers)
 {
   g_return_if_fail (GDK_IS_DEVICE (device));
-  g_return_if_fail (index_ < device->priv->num_keys);
+  g_return_if_fail (index_ < device->num_keys);
 
-  device->priv->keys[index_].keyval = keyval;
-  device->priv->keys[index_].modifiers = modifiers;
+  device->keys[index_].keyval = keyval;
+  device->keys[index_].modifiers = modifiers;
 }
 
 /**
@@ -722,9 +678,9 @@ gdk_device_get_axis_use (GdkDevice *device,
   GdkAxisInfo *info;
 
   g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
-  g_return_val_if_fail (index_ < device->priv->axes->len, GDK_AXIS_IGNORE);
+  g_return_val_if_fail (index_ < device->axes->len, GDK_AXIS_IGNORE);
 
-  info = &g_array_index (device->priv->axes, GdkAxisInfo, index_);
+  info = &g_array_index (device->axes, GdkAxisInfo, index_);
 
   return info->use;
 }
@@ -739,17 +695,15 @@ gdk_device_get_axis_use (GdkDevice *device,
  **/
 void
 gdk_device_set_axis_use (GdkDevice   *device,
-			 guint        index_,
-			 GdkAxisUse   use)
+                         guint        index_,
+                         GdkAxisUse   use)
 {
-  GdkDevicePrivate *priv;
   GdkAxisInfo *info;
 
   g_return_if_fail (GDK_IS_DEVICE (device));
-  g_return_if_fail (index_ < device->priv->axes->len);
+  g_return_if_fail (index_ < device->axes->len);
 
-  priv = device->priv;
-  info = &g_array_index (priv->axes, GdkAxisInfo, index_);
+  info = &g_array_index (device->axes, GdkAxisInfo, index_);
   info->use = use;
 
   switch (use)
@@ -785,13 +739,9 @@ gdk_device_set_axis_use (GdkDevice   *device,
 GdkDisplay *
 gdk_device_get_display (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
-
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
 
-  priv = device->priv;
-
-  return priv->display;
+  return device->display;
 }
 
 /**
@@ -815,26 +765,18 @@ gdk_device_get_display (GdkDevice *device)
 GdkDevice *
 gdk_device_get_associated_device (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
-
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
 
-  priv = device->priv;
-
-  return priv->associated;
+  return device->associated;
 }
 
 static void
 _gdk_device_set_device_type (GdkDevice     *device,
                              GdkDeviceType  type)
 {
-  GdkDevicePrivate *priv;
-
-  priv = device->priv;
-
-  if (priv->type != type)
+  if (device->type != type)
     {
-      priv->type = type;
+      device->type = type;
 
       g_object_notify (G_OBJECT (device), "type");
     }
@@ -844,28 +786,24 @@ void
 _gdk_device_set_associated_device (GdkDevice *device,
                                    GdkDevice *associated)
 {
-  GdkDevicePrivate *priv;
-
   g_return_if_fail (GDK_IS_DEVICE (device));
   g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
 
-  priv = device->priv;
-
-  if (priv->associated == associated)
+  if (device->associated == associated)
     return;
 
-  if (priv->associated)
+  if (device->associated)
     {
-      g_object_unref (priv->associated);
-      priv->associated = NULL;
+      g_object_unref (device->associated);
+      device->associated = NULL;
     }
 
   if (associated)
-    priv->associated = g_object_ref (associated);
+    device->associated = g_object_ref (associated);
 
-  if (priv->type != GDK_DEVICE_TYPE_MASTER)
+  if (device->type != GDK_DEVICE_TYPE_MASTER)
     {
-      if (priv->associated)
+      if (device->associated)
         _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_SLAVE);
       else
         _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
@@ -887,48 +825,38 @@ _gdk_device_set_associated_device (GdkDevice *device,
 GList *
 gdk_device_list_slave_devices (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
-
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
   g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER, NULL);
 
-  priv = device->priv;
-
-  return g_list_copy (priv->slaves);
+  return g_list_copy (device->slaves);
 }
 
 void
 _gdk_device_add_slave (GdkDevice *device,
                        GdkDevice *slave)
 {
-  GdkDevicePrivate *priv;
-
   g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
   g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
 
-  priv = device->priv;
-
-  if (!g_list_find (priv->slaves, slave))
-    priv->slaves = g_list_prepend (priv->slaves, slave);
+  if (!g_list_find (device->slaves, slave))
+    device->slaves = g_list_prepend (device->slaves, slave);
 }
 
 void
 _gdk_device_remove_slave (GdkDevice *device,
                           GdkDevice *slave)
 {
-  GdkDevicePrivate *priv;
   GList *elem;
 
   g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
   g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
 
-  priv = device->priv;
-  elem = g_list_find (priv->slaves, slave);
+  elem = g_list_find (device->slaves, slave);
 
   if (!elem)
     return;
 
-  priv->slaves = g_list_delete_link (priv->slaves, elem);
+  device->slaves = g_list_delete_link (device->slaves, elem);
 }
 
 /**
@@ -944,13 +872,9 @@ _gdk_device_remove_slave (GdkDevice *device,
 GdkDeviceType
 gdk_device_get_device_type (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
-
   g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_MASTER);
 
-  priv = device->priv;
-
-  return priv->type;
+  return device->type;
 }
 
 /**
@@ -968,7 +892,7 @@ gdk_device_get_n_axes (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->axes->len;
+  return device->axes->len;
 }
 
 /**
@@ -986,17 +910,14 @@ gdk_device_get_n_axes (GdkDevice *device)
 GList *
 gdk_device_list_axes (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
   GList *axes = NULL;
   gint i;
 
-  priv = device->priv;
-
-  for (i = 0; i < priv->axes->len; i++)
+  for (i = 0; i < device->axes->len; i++)
     {
       GdkAxisInfo axis_info;
 
-      axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+      axis_info = g_array_index (device->axes, GdkAxisInfo, i);
       axes = g_list_prepend (axes, GDK_ATOM_TO_POINTER (axis_info.label));
     }
 
@@ -1024,7 +945,6 @@ gdk_device_get_axis_value (GdkDevice *device,
                            GdkAtom    axis_label,
                            gdouble   *value)
 {
-  GdkDevicePrivate *priv;
   gint i;
 
   g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
@@ -1032,13 +952,11 @@ gdk_device_get_axis_value (GdkDevice *device,
   if (axes == NULL)
     return FALSE;
 
-  priv = device->priv;
-
-  for (i = 0; i < priv->axes->len; i++)
+  for (i = 0; i < device->axes->len; i++)
     {
       GdkAxisInfo axis_info;
 
-      axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+      axis_info = g_array_index (device->axes, GdkAxisInfo, i);
 
       if (axis_info.label != axis_label)
         continue;
@@ -1070,7 +988,6 @@ gdk_device_get_axis (GdkDevice  *device,
                      GdkAxisUse  use,
                      gdouble    *value)
 {
-  GdkDevicePrivate *priv;
   gint i;
 
   g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
@@ -1078,15 +995,13 @@ gdk_device_get_axis (GdkDevice  *device,
   if (axes == NULL)
     return FALSE;
 
-  priv = device->priv;
+  g_return_val_if_fail (device->axes != NULL, FALSE);
 
-  g_return_val_if_fail (priv->axes != NULL, FALSE);
-
-  for (i = 0; i < priv->axes->len; i++)
+  for (i = 0; i < device->axes->len; i++)
     {
       GdkAxisInfo axis_info;
 
-      axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+      axis_info = g_array_index (device->axes, GdkAxisInfo, i);
 
       if (axis_info.use != use)
         continue;
@@ -1250,13 +1165,10 @@ gdk_device_ungrab (GdkDevice  *device,
 void
 _gdk_device_reset_axes (GdkDevice *device)
 {
-  GdkDevicePrivate *priv;
   gint i;
 
-  priv = device->priv;
-
-  for (i = priv->axes->len - 1; i >= 0; i--)
-    g_array_remove_index (priv->axes, i);
+  for (i = device->axes->len - 1; i >= 0; i--)
+    g_array_remove_index (device->axes, i);
 
   g_object_notify (G_OBJECT (device), "n-axes");
 }
@@ -1269,12 +1181,9 @@ _gdk_device_add_axis (GdkDevice   *device,
                       gdouble      max_value,
                       gdouble      resolution)
 {
-  GdkDevicePrivate *priv;
   GdkAxisInfo axis_info;
   guint pos;
 
-  priv = device->priv;
-
   axis_info.use = use;
   axis_info.label = label_atom;
   axis_info.min_value = min_value;
@@ -1299,8 +1208,8 @@ _gdk_device_add_axis (GdkDevice   *device,
       break;
     }
 
-  priv->axes = g_array_append_val (priv->axes, axis_info);
-  pos = device->priv->axes->len - 1;
+  device->axes = g_array_append_val (device->axes, axis_info);
+  pos = device->axes->len - 1;
 
   g_object_notify (G_OBJECT (device), "n-axes");
 
@@ -1311,11 +1220,11 @@ void
 _gdk_device_set_keys (GdkDevice *device,
                       guint      num_keys)
 {
-  if (device->priv->keys)
-    g_free (device->priv->keys);
+  if (device->keys)
+    g_free (device->keys);
 
-  device->priv->num_keys = num_keys;
-  device->priv->keys = g_new0 (GdkDeviceKey, num_keys);
+  device->num_keys = num_keys;
+  device->keys = g_new0 (GdkDeviceKey, num_keys);
 }
 
 static GdkAxisInfo *
@@ -1340,12 +1249,9 @@ GdkAxisUse
 _gdk_device_get_axis_use (GdkDevice *device,
                           guint      index_)
 {
-  GdkDevicePrivate *priv;
   GdkAxisInfo info;
 
-  priv = device->priv;
-
-  info = g_array_index (priv->axes, GdkAxisInfo, index_);
+  info = g_array_index (device->axes, GdkAxisInfo, index_);
   return info.use;
 }
 
@@ -1356,7 +1262,6 @@ _gdk_device_translate_window_coord (GdkDevice *device,
                                     gdouble    value,
                                     gdouble   *axis_value)
 {
-  GdkDevicePrivate *priv;
   GdkAxisInfo axis_info;
   GdkAxisInfo *axis_info_x, *axis_info_y;
   gdouble device_width, device_height;
@@ -1367,12 +1272,10 @@ _gdk_device_translate_window_coord (GdkDevice *device,
   gdouble device_aspect;
   gint window_width, window_height;
 
-  priv = device->priv;
-
-  if (index_ >= priv->axes->len)
+  if (index_ >= device->axes->len)
     return FALSE;
 
-  axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+  axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
 
   if (axis_info.use != GDK_AXIS_X &&
       axis_info.use != GDK_AXIS_Y)
@@ -1381,11 +1284,11 @@ _gdk_device_translate_window_coord (GdkDevice *device,
   if (axis_info.use == GDK_AXIS_X)
     {
       axis_info_x = &axis_info;
-      axis_info_y = find_axis_info (priv->axes, GDK_AXIS_Y);
+      axis_info_y = find_axis_info (device->axes, GDK_AXIS_Y);
     }
   else
     {
-      axis_info_x = find_axis_info (priv->axes, GDK_AXIS_X);
+      axis_info_x = find_axis_info (device->axes, GDK_AXIS_X);
       axis_info_y = &axis_info;
     }
 
@@ -1472,17 +1375,16 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
                                     gdouble    value,
                                     gdouble   *axis_value)
 {
-  GdkDevicePrivate *priv = device->priv;
   GdkAxisInfo axis_info;
   gdouble axis_width, scale, offset;
 
-  if (priv->mode != GDK_MODE_SCREEN)
+  if (device->mode != GDK_MODE_SCREEN)
     return FALSE;
 
-  if (index_ >= priv->axes->len)
+  if (index_ >= device->axes->len)
     return FALSE;
 
-  axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+  axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
 
   if (axis_info.use != GDK_AXIS_X &&
       axis_info.use != GDK_AXIS_Y)
@@ -1521,16 +1423,13 @@ _gdk_device_translate_axis (GdkDevice *device,
                             gdouble    value,
                             gdouble   *axis_value)
 {
-  GdkDevicePrivate *priv;
   GdkAxisInfo axis_info;
   gdouble axis_width, out;
 
-  priv = device->priv;
-
-  if (index_ >= priv->axes->len)
+  if (index_ >= device->axes->len)
     return FALSE;
 
-  axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+  axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
 
   if (axis_info.use == GDK_AXIS_X ||
       axis_info.use == GDK_AXIS_Y)
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 2c797a9..8cb705a 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -156,14 +156,6 @@ struct _GdkTimeCoord
   gdouble axes[GDK_MAX_TIMECOORD_AXES];
 };
 
-struct _GdkDevice
-{
-  GObject parent_instance;
-
-  /*< private >*/
-  GdkDevicePrivate *priv;
-};
-
 GType gdk_device_get_type (void) G_GNUC_CONST;
 
 G_CONST_RETURN gchar *gdk_device_get_name       (GdkDevice *device);
@@ -172,11 +164,11 @@ gboolean              gdk_device_get_has_cursor (GdkDevice *device);
 /* Functions to configure a device */
 GdkInputSource gdk_device_get_source    (GdkDevice      *device);
 void           gdk_device_set_source    (GdkDevice      *device,
-					 GdkInputSource  source);
+                                         GdkInputSource  source);
 
 GdkInputMode   gdk_device_get_mode      (GdkDevice      *device);
 gboolean       gdk_device_set_mode      (GdkDevice      *device,
-					 GdkInputMode    mode);
+                                         GdkInputMode    mode);
 
 gint           gdk_device_get_n_keys    (GdkDevice       *device);
 gboolean       gdk_device_get_key       (GdkDevice       *device,
@@ -184,9 +176,9 @@ gboolean       gdk_device_get_key       (GdkDevice       *device,
                                          guint           *keyval,
                                          GdkModifierType *modifiers);
 void           gdk_device_set_key       (GdkDevice      *device,
-					 guint           index_,
-					 guint           keyval,
-					 GdkModifierType modifiers);
+                                         guint           index_,
+                                         guint           keyval,
+                                         GdkModifierType modifiers);
 
 GdkAxisUse     gdk_device_get_axis_use  (GdkDevice         *device,
                                          guint              index_);
@@ -196,17 +188,17 @@ void           gdk_device_set_axis_use  (GdkDevice         *device,
 
 
 void     gdk_device_get_state    (GdkDevice         *device,
-				  GdkWindow         *window,
-				  gdouble           *axes,
-				  GdkModifierType   *mask);
+                                  GdkWindow         *window,
+                                  gdouble           *axes,
+                                  GdkModifierType   *mask);
 gboolean gdk_device_get_history  (GdkDevice         *device,
-				  GdkWindow         *window,
-				  guint32            start,
-				  guint32            stop,
-				  GdkTimeCoord    ***events,
-				  gint              *n_events);
+                                  GdkWindow         *window,
+                                  guint32            start,
+                                  guint32            stop,
+                                  GdkTimeCoord    ***events,
+                                  gint              *n_events);
 void     gdk_device_free_history (GdkTimeCoord     **events,
-				  gint               n_events);
+                                  gint               n_events);
 
 gint     gdk_device_get_n_axes     (GdkDevice       *device);
 GList *  gdk_device_list_axes      (GdkDevice       *device);
@@ -216,9 +208,9 @@ gboolean gdk_device_get_axis_value (GdkDevice       *device,
                                     gdouble         *value);
 
 gboolean gdk_device_get_axis     (GdkDevice         *device,
-				  gdouble           *axes,
-				  GdkAxisUse         use,
-				  gdouble           *value);
+                                  gdouble           *axes,
+                                  GdkAxisUse         use,
+                                  gdouble           *value);
 GdkDisplay * gdk_device_get_display (GdkDevice      *device);
 
 GdkDevice  * gdk_device_get_associated_device (GdkDevice     *device);
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 5353651..bf0245a 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -20,8 +20,9 @@
 #ifndef __GDK_DEVICE_PRIVATE_H__
 #define __GDK_DEVICE_PRIVATE_H__
 
-#include <gdk/gdkdevice.h>
-#include <gdk/gdkevents.h>
+#include "gdkdevicemanager.h"
+#include "gdkdevice.h"
+#include "gdkevents.h"
 
 G_BEGIN_DECLS
 
@@ -31,21 +32,50 @@ G_BEGIN_DECLS
 
 typedef struct _GdkDeviceClass GdkDeviceClass;
 
+typedef struct _GdkDeviceKey GdkDeviceKey;
+
+struct _GdkDeviceKey
+{
+  guint keyval;
+  GdkModifierType modifiers;
+};
+
+struct _GdkDevice
+{
+  GObject parent_instance;
+
+  gchar *name;
+  GdkInputSource source;
+  GdkInputMode mode;
+  gboolean has_cursor;
+  gint num_keys;
+  GdkDeviceKey *keys;
+  GdkDeviceManager *manager;
+  GdkDisplay *display;
+  /* Paired master for master,
+   * associated master for slaves
+   */
+  GdkDevice *associated;
+  GList *slaves;
+  GdkDeviceType type;
+  GArray *axes;
+};
+
 struct _GdkDeviceClass
 {
   GObjectClass parent_class;
 
-  gboolean (* get_history) (GdkDevice      *device,
-                            GdkWindow      *window,
-                            guint32         start,
-                            guint32         stop,
-                            GdkTimeCoord ***events,
-                            gint           *n_events);
-
-  void (* get_state) (GdkDevice       *device,
-                      GdkWindow       *window,
-                      gdouble         *axes,
-                      GdkModifierType *mask);
+  gboolean (* get_history)   (GdkDevice      *device,
+                              GdkWindow      *window,
+                              guint32         start,
+                              guint32         stop,
+                              GdkTimeCoord ***events,
+                              gint           *n_events);
+
+  void (* get_state)         (GdkDevice       *device,
+                              GdkWindow       *window,
+                              gdouble         *axes,
+                              GdkModifierType *mask);
 
   void (* set_window_cursor) (GdkDevice *device,
                               GdkWindow *window,



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