]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkdevice-broadway.c
[broadway] Make broadway build with new gdk-backend setup
[~andy/gtk] / gdk / broadway / gdkdevice-broadway.c
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include "config.h"
21
22 #include "gdkdevice-broadway.h"
23
24 #include "gdkwindow.h"
25 #include "gdkprivate-broadway.h"
26
27 static gboolean gdk_broadway_device_get_history (GdkDevice      *device,
28                                                  GdkWindow      *window,
29                                                  guint32         start,
30                                                  guint32         stop,
31                                                  GdkTimeCoord ***events,
32                                                  gint           *n_events);
33 static void gdk_broadway_device_get_state (GdkDevice       *device,
34                                            GdkWindow       *window,
35                                            gdouble         *axes,
36                                            GdkModifierType *mask);
37 static void gdk_broadway_device_set_window_cursor (GdkDevice *device,
38                                                    GdkWindow *window,
39                                                    GdkCursor *cursor);
40 static void gdk_broadway_device_warp (GdkDevice *device,
41                                       GdkScreen *screen,
42                                       gint       x,
43                                       gint       y);
44 static gboolean gdk_broadway_device_query_state (GdkDevice        *device,
45                                                  GdkWindow        *window,
46                                                  GdkWindow       **root_window,
47                                                  GdkWindow       **child_window,
48                                                  gint             *root_x,
49                                                  gint             *root_y,
50                                                  gint             *win_x,
51                                                  gint             *win_y,
52                                                  GdkModifierType  *mask);
53 static GdkGrabStatus gdk_broadway_device_grab   (GdkDevice     *device,
54                                                  GdkWindow     *window,
55                                                  gboolean       owner_events,
56                                                  GdkEventMask   event_mask,
57                                                  GdkWindow     *confine_to,
58                                                  GdkCursor     *cursor,
59                                                  guint32        time_);
60 static void          gdk_broadway_device_ungrab (GdkDevice     *device,
61                                                  guint32        time_);
62 static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice       *device,
63                                                            gint            *win_x,
64                                                            gint            *win_y,
65                                                            GdkModifierType *mask,
66                                                            gboolean         get_toplevel);
67 static void      gdk_broadway_device_select_window_events (GdkDevice       *device,
68                                                            GdkWindow       *window,
69                                                            GdkEventMask     event_mask);
70
71
72 G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE)
73
74 static void
75 gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
76 {
77   GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
78
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;
88 }
89
90 static void
91 gdk_broadway_device_init (GdkBroadwayDevice *device_core)
92 {
93   GdkDevice *device;
94
95   device = GDK_DEVICE (device_core);
96
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);
99 }
100
101 static gboolean
102 gdk_broadway_device_get_history (GdkDevice      *device,
103                                  GdkWindow      *window,
104                                  guint32         start,
105                                  guint32         stop,
106                                  GdkTimeCoord ***events,
107                                  gint           *n_events)
108 {
109   return FALSE;
110 }
111
112 static void
113 gdk_broadway_device_get_state (GdkDevice       *device,
114                                GdkWindow       *window,
115                                gdouble         *axes,
116                                GdkModifierType *mask)
117 {
118   gint x_int, y_int;
119
120   gdk_window_get_pointer (window, &x_int, &y_int, mask);
121
122   if (axes)
123     {
124       axes[0] = x_int;
125       axes[1] = y_int;
126     }
127 }
128
129 static void
130 gdk_broadway_device_set_window_cursor (GdkDevice *device,
131                                        GdkWindow *window,
132                                        GdkCursor *cursor)
133 {
134 }
135
136 static void
137 gdk_broadway_device_warp (GdkDevice *device,
138                           GdkScreen *screen,
139                           gint       x,
140                           gint       y)
141 {
142 }
143
144 static gboolean
145 gdk_broadway_device_query_state (GdkDevice        *device,
146                                  GdkWindow        *window,
147                                  GdkWindow       **root_window,
148                                  GdkWindow       **child_window,
149                                  gint             *root_x,
150                                  gint             *root_y,
151                                  gint             *win_x,
152                                  gint             *win_y,
153                                  GdkModifierType  *mask)
154 {
155   return FALSE;
156 }
157
158 static GdkGrabStatus
159 gdk_broadway_device_grab (GdkDevice    *device,
160                           GdkWindow    *window,
161                           gboolean      owner_events,
162                           GdkEventMask  event_mask,
163                           GdkWindow    *confine_to,
164                           GdkCursor    *cursor,
165                           guint32       time_)
166 {
167   return GDK_GRAB_NOT_VIEWABLE;
168 }
169
170 static void
171 gdk_broadway_device_ungrab (GdkDevice *device,
172                             guint32    time_)
173 {
174 }
175
176 static GdkWindow *
177 gdk_broadway_device_window_at_position (GdkDevice       *device,
178                                         gint            *win_x,
179                                         gint            *win_y,
180                                         GdkModifierType *mask,
181                                         gboolean         get_toplevel)
182 {
183   return NULL;
184 }
185
186 static void
187 gdk_broadway_device_select_window_events (GdkDevice    *device,
188                                           GdkWindow    *window,
189                                           GdkEventMask  event_mask)
190 {
191 }