summaryrefslogtreecommitdiff
path: root/libmate-panel-applet
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-12-24 14:25:56 +0300
committerMonsta <[email protected]>2015-12-24 14:25:56 +0300
commite785bb69b37d7cb63a1828c2aa324adde6a164bc (patch)
tree1e891e52d526a7a1adcaa926348f1b0ae1efc3ef /libmate-panel-applet
parentb1206765a76fcc18980d53a6cf0d111eab48ce25 (diff)
downloadmate-panel-e785bb69b37d7cb63a1828c2aa324adde6a164bc.tar.bz2
mate-panel-e785bb69b37d7cb63a1828c2aa324adde6a164bc.tar.xz
libmate-panel-applet: move trap push/pop closer to X function call
Diffstat (limited to 'libmate-panel-applet')
-rw-r--r--libmate-panel-applet/mate-panel-applet.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index be9e3204..bd1806a3 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -1377,17 +1377,22 @@ mate_panel_applet_create_foreign_surface_for_display (GdkDisplay *display,
GdkVisual *visual,
Window xid)
{
- Window window;
- gint x, y;
- guint width, height, border, depth;
+ Status result = 0;
+ Window window;
+ gint x, y;
+ guint width, height, border, depth;
- if (!XGetGeometry (GDK_DISPLAY_XDISPLAY (display), xid, &window,
- &x, &y, &width, &height, &border, &depth))
- return NULL;
+ gdk_error_trap_push ();
+ result = XGetGeometry (GDK_DISPLAY_XDISPLAY (display), xid, &window,
+ &x, &y, &width, &height, &border, &depth);
+ gdk_error_trap_pop_ignored ();
+
+ if (result == 0)
+ return NULL;
- return cairo_xlib_surface_create (GDK_DISPLAY_XDISPLAY (display),
- xid, gdk_x11_visual_get_xvisual (visual),
- width, height);
+ return cairo_xlib_surface_create (GDK_DISPLAY_XDISPLAY (display),
+ xid, gdk_x11_visual_get_xvisual (visual),
+ width, height);
}
static cairo_pattern_t *
@@ -1432,11 +1437,9 @@ mate_panel_applet_get_pixmap (MatePanelApplet *applet,
window = gtk_widget_get_window (GTK_WIDGET (applet));
#if GTK_CHECK_VERSION (3, 0, 0)
- gdk_error_trap_push ();
background = mate_panel_applet_create_foreign_surface_for_display (gdk_window_get_display (window),
gdk_window_get_visual (window),
xid);
- gdk_error_trap_pop_ignored ();
/* background can be NULL if the user changes the background very fast.
* We'll get the next update, so it's not a big deal. */