Skip to content

Commit

Permalink
Stop a possible X error exit when checking for window decorations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsalt committed Nov 29, 2021
1 parent a3ee65b commit 547c31c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/xutils.c
Expand Up @@ -227,13 +227,19 @@ gboolean get_decorated(Window xid /*WnckWindow *window*/)
Atom type_ret;
Atom hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False);
int format_ret;
int err, result;
unsigned long nitems_ret, bytes_after_ret, *prop_ret;

devilspie2_error_trap_push();
XGetWindowProperty(disp, xid, hints_atom, 0,
PROP_MOTIF_WM_HINTS_ELEMENTS, 0, hints_atom,
&type_ret, &format_ret, &nitems_ret,
&bytes_after_ret, (unsigned char **)&prop_ret);

err = devilspie2_error_trap_pop ();
if (err != Success || result != Success)
return FALSE;

return type_ret != hints_atom || nitems_ret < 3 || prop_ret[2] != 0;
}

Expand Down

0 comments on commit 547c31c

Please sign in to comment.