[gtk+/gdk-backend] Hide GdkDevice struct



commit 33018eb38e0b9e4bcfb61a72a3fbd6f736f45777
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        |  293 +++++++++++++++++------------------------------
 gdk/gdkdevice.h        |   42 +++----
 gdk/gdkdeviceprivate.h |   50 ++++++--
 3 files changed, 161 insertions(+), 224 deletions(-)
---
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 16f4b82..19ddabd 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,21 +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;
-  GdkDevice *associated;
-  GdkDeviceType type;
-  GArray *axes;
-};
-
 static void gdk_device_dispose      (GObject      *object);
 static void gdk_device_set_property (GObject      *object,
                                      guint         prop_id,
@@ -108,8 +84,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,
@@ -123,8 +99,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,
@@ -138,8 +114,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,
@@ -170,8 +146,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,
@@ -184,8 +160,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,
@@ -201,7 +177,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,
@@ -216,8 +192,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,
@@ -231,55 +207,43 @@ 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,
                                                       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
-  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->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);
 }
@@ -291,33 +255,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);
@@ -332,36 +295,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);
@@ -448,7 +410,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;
 }
 
@@ -486,7 +448,7 @@ gdk_device_get_name (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
 
-  return device->priv->name;
+  return device->name;
 }
 
 /**
@@ -504,7 +466,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;
 }
 
 /**
@@ -522,7 +484,7 @@ gdk_device_get_source (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->source;
+  return device->source;
 }
 
 /**
@@ -534,11 +496,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");
 }
 
@@ -557,7 +519,7 @@ gdk_device_get_mode (GdkDevice *device)
 {
   g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
 
-  return device->priv->mode;
+  return device->mode;
 }
 
 /**
@@ -577,7 +539,7 @@ 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 &&
@@ -586,7 +548,7 @@ gdk_device_set_mode (GdkDevice    *device,
 
   /* FIXME: setting has_cursor when mode is window? */
 
-  device->priv->mode = mode;
+  device->mode = mode;
   g_object_notify (G_OBJECT (device), "input-mode");
 
   if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
@@ -610,7 +572,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;
 }
 
 /**
@@ -634,17 +596,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;
 }
@@ -661,15 +623,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;
 }
 
 /**
@@ -690,9 +652,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;
 }
@@ -707,17 +669,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)
@@ -753,13 +713,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;
 }
 
 /**
@@ -783,37 +739,29 @@ 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;
 }
 
 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);
 }
 
 /**
@@ -829,13 +777,9 @@ _gdk_device_set_associated_device (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;
 }
 
 /**
@@ -853,7 +797,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;
 }
 
 /**
@@ -871,17 +815,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));
     }
 
@@ -909,7 +850,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);
@@ -917,13 +857,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;
@@ -955,7 +893,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);
@@ -963,15 +900,13 @@ gdk_device_get_axis (GdkDevice  *device,
   if (axes == NULL)
     return FALSE;
 
-  priv = device->priv;
-
-  g_return_val_if_fail (priv->axes != NULL, FALSE);
+  g_return_val_if_fail (device->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;
@@ -1135,13 +1070,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");
 }
@@ -1154,12 +1086,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;
@@ -1184,8 +1113,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");
 
@@ -1196,11 +1125,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 *
@@ -1225,12 +1154,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;
 }
 
@@ -1241,7 +1167,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;
@@ -1252,12 +1177,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)
@@ -1266,11 +1189,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;
     }
 
@@ -1357,17 +1280,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)
@@ -1406,16 +1328,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 745cfaa..4b5affc 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 7714339..cfc1542 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,46 @@ 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;
+  GdkDevice *associated;
+  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]