Skip to content

Commit 6bad863

Browse files
author
raveit65
committed
na-tray-child: replace deprecated gdk_error_trap_push/pop functions
1 parent 7c63f61 commit 6bad863

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

applets/notification_area/system-tray/na-tray-child.c

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ na_tray_child_new (GdkScreen *screen,
442442
{
443443
XWindowAttributes window_attributes;
444444
Display *xdisplay;
445+
GdkDisplay *display;
445446
NaTrayChild *child;
446447
GdkVisual *visual;
447448
gboolean visual_has_alpha;
@@ -457,10 +458,11 @@ na_tray_child_new (GdkScreen *screen,
457458
* the socket in the same visual.
458459
*/
459460

460-
gdk_error_trap_push ();
461+
display = gdk_screen_get_display (screen);
462+
gdk_x11_display_error_trap_push (display);
461463
result = XGetWindowAttributes (xdisplay, icon_window,
462464
&window_attributes);
463-
gdk_error_trap_pop_ignored ();
465+
gdk_x11_display_error_trap_pop_ignored (display);
464466

465467
if (!result) /* Window already gone */
466468
return NULL;
@@ -510,7 +512,7 @@ na_tray_child_get_title (NaTrayChild *child)
510512
utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING");
511513
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME");
512514

513-
gdk_error_trap_push ();
515+
gdk_x11_display_error_trap_push (display);
514516

515517
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
516518
child->icon_window,
@@ -520,7 +522,7 @@ na_tray_child_get_title (NaTrayChild *child)
520522
&type, &format, &nitems,
521523
&bytes_after, (guchar **)&val);
522524

523-
if (gdk_error_trap_pop () || result != Success)
525+
if (gdk_x11_display_error_trap_pop (display) || result != Success)
524526
return NULL;
525527

526528
if (type != utf8_string ||
@@ -606,11 +608,15 @@ na_tray_child_force_redraw (NaTrayChild *child)
606608
* icon is expecting the server to clear-to-background before
607609
* the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
608610
*/
609-
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
611+
GdkDisplay *display;
612+
Display *xdisplay;
610613
XEvent xev;
611614
GdkWindow *plug_window;
612615
GtkAllocation allocation;
613616

617+
display = gtk_widget_get_display (widget);
618+
xdisplay = GDK_DISPLAY_XDISPLAY (display);
619+
614620
plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
615621
gtk_widget_get_allocation (widget, &allocation);
616622

@@ -622,16 +628,16 @@ na_tray_child_force_redraw (NaTrayChild *child)
622628
xev.xexpose.height = allocation.height;
623629
xev.xexpose.count = 0;
624630

625-
gdk_error_trap_push ();
626-
XSendEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
631+
gdk_x11_display_error_trap_push (display);
632+
XSendEvent (xdisplay,
627633
xev.xexpose.window,
628634
False, ExposureMask,
629635
&xev);
630636
/* We have to sync to reliably catch errors from the XSendEvent(),
631637
* since that is asynchronous.
632638
*/
633639
XSync (xdisplay, False);
634-
gdk_error_trap_pop_ignored ();
640+
gdk_x11_display_error_trap_pop_ignored (display);
635641
#else
636642
/* Hiding and showing is the safe way to do it, but can result in more
637643
* flickering.
@@ -668,14 +674,16 @@ _get_wmclass (Display *xdisplay,
668674
char **res_class,
669675
char **res_name)
670676
{
677+
GdkDisplay *display;
671678
XClassHint ch;
672679

673680
ch.res_name = NULL;
674681
ch.res_class = NULL;
675682

676-
gdk_error_trap_push ();
683+
display = gdk_display_get_default ();
684+
gdk_x11_display_error_trap_push (display);
677685
XGetClassHint (xdisplay, xwindow, &ch);
678-
gdk_error_trap_pop_ignored ();
686+
gdk_x11_display_error_trap_pop_ignored (display);
679687

680688
if (res_class)
681689
*res_class = NULL;

0 commit comments

Comments
 (0)