[gnome-panel] panel-xutils: avoid deprecated error trap functions



commit db08b5fb521ec6e8766423300e2321828bea2d6f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Sep 13 17:19:28 2018 +0300

    panel-xutils: avoid deprecated error trap functions

 gnome-panel/panel-xutils.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/gnome-panel/panel-xutils.c b/gnome-panel/panel-xutils.c
index 01255df41..5a420a151 100644
--- a/gnome-panel/panel-xutils.c
+++ b/gnome-panel/panel-xutils.c
@@ -54,20 +54,22 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
                        guint32           strut,
                        guint32           strut_start,
                        guint32           strut_end)
- {
-       Display *display;
-       Window   window;
-       gulong   struts [12] = { 0, };
+{
+       GdkDisplay *display;
+       Display *xdisplay;
+       Window xwindow;
+       gulong struts [12] = { 0, };
 
        g_return_if_fail (GDK_IS_WINDOW (gdk_window));
 
-       display = GDK_WINDOW_XDISPLAY (gdk_window);
-       window  = GDK_WINDOW_XID (gdk_window);
+       display = gdk_window_get_display (gdk_window);
+       xdisplay = gdk_x11_display_get_xdisplay (display);
+       xwindow = gdk_x11_window_get_xid (gdk_window);
 
        if (net_wm_strut == None)
-               net_wm_strut = XInternAtom (display, "_NET_WM_STRUT", False);
+               net_wm_strut = XInternAtom (xdisplay, "_NET_WM_STRUT", False);
        if (net_wm_strut_partial == None)
-               net_wm_strut_partial = XInternAtom (display, "_NET_WM_STRUT_PARTIAL", False);
+               net_wm_strut_partial = XInternAtom (xdisplay, "_NET_WM_STRUT_PARTIAL", False);
 
        switch (orientation) {
        case PANEL_ORIENTATION_LEFT:
@@ -92,14 +94,14 @@ panel_xutils_set_strut (GdkWindow        *gdk_window,
                break;
        }
 
-       gdk_error_trap_push ();
-       XChangeProperty (display, window, net_wm_strut,
+       gdk_x11_display_error_trap_push (display);
+       XChangeProperty (xdisplay, xwindow, net_wm_strut,
                         XA_CARDINAL, 32, PropModeReplace,
                         (guchar *) &struts, 4);
-       XChangeProperty (display, window, net_wm_strut_partial,
+       XChangeProperty (xdisplay, xwindow, net_wm_strut_partial,
                         XA_CARDINAL, 32, PropModeReplace,
                         (guchar *) &struts, 12);
-       gdk_error_trap_pop_ignored ();
+       gdk_x11_display_error_trap_pop_ignored (display);
 }
 
 void
@@ -107,17 +109,19 @@ panel_warp_pointer (GdkWindow *gdk_window,
                    int        x,
                    int        y)
 {
-       Display *display;
-       Window   window;
+       GdkDisplay *display;
+       Display *xdisplay;
+       Window xwindow;
 
        g_return_if_fail (GDK_IS_WINDOW (gdk_window));
 
-       display = GDK_WINDOW_XDISPLAY (gdk_window);
-       window  = GDK_WINDOW_XID (gdk_window);
+       display = gdk_window_get_display (gdk_window);
+       xdisplay = gdk_x11_display_get_xdisplay (display);
+       xwindow = gdk_x11_window_get_xid (gdk_window);
 
-       gdk_error_trap_push ();
-       XWarpPointer (display, None, window, 0, 0, 0, 0, x, y);
-       gdk_error_trap_pop_ignored ();
+       gdk_x11_display_error_trap_push (display);
+       XWarpPointer (xdisplay, None, xwindow, 0, 0, 0, 0, x, y);
+       gdk_x11_display_error_trap_pop_ignored (display);
 }
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]