[gtk+/multitouch: 1/40] gdk, xi2: Add major/minor properties to XI2 device manager



commit acd1442fb8f0d8d6141b5b71ff94ba3df809d579
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Dec 24 14:33:24 2011 +0100

    gdk,xi2: Add major/minor properties to XI2 device manager
    
    This may be used to turn on/off the features that are added to
    new XInput2 revisions.

 gdk/x11/gdkdevicemanager-x11.c |    2 ++
 gdk/x11/gdkdevicemanager-xi2.c |   34 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c
index b492304..3faff6d 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -66,6 +66,8 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
               device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2,
                                                  "display", display,
                                                  "opcode", opcode,
+                                                 "major", major,
+                                                 "minor", minor,
                                                  NULL);
 
               return GDK_DEVICE_MANAGER (device_manager_xi2);
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 01f69cc..cec2596 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -49,6 +49,8 @@ struct _GdkX11DeviceManagerXI2
   GList *devices;
 
   gint opcode;
+  gint major;
+  gint minor;
 };
 
 struct _GdkX11DeviceManagerXI2Class
@@ -96,7 +98,9 @@ static GdkWindow *  gdk_x11_device_manager_xi2_get_window           (GdkEventTra
 
 enum {
   PROP_0,
-  PROP_OPCODE
+  PROP_OPCODE,
+  PROP_MAJOR,
+  PROP_MINOR
 };
 
 static void
@@ -120,6 +124,20 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
                                                      P_("Opcode for XInput2 requests"),
                                                      0, G_MAXINT, 0,
                                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_MAJOR,
+                                   g_param_spec_int ("major",
+                                                     P_("Major"),
+                                                     P_("Major version number"),
+                                                     0, G_MAXINT, 0,
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   PROP_MINOR,
+                                   g_param_spec_int ("minor",
+                                                     P_("Minor"),
+                                                     P_("Minor version number"),
+                                                     0, G_MAXINT, 0,
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 }
 
 static void
@@ -412,6 +430,8 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
   display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
   xdisplay = GDK_DISPLAY_XDISPLAY (display);
 
+  g_assert (device_manager->major == 2);
+
   masters = g_hash_table_new (NULL, NULL);
   slaves = g_hash_table_new (NULL, NULL);
 
@@ -537,6 +557,12 @@ gdk_x11_device_manager_xi2_set_property (GObject      *object,
     case PROP_OPCODE:
       device_manager->opcode = g_value_get_int (value);
       break;
+    case PROP_MAJOR:
+      device_manager->major = g_value_get_int (value);
+      break;
+    case PROP_MINOR:
+      device_manager->minor = g_value_get_int (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -558,6 +584,12 @@ gdk_x11_device_manager_xi2_get_property (GObject    *object,
     case PROP_OPCODE:
       g_value_set_int (value, device_manager->opcode);
       break;
+    case PROP_MAJOR:
+      g_value_set_int (value, device_manager->major);
+      break;
+    case PROP_MINOR:
+      g_value_set_int (value, device_manager->minor);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;



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