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.
This commit is contained in:
Carlos Garnacho 2011-12-24 14:33:24 +01:00 committed by Matthias Clasen
parent 5495152e30
commit fbb0d8e546
2 changed files with 35 additions and 1 deletions

View File

@ -64,6 +64,8 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2, device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2,
"display", display, "display", display,
"opcode", opcode, "opcode", opcode,
"major", major,
"minor", minor,
NULL); NULL);
return GDK_DEVICE_MANAGER (device_manager_xi2); return GDK_DEVICE_MANAGER (device_manager_xi2);

View File

@ -47,6 +47,8 @@ struct _GdkX11DeviceManagerXI2
GList *devices; GList *devices;
gint opcode; gint opcode;
gint major;
gint minor;
}; };
struct _GdkX11DeviceManagerXI2Class struct _GdkX11DeviceManagerXI2Class
@ -94,7 +96,9 @@ static GdkWindow * gdk_x11_device_manager_xi2_get_window (GdkEventTra
enum { enum {
PROP_0, PROP_0,
PROP_OPCODE PROP_OPCODE,
PROP_MAJOR,
PROP_MINOR
}; };
static void static void
@ -118,6 +122,20 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
P_("Opcode for XInput2 requests"), P_("Opcode for XInput2 requests"),
0, G_MAXINT, 0, 0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); 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 static void
@ -406,6 +424,8 @@ gdk_x11_device_manager_xi2_constructed (GObject *object)
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)); display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
xdisplay = GDK_DISPLAY_XDISPLAY (display); xdisplay = GDK_DISPLAY_XDISPLAY (display);
g_assert (device_manager->major == 2);
masters = g_hash_table_new (NULL, NULL); masters = g_hash_table_new (NULL, NULL);
slaves = 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: case PROP_OPCODE:
device_manager->opcode = g_value_get_int (value); device_manager->opcode = g_value_get_int (value);
break; 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: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -552,6 +578,12 @@ gdk_x11_device_manager_xi2_get_property (GObject *object,
case PROP_OPCODE: case PROP_OPCODE:
g_value_set_int (value, device_manager->opcode); g_value_set_int (value, device_manager->opcode);
break; 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: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;