From 41d945a4e2b47471e94f8ccc8c085e8ebcb776f6 Mon Sep 17 00:00:00 2001 From: Alexander Malmberg Date: Sat, 12 Feb 2005 12:50:23 +0000 Subject: [PATCH] 2005-02-12 13:54 Alexander Malmberg * Source/x11/XGServerWindow.m (setNormalHints): If the window isn't resizable, force the min and max sizes to be equal to the current size. (-placewindow::): Set the hints after updating xframe. Fixes bug #11713. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20693 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/x11/XGServerWindow.m | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3df000..5b6e79a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-02-12 13:54 Alexander Malmberg + + * Source/x11/XGServerWindow.m (setNormalHints): If the window isn't + resizable, force the min and max sizes to be equal to the current + size. + (-placewindow::): Set the hints after updating xframe. + + Fixes bug #11713. + 2005-02-10 00:50 Alexander Malmberg * Tools/gpbs.m (init): Remove the program name from the arguments diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index 517b532..ca443a7 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -140,7 +140,34 @@ setNormalHints(Display *d, gswindow_device_t *w) if (w->siz_hints.flags & PResizeInc) NSDebugLLog(@"XGTrace", @"Hint incr %d: %d, %d", w->number, w->siz_hints.width_inc, w->siz_hints.height_inc); - XSetWMNormalHints(d, w->ident, &w->siz_hints); + if (handlesWindowDecorations + && !(w->win_attrs.window_style & NSResizableWindowMask)) + { + /* Some silly window managers (*cough* metacity *cough*) ignore + our "non-resizable" hints unless we set the min and max + sizes equal to the current size, hence the ugly code here. */ + CARD32 oldFlags; + int old_w0, old_h0, old_w1, old_h1; + + old_w0 = w->siz_hints.min_width; + old_h0 = w->siz_hints.max_width; + old_w1 = w->siz_hints.min_height; + old_h1 = w->siz_hints.max_height; + oldFlags = w->siz_hints.flags; + + w->siz_hints.flags |= PMinSize | PMaxSize; + w->siz_hints.min_width = w->siz_hints.max_width = w->xframe.size.width; + w->siz_hints.min_height = w->siz_hints.max_height = w->xframe.size.height; + XSetWMNormalHints(d, w->ident, &w->siz_hints); + + w->siz_hints.min_width = old_w0; + w->siz_hints.max_width = old_h0; + w->siz_hints.min_height = old_w1; + w->siz_hints.max_height = old_h1; + w->siz_hints.flags = oldFlags; + } + else + XSetWMNormalHints(d, w->ident, &w->siz_hints); } /* @@ -1852,7 +1879,6 @@ static BOOL didCreatePixmaps; XMoveResizeWindow (dpy, window->ident, window->siz_hints.x, window->siz_hints.y, window->siz_hints.width, window->siz_hints.height); - setNormalHints(dpy, window); /* Update xframe right away. We optimistically assume that we'll get the frame we asked for. If we're right, -gui can update/redraw right away, @@ -1861,6 +1887,11 @@ static BOOL didCreatePixmaps; at that point, we'll send new GSAppKitWindow* events to -gui. */ window->xframe = xVal; + /* Update the hints. Note that we do this _after_ updating xframe since + the hint setting code needs the new xframe to work around problems + with min/max sizes and resizability in some window managers. */ + setNormalHints(dpy, window); + if (resize == YES) { NSDebugLLog(@"Moving", @"Fake size %d - %@", window->number,