summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-11-16 23:57:25 -0500
committerMatthias Clasen <mclasen@redhat.com>2017-11-17 00:08:24 -0500
commit30e6a4c29dbcc58549b36d02a3fe7ceb26ce1f97 (patch)
tree551cc8127c69122a6fdd36301dafe3357b1eb9f3
parentfe93bc7627e72b578371de33f83e46cd108c1d74 (diff)
downloadgtk+-30e6a4c29dbcc58549b36d02a3fe7ceb26ce1f97.tar.gz
Drop the generic error trap api
This is only implemented on X11, so we don't need generic api for it.
-rw-r--r--gdk/gdkdisplay.c137
-rw-r--r--gdk/gdkmain.h14
2 files changed, 0 insertions, 151 deletions
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 6e3f9f2e39..a1898929d9 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1617,143 +1617,6 @@ gdk_keymap_get_for_display (GdkDisplay *display)
return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
}
-typedef struct _GdkGlobalErrorTrap GdkGlobalErrorTrap;
-
-struct _GdkGlobalErrorTrap
-{
- GSList *displays;
-};
-
-static GQueue gdk_error_traps = G_QUEUE_INIT;
-
-/**
- * gdk_error_trap_push:
- *
- * This function allows X errors to be trapped instead of the normal
- * behavior of exiting the application. It should only be used if it
- * is not possible to avoid the X error in any other way. Errors are
- * ignored on all #GdkDisplay currently known to the
- * #GdkDisplayManager. If you don’t care which error happens and just
- * want to ignore everything, pop with gdk_error_trap_pop_ignored().
- * If you need the error code, use gdk_error_trap_pop() which may have
- * to block and wait for the error to arrive from the X server.
- *
- * This API exists on all platforms but only does anything on X.
- *
- * You can use gdk_x11_display_error_trap_push() to ignore errors
- * on only a single display.
- *
- * ## Trapping an X error
- *
- * |[<!-- language="C" -->
- * gdk_error_trap_push ();
- *
- * // ... Call the X function which may cause an error here ...
- *
- *
- * if (gdk_error_trap_pop ())
- * {
- * // ... Handle the error here ...
- * }
- * ]|
- */
-void
-gdk_error_trap_push (void)
-{
- GdkDisplayManager *manager;
- GdkGlobalErrorTrap *trap;
- GSList *displays;
- GSList *l;
-
- manager = gdk_display_manager_get ();
- displays = gdk_display_manager_list_displays (manager);
-
- trap = g_slice_new0 (GdkGlobalErrorTrap);
- for (l = displays; l != NULL; l = l->next)
- {
- GdkDisplay *display = l->data;
- GdkDisplayClass *class = GDK_DISPLAY_GET_CLASS (display);
-
- if (class->push_error_trap != NULL)
- {
- class->push_error_trap (display);
- trap->displays = g_slist_prepend (trap->displays, g_object_ref (display));
- }
- }
-
- g_queue_push_head (&gdk_error_traps, trap);
-
- g_slist_free (displays);
-}
-
-static gint
-gdk_error_trap_pop_internal (gboolean need_code)
-{
- GdkGlobalErrorTrap *trap;
- gint result;
- GSList *l;
-
- trap = g_queue_pop_head (&gdk_error_traps);
-
- g_return_val_if_fail (trap != NULL, 0);
-
- result = 0;
- for (l = trap->displays; l != NULL; l = l->next)
- {
- GdkDisplay *display = l->data;
- GdkDisplayClass *class = GDK_DISPLAY_GET_CLASS (display);
- gint code = class->pop_error_trap (display, !need_code);
-
- /* we use the error on the last display listed, why not. */
- if (code != 0)
- result = code;
- }
-
- g_slist_free_full (trap->displays, g_object_unref);
- g_slice_free (GdkGlobalErrorTrap, trap);
-
- return result;
-}
-
-/**
- * gdk_error_trap_pop_ignored:
- *
- * Removes an error trap pushed with gdk_error_trap_push(), but
- * without bothering to wait and see whether an error occurred. If an
- * error arrives later asynchronously that was triggered while the
- * trap was pushed, that error will be ignored.
- *
- * Since: 3.0
- */
-void
-gdk_error_trap_pop_ignored (void)
-{
- gdk_error_trap_pop_internal (FALSE);
-}
-
-/**
- * gdk_error_trap_pop:
- *
- * Removes an error trap pushed with gdk_error_trap_push().
- * May block until an error has been definitively received
- * or not received from the X server. gdk_error_trap_pop_ignored()
- * is preferred if you don’t need to know whether an error
- * occurred, because it never has to block. If you don't
- * need the return value of gdk_error_trap_pop(), use
- * gdk_error_trap_pop_ignored().
- *
- * Prior to GDK 3.0, this function would not automatically
- * sync for you, so you had to gdk_flush() if your last
- * call to Xlib was not a blocking round trip.
- *
- * Returns: X error code or 0 on success
- */
-gint
-gdk_error_trap_pop (void)
-{
- return gdk_error_trap_pop_internal (TRUE);
-}
-
/*< private >
* gdk_display_make_gl_context_current:
* @display: a #GdkDisplay
diff --git a/gdk/gdkmain.h b/gdk/gdkmain.h
index fa275ea6ff..6a84fef671 100644
--- a/gdk/gdkmain.h
+++ b/gdk/gdkmain.h
@@ -32,19 +32,5 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
-G_BEGIN_DECLS
-
-
-/* Push and pop error handlers for X errors
- */
-GDK_AVAILABLE_IN_ALL
-void gdk_error_trap_push (void);
-/* warn unused because you could use pop_ignored otherwise */
-GDK_AVAILABLE_IN_ALL
-G_GNUC_WARN_UNUSED_RESULT gint gdk_error_trap_pop (void);
-GDK_AVAILABLE_IN_ALL
-void gdk_error_trap_pop_ignored (void);
-
-G_END_DECLS
#endif /* __GDK_MAIN_H__ */