Rename x11-specific GdkDevice[Manager] implementations

Make them all fit in the gdk_x11_ prefix, and make the
get_type functions and standard macros available in headers.
This commit is contained in:
Matthias Clasen 2010-12-21 01:32:01 -05:00
parent 5cddc7ccbb
commit b4802e3042
17 changed files with 933 additions and 967 deletions

View File

@ -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 \

View File

@ -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 \

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "gdkdevice-xi.h"
#include "gdkx11device-xi.h"
#include "gdkwindow.h"
#include "gdkintl.h"
@ -37,37 +37,37 @@ 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,
static void gdk_x11_device_xi_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gdk_device_xi_get_property (GObject *object,
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,
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,
static void gdk_x11_device_xi_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask);
static void gdk_device_xi_set_window_cursor (GdkDevice *device,
static void gdk_x11_device_xi_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor);
static void gdk_device_xi_warp (GdkDevice *device,
static void gdk_x11_device_xi_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_device_xi_query_state (GdkDevice *device,
static gboolean gdk_x11_device_xi_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
@ -76,28 +76,28 @@ static gboolean gdk_device_xi_query_state (GdkDevice *device,
gint *win_x,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_device_xi_grab (GdkDevice *device,
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_device_xi_ungrab (GdkDevice *device,
static void gdk_x11_device_xi_ungrab (GdkDevice *device,
guint32 time_);
static GdkWindow* gdk_device_xi_window_at_position (GdkDevice *device,
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,
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,27 +105,27 @@ 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,
@ -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,
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,
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,11 +221,11 @@ 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,
gdk_x11_device_xi_get_history (GdkDevice *device,
GdkWindow *window,
guint32 start,
guint32 stop,
@ -235,13 +235,13 @@ gdk_device_xi_get_history (GdkDevice *device,
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),
@ -260,7 +260,7 @@ 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,
_gdk_x11_device_xi_translate_axes (device, window,
device_coords[i].data,
coords[i]->axes,
NULL, NULL);
@ -274,12 +274,12 @@ gdk_device_xi_get_history (GdkDevice *device,
}
static void
gdk_device_xi_get_state (GdkDevice *device,
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,7 +298,7 @@ gdk_device_xi_get_state (GdkDevice *device,
{
case ValuatorClass:
if (axes)
gdk_device_xi_translate_axes (device, window,
_gdk_x11_device_xi_translate_axes (device, window,
((XValuatorState *) input_class)->valuators,
axes, NULL, NULL);
break;
@ -322,14 +322,14 @@ gdk_device_xi_get_state (GdkDevice *device,
}
static void
gdk_device_xi_set_window_cursor (GdkDevice *device,
gdk_x11_device_xi_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
}
static void
gdk_device_xi_warp (GdkDevice *device,
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)
@ -412,7 +412,7 @@ find_events (GdkDevice *device,
}
static gboolean
gdk_device_xi_query_state (GdkDevice *device,
gdk_x11_device_xi_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
@ -426,7 +426,7 @@ gdk_device_xi_query_state (GdkDevice *device,
}
static GdkGrabStatus
gdk_device_xi_grab (GdkDevice *device,
gdk_x11_device_xi_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
@ -436,10 +436,10 @@ gdk_device_xi_grab (GdkDevice *device,
{
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,
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,7 +482,7 @@ gdk_device_xi_ungrab (GdkDevice *device,
}
static GdkWindow*
gdk_device_xi_window_at_position (GdkDevice *device,
gdk_x11_device_xi_window_at_position (GdkDevice *device,
gint *win_x,
gint *win_y,
GdkModifierType *mask,
@ -492,18 +492,18 @@ gdk_device_xi_window_at_position (GdkDevice *device,
}
static void
gdk_device_xi_select_window_events (GdkDevice *device,
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),
@ -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,7 +544,7 @@ gdk_device_xi_update_window_info (GdkWindow *window)
}
static gboolean
gdk_device_xi_get_window_info (GdkWindow *window,
gdk_x11_device_xi_get_window_info (GdkWindow *window,
gdouble *root_x,
gdouble *root_y)
{
@ -563,15 +563,15 @@ gdk_device_xi_get_window_info (GdkWindow *window,
}
void
gdk_device_xi_update_axes (GdkDevice *device,
_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,
_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);

View File

@ -1,89 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput.h>
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__ */

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "gdkdevice-xi2.h"
#include "gdkx11device-xi2.h"
#include "gdkintl.h"
#include "gdkasync.h"
@ -27,32 +27,27 @@
#include <X11/extensions/XInput2.h>
struct _GdkDeviceXI2Private
{
int device_id;
};
static void gdk_device_xi2_get_property (GObject *object,
static void gdk_x11_device_xi2_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gdk_device_xi2_set_property (GObject *object,
static void gdk_x11_device_xi2_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gdk_device_xi2_get_state (GdkDevice *device,
static void gdk_x11_device_xi2_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask);
static void gdk_device_xi2_set_window_cursor (GdkDevice *device,
static void gdk_x11_device_xi2_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor);
static void gdk_device_xi2_warp (GdkDevice *device,
static void gdk_x11_device_xi2_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
static gboolean gdk_device_xi2_query_state (GdkDevice *device,
static gboolean gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
@ -62,27 +57,27 @@ static gboolean gdk_device_xi2_query_state (GdkDevice *device,
gint *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_device_xi2_grab (GdkDevice *device,
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_device_xi2_ungrab (GdkDevice *device,
static void gdk_x11_device_xi2_ungrab (GdkDevice *device,
guint32 time_);
static GdkWindow * gdk_device_xi2_window_at_position (GdkDevice *device,
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_device_xi2_select_window_events (GdkDevice *device,
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,22 +85,22 @@ 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,
@ -114,34 +109,25 @@ gdk_device_xi2_class_init (GdkDeviceXI2Class *klass)
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,
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,
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,
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,7 +215,7 @@ gdk_device_xi2_get_state (GdkDevice *device,
}
if (mask)
gdk_device_xi2_query_state (device, window,
gdk_x11_device_xi2_query_state (device, window,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@ -240,51 +223,46 @@ gdk_device_xi2_get_state (GdkDevice *device,
}
static void
gdk_device_xi2_set_window_cursor (GdkDevice *device,
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,
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,
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,
gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **root_window,
GdkWindow **child_window,
@ -294,9 +272,9 @@ gdk_device_xi2_query_state (GdkDevice *device,
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,13 +345,13 @@ 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,
gdk_x11_device_xi2_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
@ -386,14 +359,13 @@ gdk_device_xi2_grab (GdkDevice *device,
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,
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,
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,
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,7 +656,7 @@ gdk_device_xi2_translate_event_mask (GdkEventMask event_mask,
}
guint
gdk_device_xi2_translate_state (XIModifierState *mods_state,
_gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
XIButtonState *buttons_state)
{
guint state = 0;

View File

@ -1,66 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput2.h>
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__ */

View File

@ -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);

View File

@ -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 <X11/extensions/XInput.h>
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,
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_device_manager_xi_get_property (GObject *object,
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,
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_device_manager_xi_list_devices (GdkDeviceManager *device_manager,
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,17 +67,17 @@ 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,
@ -87,7 +87,7 @@ gdk_device_manager_xi_class_init (GdkDeviceManagerXIClass *klass)
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,16 +131,17 @@ 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) {
switch (class->class)
{
case ButtonClass:
break;
case KeyClass:
@ -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,14 +259,14 @@ 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);
@ -290,16 +291,16 @@ gdk_device_manager_xi_constructed (GObject *object)
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,
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,
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,
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,
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,9 +443,9 @@ 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,
_gdk_x11_device_xi_update_axes (device, xdbe->axes_count,
xdbe->first_axis, xdbe->axis_data);
gdk_device_xi_translate_axes (device, window,
_gdk_x11_device_xi_translate_axes (device, window,
device_xi->axis_data,
event->button.axes,
&event->button.x,
@ -554,9 +555,9 @@ 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,
_gdk_x11_device_xi_update_axes (device, xdme->axes_count,
xdme->first_axis, xdme->axis_data);
gdk_device_xi_translate_axes (device, window,
_gdk_x11_device_xi_translate_axes (device, window,
device_xi->axis_data,
event->motion.axes,
&event->motion.x,
@ -627,7 +628,7 @@ 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,
_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,
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);

View File

@ -1,57 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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__ */

View File

@ -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 <string.h>
@ -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,
static GList * gdk_x11_device_manager_xi2_list_devices (GdkDeviceManager *device_manager,
GdkDeviceType type);
static GdkDevice * gdk_device_manager_xi2_get_client_pointer (GdkDeviceManager *device_manager);
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,
static gboolean gdk_x11_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,
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,7 +80,7 @@ gdk_device_manager_xi2_init (GdkDeviceManagerXI2 *device_manager)
}
static void
_gdk_device_manager_xi2_select_events (GdkDeviceManager *device_manager,
_gdk_x11_device_manager_xi2_select_events (GdkDeviceManager *device_manager,
Window xwindow,
XIEventMask *event_mask)
{
@ -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,7 +247,7 @@ create_device (GdkDeviceManager *device_manager,
}
static GdkDevice *
add_device (GdkDeviceManagerXI2 *device_manager,
add_device (GdkX11DeviceManagerXI2 *device_manager,
XIDeviceInfo *dev,
gboolean emit_signal)
{
@ -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,7 +358,7 @@ 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);
@ -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)
@ -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_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,
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,15 +492,15 @@ 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,
handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager,
XIHierarchyEvent *ev)
{
GdkDisplay *display;
@ -564,7 +562,7 @@ handle_hierarchy_changed (GdkDeviceManagerXI2 *device_manager,
}
static void
handle_device_changed (GdkDeviceManagerXI2 *device_manager,
handle_device_changed (GdkX11DeviceManagerXI2 *device_manager,
XIDeviceChangedEvent *ev)
{
GdkDisplay *display;
@ -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)
{
@ -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,
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:
@ -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,7 +1267,7 @@ gdk_device_manager_xi2_get_handled_events (GdkEventTranslator *translator)
}
static void
gdk_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
Window window,
GdkEventMask evmask)
{
@ -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);
}

View File

@ -1,63 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput2.h>
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__ */

View File

@ -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,

View File

@ -57,7 +57,11 @@
#include <gdk/x11/gdkx11cursor.h>
#include <gdk/x11/gdkx11device-core.h>
#include <gdk/x11/gdkx11device-xi.h>
#include <gdk/x11/gdkx11device-xi2.h>
#include <gdk/x11/gdkx11devicemanager-core.h>
#include <gdk/x11/gdkx11devicemanager-xi.h>
#include <gdk/x11/gdkx11devicemanager-xi2.h>
#include <gdk/x11/gdkx11display.h>
#include <gdk/x11/gdkx11displaymanager.h>
#include <gdk/x11/gdkx11keys.h>

72
gdk/x11/gdkx11device-xi.h Normal file
View File

@ -0,0 +1,72 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput.h>
G_BEGIN_DECLS
#define GDK_TYPE_X11_DEVICE_XI (gdk_x11_device_xi_get_type ())
#define GDK_X11_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXI))
#define GDK_X11_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXIClass))
#define GDK_IS_X11_DEVICE_XI(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_XI))
#define GDK_IS_X11_DEVICE_XI_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_XI))
#define GDK_X11_DEVICE_XI_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_XI, GdkX11DeviceXIClass))
typedef struct _GdkX11DeviceXI GdkX11DeviceXI;
typedef struct _GdkX11DeviceXIClass GdkX11DeviceXIClass;
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__ */

View File

@ -0,0 +1,56 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput2.h>
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__ */

View File

@ -0,0 +1,55 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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__ */

View File

@ -0,0 +1,65 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, 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 <X11/extensions/XInput2.h>
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__ */