Skip to content
Permalink
Browse files

xsettings: replace deprecated gdk_error_trap_push/pop

  • Loading branch information...
raveit65 committed Aug 23, 2018
1 parent 03368ab commit 66b5931c274c0fadffeaecaa8e021e9b8e0e7761
Showing with 15 additions and 9 deletions.
  1. +15 −9 plugins/xsettings/wm-common.c
@@ -1,4 +1,4 @@
#include <X11/Xatom.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
#include <gdk/gdk.h>
#include <string.h>
@@ -13,6 +13,7 @@ static char *
wm_common_get_window_manager_property (Atom atom)
{
Atom utf8_string, type;
GdkDisplay *display;
int result;
char *retval;
int format;
@@ -25,18 +26,20 @@ wm_common_get_window_manager_property (Atom atom)

utf8_string = gdk_x11_get_xatom_by_name ("UTF8_STRING");

gdk_error_trap_push ();
display = gdk_display_get_default ();

gdk_x11_display_error_trap_push (display);

val = NULL;
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
wm_window,
atom,
0, G_MAXLONG,
False, utf8_string,
&type, &format, &nitems,
&bytes_after, (guchar **) &val);

if (gdk_error_trap_pop () || result != Success ||
if (gdk_x11_display_error_trap_pop (display) || result != Success ||
type != utf8_string || format != 8 || nitems == 0 ||
!g_utf8_validate (val, nitems, NULL))
{
@@ -69,13 +72,16 @@ wm_common_get_current_window_manager (void)
static void
update_wm_window (void)
{
GdkDisplay *display;
Window *xwindow;
Atom type;
gint format;
gulong nitems;
gulong bytes_after;

XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW (),
display = gdk_display_get_default ();

XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_ROOT_WINDOW (),
gdk_x11_get_xatom_by_name ("_NET_SUPPORTING_WM_CHECK"),
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
&nitems, &bytes_after, (guchar **) &xwindow);
@@ -86,11 +92,11 @@ update_wm_window (void)
return;
}

gdk_error_trap_push ();
XSelectInput (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), *xwindow, StructureNotifyMask | PropertyChangeMask);
XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), False);
gdk_x11_display_error_trap_push (display);
XSelectInput (GDK_DISPLAY_XDISPLAY (display), *xwindow, StructureNotifyMask | PropertyChangeMask);
XSync (GDK_DISPLAY_XDISPLAY (display), False);

if (gdk_error_trap_pop ())
if (gdk_x11_display_error_trap_pop (display))
{
XFree (xwindow);
wm_window = None;

0 comments on commit 66b5931

Please sign in to comment.
You can’t perform that action at this time.