summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.win32.in6
-rw-r--r--configure.ac25
-rw-r--r--gdk/Makefile.am2
-rw-r--r--gdk/x11/Makefile.am5
-rw-r--r--gdk/x11/gdkdevice-xi.c660
-rw-r--r--gdk/x11/gdkdevice-xi2.c18
-rw-r--r--gdk/x11/gdkdevicemanager-x11.c18
-rw-r--r--gdk/x11/gdkdevicemanager-xi.c685
-rw-r--r--gdk/x11/gdkdevicemanager-xi2.c25
-rw-r--r--gdk/x11/gdkdeviceprivate-xi.h59
-rw-r--r--gdk/x11/gdkprivate-x11.h18
-rw-r--r--gdk/x11/gdkx.h2
-rw-r--r--gdk/x11/gdkx11device-xi.h40
13 files changed, 6 insertions, 1557 deletions
diff --git a/config.h.win32.in b/config.h.win32.in
index 8c27bea791..f48100f928 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -279,12 +279,6 @@
/* Define to 1 if XInput 2.0 is available */
/* #undef XINPUT_2 */
-/* Define to 1 if no XInput should be used */
-/* #undef XINPUT_NONE */
-
-/* Define to 1 if XFree XInput should be used */
-/* #undef XINPUT_XFREE */
-
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
diff --git a/configure.ac b/configure.ac
index 25a84280e7..205622303e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -265,10 +265,6 @@ AC_ARG_ENABLE(xinerama,
[AS_HELP_STRING([--enable-xinerama],
[support Xinerama extension [default=maybe]])],,
[enable_xinerama="maybe"])
-AC_ARG_ENABLE(xinput,
- [AS_HELP_STRING([--enable-xinput],
- [support XInput extension [default=yes]])],,
- [enable_xinput="maybe"])
AC_ARG_ENABLE(xrandr,
[AS_HELP_STRING([--enable-xrandr],
[support XRandR extension [default=maybe]])],,
@@ -1111,11 +1107,7 @@ if test "x$enable_x11_backend" = xyes; then
AC_DEFINE(HAVE_XGENERICEVENTS, 1, [Have XGenericEvent]))
# set up things for XInput
- if test "x$enable_xinput" != "xno" && $PKG_CONFIG --exists "xi" ; then
- have_xinput=yes
-
- AC_DEFINE(XINPUT_XFREE, 1,
- [Define to 1 if XFree XInput should be used])
+ if $PKG_CONFIG --exists "xi" ; then
X_PACKAGES="$X_PACKAGES xi"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xi"
@@ -1123,26 +1115,18 @@ if test "x$enable_x11_backend" = xyes; then
AC_CHECK_HEADER(X11/extensions/XInput2.h,
have_xinput2=yes
X_EXTENSIONS="$X_EXTENSIONS XI2"
- AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]),
- X_EXTENSIONS="$X_EXTENSIONS XInput")
+ AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
gtk_save_LIBS="$LIBS"
LIBS="$LIBS -lXi"
AC_CHECK_FUNC(XIAllowTouchEvents, AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]))
LIBS="$gtk_save_LIBS"
- else
- AC_DEFINE(XINPUT_NONE, 1,
- [Define to 1 if no XInput should be used])
fi
- AM_CONDITIONAL(XINPUT_XFREE, test "x$have_xinput" = "xyes")
AM_CONDITIONAL(XINPUT_2, test "x$have_xinput2" = "xyes")
- if test "x$enable_xinput" = "xyes" ; then
- if test "x$have_xinput" != "xyes" -a "x$have_xinput2" != "xyes" ; then
- AC_MSG_ERROR([*** XInput extension not found. Check 'config.log' for more details.])
- fi
- fi
+ AS_IF([test "x$have_xinput2" != "xyes"],
+ [AC_MSG_ERROR([*** XInput2 extension not found. Check 'config.log' for more details.])])
# Check for the RANDR extension
if test x"$enable_xrandr" != xno; then
@@ -1223,7 +1207,6 @@ if test "x$enable_x11_backend" = xyes; then
else
XPACKAGES=
- AM_CONDITIONAL(XINPUT_XFREE, false)
AM_CONDITIONAL(XINPUT_2, false)
AM_CONDITIONAL(USE_X11, false)
AM_CONDITIONAL(HAVE_X11R6, false)
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 191d0b666c..6b647e5302 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -211,10 +211,8 @@ x11_introspection_files = \
x11/gdkdevice-core-x11.c \
x11/gdkdevicemanager-core-x11.c \
x11/gdkdevicemanager-x11.c \
- x11/gdkdevicemanager-xi.c \
x11/gdkdevicemanager-xi2.c \
x11/gdkdevice-xi2.c \
- x11/gdkdevice-xi.c \
x11/gdkdisplay-x11.c \
x11/gdkdnd-x11.c \
x11/gdkeventsource.c \
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index d8abfd5b4a..0b3f81e2ef 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -26,12 +26,9 @@ libgdk_x11_la_SOURCES = \
gdkasync.h \
gdkcursor-x11.c \
gdkdevice-core-x11.c \
- gdkdevice-xi.c \
gdkdevice-xi2.c \
- gdkdeviceprivate-xi.h \
gdkdevicemanager-core-x11.c \
gdkdevicemanager-x11.c \
- gdkdevicemanager-xi.c \
gdkdevicemanager-xi2.c \
gdkdevicemanagerprivate-core.h \
gdkdisplaymanager-x11.c \
@@ -70,11 +67,9 @@ libgdkx11include_HEADERS = \
gdkx11cursor.h \
gdkx11device.h \
gdkx11device-core.h \
- gdkx11device-xi.h \
gdkx11device-xi2.h \
gdkx11devicemanager.h \
gdkx11devicemanager-core.h \
- gdkx11devicemanager-xi.h \
gdkx11devicemanager-xi2.h \
gdkx11display.h \
gdkx11displaymanager.h \
diff --git a/gdk/x11/gdkdevice-xi.c b/gdk/x11/gdkdevice-xi.c
deleted file mode 100644
index 8c9c5f10c3..0000000000
--- a/gdk/x11/gdkdevice-xi.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "gdkx11device-xi.h"
-
-#include "gdkdeviceprivate-xi.h"
-
-#ifdef XINPUT_XFREE
-
-#include "gdkwindow.h"
-#include "gdkintl.h"
-#include "gdkprivate-x11.h"
-#include "gdkasync.h"
-
-#endif
-
-G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE)
-
-#ifdef XINPUT_XFREE
-
-#define MAX_DEVICE_CLASSES 13
-
-static GQuark quark_window_input_info = 0;
-
-typedef struct
-{
- gdouble root_x;
- gdouble root_y;
-} GdkWindowInputInfo;
-
-static void gdk_x11_device_xi_constructed (GObject *object);
-static void gdk_x11_device_xi_dispose (GObject *object);
-
-static void gdk_x11_device_xi_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gdk_x11_device_xi_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static gboolean gdk_x11_device_xi_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events);
-
-static void gdk_x11_device_xi_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask);
-static void gdk_x11_device_xi_set_window_cursor (GdkDevice *device,
- GdkWindow *window,
- GdkCursor *cursor);
-static void gdk_x11_device_xi_warp (GdkDevice *device,
- GdkScreen *screen,
- gint x,
- gint y);
-static gboolean gdk_x11_device_xi_query_state (GdkDevice *device,
- GdkWindow *window,
- GdkWindow **root_window,
- GdkWindow **child_window,
- gint *root_x,
- gint *root_y,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask);
-static GdkGrabStatus gdk_x11_device_xi_grab (GdkDevice *device,
- GdkWindow *window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time_);
-static void gdk_x11_device_xi_ungrab (GdkDevice *device,
- guint32 time_);
-
-static GdkWindow* gdk_x11_device_xi_window_at_position (GdkDevice *device,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask,
- gboolean get_toplevel);
-
-static void gdk_x11_device_xi_select_window_events (GdkDevice *device,
- GdkWindow *window,
- GdkEventMask mask);
-
-
-enum {
- PROP_0,
- PROP_DEVICE_ID
-};
-
-static void
-gdk_x11_device_xi_class_init (GdkX11DeviceXIClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
-
- quark_window_input_info = g_quark_from_static_string ("gdk-window-input-info");
-
- object_class->constructed = gdk_x11_device_xi_constructed;
- object_class->set_property = gdk_x11_device_xi_set_property;
- object_class->get_property = gdk_x11_device_xi_get_property;
- object_class->dispose = gdk_x11_device_xi_dispose;
-
- device_class->get_history = gdk_x11_device_xi_get_history;
- device_class->get_state = gdk_x11_device_xi_get_state;
- device_class->set_window_cursor = gdk_x11_device_xi_set_window_cursor;
- device_class->warp = gdk_x11_device_xi_warp;
- device_class->query_state = gdk_x11_device_xi_query_state;
- device_class->grab = gdk_x11_device_xi_grab;
- device_class->ungrab = gdk_x11_device_xi_ungrab;
- device_class->window_at_position = gdk_x11_device_xi_window_at_position;
- device_class->select_window_events = gdk_x11_device_xi_select_window_events;
-
- g_object_class_install_property (object_class,
- PROP_DEVICE_ID,
- g_param_spec_int ("device-id",
- P_("Device ID"),
- P_("Device ID"),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-static void
-gdk_x11_device_xi_init (GdkX11DeviceXI *device)
-{
-}
-
-static void
-gdk_x11_device_xi_constructed (GObject *object)
-{
- GdkX11DeviceXI *device;
- GdkDisplay *display;
-
- device = GDK_X11_DEVICE_XI (object);
- display = gdk_device_get_display (GDK_DEVICE (object));
-
- gdk_x11_display_error_trap_push (display);
- device->xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (display),
- device->device_id);
-
- if (gdk_x11_display_error_trap_pop (display))
- g_warning ("Device %s can't be opened",
- gdk_device_get_name (GDK_DEVICE (device)));
-
- if (G_OBJECT_CLASS (gdk_x11_device_xi_parent_class)->constructed)
- G_OBJECT_CLASS (gdk_x11_device_xi_parent_class)->constructed (object);
-}
-
-static void
-gdk_x11_device_xi_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdkX11DeviceXI *device = GDK_X11_DEVICE_XI (object);
-
- switch (prop_id)
- {
- case PROP_DEVICE_ID:
- device->device_id = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_x11_device_xi_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdkX11DeviceXI *device = GDK_X11_DEVICE_XI (object);
-
- switch (prop_id)
- {
- case PROP_DEVICE_ID:
- g_value_set_int (value, device->device_id);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_x11_device_xi_dispose (GObject *object)
-{
- GdkX11DeviceXI *device_xi;
- GdkDisplay *display;
-
- device_xi = GDK_X11_DEVICE_XI (object);
- display = gdk_device_get_display (GDK_DEVICE (device_xi));
-
- if (device_xi->xdevice)
- {
- XCloseDevice (GDK_DISPLAY_XDISPLAY (display), device_xi->xdevice);
- device_xi->xdevice = NULL;
- }
-
- if (device_xi->axis_data)
- {
- g_free (device_xi->axis_data);
- device_xi->axis_data = NULL;
- }
-
- G_OBJECT_CLASS (gdk_x11_device_xi_parent_class)->dispose (object);
-}
-
-static gboolean
-gdk_x11_device_xi_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events)
-{
- GdkTimeCoord **coords;
- XDeviceTimeCoord *device_coords;
- GdkWindow *impl_window;
- GdkX11DeviceXI *device_xi;
- gint n_events_return;
- gint mode_return;
- gint axis_count_return;
- gint i;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- impl_window = _gdk_window_get_impl_window (window);
-
- device_coords = XGetDeviceMotionEvents (GDK_WINDOW_XDISPLAY (impl_window),
- device_xi->xdevice,
- start, stop,
- &n_events_return,
- &mode_return,
- &axis_count_return);
-
- if (!device_coords)
- return FALSE;
-
- *n_events = n_events_return;
- coords = _gdk_device_allocate_history (device, *n_events);
-
- for (i = 0; i < *n_events; i++)
- {
- coords[i]->time = device_coords[i].time;
- _gdk_x11_device_xi_translate_axes (device, window,
- device_coords[i].data,
- coords[i]->axes,
- NULL, NULL);
- }
-
- XFreeDeviceMotionEvents (device_coords);
-
- *events = coords;
-
- return TRUE;
-}
-
-static void
-gdk_x11_device_xi_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask)
-{
- GdkX11DeviceXI *device_xi;
- XDeviceState *state;
- XInputClass *input_class;
- gint i;
-
- if (mask)
- gdk_window_get_device_position (window, device, NULL, NULL, mask);
-
- device_xi = GDK_X11_DEVICE_XI (device);
- state = XQueryDeviceState (GDK_WINDOW_XDISPLAY (window),
- device_xi->xdevice);
- input_class = state->data;
-
- for (i = 0; i < state->num_classes; i++)
- {
- switch (input_class->class)
- {
- case ValuatorClass:
- if (axes)
- _gdk_x11_device_xi_translate_axes (device, window,
- ((XValuatorState *) input_class)->valuators,
- axes, NULL, NULL);
- break;
-
- case ButtonClass:
- if (mask)
- {
- *mask &= 0xFF;
- if (((XButtonState *)input_class)->num_buttons > 0)
- *mask |= ((XButtonState *)input_class)->buttons[0] << 7;
- /* GDK_BUTTON1_MASK = 1 << 8, and button n is stored
- * in bit 1<<(n%8) in byte n/8. n = 1,2,... */
- }
- break;
- }
-
- input_class = (XInputClass *)(((char *)input_class)+input_class->length);
- }
-
- XFreeDeviceState (state);
-}
-
-static void
-gdk_x11_device_xi_set_window_cursor (GdkDevice *device,
- GdkWindow *window,
- GdkCursor *cursor)
-{
-}
-
-static void
-gdk_x11_device_xi_warp (GdkDevice *device,
- GdkScreen *screen,
- gint x,
- gint y)
-{
-}
-
-static void
-find_events (GdkDevice *device,
- GdkEventMask mask,
- XEventClass *classes,
- int *num_classes)
-{
- GdkX11DeviceXI *device_xi;
- XEventClass class;
- gint i;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- i = 0;
-
- if (mask & GDK_BUTTON_PRESS_MASK)
- {
- DeviceButtonPress (device_xi->xdevice, device_xi->button_press_type, class);
- if (class != 0)
- classes[i++] = class;
-
- DeviceButtonPressGrab (device_xi->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & GDK_BUTTON_RELEASE_MASK)
- {
- DeviceButtonRelease (device_xi->xdevice, device_xi->button_release_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & (GDK_POINTER_MOTION_MASK |
- GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_MOTION_MASK))
- {
- /* Make sure device->motionnotify_type is set */
- DeviceMotionNotify (device_xi->xdevice, device_xi->motion_notify_type, class);
- if (class != 0)
- classes[i++] = class;
- DeviceStateNotify (device_xi->xdevice, device_xi->state_notify_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & GDK_KEY_PRESS_MASK)
- {
- DeviceKeyPress (device_xi->xdevice, device_xi->key_press_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & GDK_KEY_RELEASE_MASK)
- {
- DeviceKeyRelease (device_xi->xdevice, device_xi->key_release_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & GDK_PROXIMITY_IN_MASK)
- {
- ProximityIn (device_xi->xdevice, device_xi->proximity_in_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- if (mask & GDK_PROXIMITY_OUT_MASK)
- {
- ProximityOut (device_xi->xdevice, device_xi->proximity_out_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- *num_classes = i;
-}
-
-static gboolean
-gdk_x11_device_xi_query_state (GdkDevice *device,
- GdkWindow *window,
- GdkWindow **root_window,
- GdkWindow **child_window,
- gint *root_x,
- gint *root_y,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask)
-{
- return FALSE;
-}
-
-static GdkGrabStatus
-gdk_x11_device_xi_grab (GdkDevice *device,
- GdkWindow *window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time_)
-{
- XEventClass event_classes[MAX_DEVICE_CLASSES];
- gint status, num_classes;
- GdkX11DeviceXI *device_xi;
- GdkDisplay *display;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- display = gdk_device_get_display (device);
- find_events (device, event_mask, event_classes, &num_classes);
-
-#ifdef G_ENABLE_DEBUG
- if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
- status = GrabSuccess;
- else
-#endif
- status = XGrabDevice (GDK_DISPLAY_XDISPLAY (display),
- device_xi->xdevice,
- GDK_WINDOW_XID (window),
- owner_events,
- num_classes, event_classes,
- GrabModeAsync, GrabModeAsync,
- time_);
-
- _gdk_x11_display_update_grab_info (display, device, status);
-
- return _gdk_x11_convert_grab_status (status);
-}
-
-static void
-gdk_x11_device_xi_ungrab (GdkDevice *device,
- guint32 time_)
-{
- GdkX11DeviceXI *device_xi;
- GdkDisplay *display;
- Display *xdisplay;
- unsigned long serial;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- display = gdk_device_get_display (device);
- xdisplay = GDK_DISPLAY_XDISPLAY (display);
-
- serial = NextRequest (xdisplay);
-
- XUngrabDevice (xdisplay, device_xi->xdevice, time_);
-
- _gdk_x11_display_update_grab_info_ungrab (display, device, time_, serial);
-}
-
-static GdkWindow*
-gdk_x11_device_xi_window_at_position (GdkDevice *device,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask,
- gboolean get_toplevel)
-{
- return NULL;
-}
-
-static void
-gdk_x11_device_xi_select_window_events (GdkDevice *device,
- GdkWindow *window,
- GdkEventMask event_mask)
-{
- XEventClass event_classes[MAX_DEVICE_CLASSES];
- gint num_classes;
-
- event_mask |= (GDK_PROXIMITY_IN_MASK |
- GDK_PROXIMITY_OUT_MASK);
-
- find_events (device, event_mask, event_classes, &num_classes);
-
- XSelectExtensionEvent (GDK_WINDOW_XDISPLAY (window),
- GDK_WINDOW_XID (window),
- event_classes, num_classes);
-
- if (event_mask)
- {
- GdkWindowInputInfo *info;
-
- info = g_new0 (GdkWindowInputInfo, 1);
- g_object_set_qdata_full (G_OBJECT (window),
- quark_window_input_info,
- info,
- (GDestroyNotify) g_free);
- }
- else
- g_object_set_qdata (G_OBJECT (window),
- quark_window_input_info,
- NULL);
-}
-
-void
-_gdk_x11_device_xi_update_window_info (GdkWindow *window)
-{
- GdkWindowInputInfo *info;
- gint root_x, root_y;
-
- info = g_object_get_qdata (G_OBJECT (window),
- quark_window_input_info);
-
- if (!info)
- return;
-
- gdk_window_get_origin (window, &root_x, &root_y);
- info->root_x = (gdouble) root_x;
- info->root_y = (gdouble) root_y;
-}
-
-static gboolean
-gdk_x11_device_xi_get_window_info (GdkWindow *window,
- gdouble *root_x,
- gdouble *root_y)
-{
- GdkWindowInputInfo *info;
-
- info = g_object_get_qdata (G_OBJECT (window),
- quark_window_input_info);
-
- if (!info)
- return FALSE;
-
- *root_x = info->root_x;
- *root_y = info->root_y;
-
- return TRUE;
-}
-
-void
-_gdk_x11_device_xi_update_axes (GdkDevice *device,
- gint axes_count,
- gint first_axis,
- gint *axis_data)
-{
- GdkX11DeviceXI *device_xi;
- int i;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- g_return_if_fail (first_axis >= 0 &&
- first_axis + axes_count <= gdk_device_get_n_axes (device));
-
- if (!device_xi->axis_data)
- device_xi->axis_data = g_new0 (gint, gdk_device_get_n_axes (device));
-
- for (i = 0; i < axes_count; i++)
- device_xi->axis_data[first_axis + i] = axis_data[i];
-}
-
-void
-_gdk_x11_device_xi_translate_axes (GdkDevice *device,
- GdkWindow *window,
- gint *axis_data,
- gdouble *axes,
- gdouble *x,
- gdouble *y)
-{
- GdkWindow *impl_window;
- gdouble root_x, root_y;
- gdouble temp_x, temp_y;
- gint n_axes;
- gint i;
-
- impl_window = _gdk_window_get_impl_window (window);
- temp_x = temp_y = 0;
-
- if (!gdk_x11_device_xi_get_window_info (impl_window, &root_x, &root_y))
- return;
-
- n_axes = gdk_device_get_n_axes (device);
-
- for (i = 0; i < n_axes; i++)
- {
- GdkAxisUse use;
-
- use = gdk_device_get_axis_use (device, i);
-
- switch (use)
- {
- case GDK_AXIS_X:
- case GDK_AXIS_Y:
- if (gdk_device_get_mode (device) == GDK_MODE_WINDOW)
- _gdk_device_translate_window_coord (device, window,
- i, axis_data[i],
- &axes[i]);
- else
- _gdk_device_translate_screen_coord (device, window,
- root_x, root_y,
- i, axis_data[i],
- &axes[i]);
- if (use == GDK_AXIS_X)
- temp_x = axes[i];
- else if (use == GDK_AXIS_Y)
- temp_y = axes[i];
-
- break;
- default:
- _gdk_device_translate_axis (device, i, axis_data[i], &axes[i]);
- break;
- }
- }
-
- if (x)
- *x = temp_x;
-
- if (y)
- *y = temp_y;
-}
-
-#else /* XINPUT_XFREE */
-
-static void
-gdk_x11_device_xi_class_init (GdkX11DeviceXIClass *klass)
-{
-}
-
-static void
-gdk_x11_device_xi_init (GdkX11DeviceXI *device)
-{
-}
-
-#endif /* XINPUT_XFREE */
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index d1139da01f..4426a0e639 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -24,14 +24,11 @@
#include "gdkasync.h"
#include "gdkprivate-x11.h"
-#ifdef XINPUT_2
-
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
-#endif
typedef struct _ScrollValuator ScrollValuator;
@@ -58,7 +55,6 @@ struct _GdkX11DeviceXI2Class
G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE)
-#ifdef XINPUT_2
static void gdk_x11_device_xi2_finalize (GObject *object);
static void gdk_x11_device_xi2_get_property (GObject *object,
@@ -885,17 +881,3 @@ _gdk_x11_device_xi2_get_id (GdkX11DeviceXI2 *device)
return device->device_id;
}
-
-#else /* XINPUT_2 */
-
-static void
-gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
-{
-}
-
-static void
-gdk_x11_device_xi2_init (GdkX11DeviceXI2 *device)
-{
-}
-
-#endif /* XINPUT_2 */
diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c
index 75470636a9..a34ff664ca 100644
--- a/gdk/x11/gdkdevicemanager-x11.c
+++ b/gdk/x11/gdkdevicemanager-x11.c
@@ -19,12 +19,9 @@
#include "gdkx11devicemanager-core.h"
#include "gdkdevicemanagerprivate-core.h"
-#ifdef XINPUT_XFREE
-#include "gdkx11devicemanager-xi.h"
#ifdef XINPUT_2
#include "gdkx11devicemanager-xi2.h"
#endif
-#endif
#include "gdkinternals.h"
#include "gdkprivate-x11.h"
@@ -39,7 +36,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
{
if (!g_getenv ("GDK_CORE_DEVICE_EVENTS"))
{
-#if defined (XINPUT_2) || defined (XINPUT_XFREE)
+#ifdef XINPUT_2
int opcode, firstevent, firsterror;
Display *xdisplay;
@@ -48,7 +45,6 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
if (XQueryExtension (xdisplay, "XInputExtension",
&opcode, &firstevent, &firsterror))
{
-#ifdef XINPUT_2
int major, minor;
major = 2;
@@ -74,18 +70,8 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
return GDK_DEVICE_MANAGER (device_manager_xi2);
}
- else
-#endif /* XINPUT_2 */
- {
- GDK_NOTE (INPUT, g_print ("Creating XI device manager\n"));
-
- return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI,
- "display", display,
- "event-base", firstevent,
- NULL);
- }
}
-#endif /* XINPUT_2 || XINPUT_XFREE */
+#endif /* XINPUT_2 */
}
GDK_NOTE (INPUT, g_print ("Creating core device manager\n"));
diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c
deleted file mode 100644
index f7a253c6ea..0000000000
--- a/gdk/x11/gdkdevicemanager-xi.c
+++ /dev/null
@@ -1,685 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#include "gdkx11devicemanager-xi.h"
-#include "gdkdevicemanagerprivate-core.h"
-#include "gdkdeviceprivate-xi.h"
-
-#include "gdkdevicemanagerprivate.h"
-#include "gdkeventtranslator.h"
-#include "gdkintl.h"
-#include "gdkprivate-x11.h"
-
-#ifdef XINPUT_XFREE
-
-#include <X11/extensions/XInput.h>
-
-#endif /* XINPUT_XFREE */
-
-struct _GdkX11DeviceManagerXI
-{
- GdkX11DeviceManagerCore parent_object;
-
- GHashTable *id_table;
- gint event_base;
- GList *devices;
- gboolean ignore_core_events;
-};
-
-struct _GdkX11DeviceManagerXIClass
-{
- GdkX11DeviceManagerCoreClass parent_class;
-};
-
-static void gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI, gdk_x11_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
- G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
- gdk_x11_device_manager_xi_event_translator_init))
-
-#ifdef XINPUT_XFREE
-
-static void gdk_x11_device_manager_xi_constructed (GObject *object);
-static void gdk_x11_device_manager_xi_dispose (GObject *object);
-static void gdk_x11_device_manager_xi_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gdk_x11_device_manager_xi_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static gboolean gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator,
- GdkDisplay *display,
- GdkEvent *event,
- XEvent *xevent);
-static GList * gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *device_manager,
- GdkDeviceType type);
-
-
-enum {
- PROP_0,
- PROP_EVENT_BASE
-};
-
-static void
-gdk_x11_device_manager_xi_class_init (GdkX11DeviceManagerXIClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
-
- object_class->constructed = gdk_x11_device_manager_xi_constructed;
- object_class->dispose = gdk_x11_device_manager_xi_dispose;
- object_class->set_property = gdk_x11_device_manager_xi_set_property;
- object_class->get_property = gdk_x11_device_manager_xi_get_property;
-
- device_manager_class->list_devices = gdk_x11_device_manager_xi_list_devices;
-
- g_object_class_install_property (object_class,
- PROP_EVENT_BASE,
- g_param_spec_int ("event-base",
- P_("Event base"),
- P_("Event base for XInput events"),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-static GdkFilterReturn
-window_input_info_filter (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer user_data)
-{
- GdkDeviceManager *device_manager;
- GdkDisplay *display;
- GdkWindow *window;
- XEvent *xev;
-
- device_manager = user_data;
- xev = (XEvent *) xevent;
-
- display = gdk_device_manager_get_display (device_manager);
- window = gdk_x11_window_lookup_for_display (display, xev->xany.window);
-
- if (window && xev->type == ConfigureNotify)
- _gdk_x11_device_xi_update_window_info (window);
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-gdk_x11_device_manager_xi_init (GdkX11DeviceManagerXI *device_manager)
-{
- device_manager->id_table = g_hash_table_new_full (NULL, NULL, NULL,
- (GDestroyNotify) g_object_unref);
-
- gdk_window_add_filter (NULL, window_input_info_filter, device_manager);
-}
-
-static void
-translate_class_info (GdkDevice *device,
- XDeviceInfo *info)
-{
- GdkX11DeviceXI *device_xi;
- XAnyClassPtr class;
- gint i, j;
-
- device_xi = GDK_X11_DEVICE_XI (device);
- class = info->inputclassinfo;
-
- for (i = 0; i < info->num_classes; i++)
- {
- switch (class->class)
- {
- case ButtonClass:
- break;
- case KeyClass:
- {
- XKeyInfo *xki = (XKeyInfo *)class;
- guint num_keys;
-
- num_keys = xki->max_keycode - xki->min_keycode + 1;
- _gdk_device_set_keys (device, num_keys);
-
- device_xi->min_keycode = xki->min_keycode;
-
- break;
- }
- case ValuatorClass:
- {
- XValuatorInfo *xvi = (XValuatorInfo *)class;
-
- for (j = 0; j < xvi->num_axes; j++)
- {
- GdkAxisUse use;
-
- switch (j)
- {
- case 0:
- use = GDK_AXIS_X;
- break;
- case 1:
- use = GDK_AXIS_Y;
- break;
- case 2:
- use = GDK_AXIS_PRESSURE;
- break;
- case 3:
- use = GDK_AXIS_XTILT;
- break;
- case 4:
- use = GDK_AXIS_YTILT;
- break;
- case 5:
- use = GDK_AXIS_WHEEL;
- break;
- default:
- use = GDK_AXIS_IGNORE;
- }
-
- _gdk_device_add_axis (device,
- GDK_NONE,
- use,
- xvi->axes[j].min_value,
- xvi->axes[j].max_value,
- xvi->axes[j].resolution);
- }
-
- break;
- }
- }
-
- class = (XAnyClassPtr) (((char *) class) + class->length);
- }
-}
-
-/* old versions of XI.h don't define these */
-#ifndef IsXExtensionKeyboard
-#define IsXExtensionKeyboard 3
-#define IsXExtensionPointer 4
-#endif
-
-static GdkDevice *
-create_device (GdkDeviceManager *device_manager,
- GdkDisplay *display,
- XDeviceInfo *info)
-{
- GdkInputSource input_source;
- GdkDevice *device;
-
- if (info->use != IsXExtensionPointer &&
- info->use != IsXExtensionKeyboard)
- return NULL;
-
- if (info->use == IsXExtensionKeyboard)
- input_source = GDK_SOURCE_KEYBOARD;
- else
- {
- gchar *tmp_name;
-
- tmp_name = g_ascii_strdown (info->name, -1);
-
- if (strstr (tmp_name, "eraser"))
- input_source = GDK_SOURCE_ERASER;
- else if (strstr (tmp_name, "cursor"))
- input_source = GDK_SOURCE_CURSOR;
- else if (strstr (tmp_name, "wacom") ||
- strstr (tmp_name, "pen"))
- input_source = GDK_SOURCE_PEN;
- else
- input_source = GDK_SOURCE_MOUSE;
-
- g_free (tmp_name);
- }
-
- device = g_object_new (GDK_TYPE_X11_DEVICE_XI,
- "name", info->name,
- "type", GDK_DEVICE_TYPE_FLOATING,
- "input-source", input_source,
- "input-mode", GDK_MODE_DISABLED,
- "has-cursor", FALSE,
- "display", display,
- "device-manager", device_manager,
- "device-id", info->id,
- NULL);
- translate_class_info (device, info);
-
- return device;
-}
-
-static void
-gdk_x11_device_manager_xi_constructed (GObject *object)
-{
- GdkX11DeviceManagerXI *device_manager;
- XDeviceInfo *devices;
- gint i, num_devices;
- GdkDisplay *display;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
- display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
- devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display), &num_devices);
-
- for(i = 0; i < num_devices; i++)
- {
- GdkDevice *device;
-
- device = create_device (GDK_DEVICE_MANAGER (object),
- display, &devices[i]);
- if (device)
- {
- device_manager->devices = g_list_prepend (device_manager->devices, device);
- g_hash_table_insert (device_manager->id_table,
- GINT_TO_POINTER (devices[i].id),
- g_object_ref (device));
- }
- }
-
- XFreeDeviceList (devices);
-
- gdk_x11_register_standard_event_type (display,
- device_manager->event_base,
- 15 /* Number of events */);
-
- if (G_OBJECT_CLASS (gdk_x11_device_manager_xi_parent_class)->constructed)
- G_OBJECT_CLASS (gdk_x11_device_manager_xi_parent_class)->constructed (object);
-}
-
-static void
-gdk_x11_device_manager_xi_dispose (GObject *object)
-{
- GdkX11DeviceManagerXI *device_manager;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
-
- g_list_free_full (device_manager->devices, g_object_unref);
- device_manager->devices = NULL;
-
- if (device_manager->id_table != NULL)
- {
- g_hash_table_destroy (device_manager->id_table);
- device_manager->id_table = NULL;
- }
-
- gdk_window_remove_filter (NULL, window_input_info_filter, object);
-
- G_OBJECT_CLASS (gdk_x11_device_manager_xi_parent_class)->dispose (object);
-}
-
-static void
-gdk_x11_device_manager_xi_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdkX11DeviceManagerXI *device_manager;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
-
- switch (prop_id)
- {
- case PROP_EVENT_BASE:
- device_manager->event_base = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_x11_device_manager_xi_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdkX11DeviceManagerXI *device_manager;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
-
- switch (prop_id)
- {
- case PROP_EVENT_BASE:
- g_value_set_int (value, device_manager->event_base);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface)
-{
- iface->translate_event = gdk_x11_device_manager_xi_translate_event;
-}
-
-/* combine the state of the core device and the device state
- * into one - for now we do this in a simple-minded manner -
- * we just take the keyboard portion of the core device and
- * the button portion (all of?) the device state.
- * Any button remapping should go on here.
- */
-static guint
-translate_state (guint state, guint device_state)
-{
- return device_state | (state & 0xFF);
-}
-
-static GdkDevice *
-lookup_device (GdkX11DeviceManagerXI *manager,
- XEvent *xevent)
-{
- GdkX11DeviceManagerXI *device_manager;
- guint32 device_id;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (manager);
-
- /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
- but it's potentially faster than scanning through the types of
- every device. If we were deceived, then it won't match any of
- the types for the device anyways */
- device_id = ((XDeviceButtonEvent *)xevent)->deviceid;
-
- return g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (device_id));
-}
-
-static gboolean
-gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator,
- GdkDisplay *display,
- GdkEvent *event,
- XEvent *xevent)
-{
- GdkX11DeviceManagerXI *device_manager;
- GdkEventTranslatorIface *parent_iface;
- GdkX11DeviceXI *device_xi;
- GdkDevice *device;
- GdkWindow *window;
-
- parent_iface = g_type_interface_peek_parent (GDK_EVENT_TRANSLATOR_GET_IFACE (translator));
- device_manager = GDK_X11_DEVICE_MANAGER_XI (translator);
-
- if (!device_manager->ignore_core_events &&
- parent_iface->translate_event (translator, display, event, xevent))
- return TRUE;
-
- device = lookup_device (device_manager, xevent);
- device_xi = GDK_X11_DEVICE_XI (device);
-
- if (!device)
- return FALSE;
-
- window = gdk_x11_window_lookup_for_display (display, xevent->xany.window);
-
- if (!window)
- return FALSE;
-
- if ((xevent->type == device_xi->button_press_type) ||
- (xevent->type == device_xi->button_release_type))
- {
- XDeviceButtonEvent *xdbe = (XDeviceButtonEvent *) xevent;
-
- event->button.type = (xdbe->type == device_xi->button_press_type) ?
- GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
-
- event->button.device = device;
- event->button.window = g_object_ref (window);
- event->button.time = xdbe->time;
-
- event->button.x_root = (gdouble) xdbe->x_root;
- event->button.y_root = (gdouble) xdbe->y_root;
-
- event->button.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
- _gdk_x11_device_xi_update_axes (device, xdbe->axes_count,
- xdbe->first_axis, xdbe->axis_data);
- _gdk_x11_device_xi_translate_axes (device, window,
- device_xi->axis_data,
- event->button.axes,
- &event->button.x,
- &event->button.y);
-
- event->button.state = translate_state (xdbe->state, xdbe->device_state);
- event->button.button = xdbe->button;
-
- if (event->button.type == GDK_BUTTON_PRESS)
- _gdk_event_button_generate (gdk_window_get_display (event->button.window),
- event);
-
- GDK_NOTE (EVENTS,
- g_print ("button %s:\t\twindow: %ld device: %ld x,y: %f %f button: %d\n",
- (event->button.type == GDK_BUTTON_PRESS) ? "press" : "release",
- xdbe->window,
- xdbe->deviceid,
- event->button.x, event->button.y,
- xdbe->button));
-
- /* Update the timestamp of the latest user interaction, if the event has
- * a valid timestamp.
- */
- if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
- gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
- gdk_event_get_time (event));
- return TRUE;
- }
-
- if ((xevent->type == device_xi->key_press_type) ||
- (xevent->type == device_xi->key_release_type))
- {
- XDeviceKeyEvent *xdke = (XDeviceKeyEvent *) xevent;
-
- GDK_NOTE (EVENTS,
- g_print ("device key %s:\twindow: %ld device: %ld keycode: %d\n",
- (event->key.type == GDK_KEY_PRESS) ? "press" : "release",
- xdke->window,
- xdke->deviceid,
- xdke->keycode));
-
- if (xdke->keycode < device_xi->min_keycode ||
- xdke->keycode >= device_xi->min_keycode + gdk_device_get_n_keys (device))
- {
- g_warning ("Invalid device key code received");
- return FALSE;
- }
-
- gdk_device_get_key (device, xdke->keycode - device_xi->min_keycode,
- &event->key.keyval,
- &event->key.state);
-
- if (event->key.keyval == 0)
- {
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - NONE\n"));
-
- return FALSE;
- }
-
- event->key.type = (xdke->type == device_xi->key_press_type) ?
- GDK_KEY_PRESS : GDK_KEY_RELEASE;
-
- event->key.window = g_object_ref (window);
- event->key.time = xdke->time;
-
- event->key.state |= translate_state (xdke->state, xdke->device_state);
-
- /* Add a string translation for the key event */
- if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))
- {
- event->key.length = 1;
- event->key.string = g_new (gchar, 2);
- event->key.string[0] = (gchar) event->key.keyval;
- event->key.string[1] = 0;
- }
- else
- {
- event->key.length = 0;
- event->key.string = g_new0 (gchar, 1);
- }
-
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - keyval: %d modifiers: %#x\n",
- event->key.keyval,
- event->key.state));
-
- /* Update the timestamp of the latest user interaction, if the event has
- * a valid timestamp.
- */
- if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
- gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
- gdk_event_get_time (event));
- return TRUE;
- }
-
- if (xevent->type == device_xi->motion_notify_type)
- {
- XDeviceMotionEvent *xdme = (XDeviceMotionEvent *) xevent;
-
- event->motion.device = device;
-
- if (device_xi->in_proximity)
- device_manager->ignore_core_events = TRUE;
-
- event->motion.x_root = (gdouble) xdme->x_root;
- event->motion.y_root = (gdouble) xdme->y_root;
-
- event->motion.axes = g_new0 (gdouble, gdk_device_get_n_axes (device));
- _gdk_x11_device_xi_update_axes (device, xdme->axes_count,
- xdme->first_axis, xdme->axis_data);
- _gdk_x11_device_xi_translate_axes (device, window,
- device_xi->axis_data,
- event->motion.axes,
- &event->motion.x,
- &event->motion.y);
-
- event->motion.type = GDK_MOTION_NOTIFY;
- event->motion.window = g_object_ref (window);
- event->motion.time = xdme->time;
- event->motion.state = translate_state (xdme->state,
- xdme->device_state);
- event->motion.is_hint = xdme->is_hint;
-
- GDK_NOTE (EVENTS,
- g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f state %#4x hint: %s\n",
- xdme->window,
- xdme->deviceid,
- event->motion.x, event->motion.y,
- event->motion.state,
- (xdme->is_hint) ? "true" : "false"));
-
-
- /* Update the timestamp of the latest user interaction, if the event has
- * a valid timestamp.
- */
- if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
- gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
- gdk_event_get_time (event));
- return TRUE;
- }
-
- if (xevent->type == device_xi->proximity_in_type ||
- xevent->type == device_xi->proximity_out_type)
- {
- XProximityNotifyEvent *xpne = (XProximityNotifyEvent *) xevent;
-
- if (xevent->type == device_xi->proximity_in_type)
- {
- event->proximity.type = GDK_PROXIMITY_IN;
- device_xi->in_proximity = TRUE;
- device_manager->ignore_core_events = TRUE;
- }
- else
- {
- event->proximity.type = GDK_PROXIMITY_OUT;
- device_xi->in_proximity = FALSE;
- device_manager->ignore_core_events = FALSE;
- }
-
- event->proximity.device = device;
- event->proximity.window = g_object_ref (window);
- event->proximity.time = xpne->time;
-
- /* Update the timestamp of the latest user interaction, if the event has
- * a valid timestamp.
- */
- if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
- gdk_x11_window_set_user_time (gdk_window_get_toplevel (window),
- gdk_event_get_time (event));
- return TRUE;
- }
-
- if (xevent->type == device_xi->state_notify_type)
- {
- XDeviceStateNotifyEvent *xdse = (XDeviceStateNotifyEvent *) xevent;
- XInputClass *input_class = (XInputClass *) xdse->data;
- int i;
-
- for (i = 0; i < xdse->num_classes; i++)
- {
- if (input_class->class == ValuatorClass)
- _gdk_x11_device_xi_update_axes (device, gdk_device_get_n_axes (device), 0,
- ((XValuatorState *)input_class)->valuators);
-
- input_class = (XInputClass *)(((char *)input_class)+input_class->length);
- }
-
- GDK_NOTE (EVENTS,
- g_print ("device state notify:\t\twindow: %ld device: %ld\n",
- xdse->window,
- xdse->deviceid));
-
- return FALSE;
- }
-
- return FALSE;
-}
-
-static GList *
-gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *manager,
- GdkDeviceType type)
-{
- GdkX11DeviceManagerXI *device_manager;
-
- device_manager = GDK_X11_DEVICE_MANAGER_XI (manager);
-
- if (type == GDK_DEVICE_TYPE_MASTER)
- return GDK_DEVICE_MANAGER_CLASS (gdk_x11_device_manager_xi_parent_class)->list_devices (manager, type);
- else if (type == GDK_DEVICE_TYPE_FLOATING)
- {
- return g_list_copy (device_manager->devices);
- }
- else
- return NULL;
-}
-
-#else /* XINPUT_XFREE */
-
-static void
-gdk_x11_device_manager_xi_class_init (GdkX11DeviceManagerXIClass *klass)
-{
-}
-
-static void
-gdk_x11_device_manager_xi_init (GdkX11DeviceManagerXI *device_manager)
-{
-}
-
-static void
-gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface)
-{
-}
-
-#endif /* XINPUT_XFREE */
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 1f7c845eef..84794644c9 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -29,16 +29,12 @@
#include "gdkkeysyms.h"
#include "gdkinternals.h"
-#ifdef XINPUT_2
-
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
#include <string.h>
-#endif /* XINPUT_2 */
-
struct _GdkX11DeviceManagerXI2
{
GdkX11DeviceManagerCore parent_object;
@@ -64,8 +60,6 @@ G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK
gdk_x11_device_manager_xi2_event_translator_init))
-#ifdef XINPUT_2
-
#define HAS_FOCUS(toplevel) ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
@@ -1646,25 +1640,6 @@ gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
return get_event_window (translator, ev);
}
-#else /* XINPUT_2 */
-
-static void
-gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
-{
-}
-
-static void
-gdk_x11_device_manager_xi2_init (GdkX11DeviceManagerXI2 *device_manager)
-{
-}
-
-static void
-gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface)
-{
-}
-
-#endif /* XINPUT_2 */
-
GdkDevice *
_gdk_x11_device_manager_xi2_lookup (GdkX11DeviceManagerXI2 *device_manager_xi2,
gint device_id)
diff --git a/gdk/x11/gdkdeviceprivate-xi.h b/gdk/x11/gdkdeviceprivate-xi.h
deleted file mode 100644
index 70626bfacf..0000000000
--- a/gdk/x11/gdkdeviceprivate-xi.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GDK_DEVICE_PRIVATE_XI_H__
-#define __GDK_DEVICE_PRIVATE_XI_H__
-
-#include "gdkx11device-xi.h"
-#include "gdkdeviceprivate.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XInput.h>
-
-G_BEGIN_DECLS
-
-struct _GdkX11DeviceXI
-{
- GdkDevice parent_instance;
-
- XDevice *xdevice;
- gint *axis_data;
-
- guint32 device_id;
-
- gint button_press_type;
- gint button_release_type;
- gint key_press_type;
- gint key_release_type;
- gint motion_notify_type;
- gint proximity_in_type;
- gint proximity_out_type;
- gint state_notify_type;
-
- gint min_keycode; /* minimum key code for device */
- guint in_proximity : 1;
-};
-
-struct _GdkX11DeviceXIClass
-{
- GdkDeviceClass parent_class;
-};
-
-G_END_DECLS
-
-#endif /* __GDK_DEVICE_PRIVATE_XI_H__ */
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 5eea9a48c3..14ab2fd391 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -39,9 +39,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#ifdef XINPUT_XFREE
-#include <X11/extensions/XInput.h>
-#endif
#ifdef XINPUT_2
#include <X11/extensions/XInput2.h>
#endif
@@ -229,21 +226,6 @@ void _gdk_x11_device_check_extension_events (GdkDevice *device);
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
-#ifdef XINPUT_XFREE
-void _gdk_x11_device_xi_update_window_info (GdkWindow *window);
-
-void _gdk_x11_device_xi_update_axes (GdkDevice *device,
- gint axes_count,
- gint first_axis,
- gint *axis_data);
-void _gdk_x11_device_xi_translate_axes (GdkDevice *device,
- GdkWindow *window,
- gint *axis_data,
- gdouble *axes,
- gdouble *x,
- gdouble *y);
-#endif
-
#ifdef XINPUT_2
guchar * _gdk_x11_device_xi2_translate_event_mask (GdkX11DeviceManagerXI2 *device_manager_xi2,
GdkEventMask event_mask,
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index 28bb36260d..b28580dc24 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -36,11 +36,9 @@
#include <gdk/x11/gdkx11cursor.h>
#include <gdk/x11/gdkx11device.h>
#include <gdk/x11/gdkx11device-core.h>
-#include <gdk/x11/gdkx11device-xi.h>
#include <gdk/x11/gdkx11device-xi2.h>
#include <gdk/x11/gdkx11devicemanager.h>
#include <gdk/x11/gdkx11devicemanager-core.h>
-#include <gdk/x11/gdkx11devicemanager-xi.h>
#include <gdk/x11/gdkx11devicemanager-xi2.h>
#include <gdk/x11/gdkx11display.h>
#include <gdk/x11/gdkx11displaymanager.h>
diff --git a/gdk/x11/gdkx11device-xi.h b/gdk/x11/gdkx11device-xi.h
deleted file mode 100644
index 6d66ac3556..0000000000
--- a/gdk/x11/gdkx11device-xi.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GDK_X11_DEVICE_XI_H__
-#define __GDK_X11_DEVICE_XI_H__
-
-#include <gdk/gdk.h>
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_X11_DEVICE_XI (gdk_x11_device_xi_get_type ())
-#define GDK_X11_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXI))
-#define GDK_X11_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXIClass))
-#define GDK_IS_X11_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_XI))
-#define GDK_IS_X11_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_XI))
-#define GDK_X11_DEVICE_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXIClass))
-
-typedef struct _GdkX11DeviceXI GdkX11DeviceXI;
-typedef struct _GdkX11DeviceXIClass GdkX11DeviceXIClass;
-
-
-GType gdk_x11_device_xi_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GDK_X11_DEVICE_XI_H__ */