Rename GdkDevice[Manager]Core to GdkX11Device[Manager]Core

This is mainly to avoid clash with the classes of the same
name in the quartz backend.
This commit is contained in:
Matthias Clasen
2010-12-20 23:59:07 -05:00
parent e96c193d06
commit 5cddc7ccbb
11 changed files with 503 additions and 502 deletions

View File

@ -23,10 +23,8 @@ libgdk_x11_la_SOURCES = \
gdkasync.c \ gdkasync.c \
gdkasync.h \ gdkasync.h \
gdkcursor-x11.c \ gdkcursor-x11.c \
gdkdevice-core.h \ gdkdevice-core-x11.c \
gdkdevice-core.c \ gdkdevicemanager-core-x11.c \
gdkdevicemanager-core.h \
gdkdevicemanager-core.c \
gdkdevicemanager-x11.c \ gdkdevicemanager-x11.c \
gdkdisplaymanager-x11.c \ gdkdisplaymanager-x11.c \
gdkdisplay-x11.c \ gdkdisplay-x11.c \
@ -77,6 +75,8 @@ libgdkinclude_HEADERS = \
libgdkx11include_HEADERS = \ libgdkx11include_HEADERS = \
gdkx11cursor.h \ gdkx11cursor.h \
gdkx11device-core.h \
gdkx11devicemanager-core.h \
gdkx11display.h \ gdkx11display.h \
gdkx11displaymanager.h \ gdkx11displaymanager.h \
gdkx11keys.h \ gdkx11keys.h \

View File

@ -19,78 +19,77 @@
#include "config.h" #include "config.h"
#include "gdkdevice-core.h" #include "gdkx11device-core.h"
#include "gdkinternals.h" #include "gdkinternals.h"
#include "gdkwindow.h" #include "gdkwindow.h"
#include "gdkprivate-x11.h" #include "gdkprivate-x11.h"
#include "gdkasync.h" #include "gdkasync.h"
static gboolean gdk_device_core_get_history (GdkDevice *device, static gboolean gdk_x11_device_core_get_history (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
guint32 start, guint32 start,
guint32 stop, guint32 stop,
GdkTimeCoord ***events, GdkTimeCoord ***events,
gint *n_events); gint *n_events);
static void gdk_device_core_get_state (GdkDevice *device, static void gdk_x11_device_core_get_state (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
gdouble *axes, gdouble *axes,
GdkModifierType *mask); GdkModifierType *mask);
static void gdk_device_core_set_window_cursor (GdkDevice *device, static void gdk_x11_device_core_set_window_cursor (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkCursor *cursor); GdkCursor *cursor);
static void gdk_device_core_warp (GdkDevice *device, static void gdk_x11_device_core_warp (GdkDevice *device,
GdkScreen *screen, GdkScreen *screen,
gint x, gint x,
gint y); gint y);
static gboolean gdk_device_core_query_state (GdkDevice *device, static gboolean gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkWindow **root_window, GdkWindow **root_window,
GdkWindow **child_window, GdkWindow **child_window,
gint *root_x, gint *root_x,
gint *root_y, gint *root_y,
gint *win_x, gint *win_x,
gint *win_y, gint *win_y,
GdkModifierType *mask); GdkModifierType *mask);
static GdkGrabStatus gdk_device_core_grab (GdkDevice *device, static GdkGrabStatus gdk_x11_device_core_grab (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
gboolean owner_events, gboolean owner_events,
GdkEventMask event_mask, GdkEventMask event_mask,
GdkWindow *confine_to, GdkWindow *confine_to,
GdkCursor *cursor, GdkCursor *cursor,
guint32 time_); guint32 time_);
static void gdk_device_core_ungrab (GdkDevice *device, static void gdk_x11_device_core_ungrab (GdkDevice *device,
guint32 time_); guint32 time_);
static GdkWindow * gdk_device_core_window_at_position (GdkDevice *device, static GdkWindow * gdk_x11_device_core_window_at_position (GdkDevice *device,
gint *win_x, gint *win_x,
gint *win_y, gint *win_y,
GdkModifierType *mask, GdkModifierType *mask,
gboolean get_toplevel); gboolean get_toplevel);
static void gdk_device_core_select_window_events (GdkDevice *device, static void gdk_x11_device_core_select_window_events (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkEventMask event_mask); GdkEventMask event_mask);
G_DEFINE_TYPE (GdkX11DeviceCore, gdk_x11_device_core, GDK_TYPE_DEVICE)
G_DEFINE_TYPE (GdkDeviceCore, gdk_device_core, GDK_TYPE_DEVICE)
static void static void
gdk_device_core_class_init (GdkDeviceCoreClass *klass) gdk_x11_device_core_class_init (GdkX11DeviceCoreClass *klass)
{ {
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass); GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_history = gdk_device_core_get_history; device_class->get_history = gdk_x11_device_core_get_history;
device_class->get_state = gdk_device_core_get_state; device_class->get_state = gdk_x11_device_core_get_state;
device_class->set_window_cursor = gdk_device_core_set_window_cursor; device_class->set_window_cursor = gdk_x11_device_core_set_window_cursor;
device_class->warp = gdk_device_core_warp; device_class->warp = gdk_x11_device_core_warp;
device_class->query_state = gdk_device_core_query_state; device_class->query_state = gdk_x11_device_core_query_state;
device_class->grab = gdk_device_core_grab; device_class->grab = gdk_x11_device_core_grab;
device_class->ungrab = gdk_device_core_ungrab; device_class->ungrab = gdk_x11_device_core_ungrab;
device_class->window_at_position = gdk_device_core_window_at_position; device_class->window_at_position = gdk_x11_device_core_window_at_position;
device_class->select_window_events = gdk_device_core_select_window_events; device_class->select_window_events = gdk_x11_device_core_select_window_events;
} }
static void static void
gdk_device_core_init (GdkDeviceCore *device_core) gdk_x11_device_core_init (GdkX11DeviceCore *device_core)
{ {
GdkDevice *device; GdkDevice *device;
@ -117,12 +116,12 @@ impl_coord_in_window (GdkWindow *window,
} }
static gboolean static gboolean
gdk_device_core_get_history (GdkDevice *device, gdk_x11_device_core_get_history (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
guint32 start, guint32 start,
guint32 stop, guint32 stop,
GdkTimeCoord ***events, GdkTimeCoord ***events,
gint *n_events) gint *n_events)
{ {
XTimeCoord *xcoords; XTimeCoord *xcoords;
GdkTimeCoord **coords; GdkTimeCoord **coords;
@ -179,10 +178,10 @@ gdk_device_core_get_history (GdkDevice *device,
} }
static void static void
gdk_device_core_get_state (GdkDevice *device, gdk_x11_device_core_get_state (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
gdouble *axes, gdouble *axes,
GdkModifierType *mask) GdkModifierType *mask)
{ {
gint x_int, y_int; gint x_int, y_int;
@ -196,9 +195,9 @@ gdk_device_core_get_state (GdkDevice *device,
} }
static void static void
gdk_device_core_set_window_cursor (GdkDevice *device, gdk_x11_device_core_set_window_cursor (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkCursor *cursor) GdkCursor *cursor)
{ {
Cursor xcursor; Cursor xcursor;
@ -213,10 +212,10 @@ gdk_device_core_set_window_cursor (GdkDevice *device,
} }
static void static void
gdk_device_core_warp (GdkDevice *device, gdk_x11_device_core_warp (GdkDevice *device,
GdkScreen *screen, GdkScreen *screen,
gint x, gint x,
gint y) gint y)
{ {
Display *xdisplay; Display *xdisplay;
Window dest; Window dest;
@ -228,15 +227,15 @@ gdk_device_core_warp (GdkDevice *device,
} }
static gboolean static gboolean
gdk_device_core_query_state (GdkDevice *device, gdk_x11_device_core_query_state (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkWindow **root_window, GdkWindow **root_window,
GdkWindow **child_window, GdkWindow **child_window,
gint *root_x, gint *root_x,
gint *root_y, gint *root_y,
gint *win_x, gint *win_x,
gint *win_y, gint *win_y,
GdkModifierType *mask) GdkModifierType *mask)
{ {
GdkDisplay *display; GdkDisplay *display;
GdkScreen *default_screen; GdkScreen *default_screen;
@ -253,10 +252,8 @@ gdk_device_core_query_state (GdkDevice *device,
GDK_WINDOW_XID (window), GDK_WINDOW_XID (window),
&xroot_window, &xroot_window,
&xchild_window, &xchild_window,
&xroot_x, &xroot_x, &xroot_y,
&xroot_y, &xwin_x, &xwin_y,
&xwin_x,
&xwin_y,
&xmask)) &xmask))
return FALSE; return FALSE;
} }
@ -276,10 +273,8 @@ gdk_device_core_query_state (GdkDevice *device,
XQueryPointer (xdisplay, w, XQueryPointer (xdisplay, w,
&xroot_window, &xroot_window,
&xchild_window, &xchild_window,
&xroot_x, &xroot_x, &xroot_y,
&xroot_y, &xwin_x, &xwin_y,
&xwin_x,
&xwin_y,
&xmask); &xmask);
XDestroyWindow (xdisplay, w); XDestroyWindow (xdisplay, w);
} }
@ -309,13 +304,13 @@ gdk_device_core_query_state (GdkDevice *device,
} }
static GdkGrabStatus static GdkGrabStatus
gdk_device_core_grab (GdkDevice *device, gdk_x11_device_core_grab (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
gboolean owner_events, gboolean owner_events,
GdkEventMask event_mask, GdkEventMask event_mask,
GdkWindow *confine_to, GdkWindow *confine_to,
GdkCursor *cursor, GdkCursor *cursor,
guint32 time_) guint32 time_)
{ {
GdkDisplay *display; GdkDisplay *display;
Window xwindow, xconfine_to; Window xwindow, xconfine_to;
@ -391,8 +386,8 @@ gdk_device_core_grab (GdkDevice *device,
} }
static void static void
gdk_device_core_ungrab (GdkDevice *device, gdk_x11_device_core_ungrab (GdkDevice *device,
guint32 time_) guint32 time_)
{ {
GdkDisplay *display; GdkDisplay *display;
gulong serial; gulong serial;
@ -409,11 +404,11 @@ gdk_device_core_ungrab (GdkDevice *device,
} }
static GdkWindow * static GdkWindow *
gdk_device_core_window_at_position (GdkDevice *device, gdk_x11_device_core_window_at_position (GdkDevice *device,
gint *win_x, gint *win_x,
gint *win_y, gint *win_y,
GdkModifierType *mask, GdkModifierType *mask,
gboolean get_toplevel) gboolean get_toplevel)
{ {
GdkDisplay *display; GdkDisplay *display;
GdkScreen *screen; GdkScreen *screen;
@ -473,7 +468,10 @@ gdk_device_core_window_at_position (GdkDevice *device,
xwindow = GDK_WINDOW_XID (window); xwindow = GDK_WINDOW_XID (window);
gdk_x11_display_error_trap_push (display); gdk_x11_display_error_trap_push (display);
XQueryPointer (xdisplay, xwindow, XQueryPointer (xdisplay, xwindow,
&root, &child, &rootx, &rooty, &winx, &winy, &xmask); &root, &child,
&rootx, &rooty,
&winx, &winy,
&xmask);
if (gdk_x11_display_error_trap_pop (display)) if (gdk_x11_display_error_trap_pop (display))
continue; continue;
if (child != None) if (child != None)
@ -494,7 +492,9 @@ gdk_device_core_window_at_position (GdkDevice *device,
XMapWindow (xdisplay, w); XMapWindow (xdisplay, w);
XQueryPointer (xdisplay, xwindow, XQueryPointer (xdisplay, xwindow,
&root, &child, &root, &child,
&rootx, &rooty, &winx, &winy, &xmask); &rootx, &rooty,
&winx, &winy,
&xmask);
XDestroyWindow (xdisplay, w); XDestroyWindow (xdisplay, w);
if (child == w) if (child == w)
{ {
@ -550,9 +550,9 @@ gdk_device_core_window_at_position (GdkDevice *device,
} }
static void static void
gdk_device_core_select_window_events (GdkDevice *device, gdk_x11_device_core_select_window_events (GdkDevice *device,
GdkWindow *window, GdkWindow *window,
GdkEventMask event_mask) GdkEventMask event_mask)
{ {
GdkEventMask filter_mask, window_mask; GdkEventMask filter_mask, window_mask;
guint xmask = 0; guint xmask = 0;

View File

@ -1,52 +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_CORE_H__
#define __GDK_DEVICE_CORE_H__
#include "gdkdeviceprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE_CORE (gdk_device_core_get_type ())
#define GDK_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_CORE, GdkDeviceCore))
#define GDK_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_CORE, GdkDeviceCoreClass))
#define GDK_IS_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_CORE))
#define GDK_IS_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_CORE))
#define GDK_DEVICE_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_CORE, GdkDeviceCoreClass))
typedef struct _GdkDeviceCore GdkDeviceCore;
typedef struct _GdkDeviceCoreClass GdkDeviceCoreClass;
struct _GdkDeviceCore
{
GdkDevice parent_instance;
};
struct _GdkDeviceCoreClass
{
GdkDeviceClass parent_class;
};
G_GNUC_INTERNAL
GType gdk_device_core_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_DEVICE_CORE_H__ */

View File

@ -19,13 +19,13 @@
#include "config.h" #include "config.h"
#include "gdkdevicemanager-core.h" #include "gdkx11devicemanager-core.h"
#include "gdkx11device-core.h"
#include "gdkkeysyms.h" #include "gdkkeysyms.h"
#include "gdkdevicemanagerprivate.h" #include "gdkdevicemanagerprivate.h"
#include "gdkdisplayprivate.h" #include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h" #include "gdkeventtranslator.h"
#include "gdkdevice-core.h"
#include "gdkprivate-x11.h" #include "gdkprivate-x11.h"
#ifdef HAVE_XKB #ifdef HAVE_XKB
@ -36,48 +36,48 @@
#define HAS_FOCUS(toplevel) \ #define HAS_FOCUS(toplevel) \
((toplevel)->has_focus || (toplevel)->has_pointer_focus) ((toplevel)->has_focus || (toplevel)->has_pointer_focus)
static void gdk_device_manager_core_finalize (GObject *object); static void gdk_x11_device_manager_core_finalize (GObject *object);
static void gdk_device_manager_core_constructed (GObject *object); static void gdk_x11_device_manager_core_constructed (GObject *object);
static GList * gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager, static GList * gdk_x11_device_manager_core_list_devices (GdkDeviceManager *device_manager,
GdkDeviceType type); GdkDeviceType type);
static GdkDevice * gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager); static GdkDevice * gdk_x11_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager);
static void gdk_device_manager_event_translator_init (GdkEventTranslatorIface *iface); static void gdk_x11_device_manager_event_translator_init (GdkEventTranslatorIface *iface);
static gboolean gdk_device_manager_core_translate_event (GdkEventTranslator *translator, static gboolean gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
GdkDisplay *display, GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
XEvent *xevent); XEvent *xevent);
G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerCore, gdk_device_manager_core, GDK_TYPE_DEVICE_MANAGER, G_DEFINE_TYPE_WITH_CODE (GdkX11DeviceManagerCore, gdk_x11_device_manager_core, GDK_TYPE_DEVICE_MANAGER,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR, G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_device_manager_event_translator_init)) gdk_x11_device_manager_event_translator_init))
static void static void
gdk_device_manager_core_class_init (GdkDeviceManagerCoreClass *klass) gdk_x11_device_manager_core_class_init (GdkX11DeviceManagerCoreClass *klass)
{ {
GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass); GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_device_manager_core_finalize; object_class->finalize = gdk_x11_device_manager_core_finalize;
object_class->constructed = gdk_device_manager_core_constructed; object_class->constructed = gdk_x11_device_manager_core_constructed;
device_manager_class->list_devices = gdk_device_manager_core_list_devices; device_manager_class->list_devices = gdk_x11_device_manager_core_list_devices;
device_manager_class->get_client_pointer = gdk_device_manager_core_get_client_pointer; device_manager_class->get_client_pointer = gdk_x11_device_manager_core_get_client_pointer;
} }
static void static void
gdk_device_manager_event_translator_init (GdkEventTranslatorIface *iface) gdk_x11_device_manager_event_translator_init (GdkEventTranslatorIface *iface)
{ {
iface->translate_event = gdk_device_manager_core_translate_event; iface->translate_event = gdk_x11_device_manager_core_translate_event;
} }
static GdkDevice * static GdkDevice *
create_core_pointer (GdkDeviceManager *device_manager, create_core_pointer (GdkDeviceManager *device_manager,
GdkDisplay *display) GdkDisplay *display)
{ {
return g_object_new (GDK_TYPE_DEVICE_CORE, return g_object_new (GDK_TYPE_X11_DEVICE_CORE,
"name", "Core Pointer", "name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER, "type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE, "input-source", GDK_SOURCE_MOUSE,
@ -92,7 +92,7 @@ static GdkDevice *
create_core_keyboard (GdkDeviceManager *device_manager, create_core_keyboard (GdkDeviceManager *device_manager,
GdkDisplay *display) GdkDisplay *display)
{ {
return g_object_new (GDK_TYPE_DEVICE_CORE, return g_object_new (GDK_TYPE_X11_DEVICE_CORE,
"name", "Core Keyboard", "name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER, "type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_KEYBOARD, "input-source", GDK_SOURCE_KEYBOARD,
@ -104,30 +104,30 @@ create_core_keyboard (GdkDeviceManager *device_manager,
} }
static void static void
gdk_device_manager_core_init (GdkDeviceManagerCore *device_manager) gdk_x11_device_manager_core_init (GdkX11DeviceManagerCore *device_manager)
{ {
} }
static void static void
gdk_device_manager_core_finalize (GObject *object) gdk_x11_device_manager_core_finalize (GObject *object)
{ {
GdkDeviceManagerCore *device_manager_core; GdkX11DeviceManagerCore *device_manager_core;
device_manager_core = GDK_DEVICE_MANAGER_CORE (object); device_manager_core = GDK_X11_DEVICE_MANAGER_CORE (object);
g_object_unref (device_manager_core->core_pointer); g_object_unref (device_manager_core->core_pointer);
g_object_unref (device_manager_core->core_keyboard); g_object_unref (device_manager_core->core_keyboard);
G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object); G_OBJECT_CLASS (gdk_x11_device_manager_core_parent_class)->finalize (object);
} }
static void static void
gdk_device_manager_core_constructed (GObject *object) gdk_x11_device_manager_core_constructed (GObject *object)
{ {
GdkDeviceManagerCore *device_manager; GdkX11DeviceManagerCore *device_manager;
GdkDisplay *display; GdkDisplay *display;
device_manager = GDK_DEVICE_MANAGER_CORE (object); device_manager = GDK_X11_DEVICE_MANAGER_CORE (object);
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object)); display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
device_manager->core_pointer = create_core_pointer (GDK_DEVICE_MANAGER (device_manager), display); device_manager->core_pointer = create_core_pointer (GDK_DEVICE_MANAGER (device_manager), display);
device_manager->core_keyboard = create_core_keyboard (GDK_DEVICE_MANAGER (device_manager), display); device_manager->core_keyboard = create_core_keyboard (GDK_DEVICE_MANAGER (device_manager), display);
@ -137,10 +137,10 @@ gdk_device_manager_core_constructed (GObject *object)
} }
static void static void
translate_key_event (GdkDisplay *display, translate_key_event (GdkDisplay *display,
GdkDeviceManagerCore *device_manager, GdkX11DeviceManagerCore *device_manager,
GdkEvent *event, GdkEvent *event,
XEvent *xevent) XEvent *xevent)
{ {
GdkKeymap *keymap = gdk_keymap_get_for_display (display); GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkModifierType consumed, state; GdkModifierType consumed, state;
@ -158,10 +158,10 @@ translate_key_event (GdkDisplay *display,
event->key.keyval = GDK_KEY_VoidSymbol; event->key.keyval = GDK_KEY_VoidSymbol;
gdk_keymap_translate_keyboard_state (keymap, gdk_keymap_translate_keyboard_state (keymap,
event->key.hardware_keycode, event->key.hardware_keycode,
event->key.state, event->key.state,
event->key.group, event->key.group,
&event->key.keyval, &event->key.keyval,
NULL, NULL, &consumed); NULL, NULL, &consumed);
state = event->key.state & ~consumed; state = event->key.state & ~consumed;
@ -186,28 +186,28 @@ translate_key_event (GdkDisplay *display,
/* Apply the control key - Taken from Xlib /* Apply the control key - Taken from Xlib
*/ */
if (event->key.state & GDK_CONTROL_MASK) if (event->key.state & GDK_CONTROL_MASK)
{ {
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
else if (c == '2') else if (c == '2')
{ {
event->key.string = g_memdup ("\0\0", 2); event->key.string = g_memdup ("\0\0", 2);
event->key.length = 1; event->key.length = 1;
buf[0] = '\0'; buf[0] = '\0';
goto out; goto out;
} }
else if (c >= '3' && c <= '7') c -= ('3' - '\033'); else if (c >= '3' && c <= '7') c -= ('3' - '\033');
else if (c == '8') c = '\177'; else if (c == '8') c = '\177';
else if (c == '/') c = '_' & 0x1F; else if (c == '/') c = '_' & 0x1F;
} }
len = g_unichar_to_utf8 (c, buf); len = g_unichar_to_utf8 (c, buf);
buf[len] = '\0'; buf[len] = '\0';
event->key.string = g_locale_from_utf8 (buf, len, event->key.string = g_locale_from_utf8 (buf, len,
NULL, &bytes_written, NULL, &bytes_written,
NULL); NULL);
if (event->key.string) if (event->key.string)
event->key.length = bytes_written; event->key.length = bytes_written;
} }
else if (event->key.keyval == GDK_KEY_Escape) else if (event->key.keyval == GDK_KEY_Escape)
{ {
@ -215,7 +215,7 @@ translate_key_event (GdkDisplay *display,
event->key.string = g_strdup ("\033"); event->key.string = g_strdup ("\033");
} }
else if (event->key.keyval == GDK_KEY_Return || else if (event->key.keyval == GDK_KEY_Return ||
event->key.keyval == GDK_KEY_KP_Enter) event->key.keyval == GDK_KEY_KP_Enter)
{ {
event->key.length = 1; event->key.length = 1;
event->key.string = g_strdup ("\r"); event->key.string = g_strdup ("\r");
@ -231,15 +231,15 @@ translate_key_event (GdkDisplay *display,
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_EVENTS) if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
{ {
g_message ("%s:\t\twindow: %ld key: %12s %d", g_message ("%s:\t\twindow: %ld key: %12s %d",
event->type == GDK_KEY_PRESS ? "key press " : "key release", event->type == GDK_KEY_PRESS ? "key press " : "key release",
xevent->xkey.window, xevent->xkey.window,
event->key.keyval ? gdk_keyval_name (event->key.keyval) : "(none)", event->key.keyval ? gdk_keyval_name (event->key.keyval) : "(none)",
event->key.keyval); event->key.keyval);
if (event->key.length > 0) if (event->key.length > 0)
g_message ("\t\tlength: %4d string: \"%s\"", g_message ("\t\tlength: %4d string: \"%s\"",
event->key.length, buf); event->key.length, buf);
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
return; return;
@ -267,7 +267,7 @@ static const char notify_details[][23] = {
static void static void
set_user_time (GdkWindow *window, set_user_time (GdkWindow *window,
GdkEvent *event) GdkEvent *event)
{ {
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
@ -283,9 +283,9 @@ set_user_time (GdkWindow *window,
} }
static void static void
generate_focus_event (GdkDeviceManagerCore *device_manager, generate_focus_event (GdkX11DeviceManagerCore *device_manager,
GdkWindow *window, GdkWindow *window,
gboolean in) gboolean in)
{ {
GdkEvent *event; GdkEvent *event;
@ -301,8 +301,8 @@ generate_focus_event (GdkDeviceManagerCore *device_manager,
static gboolean static gboolean
set_screen_from_root (GdkDisplay *display, set_screen_from_root (GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
Window xrootwin) Window xrootwin)
{ {
GdkScreen *screen; GdkScreen *screen;
@ -364,7 +364,7 @@ is_parent_of (GdkWindow *parent,
while (w != NULL) while (w != NULL)
{ {
if (w == parent) if (w == parent)
return TRUE; return TRUE;
w = gdk_window_get_parent (w); w = gdk_window_get_parent (w);
} }
@ -392,7 +392,7 @@ get_event_window (GdkEventTranslator *translator,
serial = _gdk_display_get_next_serial (display); serial = _gdk_display_get_next_serial (display);
info = _gdk_display_has_device_grab (display, info = _gdk_display_has_device_grab (display,
GDK_DEVICE_MANAGER_CORE (device_manager)->core_keyboard, GDK_X11_DEVICE_MANAGER_CORE (device_manager)->core_keyboard,
serial); serial);
if (info && if (info &&
(!is_parent_of (info->window, window) || (!is_parent_of (info->window, window) ||
@ -407,19 +407,19 @@ get_event_window (GdkEventTranslator *translator,
} }
static gboolean static gboolean
gdk_device_manager_core_translate_event (GdkEventTranslator *translator, gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
GdkDisplay *display, GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
XEvent *xevent) XEvent *xevent)
{ {
GdkDeviceManagerCore *device_manager; GdkX11DeviceManagerCore *device_manager;
GdkWindow *window; GdkWindow *window;
GdkWindowImplX11 *window_impl = NULL; GdkWindowImplX11 *window_impl = NULL;
gboolean return_val; gboolean return_val;
GdkToplevelX11 *toplevel = NULL; GdkToplevelX11 *toplevel = NULL;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display); GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
device_manager = GDK_DEVICE_MANAGER_CORE (translator); device_manager = GDK_X11_DEVICE_MANAGER_CORE (translator);
return_val = FALSE; return_val = FALSE;
window = get_event_window (translator, xevent); window = get_event_window (translator, xevent);
@ -440,10 +440,10 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
if (window && GDK_WINDOW_DESTROYED (window)) if (window && GDK_WINDOW_DESTROYED (window))
{ {
if (xevent->type != DestroyNotify) if (xevent->type != DestroyNotify)
{ {
return_val = FALSE; return_val = FALSE;
goto done; goto done;
} }
} }
if (window && if (window &&
@ -491,45 +491,45 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
*/ */
if (!display_x11->have_xkb_autorepeat && XPending (xevent->xkey.display)) if (!display_x11->have_xkb_autorepeat && XPending (xevent->xkey.display))
{ {
XEvent next_event; XEvent next_event;
XPeekEvent (xevent->xkey.display, &next_event); XPeekEvent (xevent->xkey.display, &next_event);
if (next_event.type == KeyPress && if (next_event.type == KeyPress &&
next_event.xkey.keycode == xevent->xkey.keycode && next_event.xkey.keycode == xevent->xkey.keycode &&
next_event.xkey.time == xevent->xkey.time) next_event.xkey.time == xevent->xkey.time)
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
} }
translate_key_event (display, device_manager, event, xevent); translate_key_event (display, device_manager, event, xevent);
break; break;
case ButtonPress: case ButtonPress:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("button press:\t\twindow: %ld x,y: %d %d button: %d", g_message ("button press:\t\twindow: %ld x,y: %d %d button: %d",
xevent->xbutton.window, xevent->xbutton.window,
xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button)); xevent->xbutton.button));
if (window == NULL) if (window == NULL)
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
/* If we get a ButtonPress event where the button is 4 or 5, /* If we get a ButtonPress event where the button is 4 or 5,
it's a Scroll event */ it's a Scroll event */
switch (xevent->xbutton.button) switch (xevent->xbutton.button)
{ {
case 4: /* up */ case 4: /* up */
case 5: /* down */ case 5: /* down */
case 6: /* left */ case 6: /* left */
case 7: /* right */ case 7: /* right */
event->scroll.type = GDK_SCROLL; event->scroll.type = GDK_SCROLL;
if (xevent->xbutton.button == 4) if (xevent->xbutton.button == 4)
event->scroll.direction = GDK_SCROLL_UP; event->scroll.direction = GDK_SCROLL_UP;
@ -540,41 +540,41 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
else else
event->scroll.direction = GDK_SCROLL_RIGHT; event->scroll.direction = GDK_SCROLL_RIGHT;
event->scroll.window = window; event->scroll.window = window;
event->scroll.time = xevent->xbutton.time; event->scroll.time = xevent->xbutton.time;
event->scroll.x = (gdouble) xevent->xbutton.x; event->scroll.x = (gdouble) xevent->xbutton.x;
event->scroll.y = (gdouble) xevent->xbutton.y; event->scroll.y = (gdouble) xevent->xbutton.y;
event->scroll.x_root = (gdouble) xevent->xbutton.x_root; event->scroll.x_root = (gdouble) xevent->xbutton.x_root;
event->scroll.y_root = (gdouble) xevent->xbutton.y_root; event->scroll.y_root = (gdouble) xevent->xbutton.y_root;
event->scroll.state = (GdkModifierType) xevent->xbutton.state; event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = device_manager->core_pointer; event->scroll.device = device_manager->core_pointer;
if (!set_screen_from_root (display, event, xevent->xbutton.root)) if (!set_screen_from_root (display, event, xevent->xbutton.root))
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
break; break;
default: default:
event->button.type = GDK_BUTTON_PRESS; event->button.type = GDK_BUTTON_PRESS;
event->button.window = window; event->button.window = window;
event->button.time = xevent->xbutton.time; event->button.time = xevent->xbutton.time;
event->button.x = (gdouble) xevent->xbutton.x; event->button.x = (gdouble) xevent->xbutton.x;
event->button.y = (gdouble) xevent->xbutton.y; event->button.y = (gdouble) xevent->xbutton.y;
event->button.x_root = (gdouble) xevent->xbutton.x_root; event->button.x_root = (gdouble) xevent->xbutton.x_root;
event->button.y_root = (gdouble) xevent->xbutton.y_root; event->button.y_root = (gdouble) xevent->xbutton.y_root;
event->button.axes = NULL; event->button.axes = NULL;
event->button.state = (GdkModifierType) xevent->xbutton.state; event->button.state = (GdkModifierType) xevent->xbutton.state;
event->button.button = xevent->xbutton.button; event->button.button = xevent->xbutton.button;
event->button.device = device_manager->core_pointer; event->button.device = device_manager->core_pointer;
if (!set_screen_from_root (display, event, xevent->xbutton.root)) if (!set_screen_from_root (display, event, xevent->xbutton.root))
return_val = FALSE; return_val = FALSE;
break; break;
} }
set_user_time (window, event); set_user_time (window, event);
@ -582,24 +582,24 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
case ButtonRelease: case ButtonRelease:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("button release:\twindow: %ld x,y: %d %d button: %d", g_message ("button release:\twindow: %ld x,y: %d %d button: %d",
xevent->xbutton.window, xevent->xbutton.window,
xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button)); xevent->xbutton.button));
if (window == NULL) if (window == NULL)
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
/* We treat button presses as scroll wheel events, so ignore the release */ /* We treat button presses as scroll wheel events, so ignore the release */
if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5 || if (xevent->xbutton.button == 4 || xevent->xbutton.button == 5 ||
xevent->xbutton.button == 6 || xevent->xbutton.button == 7) xevent->xbutton.button == 6 || xevent->xbutton.button == 7)
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
event->button.type = GDK_BUTTON_RELEASE; event->button.type = GDK_BUTTON_RELEASE;
event->button.window = window; event->button.window = window;
@ -620,16 +620,16 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
case MotionNotify: case MotionNotify:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s", g_message ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s",
xevent->xmotion.window, xevent->xmotion.window,
xevent->xmotion.x, xevent->xmotion.y, xevent->xmotion.x, xevent->xmotion.y,
(xevent->xmotion.is_hint) ? "true" : "false")); (xevent->xmotion.is_hint) ? "true" : "false"));
if (window == NULL) if (window == NULL)
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
event->motion.type = GDK_MOTION_NOTIFY; event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window; event->motion.window = window;
@ -644,19 +644,19 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
event->motion.device = device_manager->core_pointer; event->motion.device = device_manager->core_pointer;
if (!set_screen_from_root (display, event, xevent->xbutton.root)) if (!set_screen_from_root (display, event, xevent->xbutton.root))
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
break; break;
case EnterNotify: case EnterNotify:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("enter notify:\t\twindow: %ld detail: %d subwin: %ld", g_message ("enter notify:\t\twindow: %ld detail: %d subwin: %ld",
xevent->xcrossing.window, xevent->xcrossing.window,
xevent->xcrossing.detail, xevent->xcrossing.detail,
xevent->xcrossing.subwindow)); xevent->xcrossing.subwindow));
if (window == NULL) if (window == NULL)
{ {
@ -665,10 +665,10 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
} }
if (!set_screen_from_root (display, event, xevent->xbutton.root)) if (!set_screen_from_root (display, event, xevent->xbutton.root))
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
event->crossing.type = GDK_ENTER_NOTIFY; event->crossing.type = GDK_ENTER_NOTIFY;
event->crossing.window = window; event->crossing.window = window;
@ -678,9 +678,9 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
* lookup the corresponding GdkWindow. * lookup the corresponding GdkWindow.
*/ */
if (xevent->xcrossing.subwindow != None) if (xevent->xcrossing.subwindow != None)
event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow); event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow);
else else
event->crossing.subwindow = NULL; event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time; event->crossing.time = xevent->xcrossing.time;
event->crossing.x = (gdouble) xevent->xcrossing.x; event->crossing.x = (gdouble) xevent->xcrossing.x;
@ -698,9 +698,9 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
case LeaveNotify: case LeaveNotify:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("leave notify:\t\twindow: %ld detail: %d subwin: %ld", g_message ("leave notify:\t\twindow: %ld detail: %d subwin: %ld",
xevent->xcrossing.window, xevent->xcrossing.window,
xevent->xcrossing.detail, xevent->xcrossing.subwindow)); xevent->xcrossing.detail, xevent->xcrossing.subwindow));
if (window == NULL) if (window == NULL)
{ {
@ -709,10 +709,10 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
} }
if (!set_screen_from_root (display, event, xevent->xbutton.root)) if (!set_screen_from_root (display, event, xevent->xbutton.root))
{ {
return_val = FALSE; return_val = FALSE;
break; break;
} }
event->crossing.type = GDK_LEAVE_NOTIFY; event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = window; event->crossing.window = window;
@ -722,9 +722,9 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
* lookup the corresponding GdkWindow. * lookup the corresponding GdkWindow.
*/ */
if (xevent->xcrossing.subwindow != None) if (xevent->xcrossing.subwindow != None)
event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow); event->crossing.subwindow = gdk_x11_window_lookup_for_display (display, xevent->xcrossing.subwindow);
else else
event->crossing.subwindow = NULL; event->crossing.subwindow = NULL;
event->crossing.time = xevent->xcrossing.time; event->crossing.time = xevent->xcrossing.time;
event->crossing.x = (gdouble) xevent->xcrossing.x; event->crossing.x = (gdouble) xevent->xcrossing.x;
@ -745,113 +745,113 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
*/ */
case FocusIn: case FocusIn:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s", g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s",
xevent->xfocus.window, xevent->xfocus.window,
notify_details[xevent->xfocus.detail], notify_details[xevent->xfocus.detail],
notify_modes[xevent->xfocus.mode])); notify_modes[xevent->xfocus.mode]));
if (toplevel) if (toplevel)
{ {
gboolean had_focus = HAS_FOCUS (toplevel); gboolean had_focus = HAS_FOCUS (toplevel);
switch (xevent->xfocus.detail) switch (xevent->xfocus.detail)
{ {
case NotifyAncestor: case NotifyAncestor:
case NotifyVirtual: case NotifyVirtual:
/* When the focus moves from an ancestor of the window to /* When the focus moves from an ancestor of the window to
* the window or a descendent of the window, *and* the * the window or a descendent of the window, *and* the
* pointer is inside the window, then we were previously * pointer is inside the window, then we were previously
* receiving keystroke events in the has_pointer_focus * receiving keystroke events in the has_pointer_focus
* case and are now receiving them in the * case and are now receiving them in the
* has_focus_window case. * has_focus_window case.
*/ */
if (toplevel->has_pointer && if (toplevel->has_pointer &&
xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_pointer_focus = FALSE; toplevel->has_pointer_focus = FALSE;
/* fall through */ /* fall through */
case NotifyNonlinear: case NotifyNonlinear:
case NotifyNonlinearVirtual: case NotifyNonlinearVirtual:
if (xevent->xfocus.mode != NotifyGrab && if (xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_focus_window = TRUE; toplevel->has_focus_window = TRUE;
/* We pretend that the focus moves to the grab /* We pretend that the focus moves to the grab
* window, so we pay attention to NotifyGrab * window, so we pay attention to NotifyGrab
* NotifyUngrab, and ignore NotifyWhileGrabbed * NotifyUngrab, and ignore NotifyWhileGrabbed
*/ */
if (xevent->xfocus.mode != NotifyWhileGrabbed) if (xevent->xfocus.mode != NotifyWhileGrabbed)
toplevel->has_focus = TRUE; toplevel->has_focus = TRUE;
break; break;
case NotifyPointer: case NotifyPointer:
/* The X server sends NotifyPointer/NotifyGrab, /* The X server sends NotifyPointer/NotifyGrab,
* but the pointer focus is ignored while a * but the pointer focus is ignored while a
* grab is in effect * grab is in effect
*/ */
if (xevent->xfocus.mode != NotifyGrab && if (xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_pointer_focus = TRUE; toplevel->has_pointer_focus = TRUE;
break; break;
case NotifyInferior: case NotifyInferior:
case NotifyPointerRoot: case NotifyPointerRoot:
case NotifyDetailNone: case NotifyDetailNone:
break; break;
} }
if (HAS_FOCUS (toplevel) != had_focus) if (HAS_FOCUS (toplevel) != had_focus)
generate_focus_event (device_manager, window, TRUE); generate_focus_event (device_manager, window, TRUE);
} }
break; break;
case FocusOut: case FocusOut:
GDK_NOTE (EVENTS, GDK_NOTE (EVENTS,
g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s",
xevent->xfocus.window, xevent->xfocus.window,
notify_details[xevent->xfocus.detail], notify_details[xevent->xfocus.detail],
notify_modes[xevent->xfocus.mode])); notify_modes[xevent->xfocus.mode]));
if (toplevel) if (toplevel)
{ {
gboolean had_focus = HAS_FOCUS (toplevel); gboolean had_focus = HAS_FOCUS (toplevel);
switch (xevent->xfocus.detail) switch (xevent->xfocus.detail)
{ {
case NotifyAncestor: case NotifyAncestor:
case NotifyVirtual: case NotifyVirtual:
/* When the focus moves from the window or a descendent /* When the focus moves from the window or a descendent
* of the window to an ancestor of the window, *and* the * of the window to an ancestor of the window, *and* the
* pointer is inside the window, then we were previously * pointer is inside the window, then we were previously
* receiving keystroke events in the has_focus_window * receiving keystroke events in the has_focus_window
* case and are now receiving them in the * case and are now receiving them in the
* has_pointer_focus case. * has_pointer_focus case.
*/ */
if (toplevel->has_pointer && if (toplevel->has_pointer &&
xevent->xfocus.mode != NotifyGrab && xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_pointer_focus = TRUE; toplevel->has_pointer_focus = TRUE;
/* fall through */ /* fall through */
case NotifyNonlinear: case NotifyNonlinear:
case NotifyNonlinearVirtual: case NotifyNonlinearVirtual:
if (xevent->xfocus.mode != NotifyGrab && if (xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_focus_window = FALSE; toplevel->has_focus_window = FALSE;
if (xevent->xfocus.mode != NotifyWhileGrabbed) if (xevent->xfocus.mode != NotifyWhileGrabbed)
toplevel->has_focus = FALSE; toplevel->has_focus = FALSE;
break; break;
case NotifyPointer: case NotifyPointer:
if (xevent->xfocus.mode != NotifyGrab && if (xevent->xfocus.mode != NotifyGrab &&
xevent->xfocus.mode != NotifyUngrab) xevent->xfocus.mode != NotifyUngrab)
toplevel->has_pointer_focus = FALSE; toplevel->has_pointer_focus = FALSE;
break; break;
case NotifyInferior: case NotifyInferior:
case NotifyPointerRoot: case NotifyPointerRoot:
case NotifyDetailNone: case NotifyDetailNone:
break; break;
} }
if (HAS_FOCUS (toplevel) != had_focus) if (HAS_FOCUS (toplevel) != had_focus)
generate_focus_event (device_manager, window, FALSE); generate_focus_event (device_manager, window, FALSE);
} }
break; break;
default: default:
@ -862,12 +862,12 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
if (return_val) if (return_val)
{ {
if (event->any.window) if (event->any.window)
g_object_ref (event->any.window); g_object_ref (event->any.window);
if (((event->any.type == GDK_ENTER_NOTIFY) || if (((event->any.type == GDK_ENTER_NOTIFY) ||
(event->any.type == GDK_LEAVE_NOTIFY)) && (event->any.type == GDK_LEAVE_NOTIFY)) &&
(event->crossing.subwindow != NULL)) (event->crossing.subwindow != NULL))
g_object_ref (event->crossing.subwindow); g_object_ref (event->crossing.subwindow);
} }
else else
{ {
@ -883,15 +883,15 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
} }
static GList * static GList *
gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager, gdk_x11_device_manager_core_list_devices (GdkDeviceManager *device_manager,
GdkDeviceType type) GdkDeviceType type)
{ {
GdkDeviceManagerCore *device_manager_core; GdkX11DeviceManagerCore *device_manager_core;
GList *devices = NULL; GList *devices = NULL;
if (type == GDK_DEVICE_TYPE_MASTER) if (type == GDK_DEVICE_TYPE_MASTER)
{ {
device_manager_core = (GdkDeviceManagerCore *) device_manager; device_manager_core = (GdkX11DeviceManagerCore *) device_manager;
devices = g_list_prepend (devices, device_manager_core->core_keyboard); devices = g_list_prepend (devices, device_manager_core->core_keyboard);
devices = g_list_prepend (devices, device_manager_core->core_pointer); devices = g_list_prepend (devices, device_manager_core->core_pointer);
} }
@ -900,10 +900,10 @@ gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager,
} }
static GdkDevice * static GdkDevice *
gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager) gdk_x11_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager)
{ {
GdkDeviceManagerCore *device_manager_core; GdkX11DeviceManagerCore *device_manager_core;
device_manager_core = (GdkDeviceManagerCore *) device_manager; device_manager_core = (GdkX11DeviceManagerCore *) device_manager;
return device_manager_core->core_pointer; return device_manager_core->core_pointer;
} }

View File

@ -1,54 +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_CORE_H__
#define __GDK_DEVICE_MANAGER_CORE_H__
#include "gdkdevicemanagerprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE_MANAGER_CORE (gdk_device_manager_core_get_type ())
#define GDK_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCore))
#define GDK_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass))
#define GDK_IS_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER_CORE))
#define GDK_IS_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER_CORE))
#define GDK_DEVICE_MANAGER_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass))
typedef struct _GdkDeviceManagerCore GdkDeviceManagerCore;
typedef struct _GdkDeviceManagerCoreClass GdkDeviceManagerCoreClass;
struct _GdkDeviceManagerCore
{
GdkDeviceManager parent_object;
GdkDevice *core_pointer;
GdkDevice *core_keyboard;
};
struct _GdkDeviceManagerCoreClass
{
GdkDeviceManagerClass parent_class;
};
GType gdk_device_manager_core_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_DEVICE_MANAGER_CORE_H__ */

View File

@ -19,7 +19,7 @@
#include "config.h" #include "config.h"
#include "gdkdevicemanager-core.h" #include "gdkx11devicemanager-core.h"
#ifdef XINPUT_XFREE #ifdef XINPUT_XFREE
#include "gdkdevicemanager-xi.h" #include "gdkdevicemanager-xi.h"
#ifdef XINPUT_2 #ifdef XINPUT_2
@ -79,7 +79,7 @@ _gdk_x11_device_manager_new (GdkDisplay *display)
GDK_NOTE (INPUT, g_print ("Creating core device manager\n")); GDK_NOTE (INPUT, g_print ("Creating core device manager\n"));
return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE, return g_object_new (GDK_TYPE_X11_DEVICE_MANAGER_CORE,
"display", display, "display", display,
NULL); NULL);
} }

View File

@ -57,7 +57,7 @@ static GList * gdk_device_manager_xi_list_devices (GdkDeviceManager *devic
GdkDeviceType type); GdkDeviceType type);
G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerXI, gdk_device_manager_xi, GDK_TYPE_DEVICE_MANAGER_CORE, G_DEFINE_TYPE_WITH_CODE (GdkDeviceManagerXI, gdk_device_manager_xi, GDK_TYPE_X11_DEVICE_MANAGER_CORE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR, G_IMPLEMENT_INTERFACE (GDK_TYPE_EVENT_TRANSLATOR,
gdk_device_manager_xi_event_translator_init)) gdk_device_manager_xi_event_translator_init))

View File

@ -20,7 +20,7 @@
#ifndef __GDK_DEVICE_MANAGER_XI_H__ #ifndef __GDK_DEVICE_MANAGER_XI_H__
#define __GDK_DEVICE_MANAGER_XI_H__ #define __GDK_DEVICE_MANAGER_XI_H__
#include "gdkdevicemanager-core.h" #include "gdkx11devicemanager-core.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -37,7 +37,7 @@ typedef struct _GdkDeviceManagerXIClass GdkDeviceManagerXIClass;
struct _GdkDeviceManagerXI struct _GdkDeviceManagerXI
{ {
GdkDeviceManagerCore parent_object; GdkX11DeviceManagerCore parent_object;
GdkDevice *core_pointer; GdkDevice *core_pointer;
GdkDevice *core_keyboard; GdkDevice *core_keyboard;
@ -47,7 +47,7 @@ struct _GdkDeviceManagerXI
struct _GdkDeviceManagerXIClass struct _GdkDeviceManagerXIClass
{ {
GdkDeviceManagerCoreClass parent_class; GdkX11DeviceManagerCoreClass parent_class;
}; };
GType gdk_device_manager_xi_get_type (void) G_GNUC_CONST; GType gdk_device_manager_xi_get_type (void) G_GNUC_CONST;

View File

@ -56,6 +56,8 @@
#define __GDKX_H_INSIDE__ #define __GDKX_H_INSIDE__
#include <gdk/x11/gdkx11cursor.h> #include <gdk/x11/gdkx11cursor.h>
#include <gdk/x11/gdkx11device-core.h>
#include <gdk/x11/gdkx11devicemanager-core.h>
#include <gdk/x11/gdkx11display.h> #include <gdk/x11/gdkx11display.h>
#include <gdk/x11/gdkx11displaymanager.h> #include <gdk/x11/gdkx11displaymanager.h>
#include <gdk/x11/gdkx11keys.h> #include <gdk/x11/gdkx11keys.h>

View File

@ -0,0 +1,51 @@
/* 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_CORE_H__
#define __GDK_X11_DEVICE_CORE_H__
#include "gdkdeviceprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_X11_DEVICE_CORE (gdk_x11_device_core_get_type ())
#define GDK_X11_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_CORE, GdkX11DeviceCore))
#define GDK_X11_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_CORE, GdkX11DeviceCoreClass))
#define GDK_IS_X11_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_CORE))
#define GDK_IS_X11_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_CORE))
#define GDK_X11_DEVICE_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_CORE, GdkX11DeviceCoreClass))
typedef struct _GdkX11DeviceCore GdkX11DeviceCore;
typedef struct _GdkX11DeviceCoreClass GdkX11DeviceCoreClass;
struct _GdkX11DeviceCore
{
GdkDevice parent_instance;
};
struct _GdkX11DeviceCoreClass
{
GdkDeviceClass parent_class;
};
GType gdk_x11_device_core_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_X11_DEVICE_CORE_H__ */

View File

@ -0,0 +1,54 @@
/* 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_CORE_H__
#define __GDK_X11_DEVICE_MANAGER_CORE_H__
#include "gdkdevicemanagerprivate.h"
G_BEGIN_DECLS
#define GDK_TYPE_X11_DEVICE_MANAGER_CORE (gdk_x11_device_manager_core_get_type ())
#define GDK_X11_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_X11_DEVICE_MANAGER_CORE, GdkX11DeviceManagerCore))
#define GDK_X11_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_X11_DEVICE_MANAGER_CORE, GdkX11DeviceManagerCoreClass))
#define GDK_IS_X11_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_X11_DEVICE_MANAGER_CORE))
#define GDK_IS_X11_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_X11_DEVICE_MANAGER_CORE))
#define GDK_X11_DEVICE_MANAGER_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_X11_DEVICE_MANAGER_CORE, GdkX11DeviceManagerCoreClass))
typedef struct _GdkX11DeviceManagerCore GdkX11DeviceManagerCore;
typedef struct _GdkX11DeviceManagerCoreClass GdkX11DeviceManagerCoreClass;
struct _GdkX11DeviceManagerCore
{
GdkDeviceManager parent_object;
GdkDevice *core_pointer;
GdkDevice *core_keyboard;
};
struct _GdkX11DeviceManagerCoreClass
{
GdkDeviceManagerClass parent_class;
};
GType gdk_x11_device_manager_core_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_X11_DEVICE_MANAGER_CORE_H__ */