diff --git a/gdk/Makefile.am b/gdk/Makefile.am index e96d813cf1..8841f8031d 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -190,11 +190,11 @@ x11_introspection_files = \ x11/gdkapplaunchcontext-x11.c \ x11/gdkasync.c \ x11/gdkcursor-x11.c \ - x11/gdkdevice-core.c \ - x11/gdkdevicemanager-core.c \ + x11/gdkdevice-core-x11.c \ + x11/gdkdevicemanager-core-x11.c \ x11/gdkdevicemanager-x11.c \ - x11/gdkdevicemanager-xi2.c \ x11/gdkdevicemanager-xi.c \ + x11/gdkdevicemanager-xi2.c \ x11/gdkdevice-xi2.c \ x11/gdkdevice-xi.c \ x11/gdkdisplay-x11.c \ diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am index 8b09b320dc..3a4ae66600 100644 --- a/gdk/x11/Makefile.am +++ b/gdk/x11/Makefile.am @@ -54,18 +54,22 @@ libgdk_x11_la_SOURCES = \ xsettings-common.h \ xsettings-common.c +libgdkx11include_HEADERS = + if XINPUT_XFREE libgdk_x11_la_SOURCES += \ gdkdevicemanager-xi.c \ - gdkdevicemanager-xi.h \ - gdkdevice-xi.c \ - gdkdevice-xi.h + gdkdevice-xi.c +libgdkx11include_HEADERS += \ + gdkx11devicemanager-xi.h \ + gdkx11device-xi.h if XINPUT_2 libgdk_x11_la_SOURCES += \ gdkdevicemanager-xi2.c \ - gdkdevicemanager-xi2.h \ - gdkdevice-xi2.c \ - gdkdevice-xi2.h + gdkdevice-xi2.c +libgdkx11include_HEADERS += \ + gdkx11devicemanager-xi2.h \ + gdkx11device-xi2.h endif endif @@ -73,7 +77,7 @@ endif libgdkinclude_HEADERS = \ gdkx.h -libgdkx11include_HEADERS = \ +libgdkx11include_HEADERS += \ gdkx11cursor.h \ gdkx11device-core.h \ gdkx11devicemanager-core.h \ diff --git a/gdk/x11/gdkdevice-xi.c b/gdk/x11/gdkdevice-xi.c index 3ad3cb6025..17a90ec0b2 100644 --- a/gdk/x11/gdkdevice-xi.c +++ b/gdk/x11/gdkdevice-xi.c @@ -19,7 +19,7 @@ #include "config.h" -#include "gdkdevice-xi.h" +#include "gdkx11device-xi.h" #include "gdkwindow.h" #include "gdkintl.h" @@ -37,67 +37,67 @@ typedef struct gdouble root_y; } GdkWindowInputInfo; -static void gdk_device_xi_constructed (GObject *object); -static void gdk_device_xi_dispose (GObject *object); +static void gdk_x11_device_xi_constructed (GObject *object); +static void gdk_x11_device_xi_dispose (GObject *object); -static void gdk_device_xi_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gdk_device_xi_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +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_device_xi_get_history (GdkDevice *device, - GdkWindow *window, - guint32 start, - guint32 stop, - GdkTimeCoord ***events, - gint *n_events); +static gboolean gdk_x11_device_xi_get_history (GdkDevice *device, + GdkWindow *window, + guint32 start, + guint32 stop, + GdkTimeCoord ***events, + gint *n_events); -static void gdk_device_xi_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask); -static void gdk_device_xi_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor); -static void gdk_device_xi_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y); -static gboolean gdk_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_device_xi_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_); -static void gdk_device_xi_ungrab (GdkDevice *device, - guint32 time_); +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_device_xi_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel); +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_device_xi_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask mask); +static void gdk_x11_device_xi_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask mask); -G_DEFINE_TYPE (GdkDeviceXI, gdk_device_xi, GDK_TYPE_DEVICE) +G_DEFINE_TYPE (GdkX11DeviceXI, gdk_x11_device_xi, GDK_TYPE_DEVICE) enum { PROP_0, @@ -105,31 +105,31 @@ enum { }; static void -gdk_device_xi_class_init (GdkDeviceXIClass *klass) +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_device_xi_constructed; - object_class->set_property = gdk_device_xi_set_property; - object_class->get_property = gdk_device_xi_get_property; - object_class->dispose = gdk_device_xi_dispose; + 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_device_xi_get_history; - device_class->get_state = gdk_device_xi_get_state; - device_class->set_window_cursor = gdk_device_xi_set_window_cursor; - device_class->warp = gdk_device_xi_warp; - device_class->query_state = gdk_device_xi_query_state; - device_class->grab = gdk_device_xi_grab; - device_class->ungrab = gdk_device_xi_ungrab; - device_class->window_at_position = gdk_device_xi_window_at_position; - device_class->select_window_events = gdk_device_xi_select_window_events; + 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", + PROP_DEVICE_ID, + g_param_spec_int ("device-id", P_("Device ID"), P_("Device ID"), 0, G_MAXINT, 0, @@ -137,17 +137,17 @@ gdk_device_xi_class_init (GdkDeviceXIClass *klass) } static void -gdk_device_xi_init (GdkDeviceXI *device) +gdk_x11_device_xi_init (GdkX11DeviceXI *device) { } static void -gdk_device_xi_constructed (GObject *object) +gdk_x11_device_xi_constructed (GObject *object) { - GdkDeviceXI *device; + GdkX11DeviceXI *device; GdkDisplay *display; - device = GDK_DEVICE_XI (object); + device = GDK_X11_DEVICE_XI (object); display = gdk_device_get_display (GDK_DEVICE (object)); gdk_x11_display_error_trap_push (display); @@ -158,17 +158,17 @@ gdk_device_xi_constructed (GObject *object) g_warning ("Device %s can't be opened", gdk_device_get_name (GDK_DEVICE (device))); - if (G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed) - G_OBJECT_CLASS (gdk_device_xi_parent_class)->constructed (object); + 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_device_xi_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gdk_x11_device_xi_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GdkDeviceXI *device = GDK_DEVICE_XI (object); + GdkX11DeviceXI *device = GDK_X11_DEVICE_XI (object); switch (prop_id) { @@ -182,12 +182,12 @@ gdk_device_xi_set_property (GObject *object, } static void -gdk_device_xi_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gdk_x11_device_xi_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GdkDeviceXI *device = GDK_DEVICE_XI (object); + GdkX11DeviceXI *device = GDK_X11_DEVICE_XI (object); switch (prop_id) { @@ -201,12 +201,12 @@ gdk_device_xi_get_property (GObject *object, } static void -gdk_device_xi_dispose (GObject *object) +gdk_x11_device_xi_dispose (GObject *object) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; GdkDisplay *display; - device_xi = GDK_DEVICE_XI (object); + device_xi = GDK_X11_DEVICE_XI (object); display = gdk_device_get_display (GDK_DEVICE (device_xi)); if (device_xi->xdevice) @@ -221,35 +221,35 @@ gdk_device_xi_dispose (GObject *object) device_xi->axis_data = NULL; } - G_OBJECT_CLASS (gdk_device_xi_parent_class)->dispose (object); + G_OBJECT_CLASS (gdk_x11_device_xi_parent_class)->dispose (object); } static gboolean -gdk_device_xi_get_history (GdkDevice *device, - GdkWindow *window, - guint32 start, - guint32 stop, - GdkTimeCoord ***events, - gint *n_events) +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; - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; gint n_events_return; gint mode_return; gint axis_count_return; gint i; - device_xi = GDK_DEVICE_XI (device); + 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, + device_xi->xdevice, + start, stop, + &n_events_return, &mode_return, - &axis_count_return); + &axis_count_return); if (!device_coords) return FALSE; @@ -260,10 +260,10 @@ gdk_device_xi_get_history (GdkDevice *device, for (i = 0; i < *n_events; i++) { coords[i]->time = device_coords[i].time; - gdk_device_xi_translate_axes (device, window, - device_coords[i].data, - coords[i]->axes, - NULL, NULL); + _gdk_x11_device_xi_translate_axes (device, window, + device_coords[i].data, + coords[i]->axes, + NULL, NULL); } XFreeDeviceMotionEvents (device_coords); @@ -274,12 +274,12 @@ gdk_device_xi_get_history (GdkDevice *device, } static void -gdk_device_xi_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask) +gdk_x11_device_xi_get_state (GdkDevice *device, + GdkWindow *window, + gdouble *axes, + GdkModifierType *mask) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; XDeviceState *state; XInputClass *input_class; gint i; @@ -287,7 +287,7 @@ gdk_device_xi_get_state (GdkDevice *device, if (mask) gdk_window_get_pointer (window, NULL, NULL, mask); - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); state = XQueryDeviceState (GDK_WINDOW_XDISPLAY (window), device_xi->xdevice); input_class = state->data; @@ -298,9 +298,9 @@ gdk_device_xi_get_state (GdkDevice *device, { case ValuatorClass: if (axes) - gdk_device_xi_translate_axes (device, window, - ((XValuatorState *) input_class)->valuators, - axes, NULL, NULL); + _gdk_x11_device_xi_translate_axes (device, window, + ((XValuatorState *) input_class)->valuators, + axes, NULL, NULL); break; case ButtonClass: @@ -322,17 +322,17 @@ gdk_device_xi_get_state (GdkDevice *device, } static void -gdk_device_xi_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor) +gdk_x11_device_xi_set_window_cursor (GdkDevice *device, + GdkWindow *window, + GdkCursor *cursor) { } static void -gdk_device_xi_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y) +gdk_x11_device_xi_warp (GdkDevice *device, + GdkScreen *screen, + gint x, + gint y) { } @@ -342,11 +342,11 @@ find_events (GdkDevice *device, XEventClass *classes, int *num_classes) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; XEventClass class; gint i; - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); i = 0; if (mask & GDK_BUTTON_PRESS_MASK) @@ -374,10 +374,10 @@ find_events (GdkDevice *device, /* Make sure device->motionnotify_type is set */ DeviceMotionNotify (device_xi->xdevice, device_xi->motion_notify_type, class); if (class != 0) - classes[i++] = class; + classes[i++] = class; DeviceStateNotify (device_xi->xdevice, device_xi->state_notify_type, class); if (class != 0) - classes[i++] = class; + classes[i++] = class; } if (mask & GDK_KEY_PRESS_MASK) @@ -412,34 +412,34 @@ find_events (GdkDevice *device, } static gboolean -gdk_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) +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_device_xi_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_) +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; - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; GdkDisplay *display; - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); display = gdk_device_get_display (device); find_events (device, event_mask, event_classes, &num_classes); @@ -462,15 +462,15 @@ gdk_device_xi_grab (GdkDevice *device, } static void -gdk_device_xi_ungrab (GdkDevice *device, - guint32 time_) +gdk_x11_device_xi_ungrab (GdkDevice *device, + guint32 time_) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; GdkDisplay *display; Display *xdisplay; unsigned long serial; - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); display = gdk_device_get_display (device); xdisplay = GDK_DISPLAY_XDISPLAY (display); @@ -482,33 +482,33 @@ gdk_device_xi_ungrab (GdkDevice *device, } static GdkWindow* -gdk_device_xi_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel) +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_device_xi_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask event_mask) +gdk_x11_device_xi_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask event_mask) { XEventClass event_classes[MAX_DEVICE_CLASSES]; - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; gint num_classes; event_mask |= (GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK); - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); find_events (device, event_mask, event_classes, &num_classes); XSelectExtensionEvent (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XID (window), - event_classes, num_classes); + GDK_WINDOW_XID (window), + event_classes, num_classes); if (event_mask) { @@ -527,7 +527,7 @@ gdk_device_xi_select_window_events (GdkDevice *device, } void -gdk_device_xi_update_window_info (GdkWindow *window) +_gdk_x11_device_xi_update_window_info (GdkWindow *window) { GdkWindowInputInfo *info; gint root_x, root_y; @@ -544,9 +544,9 @@ gdk_device_xi_update_window_info (GdkWindow *window) } static gboolean -gdk_device_xi_get_window_info (GdkWindow *window, - gdouble *root_x, - gdouble *root_y) +gdk_x11_device_xi_get_window_info (GdkWindow *window, + gdouble *root_x, + gdouble *root_y) { GdkWindowInputInfo *info; @@ -563,15 +563,15 @@ gdk_device_xi_get_window_info (GdkWindow *window, } void -gdk_device_xi_update_axes (GdkDevice *device, - gint axes_count, - gint first_axis, - gint *axis_data) +_gdk_x11_device_xi_update_axes (GdkDevice *device, + gint axes_count, + gint first_axis, + gint *axis_data) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; int i; - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); g_return_if_fail (first_axis >= 0 && first_axis + axes_count <= gdk_device_get_n_axes (device)); @@ -583,25 +583,25 @@ gdk_device_xi_update_axes (GdkDevice *device, } void -gdk_device_xi_translate_axes (GdkDevice *device, - GdkWindow *window, - gint *axis_data, - gdouble *axes, - gdouble *x, - gdouble *y) +_gdk_x11_device_xi_translate_axes (GdkDevice *device, + GdkWindow *window, + gint *axis_data, + gdouble *axes, + gdouble *x, + gdouble *y) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; GdkWindow *impl_window; gdouble root_x, root_y; gdouble temp_x, temp_y; gint n_axes; gint i; - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); impl_window = _gdk_window_get_impl_window (window); temp_x = temp_y = 0; - if (!gdk_device_xi_get_window_info (impl_window, &root_x, &root_y)) + if (!gdk_x11_device_xi_get_window_info (impl_window, &root_x, &root_y)) return; n_axes = gdk_device_get_n_axes (device); diff --git a/gdk/x11/gdkdevice-xi.h b/gdk/x11/gdkdevice-xi.h deleted file mode 100644 index e0eb08dbfd..0000000000 --- a/gdk/x11/gdkdevice-xi.h +++ /dev/null @@ -1,89 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 2009 Carlos Garnacho - * - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GDK_DEVICE_XI_H__ -#define __GDK_DEVICE_XI_H__ - -#include "gdkdeviceprivate.h" - -#include - -G_BEGIN_DECLS - -#define GDK_TYPE_DEVICE_XI (gdk_device_xi_get_type ()) -#define GDK_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_XI, GdkDeviceXI)) -#define GDK_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_XI, GdkDeviceXIClass)) -#define GDK_IS_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_XI)) -#define GDK_IS_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_XI)) -#define GDK_DEVICE_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_XI, GdkDeviceXIClass)) - -typedef struct _GdkDeviceXI GdkDeviceXI; -typedef struct _GdkDeviceXIClass GdkDeviceXIClass; - -struct _GdkDeviceXI -{ - GdkDevice parent_instance; - - guint32 device_id; - XDevice *xdevice; - - 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; - - /* minimum key code for device */ - gint min_keycode; - - gint *axis_data; - - guint in_proximity : 1; -}; - -struct _GdkDeviceXIClass -{ - GdkDeviceClass parent_class; -}; - -G_GNUC_INTERNAL -GType gdk_device_xi_get_type (void) G_GNUC_CONST; - -G_GNUC_INTERNAL -void gdk_device_xi_update_window_info (GdkWindow *window); - -G_GNUC_INTERNAL -void gdk_device_xi_update_axes (GdkDevice *device, - gint axes_count, - gint first_axis, - gint *axis_data); -G_GNUC_INTERNAL -void gdk_device_xi_translate_axes (GdkDevice *device, - GdkWindow *window, - gint *axis_data, - gdouble *axes, - gdouble *x, - gdouble *y); - -G_END_DECLS - -#endif /* __GDK_DEVICE_XI_H__ */ diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index 68686ec369..6c9b528317 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -19,7 +19,7 @@ #include "config.h" -#include "gdkdevice-xi2.h" +#include "gdkx11device-xi2.h" #include "gdkintl.h" #include "gdkasync.h" @@ -27,62 +27,57 @@ #include -struct _GdkDeviceXI2Private -{ - int device_id; -}; +static void gdk_x11_device_xi2_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gdk_x11_device_xi2_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); -static void gdk_device_xi2_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gdk_device_xi2_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); +static void gdk_x11_device_xi2_get_state (GdkDevice *device, + GdkWindow *window, + gdouble *axes, + GdkModifierType *mask); +static void gdk_x11_device_xi2_set_window_cursor (GdkDevice *device, + GdkWindow *window, + GdkCursor *cursor); +static void gdk_x11_device_xi2_warp (GdkDevice *device, + GdkScreen *screen, + gint x, + gint y); +static gboolean gdk_x11_device_xi2_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 void gdk_device_xi2_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask); -static void gdk_device_xi2_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor); -static void gdk_device_xi2_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y); -static gboolean gdk_device_xi2_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_xi2_grab (GdkDevice *device, + GdkWindow *window, + gboolean owner_events, + GdkEventMask event_mask, + GdkWindow *confine_to, + GdkCursor *cursor, + guint32 time_); +static void gdk_x11_device_xi2_ungrab (GdkDevice *device, + guint32 time_); -static GdkGrabStatus gdk_device_xi2_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_); -static void gdk_device_xi2_ungrab (GdkDevice *device, - guint32 time_); - -static GdkWindow * gdk_device_xi2_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel); -static void gdk_device_xi2_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask event_mask); +static GdkWindow * gdk_x11_device_xi2_window_at_position (GdkDevice *device, + gint *win_x, + gint *win_y, + GdkModifierType *mask, + gboolean get_toplevel); +static void gdk_x11_device_xi2_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask event_mask); -G_DEFINE_TYPE (GdkDeviceXI2, gdk_device_xi2, GDK_TYPE_DEVICE) +G_DEFINE_TYPE (GdkX11DeviceXI2, gdk_x11_device_xi2, GDK_TYPE_DEVICE) enum { PROP_0, @@ -90,58 +85,49 @@ enum { }; static void -gdk_device_xi2_class_init (GdkDeviceXI2Class *klass) +gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass); - object_class->get_property = gdk_device_xi2_get_property; - object_class->set_property = gdk_device_xi2_set_property; + object_class->get_property = gdk_x11_device_xi2_get_property; + object_class->set_property = gdk_x11_device_xi2_set_property; - device_class->get_state = gdk_device_xi2_get_state; - device_class->set_window_cursor = gdk_device_xi2_set_window_cursor; - device_class->warp = gdk_device_xi2_warp; - device_class->query_state = gdk_device_xi2_query_state; - device_class->grab = gdk_device_xi2_grab; - device_class->ungrab = gdk_device_xi2_ungrab; - device_class->window_at_position = gdk_device_xi2_window_at_position; - device_class->select_window_events = gdk_device_xi2_select_window_events; + device_class->get_state = gdk_x11_device_xi2_get_state; + device_class->set_window_cursor = gdk_x11_device_xi2_set_window_cursor; + device_class->warp = gdk_x11_device_xi2_warp; + device_class->query_state = gdk_x11_device_xi2_query_state; + device_class->grab = gdk_x11_device_xi2_grab; + device_class->ungrab = gdk_x11_device_xi2_ungrab; + device_class->window_at_position = gdk_x11_device_xi2_window_at_position; + device_class->select_window_events = gdk_x11_device_xi2_select_window_events; g_object_class_install_property (object_class, - PROP_DEVICE_ID, - g_param_spec_int ("device-id", + PROP_DEVICE_ID, + g_param_spec_int ("device-id", P_("Device ID"), P_("Device identifier"), 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - - g_type_class_add_private (object_class, sizeof (GdkDeviceXI2Private)); } static void -gdk_device_xi2_init (GdkDeviceXI2 *device) +gdk_x11_device_xi2_init (GdkX11DeviceXI2 *device) { - GdkDeviceXI2Private *priv; - - device->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device, - GDK_TYPE_DEVICE_XI2, - GdkDeviceXI2Private); } static void -gdk_device_xi2_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gdk_x11_device_xi2_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GdkDeviceXI2Private *priv; - - priv = GDK_DEVICE_XI2 (object)->priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (object); switch (prop_id) { case PROP_DEVICE_ID: - g_value_set_int (value, priv->device_id); + g_value_set_int (value, device_xi2->device_id); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -150,19 +136,17 @@ gdk_device_xi2_get_property (GObject *object, } static void -gdk_device_xi2_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gdk_x11_device_xi2_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GdkDeviceXI2Private *priv; - - priv = GDK_DEVICE_XI2 (object)->priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (object); switch (prop_id) { case PROP_DEVICE_ID: - priv->device_id = g_value_get_int (value); + device_xi2->device_id = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -171,23 +155,22 @@ gdk_device_xi2_set_property (GObject *object, } static void -gdk_device_xi2_get_state (GdkDevice *device, - GdkWindow *window, - gdouble *axes, - GdkModifierType *mask) +gdk_x11_device_xi2_get_state (GdkDevice *device, + GdkWindow *window, + gdouble *axes, + GdkModifierType *mask) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; XIDeviceInfo *info; gint i, j, ndevices; - priv = GDK_DEVICE_XI2 (device)->priv; display = gdk_device_get_display (device); if (axes) { info = XIQueryDevice(GDK_DISPLAY_XDISPLAY (display), - priv->device_id, &ndevices); + device_xi2->device_id, &ndevices); for (i = 0, j = 0; i < info->num_classes; i++) { @@ -232,71 +215,66 @@ gdk_device_xi2_get_state (GdkDevice *device, } if (mask) - gdk_device_xi2_query_state (device, window, - NULL, NULL, - NULL, NULL, - NULL, NULL, - mask); + gdk_x11_device_xi2_query_state (device, window, + NULL, NULL, + NULL, NULL, + NULL, NULL, + mask); } static void -gdk_device_xi2_set_window_cursor (GdkDevice *device, - GdkWindow *window, - GdkCursor *cursor) +gdk_x11_device_xi2_set_window_cursor (GdkDevice *device, + GdkWindow *window, + GdkCursor *cursor) { - GdkDeviceXI2Private *priv; - - priv = GDK_DEVICE_XI2 (device)->priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); /* Non-master devices don't have a cursor */ if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER) return; if (cursor) - { - XIDefineCursor (GDK_WINDOW_XDISPLAY (window), - priv->device_id, - GDK_WINDOW_XID (window), - gdk_x11_cursor_get_xcursor (cursor)); - } + XIDefineCursor (GDK_WINDOW_XDISPLAY (window), + device_xi2->device_id, + GDK_WINDOW_XID (window), + gdk_x11_cursor_get_xcursor (cursor)); else XIUndefineCursor (GDK_WINDOW_XDISPLAY (window), - priv->device_id, + device_xi2->device_id, GDK_WINDOW_XID (window)); } static void -gdk_device_xi2_warp (GdkDevice *device, - GdkScreen *screen, - gint x, - gint y) +gdk_x11_device_xi2_warp (GdkDevice *device, + GdkScreen *screen, + gint x, + gint y) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); Window dest; - priv = GDK_DEVICE_XI2 (device)->priv; dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen)); XIWarpPointer (GDK_SCREEN_XDISPLAY (screen), - priv->device_id, + device_xi2->device_id, None, dest, 0, 0, 0, 0, x, y); } static gboolean -gdk_device_xi2_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) +gdk_x11_device_xi2_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) { + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; GdkScreen *default_screen; - GdkDeviceXI2Private *priv; Window xroot_window, xchild_window; gdouble xroot_x, xroot_y, xwin_x, xwin_y; XIButtonState button_state; @@ -306,21 +284,18 @@ gdk_device_xi2_query_state (GdkDevice *device, if (!window || GDK_WINDOW_DESTROYED (window)) return FALSE; - priv = GDK_DEVICE_XI2 (device)->priv; display = gdk_window_get_display (window); default_screen = gdk_display_get_default_screen (display); if (G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client)) { if (!XIQueryPointer (GDK_WINDOW_XDISPLAY (window), - priv->device_id, + device_xi2->device_id, GDK_WINDOW_XID (window), &xroot_window, &xchild_window, - &xroot_x, - &xroot_y, - &xwin_x, - &xwin_y, + &xroot_x, &xroot_y, + &xwin_x, &xwin_y, &button_state, &mod_state, &group_state)) @@ -339,14 +314,12 @@ gdk_device_xi2_query_state (GdkDevice *device, w = XCreateWindow (xdisplay, xwindow, 0, 0, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, 0, &attributes); - XIQueryPointer (xdisplay, priv->device_id, + XIQueryPointer (xdisplay, device_xi2->device_id, w, &xroot_window, &xchild_window, - &xroot_x, - &xroot_y, - &xwin_x, - &xwin_y, + &xroot_x, &xroot_y, + &xwin_x, &xwin_y, &button_state, &mod_state, &group_state); @@ -372,28 +345,27 @@ gdk_device_xi2_query_state (GdkDevice *device, *win_y = (gint) xwin_y; if (mask) - *mask = gdk_device_xi2_translate_state (&mod_state, &button_state); + *mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state); return TRUE; } static GdkGrabStatus -gdk_device_xi2_grab (GdkDevice *device, - GdkWindow *window, - gboolean owner_events, - GdkEventMask event_mask, - GdkWindow *confine_to, - GdkCursor *cursor, - guint32 time_) +gdk_x11_device_xi2_grab (GdkDevice *device, + GdkWindow *window, + gboolean owner_events, + GdkEventMask event_mask, + GdkWindow *confine_to, + GdkCursor *cursor, + guint32 time_) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; XIEventMask mask; Window xwindow; Cursor xcursor; gint status; - priv = GDK_DEVICE_XI2 (device)->priv; display = gdk_device_get_display (device); /* FIXME: confine_to is actually unused */ @@ -408,8 +380,8 @@ gdk_device_xi2_grab (GdkDevice *device, xcursor = gdk_x11_cursor_get_xcursor (cursor); } - mask.deviceid = priv->device_id; - mask.mask = gdk_device_xi2_translate_event_mask (event_mask, &mask.mask_len); + mask.deviceid = device_xi2->device_id; + mask.mask = _gdk_x11_device_xi2_translate_event_mask (event_mask, &mask.mask_len); #ifdef G_ENABLE_DEBUG if (_gdk_debug_flags & GDK_DEBUG_NOGRABS) @@ -417,7 +389,7 @@ gdk_device_xi2_grab (GdkDevice *device, else #endif status = XIGrabDevice (GDK_DISPLAY_XDISPLAY (display), - priv->device_id, + device_xi2->device_id, xwindow, time_, xcursor, @@ -433,30 +405,29 @@ gdk_device_xi2_grab (GdkDevice *device, } static void -gdk_device_xi2_ungrab (GdkDevice *device, - guint32 time_) +gdk_x11_device_xi2_ungrab (GdkDevice *device, + guint32 time_) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; gulong serial; - priv = GDK_DEVICE_XI2 (device)->priv; display = gdk_device_get_display (device); serial = NextRequest (GDK_DISPLAY_XDISPLAY (display)); - XIUngrabDevice (GDK_DISPLAY_XDISPLAY (display), priv->device_id, time_); + XIUngrabDevice (GDK_DISPLAY_XDISPLAY (display), device_xi2->device_id, time_); _gdk_x11_display_update_grab_info_ungrab (display, device, time_, serial); } static GdkWindow * -gdk_device_xi2_window_at_position (GdkDevice *device, - gint *win_x, - gint *win_y, - GdkModifierType *mask, - gboolean get_toplevel) +gdk_x11_device_xi2_window_at_position (GdkDevice *device, + gint *win_x, + gint *win_y, + GdkModifierType *mask, + gboolean get_toplevel) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); GdkDisplay *display; GdkScreen *screen; Display *xdisplay; @@ -467,7 +438,6 @@ gdk_device_xi2_window_at_position (GdkDevice *device, XIModifierState mod_state; XIGroupState group_state; - priv = GDK_DEVICE_XI2 (device)->priv; display = gdk_device_get_display (device); screen = gdk_display_get_default_screen (display); @@ -484,7 +454,7 @@ gdk_device_xi2_window_at_position (GdkDevice *device, if (G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client)) { XIQueryPointer (xdisplay, - priv->device_id, + device_xi2->device_id, xwindow, &root, &child, &xroot_x, &xroot_y, @@ -518,7 +488,7 @@ gdk_device_xi2_window_at_position (GdkDevice *device, xwindow = GDK_WINDOW_XID (window); gdk_x11_display_error_trap_push (display); XIQueryPointer (xdisplay, - priv->device_id, + device_xi2->device_id, xwindow, &root, &child, &xroot_x, &xroot_y, @@ -545,7 +515,7 @@ gdk_device_xi2_window_at_position (GdkDevice *device, 0, &attributes); XMapWindow (xdisplay, w); XIQueryPointer (xdisplay, - priv->device_id, + device_xi2->device_id, xwindow, &root, &child, &xroot_x, &xroot_y, @@ -575,7 +545,7 @@ gdk_device_xi2_window_at_position (GdkDevice *device, last = xwindow; gdk_x11_display_error_trap_push (display); XIQueryPointer (xdisplay, - priv->device_id, + device_xi2->device_id, xwindow, &root, &xwindow, &xroot_x, &xroot_y, @@ -606,23 +576,21 @@ gdk_device_xi2_window_at_position (GdkDevice *device, *win_y = (window) ? (gint) xwin_y : -1; if (mask) - *mask = gdk_device_xi2_translate_state (&mod_state, &button_state); + *mask = _gdk_x11_device_xi2_translate_state (&mod_state, &button_state); return window; } static void -gdk_device_xi2_select_window_events (GdkDevice *device, - GdkWindow *window, - GdkEventMask event_mask) +gdk_x11_device_xi2_select_window_events (GdkDevice *device, + GdkWindow *window, + GdkEventMask event_mask) { - GdkDeviceXI2Private *priv; + GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device); XIEventMask evmask; - priv = GDK_DEVICE_XI2 (device)->priv; - - evmask.deviceid = priv->device_id; - evmask.mask = gdk_device_xi2_translate_event_mask (event_mask, &evmask.mask_len); + evmask.deviceid = device_xi2->device_id; + evmask.mask = _gdk_x11_device_xi2_translate_event_mask (event_mask, &evmask.mask_len); XISelectEvents (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window), @@ -632,8 +600,8 @@ gdk_device_xi2_select_window_events (GdkDevice *device, } guchar * -gdk_device_xi2_translate_event_mask (GdkEventMask event_mask, - int *len) +_gdk_x11_device_xi2_translate_event_mask (GdkEventMask event_mask, + gint *len) { guchar *mask; @@ -688,8 +656,8 @@ gdk_device_xi2_translate_event_mask (GdkEventMask event_mask, } guint -gdk_device_xi2_translate_state (XIModifierState *mods_state, - XIButtonState *buttons_state) +_gdk_x11_device_xi2_translate_state (XIModifierState *mods_state, + XIButtonState *buttons_state) { guint state = 0; diff --git a/gdk/x11/gdkdevice-xi2.h b/gdk/x11/gdkdevice-xi2.h deleted file mode 100644 index 63aaf252ef..0000000000 --- a/gdk/x11/gdkdevice-xi2.h +++ /dev/null @@ -1,66 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 2009 Carlos Garnacho - * - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GDK_DEVICE_XI2_H__ -#define __GDK_DEVICE_XI2_H__ - -#include "gdkdeviceprivate.h" - -#include - -G_BEGIN_DECLS - -#define GDK_TYPE_DEVICE_XI2 (gdk_device_xi2_get_type ()) -#define GDK_DEVICE_XI2(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_XI2, GdkDeviceXI2)) -#define GDK_DEVICE_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_XI2, GdkDeviceXI2Class)) -#define GDK_IS_DEVICE_XI2(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_XI2)) -#define GDK_IS_DEVICE_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_XI2)) -#define GDK_DEVICE_XI2_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_XI2, GdkDeviceXI2Class)) - -typedef struct _GdkDeviceXI2 GdkDeviceXI2; -typedef struct _GdkDeviceXI2Private GdkDeviceXI2Private; -typedef struct _GdkDeviceXI2Class GdkDeviceXI2Class; - -struct _GdkDeviceXI2 -{ - GdkDevice parent_instance; - - /*< private >*/ - GdkDeviceXI2Private *priv; -}; - -struct _GdkDeviceXI2Class -{ - GdkDeviceClass parent_class; -}; - -G_GNUC_INTERNAL -GType gdk_device_xi2_get_type (void) G_GNUC_CONST; - -G_GNUC_INTERNAL -guchar * gdk_device_xi2_translate_event_mask (GdkEventMask event_mask, - int *len); -G_GNUC_INTERNAL -guint gdk_device_xi2_translate_state (XIModifierState *mods_state, - XIButtonState *buttons_state); - - -G_END_DECLS - -#endif /* __GDK_DEVICE_XI2_H__ */ diff --git a/gdk/x11/gdkdevicemanager-x11.c b/gdk/x11/gdkdevicemanager-x11.c index 026ae769b7..6680e0a455 100644 --- a/gdk/x11/gdkdevicemanager-x11.c +++ b/gdk/x11/gdkdevicemanager-x11.c @@ -21,9 +21,9 @@ #include "gdkx11devicemanager-core.h" #ifdef XINPUT_XFREE -#include "gdkdevicemanager-xi.h" +#include "gdkx11devicemanager-xi.h" #ifdef XINPUT_2 -#include "gdkdevicemanager-xi2.h" +#include "gdkx11devicemanager-xi2.h" #endif #endif #include "gdkinternals.h" @@ -52,11 +52,11 @@ _gdk_x11_device_manager_new (GdkDisplay *display) if (!_gdk_disable_multidevice && XIQueryVersion (xdisplay, &major, &minor) != BadRequest) { - GdkDeviceManagerXI2 *device_manager_xi2; + GdkX11DeviceManagerXI2 *device_manager_xi2; GDK_NOTE (INPUT, g_print ("Creating XI2 device manager\n")); - device_manager_xi2 = g_object_new (GDK_TYPE_DEVICE_MANAGER_XI2, + device_manager_xi2 = g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI2, "display", display, NULL); device_manager_xi2->opcode = opcode; @@ -68,7 +68,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display) { GDK_NOTE (INPUT, g_print ("Creating XI device manager\n")); - return g_object_new (GDK_TYPE_DEVICE_MANAGER_XI, + return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_XI, "display", display, "event-base", firstevent, NULL); diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c index 138d133f36..1dd9f84ca2 100644 --- a/gdk/x11/gdkdevicemanager-xi.c +++ b/gdk/x11/gdkdevicemanager-xi.c @@ -19,17 +19,17 @@ #include "config.h" -#include "gdkdevicemanager-xi.h" +#include "gdkx11devicemanager-xi.h" +#include "gdkx11device-xi.h" #include "gdkeventtranslator.h" -#include "gdkdevice-xi.h" #include "gdkintl.h" #include "gdkprivate-x11.h" #include -struct _GdkDeviceManagerXIPrivate +struct _GdkX11DeviceManagerXIPrivate { GHashTable *id_table; gint event_base; @@ -37,29 +37,29 @@ struct _GdkDeviceManagerXIPrivate gboolean ignore_core_events; }; -static void gdk_device_manager_xi_constructed (GObject *object); -static void gdk_device_manager_xi_dispose (GObject *object); -static void gdk_device_manager_xi_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gdk_device_manager_xi_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); +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 void gdk_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface); -static gboolean gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, - GdkDisplay *display, - GdkEvent *event, - XEvent *xevent); -static GList * gdk_device_manager_xi_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type); +static void gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface); +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); -G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerXI, gdk_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE, +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_device_manager_xi_event_translator_init)) + gdk_x11_device_manager_xi_event_translator_init)) enum { PROP_0, @@ -67,27 +67,27 @@ enum { }; static void -gdk_device_manager_xi_class_init (GdkDeviceManagerXIClass *klass) +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_device_manager_xi_constructed; - object_class->dispose = gdk_device_manager_xi_dispose; - object_class->set_property = gdk_device_manager_xi_set_property; - object_class->get_property = gdk_device_manager_xi_get_property; + 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_device_manager_xi_list_devices; + 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", + 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)); - g_type_class_add_private (object_class, sizeof (GdkDeviceManagerXIPrivate)); + g_type_class_add_private (object_class, sizeof (GdkX11DeviceManagerXIPrivate)); } static GdkFilterReturn @@ -107,19 +107,19 @@ window_input_info_filter (GdkXEvent *xevent, window = gdk_x11_window_lookup_for_display (display, xev->xany.window); if (window && xev->type == ConfigureNotify) - gdk_device_xi_update_window_info (window); + _gdk_x11_device_xi_update_window_info (window); return GDK_FILTER_CONTINUE; } static void -gdk_device_manager_xi_init (GdkDeviceManagerXI *device_manager) +gdk_x11_device_manager_xi_init (GdkX11DeviceManagerXI *device_manager) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; device_manager->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device_manager, - GDK_TYPE_DEVICE_MANAGER_XI, - GdkDeviceManagerXIPrivate); + GDK_TYPE_X11_DEVICE_MANAGER_XI, + GdkX11DeviceManagerXIPrivate); priv->id_table = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_object_unref); @@ -131,72 +131,73 @@ static void translate_class_info (GdkDevice *device, XDeviceInfo *info) { - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; XAnyClassPtr class; gint i, j; - device_xi = GDK_DEVICE_XI (device); + 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; + 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); + num_keys = xki->max_keycode - xki->min_keycode + 1; + _gdk_device_set_keys (device, num_keys); - device_xi->min_keycode = xki->min_keycode; + device_xi->min_keycode = xki->min_keycode; - break; - } - case ValuatorClass: - { - XValuatorInfo *xvi = (XValuatorInfo *)class; + break; + } + case ValuatorClass: + { + XValuatorInfo *xvi = (XValuatorInfo *)class; - for (j = 0; j < xvi->num_axes; j++) - { - GdkAxisUse use; + 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; - } + 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); - } + _gdk_device_add_axis (device, + GDK_NONE, + use, + xvi->axes[j].min_value, + xvi->axes[j].max_value, + xvi->axes[j].resolution); + } - break; - } + break; + } } class = (XAnyClassPtr) (((char *) class) + class->length); @@ -242,7 +243,7 @@ create_device (GdkDeviceManager *device_manager, g_free (tmp_name); } - device = g_object_new (GDK_TYPE_DEVICE_XI, + device = g_object_new (GDK_TYPE_X11_DEVICE_XI, "name", info->name, "type", GDK_DEVICE_TYPE_FLOATING, "input-source", input_source, @@ -258,16 +259,16 @@ create_device (GdkDeviceManager *device_manager, } static void -gdk_device_manager_xi_constructed (GObject *object) +gdk_x11_device_manager_xi_constructed (GObject *object) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; XDeviceInfo *devices; gint i, num_devices; GdkDisplay *display; - priv = GDK_DEVICE_MANAGER_XI (object)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (object)->priv; display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)); - devices = XListInputDevices(GDK_DISPLAY_XDISPLAY (display), &num_devices); + devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display), &num_devices); for(i = 0; i < num_devices; i++) { @@ -284,22 +285,22 @@ gdk_device_manager_xi_constructed (GObject *object) } } - XFreeDeviceList(devices); + XFreeDeviceList (devices); gdk_x11_register_standard_event_type (display, priv->event_base, 15 /* Number of events */); - if (G_OBJECT_CLASS (gdk_device_manager_xi_parent_class)->constructed) - G_OBJECT_CLASS (gdk_device_manager_xi_parent_class)->constructed (object); + 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_device_manager_xi_dispose (GObject *object) +gdk_x11_device_manager_xi_dispose (GObject *object) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; - priv = GDK_DEVICE_MANAGER_XI (object)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (object)->priv; g_list_foreach (priv->devices, (GFunc) g_object_unref, NULL); g_list_free (priv->devices); @@ -313,18 +314,18 @@ gdk_device_manager_xi_dispose (GObject *object) gdk_window_remove_filter (NULL, window_input_info_filter, object); - G_OBJECT_CLASS (gdk_device_manager_xi_parent_class)->dispose (object); + G_OBJECT_CLASS (gdk_x11_device_manager_xi_parent_class)->dispose (object); } static void -gdk_device_manager_xi_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gdk_x11_device_manager_xi_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; - priv = GDK_DEVICE_MANAGER_XI (object)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (object)->priv; switch (prop_id) { @@ -338,14 +339,14 @@ gdk_device_manager_xi_set_property (GObject *object, } static void -gdk_device_manager_xi_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gdk_x11_device_manager_xi_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; - priv = GDK_DEVICE_MANAGER_XI (object)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (object)->priv; switch (prop_id) { @@ -359,9 +360,9 @@ gdk_device_manager_xi_get_property (GObject *object, } static void -gdk_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface) +gdk_x11_device_manager_xi_event_translator_init (GdkEventTranslatorIface *iface) { - iface->translate_event = gdk_device_manager_xi_translate_event; + iface->translate_event = gdk_x11_device_manager_xi_translate_event; } /* combine the state of the core device and the device state @@ -377,13 +378,13 @@ translate_state (guint state, guint device_state) } static GdkDevice * -lookup_device (GdkDeviceManagerXI *device_manager, - XEvent *xevent) +lookup_device (GdkX11DeviceManagerXI *device_manager, + XEvent *xevent) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; guint32 device_id; - priv = GDK_DEVICE_MANAGER_XI (device_manager)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (device_manager)->priv; /* This is a sort of a hack, as there isn't any XDeviceAnyEvent - but it's potentially faster than scanning through the types of @@ -395,20 +396,20 @@ lookup_device (GdkDeviceManagerXI *device_manager, } static gboolean -gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, - GdkDisplay *display, - GdkEvent *event, - XEvent *xevent) +gdk_x11_device_manager_xi_translate_event (GdkEventTranslator *translator, + GdkDisplay *display, + GdkEvent *event, + XEvent *xevent) { - GdkDeviceManagerXIPrivate *priv; - GdkDeviceManagerXI *device_manager; + GdkX11DeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXI *device_manager; GdkEventTranslatorIface *parent_iface; - GdkDeviceXI *device_xi; + GdkX11DeviceXI *device_xi; GdkDevice *device; GdkWindow *window; parent_iface = g_type_interface_peek_parent (GDK_EVENT_TRANSLATOR_GET_IFACE (translator)); - device_manager = GDK_DEVICE_MANAGER_XI (translator); + device_manager = GDK_X11_DEVICE_MANAGER_XI (translator); priv = device_manager->priv; if (!priv->ignore_core_events && @@ -416,7 +417,7 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, return TRUE; device = lookup_device (device_manager, xevent); - device_xi = GDK_DEVICE_XI (device); + device_xi = GDK_X11_DEVICE_XI (device); if (!device) return FALSE; @@ -442,35 +443,35 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, event->button.y_root = (gdouble) xdbe->y_root; event->button.axes = g_new0 (gdouble, gdk_device_get_n_axes (device)); - gdk_device_xi_update_axes (device, xdbe->axes_count, - xdbe->first_axis, xdbe->axis_data); - gdk_device_xi_translate_axes (device, window, - device_xi->axis_data, - event->button.axes, - &event->button.x, - &event->button.y); + _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_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)); + 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)); + gdk_x11_window_set_user_time (gdk_window_get_toplevel (window), + gdk_event_get_time (event)); return TRUE; } @@ -480,33 +481,33 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, 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)); + 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; - } + 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")); + { + GDK_NOTE (EVENTS, + g_print ("\t\ttranslation - NONE\n")); - return FALSE; - } + return FALSE; + } event->key.type = (xdke->type == device_xi->key_press_type) ? - GDK_KEY_PRESS : GDK_KEY_RELEASE; + GDK_KEY_PRESS : GDK_KEY_RELEASE; event->key.window = g_object_ref (window); event->key.time = xdke->time; @@ -515,29 +516,29 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, /* 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; - } + { + 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); - } + { + 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)); + 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)); + gdk_x11_window_set_user_time (gdk_window_get_toplevel (window), + gdk_event_get_time (event)); return TRUE; } @@ -554,13 +555,13 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, event->motion.y_root = (gdouble) xdme->y_root; event->motion.axes = g_new0 (gdouble, gdk_device_get_n_axes (device)); - gdk_device_xi_update_axes (device, xdme->axes_count, - xdme->first_axis, xdme->axis_data); - gdk_device_xi_translate_axes (device, window, - device_xi->axis_data, - event->motion.axes, - &event->motion.x, - &event->motion.y); + _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); @@ -570,20 +571,20 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, 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")); + 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)); + gdk_x11_window_set_user_time (gdk_window_get_toplevel (window), + gdk_event_get_time (event)); return TRUE; } @@ -613,8 +614,8 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, * 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)); + gdk_x11_window_set_user_time (gdk_window_get_toplevel (window), + gdk_event_get_time (event)); return TRUE; } @@ -627,8 +628,8 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, for (i = 0; i < xdse->num_classes; i++) { if (input_class->class == ValuatorClass) - gdk_device_xi_update_axes (device, gdk_device_get_n_axes (device), 0, - ((XValuatorState *)input_class)->valuators); + _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); } @@ -645,15 +646,15 @@ gdk_device_manager_xi_translate_event (GdkEventTranslator *translator, } static GList * -gdk_device_manager_xi_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type) +gdk_x11_device_manager_xi_list_devices (GdkDeviceManager *device_manager, + GdkDeviceType type) { - GdkDeviceManagerXIPrivate *priv; + GdkX11DeviceManagerXIPrivate *priv; - priv = GDK_DEVICE_MANAGER_XI (device_manager)->priv; + priv = GDK_X11_DEVICE_MANAGER_XI (device_manager)->priv; if (type == GDK_DEVICE_TYPE_MASTER) - return GDK_DEVICE_MANAGER_CLASS (gdk_device_manager_xi_parent_class)->list_devices (device_manager, type); + return GDK_DEVICE_MANAGER_CLASS (gdk_x11_device_manager_xi_parent_class)->list_devices (device_manager, type); else if (type == GDK_DEVICE_TYPE_FLOATING) { return g_list_copy (priv->devices); diff --git a/gdk/x11/gdkdevicemanager-xi.h b/gdk/x11/gdkdevicemanager-xi.h deleted file mode 100644 index bffa2cbf02..0000000000 --- a/gdk/x11/gdkdevicemanager-xi.h +++ /dev/null @@ -1,57 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 2009 Carlos Garnacho - * - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GDK_DEVICE_MANAGER_XI_H__ -#define __GDK_DEVICE_MANAGER_XI_H__ - -#include "gdkx11devicemanager-core.h" - -G_BEGIN_DECLS - -#define GDK_TYPE_DEVICE_MANAGER_XI (gdk_device_manager_xi_get_type ()) -#define GDK_DEVICE_MANAGER_XI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER_XI, GdkDeviceManagerXI)) -#define GDK_DEVICE_MANAGER_XI_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER_XI, GdkDeviceManagerXIClass)) -#define GDK_IS_DEVICE_MANAGER_XI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER_XI)) -#define GDK_IS_DEVICE_MANAGER_XI_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER_XI)) -#define GDK_DEVICE_MANAGER_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_XI, GdkDeviceManagerXIClass)) - -typedef struct _GdkDeviceManagerXI GdkDeviceManagerXI; -typedef struct _GdkDeviceManagerXIPrivate GdkDeviceManagerXIPrivate; -typedef struct _GdkDeviceManagerXIClass GdkDeviceManagerXIClass; - -struct _GdkDeviceManagerXI -{ - GdkX11DeviceManagerCore parent_object; - GdkDevice *core_pointer; - GdkDevice *core_keyboard; - - /*< private >*/ - GdkDeviceManagerXIPrivate *priv; -}; - -struct _GdkDeviceManagerXIClass -{ - GdkX11DeviceManagerCoreClass parent_class; -}; - -GType gdk_device_manager_xi_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* __GDK_DEVICE_MANAGER_XI_H__ */ diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index a37c16c15e..90fcd9123b 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -19,13 +19,13 @@ #include "config.h" -#include "gdkdevicemanager-xi2.h" +#include "gdkx11devicemanager-xi2.h" +#include "gdkx11device-xi2.h" #include "gdkkeysyms.h" #include "gdkdeviceprivate.h" #include "gdkdisplayprivate.h" #include "gdkeventtranslator.h" -#include "gdkdevice-xi2.h" #include "gdkprivate-x11.h" #include @@ -33,45 +33,45 @@ #define HAS_FOCUS(toplevel) ((toplevel)->has_focus || (toplevel)->has_pointer_focus) -static void gdk_device_manager_xi2_constructed (GObject *object); -static void gdk_device_manager_xi2_dispose (GObject *object); +static void gdk_x11_device_manager_xi2_constructed (GObject *object); +static void gdk_x11_device_manager_xi2_dispose (GObject *object); -static GList * gdk_device_manager_xi2_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type); -static GdkDevice * gdk_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager); +static GList * gdk_x11_device_manager_xi2_list_devices (GdkDeviceManager *device_manager, + GdkDeviceType type); +static GdkDevice * gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager); -static void gdk_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface); +static void gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface); -static gboolean gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, - GdkDisplay *display, - GdkEvent *event, - XEvent *xevent); -static GdkEventMask gdk_device_manager_xi2_get_handled_events (GdkEventTranslator *translator); -static void gdk_device_manager_xi2_select_window_events (GdkEventTranslator *translator, - Window window, - GdkEventMask event_mask); +static gboolean gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, + GdkDisplay *display, + GdkEvent *event, + XEvent *xevent); +static GdkEventMask gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator); +static void gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator, + Window window, + GdkEventMask event_mask); -G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerXI2, gdk_device_manager_xi2, GDK_TYPE_DEVICE_MANAGER, +G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerXI2, gdk_x11_device_manager_xi2, GDK_TYPE_DEVICE_MANAGER, G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR, - gdk_device_manager_xi2_event_translator_init)) + gdk_x11_device_manager_xi2_event_translator_init)) static void -gdk_device_manager_xi2_class_init (GdkDeviceManagerXI2Class *klass) +gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass) { GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->constructed = gdk_device_manager_xi2_constructed; - object_class->dispose = gdk_device_manager_xi2_dispose; + object_class->constructed = gdk_x11_device_manager_xi2_constructed; + object_class->dispose = gdk_x11_device_manager_xi2_dispose; - device_manager_class->list_devices = gdk_device_manager_xi2_list_devices; - device_manager_class->get_client_pointer = gdk_device_manager_xi2_get_client_pointer; + device_manager_class->list_devices = gdk_x11_device_manager_xi2_list_devices; + device_manager_class->get_client_pointer = gdk_x11_device_manager_xi2_get_client_pointer; } static void -gdk_device_manager_xi2_init (GdkDeviceManagerXI2 *device_manager) +gdk_x11_device_manager_xi2_init (GdkX11DeviceManagerXI2 *device_manager) { device_manager->id_table = g_hash_table_new_full (g_direct_hash, g_direct_equal, @@ -80,9 +80,9 @@ gdk_device_manager_xi2_init (GdkDeviceManagerXI2 *device_manager) } static void -_gdk_device_manager_xi2_select_events (GdkDeviceManager *device_manager, - Window xwindow, - XIEventMask *event_mask) +_gdk_x11_device_manager_xi2_select_events (GdkDeviceManager *device_manager, + Window xwindow, + XIEventMask *event_mask) { GdkDisplay *display; Display *xdisplay; @@ -230,7 +230,7 @@ create_device (GdkDeviceManager *device_manager, break; } - device = g_object_new (GDK_TYPE_DEVICE_XI2, + device = g_object_new (GDK_TYPE_X11_DEVICE_XI2, "name", dev->name, "type", type, "input-source", input_source, @@ -247,9 +247,9 @@ create_device (GdkDeviceManager *device_manager, } static GdkDevice * -add_device (GdkDeviceManagerXI2 *device_manager, - XIDeviceInfo *dev, - gboolean emit_signal) +add_device (GdkX11DeviceManagerXI2 *device_manager, + XIDeviceInfo *dev, + gboolean emit_signal) { GdkDisplay *display; GdkDevice *device; @@ -291,8 +291,8 @@ add_device (GdkDeviceManagerXI2 *device_manager, } static void -remove_device (GdkDeviceManagerXI2 *device_manager, - int device_id) +remove_device (GdkX11DeviceManagerXI2 *device_manager, + gint device_id) { GdkDevice *device; @@ -318,7 +318,7 @@ relate_masters (gpointer key, gpointer value, gpointer user_data) { - GdkDeviceManagerXI2 *device_manager; + GdkX11DeviceManagerXI2 *device_manager; GdkDevice *device, *relative; device_manager = user_data; @@ -334,7 +334,7 @@ relate_slaves (gpointer key, gpointer value, gpointer user_data) { - GdkDeviceManagerXI2 *device_manager; + GdkX11DeviceManagerXI2 *device_manager; GdkDevice *slave, *master; device_manager = user_data; @@ -346,9 +346,9 @@ relate_slaves (gpointer key, } static void -gdk_device_manager_xi2_constructed (GObject *object) +gdk_x11_device_manager_xi2_constructed (GObject *object) { - GdkDeviceManagerXI2 *device_manager_xi2; + GdkX11DeviceManagerXI2 *device_manager; GdkDisplay *display; GdkScreen *screen; GHashTable *masters, *slaves; @@ -358,14 +358,14 @@ gdk_device_manager_xi2_constructed (GObject *object) XIEventMask event_mask; unsigned char mask[2] = { 0 }; - device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (object); + device_manager = GDK_X11_DEVICE_MANAGER_XI2 (object); display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)); xdisplay = GDK_DISPLAY_XDISPLAY (display); masters = g_hash_table_new (NULL, NULL); slaves = g_hash_table_new (NULL, NULL); - info = XIQueryDevice(xdisplay, XIAllDevices, &ndevices); + info = XIQueryDevice (xdisplay, XIAllDevices, &ndevices); /* Initialize devices list */ for (i = 0; i < ndevices; i++) @@ -373,7 +373,7 @@ gdk_device_manager_xi2_constructed (GObject *object) GdkDevice *device; dev = &info[i]; - device = add_device (device_manager_xi2, dev, FALSE); + device = add_device (device_manager, dev, FALSE); if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard) @@ -391,7 +391,7 @@ gdk_device_manager_xi2_constructed (GObject *object) } } - XIFreeDeviceInfo(info); + XIFreeDeviceInfo (info); /* Stablish relationships between devices */ g_hash_table_foreach (masters, relate_masters, object); @@ -409,43 +409,41 @@ gdk_device_manager_xi2_constructed (GObject *object) event_mask.mask_len = sizeof (mask); event_mask.mask = mask; - _gdk_device_manager_xi2_select_events (GDK_DEVICE_MANAGER (object), - GDK_WINDOW_XID (gdk_screen_get_root_window (screen)), - &event_mask); + _gdk_x11_device_manager_xi2_select_events (GDK_DEVICE_MANAGER (object), + GDK_WINDOW_XID (gdk_screen_get_root_window (screen)), + &event_mask); } static void -gdk_device_manager_xi2_dispose (GObject *object) +gdk_x11_device_manager_xi2_dispose (GObject *object) { - GdkDeviceManagerXI2 *device_manager_xi2; + GdkX11DeviceManagerXI2 *device_manager; - device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (object); + device_manager = GDK_X11_DEVICE_MANAGER_XI2 (object); - g_list_foreach (device_manager_xi2->master_devices, (GFunc) g_object_unref, NULL); - g_list_free (device_manager_xi2->master_devices); - device_manager_xi2->master_devices = NULL; + g_list_free_full (device_manager->master_devices, g_object_unref); + device_manager->master_devices = NULL; - g_list_foreach (device_manager_xi2->slave_devices, (GFunc) g_object_unref, NULL); - g_list_free (device_manager_xi2->slave_devices); - device_manager_xi2->slave_devices = NULL; + g_list_free_full (device_manager->slave_devices, g_object_unref); + device_manager->slave_devices = NULL; - if (device_manager_xi2->id_table) + if (device_manager->id_table) { - g_hash_table_destroy (device_manager_xi2->id_table); - device_manager_xi2->id_table = NULL; + g_hash_table_destroy (device_manager->id_table); + device_manager->id_table = NULL; } - G_OBJECT_CLASS (gdk_device_manager_xi2_parent_class)->dispose (object); + G_OBJECT_CLASS (gdk_x11_device_manager_xi2_parent_class)->dispose (object); } static GList * -gdk_device_manager_xi2_list_devices (GdkDeviceManager *device_manager, - GdkDeviceType type) +gdk_x11_device_manager_xi2_list_devices (GdkDeviceManager *device_manager, + GdkDeviceType type) { - GdkDeviceManagerXI2 *device_manager_xi2; + GdkX11DeviceManagerXI2 *device_manager_xi2; GList *list = NULL; - device_manager_xi2 = GDK_DEVICE_MANAGER_XI2 (device_manager); + device_manager_xi2 = GDK_X11_DEVICE_MANAGER_XI2 (device_manager); switch (type) { @@ -477,13 +475,13 @@ gdk_device_manager_xi2_list_devices (GdkDeviceManager *device_manager, } static GdkDevice * -gdk_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager) +gdk_x11_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager) { - GdkDeviceManagerXI2 *device_manager_xi2; + GdkX11DeviceManagerXI2 *device_manager_xi2; GdkDisplay *display; int device_id; - device_manager_xi2 = (GdkDeviceManagerXI2 *) device_manager; + device_manager_xi2 = (GdkX11DeviceManagerXI2 *) device_manager; display = gdk_device_manager_get_display (device_manager); XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display), @@ -494,16 +492,16 @@ gdk_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager) } static void -gdk_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface) +gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface) { - iface->translate_event = gdk_device_manager_xi2_translate_event; - iface->get_handled_events = gdk_device_manager_xi2_get_handled_events; - iface->select_window_events = gdk_device_manager_xi2_select_window_events; + iface->translate_event = gdk_x11_device_manager_xi2_translate_event; + iface->get_handled_events = gdk_x11_device_manager_xi2_get_handled_events; + iface->select_window_events = gdk_x11_device_manager_xi2_select_window_events; } static void -handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager, - XIHierarchyEvent *ev) +handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager, + XIHierarchyEvent *ev) { GdkDisplay *display; Display *xdisplay; @@ -519,9 +517,9 @@ handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager, { if (ev->info[i].flags & XIDeviceEnabled) { - info = XIQueryDevice(xdisplay, ev->info[i].deviceid, &ndevices); + info = XIQueryDevice (xdisplay, ev->info[i].deviceid, &ndevices); device = add_device (device_manager, &info[0], TRUE); - XIFreeDeviceInfo(info); + XIFreeDeviceInfo (info); } else if (ev->info[i].flags & XIDeviceDisabled) remove_device (device_manager, ev->info[i].deviceid); @@ -547,7 +545,7 @@ handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager, /* Add new master if it's an attachment event */ if (ev->info[i].flags & XISlaveAttached) { - info = XIQueryDevice(xdisplay, ev->info[i].deviceid, &ndevices); + info = XIQueryDevice (xdisplay, ev->info[i].deviceid, &ndevices); master = g_hash_table_lookup (device_manager->id_table, GINT_TO_POINTER (info->attachment)); @@ -564,8 +562,8 @@ handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager, } static void -handle_device_changed (GdkDeviceManagerXI2 *device_manager, - XIDeviceChangedEvent *ev) +handle_device_changed (GdkX11DeviceManagerXI2 *device_manager, + XIDeviceChangedEvent *ev) { GdkDisplay *display; GdkDevice *device; @@ -581,7 +579,7 @@ handle_device_changed (GdkDeviceManagerXI2 *device_manager, } static GdkCrossingMode -translate_crossing_mode (int mode) +translate_crossing_mode (gint mode) { switch (mode) { @@ -597,7 +595,7 @@ translate_crossing_mode (int mode) } static GdkNotifyType -translate_notify_type (int detail) +translate_notify_type (gint detail) { switch (detail) { @@ -618,8 +616,8 @@ translate_notify_type (int detail) static gboolean set_screen_from_root (GdkDisplay *display, - GdkEvent *event, - Window xrootwin) + GdkEvent *event, + Window xrootwin) { GdkScreen *screen; @@ -675,19 +673,19 @@ translate_keyboard_string (GdkEventKey *event) /* Apply the control key - Taken from Xlib */ if (event->state & GDK_CONTROL_MASK) - { - if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; - else if (c == '2') - { - event->string = g_memdup ("\0\0", 2); - event->length = 1; - buf[0] = '\0'; + { + if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; + else if (c == '2') + { + event->string = g_memdup ("\0\0", 2); + event->length = 1; + buf[0] = '\0'; return; - } - else if (c >= '3' && c <= '7') c -= ('3' - '\033'); - else if (c == '8') c = '\177'; - else if (c == '/') c = '_' & 0x1F; - } + } + else if (c >= '3' && c <= '7') c -= ('3' - '\033'); + else if (c == '8') c = '\177'; + else if (c == '/') c = '_' & 0x1F; + } len = g_unichar_to_utf8 (c, buf); buf[len] = '\0'; @@ -696,7 +694,7 @@ translate_keyboard_string (GdkEventKey *event) NULL, &bytes_written, NULL); if (event->string) - event->length = bytes_written; + event->length = bytes_written; } else if (event->keyval == GDK_KEY_Escape) { @@ -704,7 +702,7 @@ translate_keyboard_string (GdkEventKey *event) event->string = g_strdup ("\033"); } else if (event->keyval == GDK_KEY_Return || - event->keyval == GDK_KEY_KP_Enter) + event->keyval == GDK_KEY_KP_Enter) { event->length = 1; event->string = g_strdup ("\r"); @@ -866,7 +864,7 @@ is_parent_of (GdkWindow *parent, while (w != NULL) { if (w == parent) - return TRUE; + return TRUE; w = gdk_window_get_parent (w); } @@ -902,7 +900,7 @@ get_event_window (GdkEventTranslator *translator, GdkDevice *device; gulong serial; - device = g_hash_table_lookup (GDK_DEVICE_MANAGER_XI2 (translator)->id_table, + device = g_hash_table_lookup (GDK_X11_DEVICE_MANAGER_XI2 (translator)->id_table, GUINT_TO_POINTER (((XIDeviceEvent *) ev)->deviceid)); serial = _gdk_display_get_next_serial (display); @@ -934,12 +932,12 @@ get_event_window (GdkEventTranslator *translator, } static gboolean -gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, - GdkDisplay *display, - GdkEvent *event, - XEvent *xevent) +gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator, + GdkDisplay *display, + GdkEvent *event, + XEvent *xevent) { - GdkDeviceManagerXI2 *device_manager; + GdkX11DeviceManagerXI2 *device_manager; XGenericEventCookie *cookie; gboolean return_val = TRUE; GdkWindow *window; @@ -947,7 +945,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, Display *dpy; dpy = GDK_DISPLAY_XDISPLAY (display); - device_manager = (GdkDeviceManagerXI2 *) translator; + device_manager = (GdkX11DeviceManagerXI2 *) translator; cookie = &xevent->xcookie; if (!XGetEventData (dpy, cookie)) @@ -1005,7 +1003,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->key.window = window; event->key.time = xev->time; - event->key.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons); + event->key.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons); event->key.group = _gdk_x11_get_group_for_state (display, event->key.state); event->key.hardware_keycode = xev->detail; @@ -1080,7 +1078,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, GUINT_TO_POINTER (xev->sourceid)); gdk_event_set_source_device (event, source_device); - event->scroll.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons); + event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons); break; default: event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE; @@ -1114,7 +1112,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, gdk_device_get_axis (device, event->button.axes, GDK_AXIS_Y, &event->button.y); } - event->button.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons); + event->button.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons); event->button.button = xev->detail; } @@ -1150,7 +1148,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, GUINT_TO_POINTER (xev->sourceid)); gdk_event_set_source_device (event, source_device); - event->motion.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons); + event->motion.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons); /* There doesn't seem to be motion hints in XI */ event->motion.is_hint = FALSE; @@ -1199,7 +1197,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, event->crossing.mode = translate_crossing_mode (xev->mode); event->crossing.detail = translate_notify_type (xev->detail); - event->crossing.state = gdk_device_xi2_translate_state (&xev->mods, &xev->buttons); + event->crossing.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons); } break; case XI_FocusIn: @@ -1233,8 +1231,8 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, g_object_ref (event->any.window); if (((event->any.type == GDK_ENTER_NOTIFY) || - (event->any.type == GDK_LEAVE_NOTIFY)) && - (event->crossing.subwindow != NULL)) + (event->any.type == GDK_LEAVE_NOTIFY)) && + (event->crossing.subwindow != NULL)) g_object_ref (event->crossing.subwindow); } else @@ -1250,7 +1248,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator, } static GdkEventMask -gdk_device_manager_xi2_get_handled_events (GdkEventTranslator *translator) +gdk_x11_device_manager_xi2_get_handled_events (GdkEventTranslator *translator) { return (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | @@ -1269,9 +1267,9 @@ gdk_device_manager_xi2_get_handled_events (GdkEventTranslator *translator) } static void -gdk_device_manager_xi2_select_window_events (GdkEventTranslator *translator, - Window window, - GdkEventMask evmask) +gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator, + Window window, + GdkEventMask evmask) { GdkDeviceManager *device_manager; XIEventMask event_mask; @@ -1279,8 +1277,8 @@ gdk_device_manager_xi2_select_window_events (GdkEventTranslator *translator, device_manager = GDK_DEVICE_MANAGER (translator); event_mask.deviceid = XIAllMasterDevices; - event_mask.mask = gdk_device_xi2_translate_event_mask (evmask, &event_mask.mask_len); + event_mask.mask = _gdk_x11_device_xi2_translate_event_mask (evmask, &event_mask.mask_len); - _gdk_device_manager_xi2_select_events (device_manager, window, &event_mask); + _gdk_x11_device_manager_xi2_select_events (device_manager, window, &event_mask); g_free (event_mask.mask); } diff --git a/gdk/x11/gdkdevicemanager-xi2.h b/gdk/x11/gdkdevicemanager-xi2.h deleted file mode 100644 index 7f8d926f9d..0000000000 --- a/gdk/x11/gdkdevicemanager-xi2.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 2009 Carlos Garnacho - * - * 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, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GDK_DEVICE_MANAGER_XI2_H__ -#define __GDK_DEVICE_MANAGER_XI2_H__ - -#include "gdkdevicemanagerprivate.h" - -#include - -G_BEGIN_DECLS - -#define GDK_TYPE_DEVICE_MANAGER_XI2 (gdk_device_manager_xi2_get_type ()) -#define GDK_DEVICE_MANAGER_XI2(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER_XI2, GdkDeviceManagerXI2)) -#define GDK_DEVICE_MANAGER_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER_XI2, GdkDeviceManagerXI2Class)) -#define GDK_IS_DEVICE_MANAGER_XI2(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER_XI2)) -#define GDK_IS_DEVICE_MANAGER_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER_XI2)) -#define GDK_DEVICE_MANAGER_XI2_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_XI2, GdkDeviceManagerXI2Class)) - -typedef struct _GdkDeviceManagerXI2 GdkDeviceManagerXI2; -typedef struct _GdkDeviceManagerXI2Class GdkDeviceManagerXI2Class; - -struct _GdkDeviceManagerXI2 -{ - GdkDeviceManager parent_object; - - GHashTable *id_table; - - GList *master_devices; - GList *slave_devices; - - GdkDevice *client_pointer; - - int opcode; -}; - -struct _GdkDeviceManagerXI2Class -{ - GdkDeviceManagerClass parent_class; -}; - -GType gdk_device_manager_xi2_get_type (void) G_GNUC_CONST; - - -G_END_DECLS - -#endif /* __GDK_DEVICE_MANAGER_XI2_H__ */ diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 405d05cb56..fa134c72c0 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -213,6 +213,24 @@ void _gdk_x11_device_check_extension_events (GdkDevice *device); GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display); +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); + +guchar * _gdk_x11_device_xi2_translate_event_mask (GdkEventMask event_mask, + gint *len); +guint _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state, + XIButtonState *buttons_state); + void _gdk_x11_display_manager_add_display (GdkDisplayManager *manager, GdkDisplay *display); void _gdk_x11_display_manager_remove_display (GdkDisplayManager *manager, diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index f3eef28c3a..f1ce15545c 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -57,7 +57,11 @@ #include #include +#include +#include #include +#include +#include #include #include #include diff --git a/gdk/x11/gdkx11device-xi.h b/gdk/x11/gdkx11device-xi.h new file mode 100644 index 0000000000..a22fcabd57 --- /dev/null +++ b/gdk/x11/gdkx11device-xi.h @@ -0,0 +1,72 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2009 Carlos Garnacho + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GDK_X11_DEVICE_XI_H__ +#define __GDK_X11_DEVICE_XI_H__ + +#include "gdkdeviceprivate.h" + +#include + +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; + +struct _GdkX11DeviceXI +{ + GdkDevice parent_instance; + + /*< private >*/ + guint32 device_id; + XDevice *xdevice; + + 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; + + /* minimum key code for device */ + gint min_keycode; + gint *axis_data; + + guint in_proximity : 1; +}; + +struct _GdkX11DeviceXIClass +{ + GdkDeviceClass parent_class; +}; + +GType gdk_x11_device_xi_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __GDK_X11_DEVICE_XI_H__ */ diff --git a/gdk/x11/gdkx11device-xi2.h b/gdk/x11/gdkx11device-xi2.h new file mode 100644 index 0000000000..6ef339f65a --- /dev/null +++ b/gdk/x11/gdkx11device-xi2.h @@ -0,0 +1,56 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2009 Carlos Garnacho + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GDK_X11_DEVICE_XI2_H__ +#define __GDK_X11_DEVICE_XI2_H__ + +#include "gdkdeviceprivate.h" + +#include + +G_BEGIN_DECLS + +#define GDK_TYPE_X11_DEVICE_XI2 (gdk_x11_device_xi2_get_type ()) +#define GDK_X11_DEVICE_XI2(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_XI2, GdkX11DeviceXI2)) +#define GDK_X11_DEVICE_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_XI2, GdkX11DeviceXI2Class)) +#define GDK_IS_X11_DEVICE_XI2(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_XI2)) +#define GDK_IS_X11_DEVICE_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_XI2)) +#define GDK_X11_DEVICE_XI2_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_XI2, GdkX11DeviceXI2Class)) + +typedef struct _GdkX11DeviceXI2 GdkX11DeviceXI2; +typedef struct _GdkX11DeviceXI2Class GdkX11DeviceXI2Class; + +struct _GdkX11DeviceXI2 +{ + GdkDevice parent_instance; + + /*< private >*/ + gint device_id; +}; + +struct _GdkX11DeviceXI2Class +{ + GdkDeviceClass parent_class; +}; + +GType gdk_x11_device_xi2_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __GDK_X11_DEVICE_XI2_H__ */ diff --git a/gdk/x11/gdkx11devicemanager-xi.h b/gdk/x11/gdkx11devicemanager-xi.h new file mode 100644 index 0000000000..9c90fd2a97 --- /dev/null +++ b/gdk/x11/gdkx11devicemanager-xi.h @@ -0,0 +1,55 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2009 Carlos Garnacho + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GDK_X11_DEVICE_MANAGER_XI_H__ +#define __GDK_X11_DEVICE_MANAGER_XI_H__ + +#include "gdkx11devicemanager-core.h" + +G_BEGIN_DECLS + +#define GDK_TYPE_X11_DEVICE_MANAGER_XI (gdk_x11_device_manager_xi_get_type ()) +#define GDK_X11_DEVICE_MANAGER_XI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI, GdkX11DeviceManagerXI)) +#define GDK_X11_DEVICE_MANAGER_XI_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_MANAGER_XI, GdkX11DeviceManagerXIClass)) +#define GDK_IS_X11_DEVICE_MANAGER_XI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI)) +#define GDK_IS_X11_DEVICE_MANAGER_XI_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_MANAGER_XI)) +#define GDK_X11_DEVICE_MANAGER_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI, GdkX11DeviceManagerXIClass)) + +typedef struct _GdkX11DeviceManagerXI GdkX11DeviceManagerXI; +typedef struct _GdkX11DeviceManagerXIPrivate GdkX11DeviceManagerXIPrivate; +typedef struct _GdkX11DeviceManagerXIClass GdkX11DeviceManagerXIClass; + +struct _GdkX11DeviceManagerXI +{ + GdkX11DeviceManagerCore parent_object; + + /*< private >*/ + GdkX11DeviceManagerXIPrivate *priv; +}; + +struct _GdkX11DeviceManagerXIClass +{ + GdkX11DeviceManagerCoreClass parent_class; +}; + +GType gdk_x11_device_manager_xi_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __GDK_X11_DEVICE_MANAGER_XI_H__ */ diff --git a/gdk/x11/gdkx11devicemanager-xi2.h b/gdk/x11/gdkx11devicemanager-xi2.h new file mode 100644 index 0000000000..5771c93b57 --- /dev/null +++ b/gdk/x11/gdkx11devicemanager-xi2.h @@ -0,0 +1,65 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2009 Carlos Garnacho + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GDK_X11_DEVICE_MANAGER_XI2_H__ +#define __GDK_X11_DEVICE_MANAGER_XI2_H__ + +#include "gdkdevicemanagerprivate.h" + +#include + +G_BEGIN_DECLS + +#define GDK_TYPE_X11_DEVICE_MANAGER_XI2 (gdk_x11_device_manager_xi2_get_type ()) +#define GDK_X11_DEVICE_MANAGER_XI2(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI2, GdkX11DeviceManagerXI2)) +#define GDK_X11_DEVICE_MANAGER_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_MANAGER_XI2, GdkX11DeviceManagerXI2Class)) +#define GDK_IS_X11_DEVICE_MANAGER_XI2(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI2)) +#define GDK_IS_X11_DEVICE_MANAGER_XI2_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_MANAGER_XI2)) +#define GDK_X11_DEVICE_MANAGER_XI2_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_MANAGER_XI2, GdkX11DeviceManagerXI2Class)) + +typedef struct _GdkX11DeviceManagerXI2 GdkX11DeviceManagerXI2; +typedef struct _GdkX11DeviceManagerXI2Class GdkX11DeviceManagerXI2Class; + +struct _GdkX11DeviceManagerXI2 +{ + GdkDeviceManager parent_object; + + /*< private >*/ + + GHashTable *id_table; + + GList *master_devices; + GList *slave_devices; + + GdkDevice *client_pointer; + + gint opcode; +}; + +struct _GdkX11DeviceManagerXI2Class +{ + GdkDeviceManagerClass parent_class; +}; + +GType gdk_x11_device_manager_xi2_get_type (void) G_GNUC_CONST; + + +G_END_DECLS + +#endif /* __GDK_X11_DEVICE_MANAGER_XI2_H__ */