* Source/x11/XGServerWindow.m: Check for bytes_after_ret in

PropGetCheckProperty. Attempt to improve the window border detection.
Based on idea by Tom MacSween <Tom.MacSween@crins-sinrc.ca>
This commit is contained in:
fredkiefer 2018-06-20 07:49:36 +02:00
parent b9e9f461ab
commit 6e797c9e6d
2 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2018-06-20 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m: Check for bytes_after_ret in
PropGetCheckProperty. Attempt to improve the window border detection.
Based on idea by Tom MacSween <Tom.MacSween@crins-sinrc.ca>
2018-05-01 Fred Kiefer <FredKiefer@gmx.de> 2018-05-01 Fred Kiefer <FredKiefer@gmx.de>
* Headers/x11/XGGeneric.h: Move all atoms in XGGeneric data structure. * Headers/x11/XGGeneric.h: Move all atoms in XGGeneric data structure.

View file

@ -168,27 +168,36 @@ PropGetCheckProperty(Display *dpy, Window window, Atom hint, Atom type,
int tmp; int tmp;
if (count <= 0) if (count <= 0)
tmp = 0xffffff; {
tmp = 0xffffff;
}
else else
tmp = count; {
tmp = count;
}
if (XGetWindowProperty(dpy, window, hint, 0, tmp, False, type, if (XGetWindowProperty(dpy, window, hint, 0, tmp, False, type,
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret, &type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&data)!=Success || !data) (unsigned char **)&data)!=Success || !data)
{
return NULL; return NULL;
}
if ((type != AnyPropertyType && type != type_ret) if ((type != AnyPropertyType && type != type_ret)
|| (count > 0 && nitems_ret != (unsigned long)count) || (count > 0 && nitems_ret != (unsigned long)count)
|| (bytes_after_ret != 0)
|| (format != 0 && format != fmt_ret)) || (format != 0 && format != fmt_ret))
{ {
NSLog(@"XGetWindowProperty type %d type_ret %d count %d count_ret %d format %d format_ret %d", NSLog(@"XGetWindowProperty type %d type_ret %d count %d count_ret %d format %d format_ret %d bytes_after_ret %d",
type, type_ret, count, nitems_ret, format, fmt_ret); type, type_ret, count, nitems_ret, format, fmt_ret, bytes_after_ret);
XFree(data); XFree(data);
return NULL; return NULL;
} }
if (retCount) if (retCount)
*retCount = nitems_ret; {
*retCount = nitems_ret;
}
return data; return data;
} }