1 /* GDK - The GIMP Drawing Kit
4 * Copyright 2001 Sun Microsystems Inc.
6 * Erwann Chenede <erwann.chenede@sun.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 #include "gdkdisplay.h"
27 #include "gdkdisplayprivate.h"
29 #include "gdkdeviceprivate.h"
30 #include "gdkevents.h"
31 #include "gdkwindowimpl.h"
32 #include "gdkinternals.h"
33 #include "gdkmarshalers.h"
34 #include "gdkscreen.h"
41 * @Short_description: Controls a set of GdkScreens and their associated input devices
44 * #GdkDisplay objects purpose are two fold:
47 * To manage and provide information about input devices (pointers
51 * To manage and provide information about the available #GdkScreens
55 * GdkDisplay objects are the GDK representation of an X Display,
56 * which can be described as <emphasis>a workstation consisting of
57 * a keyboard, a pointing device (such as a mouse) and one or more
59 * It is used to open and keep track of various GdkScreen objects
60 * currently instantiated by the application. It is also used to
61 * access the keyboard(s) and mouse pointer(s) of the display.
63 * Most of the input device handling has been factored out into
64 * the separate #GdkDeviceManager object. Every display has a
65 * device manager, which you can obtain using
66 * gdk_display_get_device_manager().
76 static void gdk_display_dispose (GObject *object);
77 static void gdk_display_finalize (GObject *object);
80 static GdkAppLaunchContext *gdk_display_real_get_app_launch_context (GdkDisplay *display);
82 static guint signals[LAST_SIGNAL] = { 0 };
84 G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT)
87 gdk_display_class_init (GdkDisplayClass *class)
89 GObjectClass *object_class = G_OBJECT_CLASS (class);
91 object_class->finalize = gdk_display_finalize;
92 object_class->dispose = gdk_display_dispose;
94 class->get_app_launch_context = gdk_display_real_get_app_launch_context;
95 class->window_type = GDK_TYPE_WINDOW;
99 * @display: the object on which the signal is emitted
101 * The ::opened signal is emitted when the connection to the windowing
102 * system for @display is opened.
105 g_signal_new (g_intern_static_string ("opened"),
106 G_OBJECT_CLASS_TYPE (object_class),
109 g_cclosure_marshal_VOID__VOID,
113 * GdkDisplay::closed:
114 * @display: the object on which the signal is emitted
115 * @is_error: %TRUE if the display was closed due to an error
117 * The ::closed signal is emitted when the connection to the windowing
118 * system for @display is closed.
123 g_signal_new (g_intern_static_string ("closed"),
124 G_OBJECT_CLASS_TYPE (object_class),
126 G_STRUCT_OFFSET (GdkDisplayClass, closed),
128 _gdk_marshal_VOID__BOOLEAN,
135 free_pointer_info (GdkPointerWindowInfo *info)
137 if (info->toplevel_under_pointer)
138 g_object_unref (info->toplevel_under_pointer);
139 g_slice_free (GdkPointerWindowInfo, info);
143 free_device_grab (GdkDeviceGrabInfo *info)
145 g_object_unref (info->window);
146 g_object_unref (info->native_window);
151 free_device_grabs_foreach (gpointer key,
157 g_list_foreach (list, (GFunc) free_device_grab, NULL);
164 device_removed_cb (GdkDeviceManager *device_manager,
168 g_hash_table_remove (display->multiple_click_info, device);
169 g_hash_table_remove (display->device_grabs, device);
170 g_hash_table_remove (display->pointers_info, device);
172 /* FIXME: change core pointer and remove from device list */
176 gdk_display_opened (GdkDisplay *display)
178 GdkDeviceManager *device_manager;
180 device_manager = gdk_display_get_device_manager (display);
182 g_signal_connect (device_manager, "device-removed",
183 G_CALLBACK (device_removed_cb), display);
187 gdk_display_init (GdkDisplay *display)
189 display->double_click_time = 250;
190 display->double_click_distance = 5;
192 display->device_grabs = g_hash_table_new (NULL, NULL);
193 display->motion_hint_info = g_hash_table_new_full (NULL, NULL, NULL,
194 (GDestroyNotify) g_free);
196 display->pointers_info = g_hash_table_new_full (NULL, NULL, NULL,
197 (GDestroyNotify) free_pointer_info);
199 display->multiple_click_info = g_hash_table_new_full (NULL, NULL, NULL,
200 (GDestroyNotify) g_free);
202 g_signal_connect (display, "opened",
203 G_CALLBACK (gdk_display_opened), NULL);
207 gdk_display_dispose (GObject *object)
209 GdkDisplay *display = GDK_DISPLAY (object);
210 GdkDeviceManager *device_manager;
212 device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
214 g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
215 g_list_free (display->queued_events);
216 display->queued_events = NULL;
217 display->queued_tail = NULL;
221 /* this is to make it drop devices which may require using the X
222 * display and therefore can't be cleaned up in finalize.
223 * It will also disconnect device_removed_cb
225 g_object_run_dispose (G_OBJECT (display->device_manager));
228 G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
232 gdk_display_finalize (GObject *object)
234 GdkDisplay *display = GDK_DISPLAY (object);
236 g_hash_table_foreach_remove (display->device_grabs,
237 free_device_grabs_foreach,
239 g_hash_table_destroy (display->device_grabs);
241 g_hash_table_destroy (display->motion_hint_info);
242 g_hash_table_destroy (display->pointers_info);
243 g_hash_table_destroy (display->multiple_click_info);
245 if (display->device_manager)
246 g_object_unref (display->device_manager);
248 G_OBJECT_CLASS (gdk_display_parent_class)->finalize (object);
253 * @display: a #GdkDisplay
255 * Closes the connection to the windowing system for the given display,
256 * and cleans up associated resources.
261 gdk_display_close (GdkDisplay *display)
263 g_return_if_fail (GDK_IS_DISPLAY (display));
265 if (!display->closed)
267 display->closed = TRUE;
269 g_signal_emit (display, signals[CLOSED], 0, FALSE);
270 g_object_run_dispose (G_OBJECT (display));
272 g_object_unref (display);
277 * gdk_display_is_closed:
278 * @display: a #GdkDisplay
280 * Finds out if the display has been closed.
282 * Returns: %TRUE if the display is closed.
287 gdk_display_is_closed (GdkDisplay *display)
289 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
291 return display->closed;
295 * gdk_display_get_event:
296 * @display: a #GdkDisplay
298 * Gets the next #GdkEvent to be processed for @display, fetching events from the
299 * windowing system if necessary.
301 * Return value: the next #GdkEvent to be processed, or %NULL if no events
302 * are pending. The returned #GdkEvent should be freed with gdk_event_free().
307 gdk_display_get_event (GdkDisplay *display)
309 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
311 GDK_DISPLAY_GET_CLASS (display)->queue_events (display);
312 return _gdk_event_unqueue (display);
316 * gdk_display_peek_event:
317 * @display: a #GdkDisplay
319 * Gets a copy of the first #GdkEvent in the @display's event queue, without
320 * removing the event from the queue. (Note that this function will
321 * not get more events from the windowing system. It only checks the events
322 * that have already been moved to the GDK event queue.)
324 * Return value: a copy of the first #GdkEvent on the event queue, or %NULL
325 * if no events are in the queue. The returned #GdkEvent should be freed with
331 gdk_display_peek_event (GdkDisplay *display)
335 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
337 tmp_list = _gdk_event_queue_find_first (display);
340 return gdk_event_copy (tmp_list->data);
346 * gdk_display_put_event:
347 * @display: a #GdkDisplay
348 * @event: a #GdkEvent.
350 * Appends a copy of the given event onto the front of the event
351 * queue for @display.
356 gdk_display_put_event (GdkDisplay *display,
357 const GdkEvent *event)
359 g_return_if_fail (GDK_IS_DISPLAY (display));
360 g_return_if_fail (event != NULL);
362 _gdk_event_queue_append (display, gdk_event_copy (event));
363 /* If the main loop is blocking in a different thread, wake it up */
364 g_main_context_wakeup (NULL);
368 * gdk_display_pointer_ungrab:
369 * @display: a #GdkDisplay.
370 * @time_: a timestap (e.g. %GDK_CURRENT_TIME).
372 * Release any pointer grab.
376 * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
380 gdk_display_pointer_ungrab (GdkDisplay *display,
383 GdkDeviceManager *device_manager;
384 GList *devices, *dev;
387 g_return_if_fail (GDK_IS_DISPLAY (display));
389 device_manager = gdk_display_get_device_manager (display);
390 devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
392 /* FIXME: Should this be generic to all backends? */
393 /* FIXME: What happens with extended devices? */
394 for (dev = devices; dev; dev = dev->next)
398 if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
401 gdk_device_ungrab (device, time_);
404 g_list_free (devices);
408 * gdk_display_keyboard_ungrab:
409 * @display: a #GdkDisplay.
410 * @time_: a timestap (e.g #GDK_CURRENT_TIME).
412 * Release any keyboard grab
416 * Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
420 gdk_display_keyboard_ungrab (GdkDisplay *display,
423 GdkDeviceManager *device_manager;
424 GList *devices, *dev;
427 g_return_if_fail (GDK_IS_DISPLAY (display));
429 device_manager = gdk_display_get_device_manager (display);
430 devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
432 /* FIXME: Should this be generic to all backends? */
433 /* FIXME: What happens with extended devices? */
434 for (dev = devices; dev; dev = dev->next)
438 if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
441 gdk_device_ungrab (device, time);
444 g_list_free (devices);
450 * Emits a short beep on the default display.
455 gdk_display_beep (gdk_display_get_default ());
461 * Flushes the output buffers of all display connections and waits
462 * until all requests have been processed.
463 * This is rarely needed by applications.
470 list = gdk_display_manager_list_displays (gdk_display_manager_get ());
471 for (l = list; l; l = l->next)
473 GdkDisplay *display = l->data;
475 GDK_DISPLAY_GET_CLASS (display)->sync (display);
482 _gdk_display_enable_motion_hints (GdkDisplay *display,
485 gulong *device_serial, serial;
487 device_serial = g_hash_table_lookup (display->motion_hint_info, device);
491 device_serial = g_new0 (gulong, 1);
492 *device_serial = G_MAXULONG;
493 g_hash_table_insert (display->motion_hint_info, device, device_serial);
496 if (*device_serial != 0)
498 serial = _gdk_display_get_next_serial (display);
499 /* We might not actually generate the next request, so
500 make sure this triggers always, this may cause it to
501 trigger slightly too early, but this is just a hint
505 if (serial < *device_serial)
506 *device_serial = serial;
511 * gdk_display_get_pointer:
512 * @display: a #GdkDisplay
513 * @screen: (out) (allow-none) (transfer none): location to store the screen that the
514 * cursor is on, or %NULL.
515 * @x: (out) (allow-none): location to store root window X coordinate of pointer, or %NULL.
516 * @y: (out) (allow-none): location to store root window Y coordinate of pointer, or %NULL.
517 * @mask: (out) (allow-none): location to store current modifier mask, or %NULL
519 * Gets the current location of the pointer and the current modifier
520 * mask for a given display.
524 * Deprecated: 3.0: Use gdk_device_get_position() instead.
527 gdk_display_get_pointer (GdkDisplay *display,
531 GdkModifierType *mask)
533 GdkScreen *default_screen;
536 GdkModifierType tmp_mask;
538 g_return_if_fail (GDK_IS_DISPLAY (display));
540 if (gdk_display_is_closed (display))
543 default_screen = gdk_display_get_default_screen (display);
545 /* We call _gdk_device_query_state() here manually instead of
546 * gdk_device_get_position() because we care about the modifier mask */
548 _gdk_device_query_state (display->core_pointer,
549 gdk_screen_get_root_window (default_screen),
556 *screen = gdk_window_get_screen (root);
566 * gdk_display_get_window_at_pointer:
567 * @display: a #GdkDisplay
568 * @win_x: (out) (allow-none): return location for x coordinate of the pointer location relative
569 * to the window origin, or %NULL
570 * @win_y: (out) (allow-none): return location for y coordinate of the pointer location relative
571 & to the window origin, or %NULL
573 * Obtains the window underneath the mouse pointer, returning the location
574 * of the pointer in that window in @win_x, @win_y for @screen. Returns %NULL
575 * if the window under the mouse pointer is not known to GDK (for example,
576 * belongs to another application).
578 * Returns: (transfer none): the window under the mouse pointer, or %NULL
582 * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
585 gdk_display_get_window_at_pointer (GdkDisplay *display,
589 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
591 return gdk_device_get_window_at_position (display->core_pointer, win_x, win_y);
595 generate_grab_broken_event (GdkWindow *window,
598 GdkWindow *grab_window)
600 g_return_if_fail (window != NULL);
602 if (!GDK_WINDOW_DESTROYED (window))
606 event = gdk_event_new (GDK_GRAB_BROKEN);
607 event->grab_broken.window = g_object_ref (window);
608 event->grab_broken.send_event = FALSE;
609 event->grab_broken.implicit = implicit;
610 event->grab_broken.grab_window = grab_window;
611 gdk_event_set_device (event, device);
612 event->grab_broken.keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
614 gdk_event_put (event);
615 gdk_event_free (event);
620 _gdk_display_get_last_device_grab (GdkDisplay *display,
625 l = g_hash_table_lookup (display->device_grabs, device);
637 _gdk_display_add_device_grab (GdkDisplay *display,
640 GdkWindow *native_window,
641 GdkGrabOwnership grab_ownership,
642 gboolean owner_events,
643 GdkEventMask event_mask,
644 unsigned long serial_start,
648 GdkDeviceGrabInfo *info, *other_info;
651 info = g_new0 (GdkDeviceGrabInfo, 1);
653 info->window = g_object_ref (window);
654 info->native_window = g_object_ref (native_window);
655 info->serial_start = serial_start;
656 info->serial_end = G_MAXULONG;
657 info->owner_events = owner_events;
658 info->event_mask = event_mask;
660 info->implicit = implicit;
661 info->ownership = grab_ownership;
663 grabs = g_hash_table_lookup (display->device_grabs, device);
665 /* Find the first grab that has a larger start time (if any) and insert
666 * before that. I.E we insert after already existing grabs with same
668 for (l = grabs; l != NULL; l = l->next)
670 other_info = l->data;
672 if (info->serial_start < other_info->serial_start)
676 grabs = g_list_insert_before (grabs, l, info);
678 /* Make sure the new grab end before next grab */
681 other_info = l->data;
682 info->serial_end = other_info->serial_start;
685 /* Find any previous grab and update its end time */
686 l = g_list_find (grabs, info);
690 other_info = l->data;
691 other_info->serial_end = serial_start;
694 g_hash_table_insert (display->device_grabs, device, grabs);
699 /* _gdk_synthesize_crossing_events only works inside one toplevel.
700 This function splits things into two calls if needed, converting the
701 coordinates to the right toplevel */
703 synthesize_crossing_events (GdkDisplay *display,
705 GdkDevice *source_device,
706 GdkWindow *src_window,
707 GdkWindow *dest_window,
708 GdkCrossingMode crossing_mode,
712 GdkWindow *src_toplevel, *dest_toplevel;
713 GdkModifierType state;
717 src_toplevel = gdk_window_get_toplevel (src_window);
721 dest_toplevel = gdk_window_get_toplevel (dest_window);
723 dest_toplevel = NULL;
725 if (src_toplevel == NULL && dest_toplevel == NULL)
728 if (src_toplevel == NULL ||
729 src_toplevel == dest_toplevel)
732 gdk_window_get_device_position (dest_toplevel,
735 _gdk_synthesize_crossing_events (display,
738 device, source_device,
745 else if (dest_toplevel == NULL)
747 gdk_window_get_device_position (src_toplevel,
750 _gdk_synthesize_crossing_events (display,
753 device, source_device,
762 /* Different toplevels */
763 gdk_window_get_device_position (src_toplevel,
766 _gdk_synthesize_crossing_events (display,
769 device, source_device,
775 gdk_window_get_device_position (dest_toplevel,
778 _gdk_synthesize_crossing_events (display,
781 device, source_device,
791 get_current_toplevel (GdkDisplay *display,
795 GdkModifierType *state_out)
797 GdkWindow *pointer_window;
799 GdkModifierType state;
801 pointer_window = _gdk_device_window_at_position (device, &x, &y, &state, TRUE);
803 if (pointer_window != NULL &&
804 (GDK_WINDOW_DESTROYED (pointer_window) ||
805 GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_ROOT ||
806 GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_FOREIGN))
807 pointer_window = NULL;
813 return pointer_window;
817 switch_to_pointer_grab (GdkDisplay *display,
819 GdkDevice *source_device,
820 GdkDeviceGrabInfo *grab,
821 GdkDeviceGrabInfo *last_grab,
825 GdkWindow *src_window, *pointer_window, *new_toplevel;
826 GdkPointerWindowInfo *info;
828 GdkModifierType state;
831 /* Temporarily unset pointer to make sure we send the crossing events below */
832 old_grabs = g_hash_table_lookup (display->device_grabs, device);
833 g_hash_table_steal (display->device_grabs, device);
834 info = _gdk_display_get_pointer_info (display, device);
838 /* New grab is in effect */
840 /* We need to generate crossing events for the grab.
841 * However, there are never any crossing events for implicit grabs
842 * TODO: ... Actually, this could happen if the pointer window
843 * doesn't have button mask so a parent gets the event...
847 /* We send GRAB crossing events from the window under the pointer to the
848 grab window. Except if there is an old grab then we start from that */
850 src_window = last_grab->window;
852 src_window = info->window_under_pointer;
854 if (src_window != grab->window)
855 synthesize_crossing_events (display, device, source_device,
856 src_window, grab->window,
857 GDK_CROSSING_GRAB, time, serial);
859 /* !owner_event Grabbing a window that we're not inside, current status is
860 now NULL (i.e. outside grabbed window) */
861 if (!grab->owner_events && info->window_under_pointer != grab->window)
862 _gdk_display_set_window_under_pointer (display, device, NULL);
865 grab->activated = TRUE;
872 if (grab == NULL /* ungrab */ ||
873 (!last_grab->owner_events && grab->owner_events) /* switched to owner_events */ )
875 /* We force check what window we're in, and update the toplevel_under_pointer info,
876 * as that won't get told of this change with toplevel enter events.
878 if (info->toplevel_under_pointer)
879 g_object_unref (info->toplevel_under_pointer);
880 info->toplevel_under_pointer = NULL;
882 /* Ungrabbed slave devices don't have a position by
883 * itself, rather depend on its master pointer, so
884 * it doesn't make sense to track any position for
885 * these after the grab
887 if (grab || gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE)
888 new_toplevel = get_current_toplevel (display, device, &x, &y, &state);
892 /* w is now toplevel and x,y in toplevel coords */
893 info->toplevel_under_pointer = g_object_ref (new_toplevel);
894 info->toplevel_x = x;
895 info->toplevel_y = y;
900 if (grab == NULL) /* Ungrabbed, send events */
902 pointer_window = NULL;
905 /* Find (possibly virtual) child window */
907 _gdk_window_find_descendant_at (new_toplevel,
912 if (pointer_window != last_grab->window)
913 synthesize_crossing_events (display, device, source_device,
914 last_grab->window, pointer_window,
915 GDK_CROSSING_UNGRAB, time, serial);
917 /* We're now ungrabbed, update the window_under_pointer */
918 _gdk_display_set_window_under_pointer (display, device, pointer_window);
922 g_hash_table_insert (display->device_grabs, device, old_grabs);
926 _gdk_display_device_grab_update (GdkDisplay *display,
928 GdkDevice *source_device,
929 gulong current_serial)
931 GdkDeviceGrabInfo *current_grab, *next_grab;
935 time = display->last_event_time;
936 grabs = g_hash_table_lookup (display->device_grabs, device);
938 while (grabs != NULL)
940 current_grab = grabs->data;
942 if (current_grab->serial_start > current_serial)
943 return; /* Hasn't started yet */
945 if (current_grab->serial_end > current_serial)
947 /* This one hasn't ended yet.
948 its the currently active one or scheduled to be active */
950 if (!current_grab->activated)
952 if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
953 switch_to_pointer_grab (display, device, source_device, current_grab, NULL, time, current_serial);
962 /* This is the next active grab */
963 next_grab = grabs->next->data;
965 if (next_grab->serial_start > current_serial)
966 next_grab = NULL; /* Actually its not yet active */
969 if ((next_grab == NULL && current_grab->implicit_ungrab) ||
970 (next_grab != NULL && current_grab->window != next_grab->window))
971 generate_grab_broken_event (GDK_WINDOW (current_grab->window),
973 current_grab->implicit,
974 next_grab? next_grab->window : NULL);
976 /* Remove old grab */
977 grabs = g_list_delete_link (grabs, grabs);
978 g_hash_table_insert (display->device_grabs, device, grabs);
980 if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
981 switch_to_pointer_grab (display, device, source_device,
982 next_grab, current_grab,
983 time, current_serial);
985 free_device_grab (current_grab);
990 grab_list_find (GList *grabs,
993 GdkDeviceGrabInfo *grab;
999 if (serial >= grab->serial_start && serial < grab->serial_end)
1002 grabs = grabs->next;
1009 find_device_grab (GdkDisplay *display,
1015 l = g_hash_table_lookup (display->device_grabs, device);
1016 return grab_list_find (l, serial);
1020 _gdk_display_has_device_grab (GdkDisplay *display,
1026 l = find_device_grab (display, device, serial);
1033 /* Returns true if last grab was ended
1034 * If if_child is non-NULL, end the grab only if the grabbed
1035 * window is the same as if_child or a descendant of it */
1037 _gdk_display_end_device_grab (GdkDisplay *display,
1040 GdkWindow *if_child,
1043 GdkDeviceGrabInfo *grab;
1046 l = find_device_grab (display, device, serial);
1053 (if_child == NULL ||
1054 _gdk_window_event_parent_of (if_child, grab->window)))
1056 grab->serial_end = serial;
1057 grab->implicit_ungrab = implicit;
1058 return l->next == NULL;
1064 /* Returns TRUE if device events are not blocked by any grab */
1066 _gdk_display_check_grab_ownership (GdkDisplay *display,
1070 GHashTableIter iter;
1071 gpointer key, value;
1072 GdkGrabOwnership higher_ownership, device_ownership;
1073 gboolean device_is_keyboard;
1075 g_hash_table_iter_init (&iter, display->device_grabs);
1076 higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
1077 device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);
1079 while (g_hash_table_iter_next (&iter, &key, &value))
1081 GdkDeviceGrabInfo *grab;
1087 grabs = grab_list_find (grabs, serial);
1092 /* Discard device if it's not of the same type */
1093 if ((device_is_keyboard && gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) ||
1094 (!device_is_keyboard && gdk_device_get_source (dev) == GDK_SOURCE_KEYBOARD))
1100 device_ownership = grab->ownership;
1103 if (grab->ownership > higher_ownership)
1104 higher_ownership = grab->ownership;
1108 if (higher_ownership > device_ownership)
1110 /* There's a higher priority ownership
1111 * going on for other device(s)
1119 GdkPointerWindowInfo *
1120 _gdk_display_get_pointer_info (GdkDisplay *display,
1123 GdkPointerWindowInfo *info;
1125 if (G_UNLIKELY (!device))
1128 info = g_hash_table_lookup (display->pointers_info, device);
1130 if (G_UNLIKELY (!info))
1132 info = g_slice_new0 (GdkPointerWindowInfo);
1133 g_hash_table_insert (display->pointers_info, device, info);
1140 _gdk_display_pointer_info_foreach (GdkDisplay *display,
1141 GdkDisplayPointerInfoForeach func,
1144 GHashTableIter iter;
1145 gpointer key, value;
1147 g_hash_table_iter_init (&iter, display->pointers_info);
1149 while (g_hash_table_iter_next (&iter, &key, &value))
1151 GdkPointerWindowInfo *info = value;
1152 GdkDevice *device = key;
1154 (func) (display, device, info, user_data);
1159 * gdk_device_grab_info_libgtk_only:
1160 * @display: the display for which to get the grab information
1161 * @device: device to get the grab information from
1162 * @grab_window: (out) (transfer none): location to store current grab window
1163 * @owner_events: (out): location to store boolean indicating whether
1164 * the @owner_events flag to gdk_keyboard_grab() or
1165 * gdk_pointer_grab() was %TRUE.
1167 * Determines information about the current keyboard grab.
1168 * This is not public API and must not be used by applications.
1170 * Return value: %TRUE if this application currently has the
1174 gdk_device_grab_info_libgtk_only (GdkDisplay *display,
1176 GdkWindow **grab_window,
1177 gboolean *owner_events)
1179 GdkDeviceGrabInfo *info;
1181 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1182 g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
1184 info = _gdk_display_get_last_device_grab (display, device);
1189 *grab_window = info->window;
1191 *owner_events = info->owner_events;
1200 * gdk_display_pointer_is_grabbed:
1201 * @display: a #GdkDisplay
1203 * Test if the pointer is grabbed.
1205 * Returns: %TRUE if an active X pointer grab is in effect
1209 * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
1212 gdk_display_pointer_is_grabbed (GdkDisplay *display)
1214 GdkDeviceManager *device_manager;
1215 GList *devices, *dev;
1218 g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
1220 device_manager = gdk_display_get_device_manager (display);
1221 devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
1223 for (dev = devices; dev; dev = dev->next)
1227 if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE &&
1228 gdk_display_device_is_grabbed (display, device))
1230 g_list_free (devices);
1235 g_list_free (devices);
1241 * gdk_display_device_is_grabbed:
1242 * @display: a #GdkDisplay
1243 * @device: a #GdkDevice
1245 * Returns %TRUE if there is an ongoing grab on @device for @display.
1247 * Returns: %TRUE if there is a grab in effect for @device.
1250 gdk_display_device_is_grabbed (GdkDisplay *display,
1253 GdkDeviceGrabInfo *info;
1255 g_return_val_if_fail (GDK_IS_DISPLAY (display), TRUE);
1256 g_return_val_if_fail (GDK_IS_DEVICE (device), TRUE);
1258 /* What we're interested in is the steady state (ie last grab),
1259 because we're interested e.g. if we grabbed so that we
1260 can ungrab, even if our grab is not active just yet. */
1261 info = _gdk_display_get_last_device_grab (display, device);
1263 return (info && !info->implicit);
1267 * gdk_display_get_device_manager:
1268 * @display: a #GdkDisplay.
1270 * Returns the #GdkDeviceManager associated to @display.
1272 * Returns: (transfer none): A #GdkDeviceManager, or %NULL. This memory is
1273 * owned by GDK and must not be freed or unreferenced.
1278 gdk_display_get_device_manager (GdkDisplay *display)
1280 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1282 return display->device_manager;
1286 * gdk_display_get_name:
1287 * @display: a #GdkDisplay
1289 * Gets the name of the display.
1291 * Returns: a string representing the display name. This string is owned
1292 * by GDK and should not be modified or freed.
1297 gdk_display_get_name (GdkDisplay *display)
1299 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1301 return GDK_DISPLAY_GET_CLASS (display)->get_name (display);
1305 gdk_get_display (void)
1307 return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
1311 * gdk_display_get_n_screens:
1312 * @display: a #GdkDisplay
1314 * Gets the number of screen managed by the @display.
1316 * Returns: number of screens.
1321 gdk_display_get_n_screens (GdkDisplay *display)
1323 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
1325 return GDK_DISPLAY_GET_CLASS (display)->get_n_screens (display);
1329 * gdk_display_get_screen:
1330 * @display: a #GdkDisplay
1331 * @screen_num: the screen number
1333 * Returns a screen object for one of the screens of the display.
1335 * Returns: (transfer none): the #GdkScreen object
1340 gdk_display_get_screen (GdkDisplay *display,
1343 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1345 return GDK_DISPLAY_GET_CLASS (display)->get_screen (display, screen_num);
1349 * gdk_display_get_default_screen:
1350 * @display: a #GdkDisplay
1352 * Get the default #GdkScreen for @display.
1354 * Returns: (transfer none): the default #GdkScreen object for @display
1359 gdk_display_get_default_screen (GdkDisplay *display)
1361 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1363 return GDK_DISPLAY_GET_CLASS (display)->get_default_screen (display);
1368 * @display: a #GdkDisplay
1370 * Emits a short beep on @display
1375 gdk_display_beep (GdkDisplay *display)
1377 g_return_if_fail (GDK_IS_DISPLAY (display));
1379 GDK_DISPLAY_GET_CLASS (display)->beep (display);
1384 * @display: a #GdkDisplay
1386 * Flushes any requests queued for the windowing system and waits until all
1387 * requests have been handled. This is often used for making sure that the
1388 * display is synchronized with the current state of the program. Calling
1389 * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
1390 * generated from earlier requests are handled before the error trap is
1393 * This is most useful for X11. On windowing systems where requests are
1394 * handled synchronously, this function will do nothing.
1399 gdk_display_sync (GdkDisplay *display)
1401 g_return_if_fail (GDK_IS_DISPLAY (display));
1403 GDK_DISPLAY_GET_CLASS (display)->sync (display);
1407 * gdk_display_flush:
1408 * @display: a #GdkDisplay
1410 * Flushes any requests queued for the windowing system; this happens automatically
1411 * when the main loop blocks waiting for new events, but if your application
1412 * is drawing without returning control to the main loop, you may need
1413 * to call this function explicitely. A common case where this function
1414 * needs to be called is when an application is executing drawing commands
1415 * from a thread other than the thread where the main loop is running.
1417 * This is most useful for X11. On windowing systems where requests are
1418 * handled synchronously, this function will do nothing.
1423 gdk_display_flush (GdkDisplay *display)
1425 g_return_if_fail (GDK_IS_DISPLAY (display));
1427 GDK_DISPLAY_GET_CLASS (display)->flush (display);
1431 * gdk_display_get_default_group:
1432 * @display: a #GdkDisplay
1434 * Returns the default group leader window for all toplevel windows
1435 * on @display. This window is implicitly created by GDK.
1436 * See gdk_window_set_group().
1438 * Return value: (transfer none): The default group leader window
1444 gdk_display_get_default_group (GdkDisplay *display)
1446 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1448 return GDK_DISPLAY_GET_CLASS (display)->get_default_group (display);
1452 * gdk_display_supports_selection_notification:
1453 * @display: a #GdkDisplay
1455 * Returns whether #GdkEventOwnerChange events will be
1456 * sent when the owner of a selection changes.
1458 * Return value: whether #GdkEventOwnerChange events will
1464 gdk_display_supports_selection_notification (GdkDisplay *display)
1466 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1468 return GDK_DISPLAY_GET_CLASS (display)->supports_selection_notification (display);
1472 * gdk_display_request_selection_notification:
1473 * @display: a #GdkDisplay
1474 * @selection: the #GdkAtom naming the selection for which
1475 * ownership change notification is requested
1477 * Request #GdkEventOwnerChange events for ownership changes
1478 * of the selection named by the given atom.
1480 * Return value: whether #GdkEventOwnerChange events will
1486 gdk_display_request_selection_notification (GdkDisplay *display,
1490 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1492 return GDK_DISPLAY_GET_CLASS (display)->request_selection_notification (display, selection);
1496 * gdk_display_supports_clipboard_persistence
1497 * @display: a #GdkDisplay
1499 * Returns whether the speicifed display supports clipboard
1500 * persistance; i.e. if it's possible to store the clipboard data after an
1501 * application has quit. On X11 this checks if a clipboard daemon is
1504 * Returns: %TRUE if the display supports clipboard persistance.
1509 gdk_display_supports_clipboard_persistence (GdkDisplay *display)
1511 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1513 return GDK_DISPLAY_GET_CLASS (display)->supports_clipboard_persistence (display);
1517 * gdk_display_store_clipboard
1518 * @display: a #GdkDisplay
1519 * @clipboard_window: a #GdkWindow belonging to the clipboard owner
1520 * @time_: a timestamp
1521 * @targets: (array length=n_targets): an array of targets
1522 * that should be saved, or %NULL
1523 * if all available targets should be saved.
1524 * @n_targets: length of the @targets array
1526 * Issues a request to the clipboard manager to store the
1527 * clipboard data. On X11, this is a special program that works
1528 * according to the freedesktop clipboard specification, available at
1529 * <ulink url="http://www.freedesktop.org/Standards/clipboard-manager-spec">
1530 * http://www.freedesktop.org/Standards/clipboard-manager-spec</ulink>.
1535 gdk_display_store_clipboard (GdkDisplay *display,
1536 GdkWindow *clipboard_window,
1538 const GdkAtom *targets,
1541 g_return_if_fail (GDK_IS_DISPLAY (display));
1543 GDK_DISPLAY_GET_CLASS (display)->store_clipboard (display, clipboard_window, time_, targets, n_targets);
1547 * gdk_display_supports_shapes:
1548 * @display: a #GdkDisplay
1550 * Returns %TRUE if gdk_window_shape_combine_mask() can
1551 * be used to create shaped windows on @display.
1553 * Returns: %TRUE if shaped windows are supported
1558 gdk_display_supports_shapes (GdkDisplay *display)
1560 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1562 return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
1566 * gdk_display_supports_input_shapes:
1567 * @display: a #GdkDisplay
1569 * Returns %TRUE if gdk_window_input_shape_combine_mask() can
1570 * be used to modify the input shape of windows on @display.
1572 * Returns: %TRUE if windows with modified input shape are supported
1577 gdk_display_supports_input_shapes (GdkDisplay *display)
1579 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1581 return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
1585 * gdk_display_supports_composite:
1586 * @display: a #GdkDisplay
1588 * Returns %TRUE if gdk_window_set_composited() can be used
1589 * to redirect drawing on the window using compositing.
1591 * Currently this only works on X11 with XComposite and
1592 * XDamage extensions available.
1594 * Returns: %TRUE if windows may be composited.
1599 gdk_display_supports_composite (GdkDisplay *display)
1601 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1603 return GDK_DISPLAY_GET_CLASS (display)->supports_composite (display);
1607 * gdk_display_list_devices:
1608 * @display: a #GdkDisplay
1610 * Returns the list of available input devices attached to @display.
1611 * The list is statically allocated and should not be freed.
1613 * Return value: (transfer none) (element-type GdkDevice):
1614 * a list of #GdkDevice
1618 * Deprecated: 3.0: Use gdk_device_manager_list_devices() instead.
1621 gdk_display_list_devices (GdkDisplay *display)
1623 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1625 return GDK_DISPLAY_GET_CLASS (display)->list_devices (display);
1628 static GdkAppLaunchContext *
1629 gdk_display_real_get_app_launch_context (GdkDisplay *display)
1631 GdkAppLaunchContext *ctx;
1633 ctx = g_object_new (GDK_TYPE_APP_LAUNCH_CONTEXT,
1641 * gdk_display_get_app_launch_context:
1642 * @display: a #GdkDisplay
1644 * Returns a #GdkAppLaunchContext suitable for launching
1645 * applications on the given display.
1647 * Returns: (transfer full): a new #GdkAppLaunchContext for @display.
1648 * Free with g_object_unref() when done
1652 GdkAppLaunchContext *
1653 gdk_display_get_app_launch_context (GdkDisplay *display)
1655 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1657 return GDK_DISPLAY_GET_CLASS (display)->get_app_launch_context (display);
1662 * @display_name: the name of the display to open
1666 * Return value: (transfer none): a #GdkDisplay, or %NULL
1667 * if the display could not be opened
1672 gdk_display_open (const gchar *display_name)
1674 return gdk_display_manager_open_display (gdk_display_manager_get (),
1679 * gdk_display_has_pending:
1680 * @display: a #GdkDisplay
1682 * Returns whether the display has events that are waiting
1685 * Returns: %TRUE if there are events ready to be processed.
1690 gdk_display_has_pending (GdkDisplay *display)
1692 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1694 return GDK_DISPLAY_GET_CLASS (display)->has_pending (display);
1698 * gdk_display_supports_cursor_alpha:
1699 * @display: a #GdkDisplay
1701 * Returns %TRUE if cursors can use an 8bit alpha channel
1702 * on @display. Otherwise, cursors are restricted to bilevel
1703 * alpha (i.e. a mask).
1705 * Returns: whether cursors can have alpha channels.
1710 gdk_display_supports_cursor_alpha (GdkDisplay *display)
1712 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1714 return GDK_DISPLAY_GET_CLASS (display)->supports_cursor_alpha (display);
1718 * gdk_display_supports_cursor_color:
1719 * @display: a #GdkDisplay
1721 * Returns %TRUE if multicolored cursors are supported
1722 * on @display. Otherwise, cursors have only a forground
1723 * and a background color.
1725 * Returns: whether cursors can have multiple colors.
1730 gdk_display_supports_cursor_color (GdkDisplay *display)
1732 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1734 return GDK_DISPLAY_GET_CLASS (display)->supports_cursor_color (display);
1738 * gdk_display_get_default_cursor_size:
1739 * @display: a #GdkDisplay
1741 * Returns the default size to use for cursors on @display.
1743 * Returns: the default cursor size.
1748 gdk_display_get_default_cursor_size (GdkDisplay *display)
1750 guint width, height;
1752 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1754 GDK_DISPLAY_GET_CLASS (display)->get_default_cursor_size (display,
1758 return MIN (width, height);
1762 * gdk_display_get_maximal_cursor_size:
1763 * @display: a #GdkDisplay
1764 * @width: (out): the return location for the maximal cursor width
1765 * @height: (out): the return location for the maximal cursor height
1767 * Gets the maximal size to use for cursors on @display.
1772 gdk_display_get_maximal_cursor_size (GdkDisplay *display,
1776 g_return_if_fail (GDK_IS_DISPLAY (display));
1778 GDK_DISPLAY_GET_CLASS (display)->get_maximal_cursor_size (display,
1784 * gdk_display_warp_pointer:
1785 * @display: a #GdkDisplay
1786 * @screen: the screen of @display to warp the pointer to
1787 * @x: the x coordinate of the destination
1788 * @y: the y coordinate of the destination
1790 * Warps the pointer of @display to the point @x,@y on
1791 * the screen @screen, unless the pointer is confined
1792 * to a window by a grab, in which case it will be moved
1793 * as far as allowed by the grab. Warping the pointer
1794 * creates events as if the user had moved the mouse
1795 * instantaneously to the destination.
1797 * Note that the pointer should normally be under the
1798 * control of the user. This function was added to cover
1799 * some rare use cases like keyboard navigation support
1800 * for the color picker in the #GtkColorSelectionDialog.
1804 * Deprecated: 3.0: Use gdk_device_warp() instead.
1807 gdk_display_warp_pointer (GdkDisplay *display,
1812 g_return_if_fail (GDK_IS_DISPLAY (display));
1814 gdk_device_warp (display->core_pointer,
1820 _gdk_display_get_next_serial (GdkDisplay *display)
1822 return GDK_DISPLAY_GET_CLASS (display)->get_next_serial (display);
1827 * gdk_notify_startup_complete:
1829 * Indicates to the GUI environment that the application has finished
1830 * loading. If the applications opens windows, this function is
1831 * normally called after opening the application's initial set of
1834 * GTK+ will call this function automatically after opening the first
1835 * #GtkWindow unless gtk_window_set_auto_startup_notification() is called
1836 * to disable that feature.
1841 gdk_notify_startup_complete (void)
1843 gdk_notify_startup_complete_with_id (NULL);
1847 * gdk_notify_startup_complete_with_id:
1848 * @startup_id: a startup-notification identifier, for which
1849 * notification process should be completed
1851 * Indicates to the GUI environment that the application has
1852 * finished loading, using a given identifier.
1854 * GTK+ will call this function automatically for #GtkWindow
1855 * with custom startup-notification identifier unless
1856 * gtk_window_set_auto_startup_notification() is called to
1857 * disable that feature.
1862 gdk_notify_startup_complete_with_id (const gchar* startup_id)
1864 GdkDisplay *display;
1866 display = gdk_display_get_default ();
1868 gdk_display_notify_startup_complete (display, startup_id);
1872 * gdk_display_notify_startup_complete:
1873 * @display: a #GdkDisplay
1874 * @startup_id: a startup-notification identifier, for which
1875 * notification process should be completed
1877 * Indicates to the GUI environment that the application has
1878 * finished loading, using a given identifier.
1880 * GTK+ will call this function automatically for #GtkWindow
1881 * with custom startup-notification identifier unless
1882 * gtk_window_set_auto_startup_notification() is called to
1883 * disable that feature.
1888 gdk_display_notify_startup_complete (GdkDisplay *display,
1889 const gchar *startup_id)
1891 g_return_if_fail (GDK_IS_DISPLAY (display));
1893 GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
1897 _gdk_display_event_data_copy (GdkDisplay *display,
1898 const GdkEvent *event,
1899 GdkEvent *new_event)
1901 GDK_DISPLAY_GET_CLASS (display)->event_data_copy (display, event, new_event);
1905 _gdk_display_event_data_free (GdkDisplay *display,
1908 GDK_DISPLAY_GET_CLASS (display)->event_data_free (display, event);
1912 _gdk_display_create_window_impl (GdkDisplay *display,
1914 GdkWindow *real_parent,
1916 GdkEventMask event_mask,
1917 GdkWindowAttr *attributes,
1918 gint attributes_mask)
1920 GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
1930 _gdk_display_create_window (GdkDisplay *display)
1932 return g_object_new (GDK_DISPLAY_GET_CLASS (display)->window_type, NULL);
1936 * gdk_keymap_get_for_display:
1937 * @display: the #GdkDisplay.
1939 * Returns the #GdkKeymap attached to @display.
1941 * Return value: (transfer none): the #GdkKeymap attached to @display.
1946 gdk_keymap_get_for_display (GdkDisplay *display)
1948 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
1950 return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
1953 typedef struct _GdkGlobalErrorTrap GdkGlobalErrorTrap;
1955 struct _GdkGlobalErrorTrap
1960 static GQueue gdk_error_traps = G_QUEUE_INIT;
1963 * gdk_error_trap_push:
1965 * This function allows X errors to be trapped instead of the normal
1966 * behavior of exiting the application. It should only be used if it
1967 * is not possible to avoid the X error in any other way. Errors are
1968 * ignored on all #GdkDisplay currently known to the
1969 * #GdkDisplayManager. If you don't care which error happens and just
1970 * want to ignore everything, pop with gdk_error_trap_pop_ignored().
1971 * If you need the error code, use gdk_error_trap_pop() which may have
1972 * to block and wait for the error to arrive from the X server.
1974 * This API exists on all platforms but only does anything on X.
1976 * You can use gdk_x11_display_error_trap_push() to ignore errors
1977 * on only a single display.
1980 * <title>Trapping an X error</title>
1982 * gdk_error_trap_push (<!-- -->);
1984 * // ... Call the X function which may cause an error here ...
1987 * if (gdk_error_trap_pop (<!-- -->))
1989 * // ... Handle the error here ...
1995 gdk_error_trap_push (void)
1997 GdkDisplayManager *manager;
1998 GdkDisplayClass *class;
1999 GdkGlobalErrorTrap *trap;
2002 manager = gdk_display_manager_get ();
2003 class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
2005 if (class->push_error_trap == NULL)
2008 trap = g_slice_new (GdkGlobalErrorTrap);
2009 trap->displays = gdk_display_manager_list_displays (manager);
2011 g_slist_foreach (trap->displays, (GFunc) g_object_ref, NULL);
2012 for (l = trap->displays; l != NULL; l = l->next)
2014 class->push_error_trap (l->data);
2017 g_queue_push_head (&gdk_error_traps, trap);
2021 gdk_error_trap_pop_internal (gboolean need_code)
2023 GdkDisplayManager *manager;
2024 GdkDisplayClass *class;
2025 GdkGlobalErrorTrap *trap;
2029 manager = gdk_display_manager_get ();
2030 class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
2032 if (class->pop_error_trap == NULL)
2035 trap = g_queue_pop_head (&gdk_error_traps);
2037 g_return_val_if_fail (trap != NULL, 0);
2040 for (l = trap->displays; l != NULL; l = l->next)
2044 code = class->pop_error_trap (l->data, !need_code);
2046 /* we use the error on the last display listed, why not. */
2051 g_slist_free_full (trap->displays, g_object_unref);
2052 g_slice_free (GdkGlobalErrorTrap, trap);
2058 * gdk_error_trap_pop_ignored:
2060 * Removes an error trap pushed with gdk_error_trap_push(), but
2061 * without bothering to wait and see whether an error occurred. If an
2062 * error arrives later asynchronously that was triggered while the
2063 * trap was pushed, that error will be ignored.
2068 gdk_error_trap_pop_ignored (void)
2070 gdk_error_trap_pop_internal (FALSE);
2074 * gdk_error_trap_pop:
2076 * Removes an error trap pushed with gdk_error_trap_push().
2077 * May block until an error has been definitively received
2078 * or not received from the X server. gdk_error_trap_pop_ignored()
2079 * is preferred if you don't need to know whether an error
2080 * occurred, because it never has to block. If you don't
2081 * need the return value of gdk_error_trap_pop(), use
2082 * gdk_error_trap_pop_ignored().
2084 * Prior to GDK 3.0, this function would not automatically
2085 * sync for you, so you had to gdk_flush() if your last
2086 * call to Xlib was not a blocking round trip.
2088 * Return value: X error code or 0 on success
2091 gdk_error_trap_pop (void)
2093 return gdk_error_trap_pop_internal (TRUE);