[gtk+] Drop the generic error trap api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Drop the generic error trap api
- Date: Fri, 17 Nov 2017 05:17:09 +0000 (UTC)
commit 30e6a4c29dbcc58549b36d02a3fe7ceb26ce1f97
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 16 23:57:25 2017 -0500
Drop the generic error trap api
This is only implemented on X11, so we don't
need generic api for it.
gdk/gdkdisplay.c | 137 ------------------------------------------------------
gdk/gdkmain.h | 14 ------
2 files changed, 0 insertions(+), 151 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 6e3f9f2..a189892 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 fa275ea..6a84fef 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]