Hi, Robert,

Here's a patch for GraphicsWindowX11.cpp to fix support for disabling resizing of windows. It seems that some window managers are ignoring the MWM-based code that was there.

I tried to think of a use case that this would break, but I couldn't come up with any. Still, you might want to give it a once-over to make sure there isn't some combination of traits that it won't work for.

--"J"



Index: GraphicsWindowX11.cpp
===================================================================
--- GraphicsWindowX11.cpp    (revision 12997)
+++ GraphicsWindowX11.cpp    (working copy)
@@ -449,11 +449,6 @@
             wmHints.decorations = MWM_DECOR_ALL;
             wmHints.inputMode = 0;
             wmHints.status = 0;
-
- // if traits says not resize we want to set the functions to exlude MWM_FUNC_RESIZE, - // but this bitmask needs to be set if the MWM_FUNC_ALL bit is already set in order to toggle it off. - if (_traits.valid() && !_traits->supportsResize) wmHints.functions = wmHints.functions | MWM_FUNC_RESIZE;
-
         }
         else
         {
@@ -473,6 +468,21 @@
         result = false;
     }

+    // If resizing is disabled in the traits, use the ICCCM window manager
+    // hints to configure this (some window managers, like Metacity, don't
+    // seem to respect the older MWM hints for this)
+    if (_traits.valid() && !_traits->supportsResize)
+    {
+        XSizeHints *sizeHints = XAllocSizeHints();
+        sizeHints->flags = PMinSize | PMaxSize;
+        sizeHints->min_width = _traits->width;
+        sizeHints->max_width = _traits->width;
+        sizeHints->min_height = _traits->height;
+        sizeHints->max_height = _traits->height;
+
+        XSetWMNormalHints(display, _window, sizeHints);
+    }
+
     XFlush(display);
     XSync(display,0);
// add usleep here to give window manager a chance to handle the request, if

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to