XInput2 by default in 3.0?
- From: Carlos Garnacho <carlosg gnome org>
- To: gtk-devel-list gnome org
- Subject: XInput2 by default in 3.0?
- Date: Tue, 14 Dec 2010 14:31:14 +0100
Hi!,
I've been wanting to raise this topic for some time. The patch
(attached) is simple, it basically will enable the XInput2
GdkDeviceManager by default, unless gdk_disable_multidevice() is called.
Even if the change looks intricated, the only new code that'd get
exercised lies in gdk/x11/gdkdevice(manager)-xi2.c, and trying out 95%
of that code is as easy as opening some test, typing something, and
opening/closing a menu.
As things are now, GTK+ behaves reasonably well by default with multiple
device pairs, even though no widgets take advantage of it directly yet,
enter/leave events would be compressed into a single pair if multiple
pointers enter say a button. In short, how current unmodified GTK (and
apps relying on core events) behave with multiple pointers now. GTK
would obviously work as well under a single mouse/keyboard pair.
There are little modules in the GNOME set that need at least calling
gdk_disable_multidevice() for the time being, I'm mostly thinking about
Mutter/metacity. Basically it's a call for problems doing any of:
* Performing XGrabPointer/XGrabKeyboard calls, these coerce core
events even if gdk doesn't understand these anymore
* filtering for XEvents yourself and expecting old fashioned
events like XKeyEvent, XMotionEvent, XButtonEvent, etc...
Within GTK+, The only points not fully aware of multiple devices are DnD
and GtkPlug/Socket, the only practical drawback is that simultaneous DnD
isn't possible yet and embedded apps might not work with multiple
keyboards.
Carlos
>From faf3a7483830c9f806a266e1d5ed139b8a31e949 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg gnome org>
Date: Mon, 13 Dec 2010 00:55:19 +0100
Subject: [PATCH] Enable XI2 by default
gdk_enable_multidevice() has been replaced with gdk_disable_multidevice(),
so applications may call that function if they want to go back at the
previous behavior.
There would be usually little reasons to call that function, unless the
application is doing X calls itself that count on old fashioned core
devices.
---
gdk/gdk.c | 16 ++++++++--------
gdk/gdk.symbols | 2 +-
gdk/gdkdevicemanager.c | 11 ++++++-----
gdk/gdkglobals.c | 2 +-
gdk/gdkinternals.h | 2 +-
gdk/x11/gdkdevicemanager-x11.c | 2 +-
6 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 003ad34..1b75f7f 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -1063,24 +1063,24 @@ gdk_set_program_class (const char *program_class)
}
/**
- * gdk_enable_multidevice:
+ * gdk_disable_multidevice:
*
- * Enables multidevice support in GDK. This call must happen prior
+ * Disables multidevice support in GDK. This call must happen prior
* to gdk_display_open(), gtk_init(), gtk_init_with_args() or
* gtk_init_check() in order to take effect.
*
- * Note that individual #GdkWindow<!-- -->s still need to explicitly
- * enable multidevice awareness through gdk_window_set_support_multidevice().
- *
- * This function must be called before initializing GDK.
+ * Most common GTK+ applications won't ever need to call this. Only
+ * applications that do mixed GDK/Xlib calls could want to disable
+ * multidevice support if such Xlib code deals with input devices in
+ * any way and doesn't observe the presence of XInput 2.
*
* Since: 3.0
**/
void
-gdk_enable_multidevice (void)
+gdk_disable_multidevice (void)
{
if (gdk_initialized)
return;
- _gdk_enable_multidevice = TRUE;
+ _gdk_disable_multidevice = TRUE;
}
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index df8cff6..13d2349 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -80,6 +80,7 @@ gdk_device_set_source
gdk_devices_list
gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab
+gdk_disable_multidevice
gdk_display_add_client_message_filter
gdk_display_beep
gdk_display_close
@@ -157,7 +158,6 @@ gdk_drag_protocol_get_type G_GNUC_CONST
gdk_drag_status
gdk_drop_finish
gdk_drop_reply
-gdk_enable_multidevice
gdk_error_trap_pop
gdk_error_trap_pop_ignored
gdk_error_trap_push
diff --git a/gdk/gdkdevicemanager.c b/gdk/gdkdevicemanager.c
index 56499bc..fced01f 100644
--- a/gdk/gdkdevicemanager.c
+++ b/gdk/gdkdevicemanager.c
@@ -36,12 +36,13 @@
* additional features such as sub-pixel positioning information and additional
* device-dependent information.
* @Title: GdkDeviceManager
- * @See_also: #GdkDevice, #GdkEvent, gdk_enable_multidevice()
+ * @See_also: #GdkDevice, #GdkEvent, gdk_disable_multidevice()
*
- * By default, GDK supports the traditional single keyboard/pointer input scheme (Plus additional
- * special input devices such as tablets. In short, backwards compatible with 2.X). Since version 3.0,
- * if gdk_enable_multidevice() is called before gdk_display_open() and the platform supports it, GDK
- * will be aware of multiple keyboard/pointer pairs interacting simultaneously with the user interface.
+ * By default, and if the platform supports it, GDK is aware of multiple keyboard/pointer pairs
+ * and multitouch devices, this behavior can be changed by calling gdk_disable_multidevice()
+ * before gdk_display_open(), although there would be rarely a reason to do that. For a widget
+ * or window to be dealt as multipointer aware, gdk_window_set_support_multidevice() or
+ * gtk_widget_set_support_multidevice() must have been called on it.
*
* Conceptually, in multidevice mode there are 2 device types, virtual devices (or master devices)
* are represented by the pointer cursors and keyboard foci that are seen on the screen. physical
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index 5413886..2a57298 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -38,6 +38,6 @@ 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;
+gboolean _gdk_disable_multidevice = FALSE;
GSList *_gdk_displays = NULL;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index b5f5a57..8ade0c1 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -272,7 +272,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;
+extern gboolean _gdk_disable_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 a6bb50b..4a6953d 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -48,7 +48,7 @@ _gdk_device_manager_new (GdkDisplay *display)
major = 2;
minor = 0;
- if (_gdk_enable_multidevice &&
+ if (!_gdk_disable_multidevice &&
XIQueryVersion (xdisplay, &major, &minor) != BadRequest)
{
GdkDeviceManagerXI2 *device_manager_xi2;
--
1.7.3.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]