[gnome-panel] notification-area: avoid deprecated error trap functions
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] notification-area: avoid deprecated error trap functions
- Date: Thu, 18 Jan 2018 19:06:00 +0000 (UTC)
commit 9bb347146d5d611d6e0a882a6ea675ba08cfe628
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Jan 11 20:30:29 2018 +0200
notification-area: avoid deprecated error trap functions
modules/notification-area/na-tray-child.c | 38 +++++++++++++++++-----------
1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/modules/notification-area/na-tray-child.c b/modules/notification-area/na-tray-child.c
index c46509a..c8586a6 100644
--- a/modules/notification-area/na-tray-child.c
+++ b/modules/notification-area/na-tray-child.c
@@ -246,6 +246,7 @@ na_tray_child_new (GdkScreen *screen,
Window icon_window)
{
XWindowAttributes window_attributes;
+ GdkDisplay *display;
Display *xdisplay;
NaTrayChild *child;
GdkVisual *visual;
@@ -256,16 +257,17 @@ na_tray_child_new (GdkScreen *screen,
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (icon_window != None, NULL);
+ display = gdk_screen_get_display (screen);
xdisplay = GDK_SCREEN_XDISPLAY (screen);
/* We need to determine the visual of the window we are embedding and create
* the socket in the same visual.
*/
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
result = XGetWindowAttributes (xdisplay, icon_window,
&window_attributes);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
if (!result) /* Window already gone */
return NULL;
@@ -289,7 +291,7 @@ na_tray_child_new (GdkScreen *screen,
visual_has_alpha = red_prec + blue_prec + green_prec < depth;
child->has_alpha = (visual_has_alpha &&
- gdk_display_supports_composite (gdk_screen_get_display (screen)));
+ gdk_display_supports_composite (display));
child->composited = child->has_alpha;
@@ -315,7 +317,7 @@ na_tray_child_get_title (NaTrayChild *child)
utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
child->icon_window,
@@ -325,7 +327,7 @@ na_tray_child_get_title (NaTrayChild *child)
&type, &format, &nitems,
&bytes_after, (guchar **)&val);
- if (gdk_error_trap_pop () || result != Success)
+ if (gdk_x11_display_error_trap_pop (display) || result != Success)
return NULL;
if (type != utf8_string ||
@@ -411,11 +413,14 @@ na_tray_child_force_redraw (NaTrayChild *child)
* icon is expecting the server to clear-to-background before
* the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
*/
- Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
+ GdkDisplay *display;
+ Display *xdisplay;
XEvent xev;
GdkWindow *plug_window;
GtkAllocation allocation;
+ display = gtk_widget_get_display (widget);
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
gtk_widget_get_allocation (widget, &allocation);
@@ -427,12 +432,12 @@ na_tray_child_force_redraw (NaTrayChild *child)
xev.xexpose.height = allocation.height;
xev.xexpose.count = 0;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
XSendEvent (xdisplay,
xev.xexpose.window,
False, ExposureMask,
&xev);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
#else
/* Hiding and showing is the safe way to do it, but can result in more
* flickering.
@@ -464,19 +469,22 @@ latin1_to_utf8 (const char *latin1)
/* derived from libwnck/xutils.c, comes as LGPLv2+ */
static void
-_get_wmclass (Display *xdisplay,
- Window xwindow,
- char **res_class,
- char **res_name)
+_get_wmclass (GdkDisplay *display,
+ Window xwindow,
+ char **res_class,
+ char **res_name)
{
+ Display *xdisplay;
XClassHint ch;
ch.res_name = NULL;
ch.res_class = NULL;
- gdk_error_trap_push ();
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
+
+ gdk_x11_display_error_trap_push (display);
XGetClassHint (xdisplay, xwindow, &ch);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
if (res_class)
*res_class = NULL;
@@ -522,7 +530,7 @@ na_tray_child_get_wm_class (NaTrayChild *child,
display = gtk_widget_get_display (GTK_WIDGET (child));
- _get_wmclass (GDK_DISPLAY_XDISPLAY (display),
+ _get_wmclass (display,
child->icon_window,
res_class,
res_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]