[gtk+] xi2: Add major/minor properties to XI2 device manager



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

    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 cd77b24..0fff0eb 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -64,6 +64,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 7c7fc1e..3cf947a 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -47,6 +47,8 @@ struct _GdkX11DeviceManagerXI2
   GList *devices;
 
   gint opcode;
+  gint major;
+  gint minor;
 };
 
 struct _GdkX11DeviceManagerXI2Class
@@ -94,7 +96,9 @@ static GdkWindow *  gdk_x11_device_manager_xi2_get_window           (GdkEventTra
 
 enum {
   PROP_0,
-  PROP_OPCODE
+  PROP_OPCODE,
+  PROP_MAJOR,
+  PROP_MINOR
 };
 
 static void
@@ -118,6 +122,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
@@ -406,6 +424,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);
 
@@ -531,6 +551,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;
@@ -552,6 +578,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]