1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 #include "gdkdevice-broadway.h"
24 #include "gdkwindow.h"
25 #include "gdkprivate-broadway.h"
27 static gboolean gdk_broadway_device_get_history (GdkDevice *device,
31 GdkTimeCoord ***events,
33 static void gdk_broadway_device_get_state (GdkDevice *device,
36 GdkModifierType *mask);
37 static void gdk_broadway_device_set_window_cursor (GdkDevice *device,
40 static void gdk_broadway_device_warp (GdkDevice *device,
44 static gboolean gdk_broadway_device_query_state (GdkDevice *device,
46 GdkWindow **root_window,
47 GdkWindow **child_window,
52 GdkModifierType *mask);
53 static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device,
55 gboolean owner_events,
56 GdkEventMask event_mask,
57 GdkWindow *confine_to,
60 static void gdk_broadway_device_ungrab (GdkDevice *device,
62 static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice *device,
65 GdkModifierType *mask,
66 gboolean get_toplevel);
67 static void gdk_broadway_device_select_window_events (GdkDevice *device,
69 GdkEventMask event_mask);
72 G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE)
75 gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
77 GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
79 device_class->get_history = gdk_broadway_device_get_history;
80 device_class->get_state = gdk_broadway_device_get_state;
81 device_class->set_window_cursor = gdk_broadway_device_set_window_cursor;
82 device_class->warp = gdk_broadway_device_warp;
83 device_class->query_state = gdk_broadway_device_query_state;
84 device_class->grab = gdk_broadway_device_grab;
85 device_class->ungrab = gdk_broadway_device_ungrab;
86 device_class->window_at_position = gdk_broadway_device_window_at_position;
87 device_class->select_window_events = gdk_broadway_device_select_window_events;
91 gdk_broadway_device_init (GdkBroadwayDevice *device_core)
95 device = GDK_DEVICE (device_core);
97 _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_X, 0, 0, 1);
98 _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_Y, 0, 0, 1);
102 gdk_broadway_device_get_history (GdkDevice *device,
106 GdkTimeCoord ***events,
113 gdk_broadway_device_get_state (GdkDevice *device,
116 GdkModifierType *mask)
120 gdk_window_get_pointer (window, &x_int, &y_int, mask);
130 gdk_broadway_device_set_window_cursor (GdkDevice *device,
137 gdk_broadway_device_warp (GdkDevice *device,
145 gdk_broadway_device_query_state (GdkDevice *device,
147 GdkWindow **root_window,
148 GdkWindow **child_window,
153 GdkModifierType *mask)
159 gdk_broadway_device_grab (GdkDevice *device,
161 gboolean owner_events,
162 GdkEventMask event_mask,
163 GdkWindow *confine_to,
167 return GDK_GRAB_NOT_VIEWABLE;
171 gdk_broadway_device_ungrab (GdkDevice *device,
177 gdk_broadway_device_window_at_position (GdkDevice *device,
180 GdkModifierType *mask,
181 gboolean get_toplevel)
187 gdk_broadway_device_select_window_events (GdkDevice *device,
189 GdkEventMask event_mask)