[gtk+/xi2] Add gdk_enable_multidevice().
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/xi2] Add gdk_enable_multidevice().
- Date: Sun, 10 Jan 2010 20:22:20 +0000 (UTC)
commit c66aabedac50847e33a3dcfc52d6d904e43ff86c
Author: Carlos Garnacho <carlos gnome org>
Date: Sat Jan 9 15:36:24 2010 +0100
Add gdk_enable_multidevice().
This is a global switch to enable multidevice awareness. In the X11 backend,
if this function is called, XInput2 will be used to handle events if available,
else either XInput1 and/or core events will be used.
gdk/gdk.c | 16 ++++++++++++++++
gdk/gdk.h | 1 +
gdk/gdkglobals.c | 1 +
gdk/gdkinternals.h | 1 +
gdk/x11/gdkdevicemanager-x11.c | 5 +++--
5 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 5dd2fae..dc8e207 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -806,5 +806,21 @@ gdk_set_program_class (const char *program_class)
gdk_progclass = g_strdup (program_class);
}
+/**
+ * gdk_enable_multidevice:
+ *
+ * Enables multidevice support in GDK. Note that individual
+ * #GdkWindow<!-- -->s still need to explicitly enable multidevice
+ * awareness through gdk_window_set_support_multidevice().
+ **/
+void
+gdk_enable_multidevice (void)
+{
+ if (gdk_initialized)
+ return;
+
+ _gdk_enable_multidevice = TRUE;
+}
+
#define __GDK_C__
#include "gdkaliasdef.c"
diff --git a/gdk/gdk.h b/gdk/gdk.h
index dff03c1..d24ee13 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -68,6 +68,7 @@ G_BEGIN_DECLS
/* Initialization, exit and events
*/
#define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
+void gdk_enable_multidevice (void);
void gdk_parse_args (gint *argc,
gchar ***argv);
void gdk_init (gint *argc,
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index 4c3ad80..a805bcc 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -40,6 +40,7 @@ gchar *_gdk_display_name = NULL;
gint _gdk_screen_number = -1;
gchar *_gdk_display_arg_name = NULL;
gboolean _gdk_native_windows = FALSE;
+gboolean _gdk_enable_multidevice = FALSE;
GSList *_gdk_displays = NULL;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 69e4c26..32cc15b 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -297,6 +297,7 @@ extern GSList *_gdk_displays;
extern gchar *_gdk_display_name;
extern gint _gdk_screen_number;
extern gchar *_gdk_display_arg_name;
+extern gboolean _gdk_enable_multidevice;
void _gdk_events_queue (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c
index 5d04842..335764b 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -31,7 +31,7 @@
GdkDeviceManager *
_gdk_device_manager_new (GdkDisplay *display)
{
- if (G_UNLIKELY (!g_getenv ("GDK_CORE_DEVICE_EVENTS")))
+ if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
{
#if defined (XINPUT_2) || defined (XINPUT_XFREE)
int opcode, firstevent, firsterror;
@@ -48,7 +48,8 @@ _gdk_device_manager_new (GdkDisplay *display)
major = 2;
minor = 0;
- if (XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
+ if (_gdk_enable_multidevice &&
+ XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
{
GdkDeviceManagerXI2 *device_manager_xi2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]