Try to avoid value flip in window border computation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2008-02-26 00:32:33 +00:00
parent 47ca0b471e
commit bec7259309
2 changed files with 16 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2008-02-26 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServerWindow.m (-_checkStyle:): Restructure code
for double parent handling to avoid wrong computation path.
2008-02-25 Fred Kiefer <FredKiefer@gmx.de>
* Source/x11/XGServer.m (-_screenContextForScreen:): Remove wrong

View file

@ -996,17 +996,15 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
XGetWindowAttributes(dpy, parent, &wattr);
NSDebugLLog(@"Offset", @"Parent border,width,height %d,%d,%d\n",
wattr.border_width, wattr.width, wattr.height);
l = repx + wattr.border_width;
t = repy + wattr.border_width;
l = wattr.border_width;
t = wattr.border_width;
/* Find total parent size and subtract window size and
* top-left-corner offset to determine bottom-right-corner
* offset.
*/
r = wattr.width + wattr.border_width * 2;
r -= (window->xframe.size.width + l);
b = wattr.height + wattr.border_width * 2;
b -= (window->xframe.size.height + t);
// Some window manager e.g. KDE2 put in multiple windows,
// so we have to find the right parent, closest to root
@ -1022,8 +1020,6 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
{
Window new_parent = parent;
r = wattr.width + wattr.border_width * 2;
b = wattr.height + wattr.border_width * 2;
while (new_parent && (new_parent != window->root))
{
Window root;
@ -1050,16 +1046,20 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
if (new_parent && new_parent != window->root)
{
XGetWindowAttributes(dpy, parent, &wattr);
l += wattr.x + wattr.border_width;
t += wattr.y + wattr.border_width;
l += repx + wattr.border_width;
t += repy + wattr.border_width;
r = wattr.width + wattr.border_width * 2;
b = wattr.height + wattr.border_width * 2;
repx = wattr.x;
repy = wattr.y;
}
} /* while */
r -= (window->xframe.size.width + l);
b -= (window->xframe.size.height + t);
} /* generic.flags.doubleParentWindow */
r -= (window->xframe.size.width + l);
b -= (window->xframe.size.height + t);
l += repx;
t += repy;
o->l = l;
o->r = r;
o->t = t;