Hi, > 0002-Do-not-make-constrainNewWindowSize-depend-on-the-act.patch > This one updates constrainNewWindowSize so that it returns TRUE if the > new calculated size does not match the old, passed size rather than the > window's server size.
I just noticed that this patch has some implications on existing usages of constrainNewWindowSize which cause these to not work properly. Please find attached a patch which extends the mentioned patch by fixing those existing usages of this function. We still need this patch, however, because otherwise we can't know if any constraining was done by constrainNewWindowSize when called using outline resize mode as in this mode, w->serverWidth/Height will be constant all the time. I also believe making the return value depend on the information if there was actual constraining done makes a cleaner API. Regards, Danny
diff --git a/src/window.c b/src/window.c index fbae40e..6e18579 100644 --- a/src/window.c +++ b/src/window.c @@ -3435,13 +3435,23 @@ addWindowSizeChanges (CompWindow *w, xwc->width = oldWidth; xwc->height = oldHeight; - if (constrainNewWindowSize (w, width, height, &width, &height)) + constrainNewWindowSize (w, width, height, &width, &height); + + if (width != w->serverWidth) + { + mask |= CWWidth; + xwc->width = width; + } + else + mask &= ~CWWidth; + + if (height != w->serverHeight) { - xwc->width = width; + mask |= CWHeight; xwc->height = height; } else - mask &= ~(CWWidth | CWHeight); + mask &= ~CWHeight; if (w->state & CompWindowStateMaximizedVertMask) { @@ -3528,17 +3538,29 @@ moveResizeWindow (CompWindow *w, { int width, height; - if (constrainNewWindowSize (w, - xwc->width, xwc->height, - &width, &height)) + if (!constrainNewWindowSize (w, + xwc->width, xwc->height, + &width, &height)) { - xwcm |= (CWWidth | CWHeight); + width = xwc->width; + height = xwc->height; + } + if (width != w->serverWidth) + { + xwcm |= CWWidth; xwc->width = width; + } + else + xwcm &= ~CWWidth; + + if (height != w->serverHeight) + { + xwcm |= CWHeight; xwc->height = height; } else - xwcm &= ~(CWWidth | CWHeight); + xwcm &= ~CWHeight; } if (xwcm & (CWX | CWWidth)) @@ -4033,6 +4055,8 @@ constrainNewWindowSize (CompWindow *w, { CompDisplay *d = w->screen->display; const XSizeHints *hints = &w->sizeHints; + int oldWidth = width; + int oldHeight = height; int min_width = 0; int min_height = 0; int base_width = 0; @@ -4164,7 +4188,7 @@ constrainNewWindowSize (CompWindow *w, #undef FLOOR64 #undef FLOOR - if (width != w->serverWidth || height != w->serverHeight) + if (width != oldWidth || height != oldHeight) { *newWidth = width; *newHeight = height;
_______________________________________________ compiz mailing list compiz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/compiz