Skip to content
Permalink
Browse files

avoid deprecated 'gdk_error_trap_push/pop/pop_ignored' and 'gdk_flush'

  • Loading branch information...
sc0w committed Jan 7, 2019
1 parent 80bc7d7 commit 92910b6b2dd0b75bcc99e30eb660742168cef6ce
Showing with 25 additions and 19 deletions.
  1. +3 −2 maximus/main.c
  2. +13 −10 maximus/maximus-app.c
  3. +5 −4 maximus/tomboykeybinder.c
  4. +4 −3 maximus/xutils.c
@@ -64,6 +64,7 @@ gint main (gint argc, gchar *argv[])
MaximusApp UNUSED_VARIABLE *app;
GOptionContext *context;
GError *error = NULL;
GdkDisplay *gdk_display = gdk_display_get_default ();

g_set_application_name ("Maximus");

@@ -89,9 +90,9 @@ gint main (gint argc, gchar *argv[])
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free(context);

gdk_error_trap_push ();
gdk_x11_display_error_trap_push (gdk_display);
app = maximus_app_get_default ();
gdk_error_trap_pop_ignored ();
gdk_x11_display_error_trap_pop_ignored (gdk_display);

gtk_main ();

@@ -149,13 +149,13 @@ gdk_window_set_mwm_hints (WnckWindow *window,
hints_atom = gdk_x11_get_xatom_by_name_for_display (display,
_XA_MOTIF_WM_HINTS);

gdk_error_trap_push ();
gdk_x11_display_error_trap_push (display);
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
wnck_window_get_xid (window),
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, &data);
if (gdk_error_trap_pop ())
if (gdk_x11_display_error_trap_pop (display))
return;

if (type != hints_atom || !data)
@@ -181,7 +181,7 @@ gdk_window_set_mwm_hints (WnckWindow *window,
wnck_window_get_xid (window),
hints_atom, hints_atom, 32, PropModeReplace,
(guchar *)hints, sizeof (MotifWmHints)/sizeof (long));
gdk_flush ();
gdk_display_flush (display);
_wnck_error_trap_pop ();

if (data)
@@ -359,6 +359,7 @@ on_window_opened (WnckScreen *screen,
MaximusAppPrivate *priv;
WnckWindowType type;
gint exclude = 0;
GdkDisplay *gdk_display = gdk_display_get_default ();

g_return_if_fail (MAXIMUS_IS_APP (app));
g_return_if_fail (WNCK_IS_WINDOW (window));
@@ -369,9 +370,9 @@ on_window_opened (WnckScreen *screen,
return;

/* Ignore undecorated windows */
gdk_error_trap_push ();
gdk_x11_display_error_trap_push (gdk_display);
exclude = wnck_window_is_decorated (window) ? 0 : 1;
if (gdk_error_trap_pop ())
if (gdk_x11_display_error_trap_pop (gdk_display))
return;

if (wnck_window_is_maximized (window))
@@ -390,7 +391,7 @@ on_window_opened (WnckScreen *screen,
if (wnck_window_is_maximized(window) && priv->undecorate)
{
_window_set_decorations (window, 0);
gdk_flush ();
gdk_display_flush (gdk_display);
}
g_signal_connect (window, "state-changed",
G_CALLBACK (on_window_state_changed), app);
@@ -403,7 +404,7 @@ on_window_opened (WnckScreen *screen,
if (!window_is_too_large_for_screen (window))
{
_window_set_decorations (window, 0);
gdk_flush ();
gdk_display_flush (gdk_display);
}
}

@@ -483,12 +484,14 @@ on_app_undecorate_changed (GSettings *settings,

if (!is_excluded (app, window))
{
gdk_error_trap_push ();
GdkDisplay *gdk_display = gdk_display_get_default ();

gdk_x11_display_error_trap_push (gdk_display);
_window_set_decorations (window, priv->undecorate ? 0 : 1);
wnck_window_unmaximize (window);
wnck_window_maximize (window);
gdk_flush ();
gdk_error_trap_pop_ignored ();
gdk_display_flush (gdk_display);
gdk_x11_display_error_trap_pop_ignored (gdk_display);

sleep (1);
}
@@ -102,7 +102,8 @@ grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin,
static gboolean
do_grab_key (Binding *binding)
{
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
GdkDisplay *gdk_display = gdk_display_get_default ();
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display);
GdkWindow *rootwin = gdk_get_default_root_window ();

EggVirtualModifierType virtual_mods = 0;
@@ -131,15 +132,15 @@ do_grab_key (Binding *binding)

TRACE (g_print ("Got modmask %d\n", binding->modifiers));

gdk_error_trap_push ();
gdk_x11_display_error_trap_push (gdk_display);

grab_ungrab_with_ignorable_modifiers (rootwin,
binding,
TRUE /* grab */);

gdk_flush ();
gdk_display_flush (gdk_display);

if (gdk_error_trap_pop ()) {
if (gdk_x11_display_error_trap_pop (gdk_display)) {
g_warning ("Binding '%s' failed!\n", binding->keystring);
return FALSE;
}
@@ -37,14 +37,15 @@
void
_wnck_error_trap_push (void)
{
gdk_error_trap_push ();
gdk_x11_display_error_trap_push (gdk_display_get_default ());
}

int
_wnck_error_trap_pop (void)
{
XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), False);
return gdk_error_trap_pop ();
GdkDisplay *gdk_display = gdk_display_get_default ();
XSync (GDK_DISPLAY_XDISPLAY (gdk_display), False);
return gdk_x11_display_error_trap_pop (gdk_display);
}

static char*

0 comments on commit 92910b6

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