Author: toshok
Date: 2006-09-19 15:14:01 -0400 (Tue, 19 Sep 2006)
New Revision: 65681

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2006-09-19  Chris Toshok  <[EMAIL PROTECTED]>

        * XplatUIX11.cs: apply Alexander's tool window fix for bug #79245
        (mapping them to _NET_WM_WINDOW_TYPE_UTILITY).  and add a little
        added cleanup to get MessageBox titles appearing again, which were
        broken by my earlier fix for caption-less/ControlBox-less windows.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-19 18:29:25 UTC (rev 65680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-19 19:14:01 UTC (rev 65681)
@@ -1,3 +1,10 @@
+2006-09-19  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * XplatUIX11.cs: apply Alexander's tool window fix for bug #79245
+       (mapping them to _NET_WM_WINDOW_TYPE_UTILITY).  and add a little
+       added cleanup to get MessageBox titles appearing again, which were
+       broken by my earlier fix for caption-less/ControlBox-less windows.
+
 2006-09-18  Jonathan Pobst <[EMAIL PROTECTED]>
 
        * ToolStripArrowRenderEventArgs.cs, ToolStripArrowRenderEventHandler.cs,

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-19 18:29:25 UTC (rev 65680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-19 19:14:01 UTC (rev 65681)
@@ -665,7 +665,7 @@
                                                border_style = 
FormBorderStyle.Sizable;
                                        }
                                } else {
-                                       if ((Style & 
(int)WindowStyles.WS_CAPTION) == (int)WindowStyles.WS_CAPTION) {
+                                       if ((Style & 
(int)WindowStyles.WS_CAPTION) != 0) {
                                                if ((ExStyle & 
(int)WindowExStyles.WS_EX_CLIENTEDGE) != 0) {
                                                        border_style = 
FormBorderStyle.Fixed3D;
                                                } else if ((ExStyle & 
(int)WindowExStyles.WS_EX_DLGMODALFRAME) != 0) {
@@ -733,36 +733,33 @@
                                decorations |= MotifDecorations.Border;
                        }
 
-                       if ((cp.Style & ((int)WindowStyles.WS_DLGFRAME)) != 0) {
+                       if ((cp.Style & ((int)WindowStyles.WS_BORDER)) != 0) {
                                decorations |= MotifDecorations.Border;
                        }
-
-                       if ((cp.Style & ((int)WindowStyles.WS_BORDER)) != 0) {
+                       
+                       if ((cp.Style & ((int)WindowStyles.WS_DLGFRAME)) != 0) {
                                decorations |= MotifDecorations.Border;
                        }
+                       else {
+                               if ((cp.Style & ((int)WindowStyles.WS_SYSMENU)) 
!= 0) {
+                                       functions |= MotifFunctions.Close;
+                               }
+                               else {
+                                       functions &= ~(MotifFunctions.Maximize 
| MotifFunctions.Minimize | MotifFunctions.Close);
+                                       decorations &= ~(MotifDecorations.Menu 
| MotifDecorations.Maximize | MotifDecorations.Minimize);
+                                       if (cp.Caption == "") {
+                                               functions &= 
~MotifFunctions.Move;
+                                               decorations &= 
~MotifDecorations.Title;
+                                       }
+                               }
+                       }
 
                        if ((cp.ExStyle & 
((int)WindowExStyles.WS_EX_TOOLWINDOW)) != 0) {
                                functions = 0;
                                decorations = 0;
                        }
 
-                       if ((cp.Style & (int)WindowStyles.WS_DLGFRAME) == 
(int)WindowStyles.WS_DLGFRAME) {
-                               decorations ^= MotifDecorations.Menu;
-                       }
 
-                       if ((cp.Style & ((int)WindowStyles.WS_SYSMENU)) != 0) {
-                               functions |= MotifFunctions.Close;
-                       }
-                       else {
-                               functions &= ~(MotifFunctions.Maximize | 
MotifFunctions.Minimize | MotifFunctions.Close);
-                               decorations &= ~(MotifDecorations.Menu | 
MotifDecorations.Maximize | MotifDecorations.Minimize);
-                               if (cp.Caption == "") {
-                                       functions &= ~MotifFunctions.Move;
-                                       decorations &= ~MotifDecorations.Title;
-                               }
-                       }
-
-
                        if ((cp.Style & (int)(WindowStyles.WS_CAPTION | 
WindowStyles.WS_BORDER | WindowStyles.WS_DLGFRAME)) == 0) {
                                functions = 0;
                                decorations = 0;
@@ -780,6 +777,14 @@
 
                        client_rect = hwnd.ClientRect;
                        lock (XlibLock) {
+                               // needed! map toolwindows to 
_NET_WM_WINDOW_TYPE_UTILITY to make newer metacity versions happy
+                               // and get those windows in front of their 
parents
+                               if ((cp.ExStyle & 
(int)WindowExStyles.WS_EX_TOOLWINDOW) != 0) {
+                                       atoms [0] = NetAtoms 
[(int)NA._NET_WM_WINDOW_TYPE_UTILITY].ToInt32 ();
+                                       XChangeProperty (DisplayHandle, 
hwnd.whole_window,  NetAtoms [(int)NA._NET_WM_WINDOW_TYPE],
+                                                        (IntPtr)Atom.XA_ATOM, 
32, PropertyMode.Replace, atoms, 1);
+                               }
+                               
                                XChangeProperty(DisplayHandle, 
hwnd.whole_window, NetAtoms[(int)NA._MOTIF_WM_HINTS], 
NetAtoms[(int)NA._MOTIF_WM_HINTS], 32, PropertyMode.Replace, ref mwmHints, 5);
                                if (((cp.Style & (int)WindowStyles.WS_POPUP) != 
0) && (hwnd.parent != null) && (hwnd.parent.whole_window != IntPtr.Zero)) {
                                        atoms[0] = 
NetAtoms[(int)NA._NET_WM_WINDOW_TYPE_NORMAL].ToInt32();
@@ -2271,6 +2276,23 @@
                        }
 
                        SetWMStyles(hwnd, cp);
+                       
+                       // set the group leader
+                       XWMHints wm_hints = new XWMHints ();
+                       
+                       wm_hints.flags = (IntPtr)(XWMHintsFlags.InputHint | 
XWMHintsFlags.StateHint | XWMHintsFlags.WindowGroupHint);
+                       wm_hints.input = !((cp.Style & 
(int)WindowStyles.WS_DISABLED) != 0 ? true : false);
+                       wm_hints.initial_state = ((cp.Style & 
(int)WindowStyles.WS_MINIMIZE) !=0) ? XInitialState.IconicState : 
XInitialState.NormalState;
+                       
+                       if (ParentHandle != RootWindow) {
+                               wm_hints.window_group = hwnd.whole_window;
+                       } else {
+                               wm_hints.window_group = ParentHandle;
+                       }
+                       
+                       lock (XlibLock) {
+                               XSetWMHints(DisplayHandle, hwnd.whole_window, 
ref wm_hints );
+                       }
 
                        if ((cp.Style & (int)WindowStyles.WS_MINIMIZE) != 0) {
                                SetWindowState(hwnd.Handle, 
FormWindowState.Minimized);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to