1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Copyright (C) 1998-1999 Tor Lillqvist
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team.
27 * GTK+ DirectFB backend
28 * Copyright (C) 2001-2002 convergence integrated media GmbH
29 * Copyright (C) 2002-2004 convergence GmbH
30 * Written by Denis Oliver Kropp <dok@convergence.de> and
31 * Sven Neumann <sven@convergence.de>
35 Main entry point for 2.6 seems to be open_display so
36 most stuff in main is moved over to gdkdisplay-directfb.c
37 I'll move stub functions here that make no sense for directfb
47 #include "gdkdisplay.h"
48 #include "gdkdirectfb.h"
49 #include "gdkprivate-directfb.h"
51 #include "gdkinternals.h"
53 #include "gdkinput-directfb.h"
60 _gdk_windowing_init (void)
62 /* Not that usable called before parse_args
67 gdk_set_use_xshm (gboolean use_xshm)
72 gdk_get_use_xshm (void)
78 _gdk_windowing_display_set_sm_client_id (GdkDisplay *display,const gchar *sm_client_id)
80 g_message ("gdk_set_sm_client_id() is unimplemented.");
85 _gdk_windowing_exit (void)
88 if (_gdk_display->buffer)
89 _gdk_display->buffer->Release (_gdk_display->buffer);
91 _gdk_directfb_keyboard_exit ();
93 if (_gdk_display->keyboard)
94 _gdk_display->keyboard->Release (_gdk_display->keyboard);
96 _gdk_display->layer->Release (_gdk_display->layer);
98 _gdk_display->directfb->Release (_gdk_display->directfb);
100 g_free (_gdk_display);
105 gdk_get_display (void)
107 return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
112 static const guint type_masks[] =
114 GDK_STRUCTURE_MASK, /* GDK_DELETE = 0, */
115 GDK_STRUCTURE_MASK, /* GDK_DESTROY = 1, */
116 GDK_EXPOSURE_MASK, /* GDK_EXPOSE = 2, */
117 GDK_POINTER_MOTION_MASK, /* GDK_MOTION_NOTIFY = 3, */
118 GDK_BUTTON_PRESS_MASK, /* GDK_BUTTON_PRESS = 4, */
119 GDK_BUTTON_PRESS_MASK, /* GDK_2BUTTON_PRESS = 5, */
120 GDK_BUTTON_PRESS_MASK, /* GDK_3BUTTON_PRESS = 6, */
121 GDK_BUTTON_RELEASE_MASK, /* GDK_BUTTON_RELEASE = 7, */
122 GDK_KEY_PRESS_MASK, /* GDK_KEY_PRESS = 8, */
123 GDK_KEY_RELEASE_MASK, /* GDK_KEY_RELEASE = 9, */
124 GDK_ENTER_NOTIFY_MASK, /* GDK_ENTER_NOTIFY = 10, */
125 GDK_LEAVE_NOTIFY_MASK, /* GDK_LEAVE_NOTIFY = 11, */
126 GDK_FOCUS_CHANGE_MASK, /* GDK_FOCUS_CHANGE = 12, */
127 GDK_STRUCTURE_MASK, /* GDK_CONFIGURE = 13, */
128 GDK_VISIBILITY_NOTIFY_MASK,/* GDK_MAP = 14, */
129 GDK_VISIBILITY_NOTIFY_MASK,/* GDK_UNMAP = 15, */
130 GDK_PROPERTY_CHANGE_MASK, /* GDK_PROPERTY_NOTIFY = 16, */
131 GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_CLEAR = 17, */
132 GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_REQUEST = 18, */
133 GDK_PROPERTY_CHANGE_MASK, /* GDK_SELECTION_NOTIFY = 19, */
134 GDK_PROXIMITY_IN_MASK, /* GDK_PROXIMITY_IN = 20, */
135 GDK_PROXIMITY_OUT_MASK, /* GDK_PROXIMITY_OUT = 21, */
136 GDK_ALL_EVENTS_MASK, /* GDK_DRAG_ENTER = 22, */
137 GDK_ALL_EVENTS_MASK, /* GDK_DRAG_LEAVE = 23, */
138 GDK_ALL_EVENTS_MASK, /* GDK_DRAG_MOTION = 24, */
139 GDK_ALL_EVENTS_MASK, /* GDK_DRAG_STATUS = 25, */
140 GDK_ALL_EVENTS_MASK, /* GDK_DROP_START = 26, */
141 GDK_ALL_EVENTS_MASK, /* GDK_DROP_FINISHED = 27, */
142 GDK_ALL_EVENTS_MASK, /* GDK_CLIENT_EVENT = 28, */
143 GDK_VISIBILITY_NOTIFY_MASK,/* GDK_VISIBILITY_NOTIFY = 29, */
144 GDK_EXPOSURE_MASK, /* GDK_NO_EXPOSE = 30, */
145 GDK_SCROLL_MASK /* GDK_SCROLL = 31 */
149 gdk_directfb_other_event_window (GdkWindow *window,
156 while (w != _gdk_parent_root)
158 /* Huge hack, so that we don't propagate events to GtkWindow->frame */
160 (GDK_WINDOW_OBJECT (w)->window_type != GDK_WINDOW_CHILD) &&
161 (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
164 evmask = GDK_WINDOW_OBJECT (w)->event_mask;
166 if (evmask & type_masks[type])
169 w = gdk_window_get_parent (w);
176 gdk_directfb_pointer_event_window (GdkWindow *window,
180 GdkModifierType mask;
183 gdk_directfb_mouse_get_info (NULL, NULL, &mask);
185 if (_gdk_directfb_pointer_grab_window && !_gdk_directfb_pointer_grab_owner_events )
187 evmask = _gdk_directfb_pointer_grab_events;
189 if (evmask & (GDK_BUTTON1_MOTION_MASK |
190 GDK_BUTTON2_MOTION_MASK |
191 GDK_BUTTON3_MOTION_MASK))
193 if (((mask & GDK_BUTTON1_MASK) &&
194 (evmask & GDK_BUTTON1_MOTION_MASK)) ||
195 ((mask & GDK_BUTTON2_MASK) &&
196 (evmask & GDK_BUTTON2_MOTION_MASK)) ||
197 ((mask & GDK_BUTTON3_MASK) &&
198 (evmask & GDK_BUTTON3_MOTION_MASK)))
199 evmask |= GDK_POINTER_MOTION_MASK;
202 if (evmask & type_masks[type]) {
204 if( _gdk_directfb_pointer_grab_owner_events ) {
205 return _gdk_directfb_pointer_grab_window;
207 GdkWindowObject *obj= GDK_WINDOW_OBJECT(window);
208 while (obj != NULL &&
209 obj != GDK_WINDOW_OBJECT(_gdk_directfb_pointer_grab_window)) {
210 obj = (GdkWindowObject *)obj->parent;
212 if( obj ==GDK_WINDOW_OBJECT(_gdk_directfb_pointer_grab_window) ) {
215 //was not child of the grab window so return the grab window
216 return _gdk_directfb_pointer_grab_window;
223 while (w != _gdk_parent_root)
225 /* Huge hack, so that we don't propagate events to GtkWindow->frame */
227 (GDK_WINDOW_OBJECT (w)->window_type != GDK_WINDOW_CHILD) &&
228 (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
231 evmask = GDK_WINDOW_OBJECT (w)->event_mask;
233 if (evmask & (GDK_BUTTON1_MOTION_MASK |
234 GDK_BUTTON2_MOTION_MASK |
235 GDK_BUTTON3_MOTION_MASK))
237 if (((mask & GDK_BUTTON1_MASK) &&
238 (evmask & GDK_BUTTON1_MOTION_MASK)) ||
239 ((mask & GDK_BUTTON2_MASK) &&
240 (evmask & GDK_BUTTON2_MOTION_MASK)) ||
241 ((mask & GDK_BUTTON3_MASK) &&
242 (evmask & GDK_BUTTON3_MOTION_MASK)))
243 evmask |= GDK_POINTER_MOTION_MASK;
246 if (evmask & type_masks[type])
249 w = gdk_window_get_parent (w);
256 gdk_directfb_keyboard_event_window (GdkWindow *window,
262 if (_gdk_directfb_keyboard_grab_window &&
263 !_gdk_directfb_keyboard_grab_owner_events)
265 return _gdk_directfb_keyboard_grab_window;
269 while (w != _gdk_parent_root)
271 /* Huge hack, so that we don't propagate events to GtkWindow->frame */
273 (GDK_WINDOW_OBJECT (w)->window_type != GDK_WINDOW_CHILD) &&
274 (g_object_get_data (G_OBJECT (w), "gdk-window-child-handler")))
277 evmask = GDK_WINDOW_OBJECT (w)->event_mask;
279 if (evmask & type_masks[type])
282 w = gdk_window_get_parent (w);
289 gdk_directfb_event_make (GdkWindow *window,
292 GdkEvent *event = gdk_event_new (GDK_NOTHING);
293 guint32 the_time = gdk_directfb_get_time ();
294 event->any.type = type;
295 event->any.window = g_object_ref (window);
296 event->any.send_event = FALSE;
300 case GDK_MOTION_NOTIFY:
301 event->motion.time = the_time;
302 event->motion.axes = NULL;
304 case GDK_BUTTON_PRESS:
305 case GDK_2BUTTON_PRESS:
306 case GDK_3BUTTON_PRESS:
307 case GDK_BUTTON_RELEASE:
308 event->button.time = the_time;
309 event->button.axes = NULL;
312 case GDK_KEY_RELEASE:
313 event->key.time = the_time;
315 case GDK_ENTER_NOTIFY:
316 case GDK_LEAVE_NOTIFY:
317 event->crossing.time = the_time;
319 case GDK_PROPERTY_NOTIFY:
320 event->property.time = the_time;
322 case GDK_SELECTION_CLEAR:
323 case GDK_SELECTION_REQUEST:
324 case GDK_SELECTION_NOTIFY:
325 event->selection.time = the_time;
327 case GDK_PROXIMITY_IN:
328 case GDK_PROXIMITY_OUT:
329 event->proximity.time = the_time;
333 case GDK_DRAG_MOTION:
334 case GDK_DRAG_STATUS:
336 case GDK_DROP_FINISHED:
337 event->dnd.time = the_time;
340 event->scroll.time = the_time;
342 case GDK_FOCUS_CHANGE:
346 case GDK_CLIENT_EVENT:
347 case GDK_VISIBILITY_NOTIFY:
356 _gdk_event_queue_append (gdk_display_get_default (), event);
362 gdk_error_trap_push (void)
367 gdk_error_trap_pop (void)
373 gdk_keyboard_grab (GdkWindow *window,
377 return gdk_directfb_keyboard_grab (gdk_display_get_default(),
384 *--------------------------------------------------------------
387 * Grabs the pointer to a specific window
390 * "window" is the window which will receive the grab
391 * "owner_events" specifies whether events will be reported as is,
392 * or relative to "window"
393 * "event_mask" masks only interesting events
394 * "confine_to" limits the cursor movement to the specified window
395 * "cursor" changes the cursor for the duration of the grab
396 * "time" specifies the time
401 * requires a corresponding call to gdk_pointer_ungrab
403 *--------------------------------------------------------------
408 _gdk_windowing_pointer_grab (GdkWindow *window,
410 gboolean owner_events,
411 GdkEventMask event_mask,
412 GdkWindow *confine_to,
416 g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
417 g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
419 _gdk_display_add_pointer_grab (&_gdk_display->parent,
428 return GDK_GRAB_SUCCESS;
431 #define __GDK_MAIN_X11_C__
432 #include "gdkaliasdef.c"