This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch 1/7] Cygwin/X: Make transient windows resizable again


This reverts the change in from-xming-patch11 which makes parented windows non-resizeable

Because this was trying to do something which we should be doing, as an alternative we
try checking WM_NORMAL_HINTS for windows which shouldn't  be resizable

If a window has a maximum size specified, no maximize box
If a window has a fixed size (max size == min size, per ICCM ....), no resizing frame

---
 xserver/hw/xwin/winmultiwindowwm.c |   33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

Index: xorg-server-1.5.3/xserver/hw/xwin/winmultiwindowwm.c
===================================================================
--- xorg-server-1.5.3.orig/xserver/hw/xwin/winmultiwindowwm.c	2009-01-06 20:46:30.000000000 +0000
+++ xorg-server-1.5.3/xserver/hw/xwin/winmultiwindowwm.c	2009-01-13 03:18:22.000000000 +0000
@@ -1470,6 +1470,7 @@
 #define HINT_BORDER	(1L<<1)
 #define HINT_SIZEBOX	(1l<<2)
 #define HINT_CAPTION	(1l<<3)
+#define HINT_NOMAXIMIZE (1L<<4)
 /* These two are used on their own */
 #define HINT_MAX	(1L<<0)
 #define HINT_MIN	(1L<<1)
@@ -1547,6 +1548,29 @@
     if (pAtom) XFree(pAtom);
   }
 
+  XSizeHints *normal_hint = XAllocSizeHints();
+  long supplied;
+  if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, &normal_hint, &supplied) == Success))
+    {
+      if (normal_hint->flags & PMaxSize)
+	{
+	  /* Not maximizable if a maximum size is specified */
+	  hint |= HINT_NOMAXIMIZE;
+
+	  if (normal_hint->flags & PMinSize)
+	    {
+	      /*
+		 If both minimum size and maximum size are specified and are the same,
+		 don't bother with a resizing frame
+	      */
+	      if ((normal_hint->min_width == normal_hint->max_width)
+		  && (normal_hint->min_height == normal_hint->max_height))
+		  hint = (hint & ~HINT_SIZEBOX);
+	    }
+	}
+    }
+  XFree(normal_hint);
+
   /* Apply Styles, overriding hint settings from above */
   rcStyle = winOverrideStyle((unsigned long)pWin);
   if (rcStyle & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
@@ -1565,15 +1589,16 @@
 	hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME;
 
   SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX); /* Just in case */
-  if (!hint) /* All on, but no resize of children is allowed */
-    SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) | WS_CAPTION | (GetParent(hWnd) ? 0 : WS_SIZEBOX));
+  if (!hint) /* All on */
+    SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) | WS_CAPTION | WS_SIZEBOX);
   else if (hint & HINT_NOFRAME); /* All off, so do nothing */
   else  SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) |
 			((hint & HINT_BORDER) ? WS_BORDER : 0) |
-			((hint & HINT_SIZEBOX) ? (GetParent(hWnd) ? 0 : WS_SIZEBOX) : 0) |
+			((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
 			((hint & HINT_CAPTION) ? WS_CAPTION : 0));
 
-  return;
+  if (hint & HINT_NOMAXIMIZE)
+    SetWindowLongPtr(hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_MAXIMIZEBOX);
 }
 
 void

-- 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]