[Xfce4-commits] <xfce4-embed-plugin:master> Added X error trap for windows that are destroyed before we can check them.
David Schneider
noreply at xfce.org
Wed Feb 1 09:12:01 CET 2012
Updating branch refs/heads/master
to 1be8c60c498e8971cc8a49776369dd5c3d555f3e (commit)
from f0198aa074f1023653dc016dea741714f9b0d844 (commit)
commit 1be8c60c498e8971cc8a49776369dd5c3d555f3e
Author: David Schneider <dnschneid at gmail.com>
Date: Tue Jan 31 23:44:52 2012 -0800
Added X error trap for windows that are destroyed before we can check them.
panel-plugin/embed.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/panel-plugin/embed.c b/panel-plugin/embed.c
index de812d0..4ed0e72 100644
--- a/panel-plugin/embed.c
+++ b/panel-plugin/embed.c
@@ -453,6 +453,10 @@ embed_search (EmbedPlugin *embed)
gboolean match;
match = TRUE;
+ /* Windows tend to disappear before we get to them, triggering X errors.
+ * Trap and ignore them. */
+ gdk_error_trap_push ();
+
/* AND-match each specified criteria, starting with the presumably
* lightest-weight/most-specific ones first. */
if (match && embed->proc_name && embed->proc_name[0]) {
@@ -472,6 +476,14 @@ embed_search (EmbedPlugin *embed)
g_free (str);
}
+ /* Trigger any pending X errors, then re-enable errors.
+ * If we hit an error, we definitely do NOT want this window. */
+ gdk_flush ();
+ if (gdk_error_trap_pop ()) {
+ DBG ("caught X error for window 0x%X", (GdkNativeWindow)client_list[i]);
+ match = FALSE;
+ }
+
/* If it's a match, make a fake socket and embed the window in it. */
if (match) {
/* Destroy the true GtkSocket if it exists, as don't need it. */
More information about the Xfce4-commits
mailing list