- Applied patch from Ashwin Bharambe, implementing SetModal() method
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 19 Dec 2004 07:38:34 +0000 (07:38 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 19 Dec 2004 07:38:34 +0000 (07:38 -0000)
svn path=/trunk/mcs/; revision=37929

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index 079c8768f70fb92da5eeb787c4b42a0f2c27f598..5cd38c79d70a75c06de42f4470a4b2b7588f029f 100644 (file)
@@ -1,4 +1,8 @@
-<<<<<<< .mine
+2004-12-18  Peter Bartok  <pbartok@novell.com>
+
+       * XplatUIX11.cs (SetModal): Applied patch from Ashwin Bharambe, 
+         implementing SetModal() method
+
 2004-12-18  Peter Bartok  <pbartok@novell.com>
 
        * X11Structs.cs (XGCValues): Fixed type of function element
        * XplatUIX11.cs: Implemented ScrollWindow() method
        * XplatUIOSX.cs: Stubbed out ScrollWindow() method
 
-=======
 2004-12-17  Geoff Norton  <gnorton@customerdna.com>
 
        * XplatUIOSX.cs:  Fix cursor to use an Invert instead of drawing it
        Some more keyboard support (INCOMPLETE)
 
->>>>>>> .r37924
 2004-12-17  Peter Bartok  <pbartok@novell.com>
 
        * TextControl.cs:
index ba32fd47fad31faef77444c71b65155936d97bc4..42c46fce1f467dabf9a6cc95e3e834f64a8a30cb 100644 (file)
@@ -83,6 +83,7 @@ namespace System.Windows.Forms {
                private static int              wm_no_taskbar;          // X Atom
                private static int              wm_state_above;         // X Atom
                private static int              atom;                   // X Atom
+               private static int              wm_state_modal;         // X Atom
                private static int              net_wm_state;           // X Atom
                private static int              async_method;
                private static int              post_message;
@@ -359,6 +360,8 @@ namespace System.Windows.Forms {
                                net_wm_state=XInternAtom(display_handle, "_NET_WM_STATE", false);
                                wm_no_taskbar=XInternAtom(display_handle, "_NET_WM_STATE_NO_TASKBAR", false);
                                wm_state_above=XInternAtom(display_handle, "_NET_WM_STATE_ABOVE", false);
+                               wm_state_modal = XInternAtom(display_handle, "_NET_WM_STATE_MODAL", false);
+
                                atom=XInternAtom(display_handle, "ATOM", false);
                                async_method = XInternAtom(display_handle, "_SWF_AsyncAtom", false);
                                post_message = XInternAtom (display_handle, "_SWF_PostMessageAtom", false);
@@ -691,8 +694,18 @@ namespace System.Windows.Forms {
                }
 
                internal override void SetModal(IntPtr handle, bool Modal) {
-                       // We need to use the Motif window manager hints to build modal stuff; see freedesktop.org
-                       throw new NotImplementedException("Finish me");
+                       XEvent  xevent = new XEvent();\r
+\r
+                       xevent.ClientMessageEvent.type = XEventName.ClientMessage;\r
+                       xevent.ClientMessageEvent.serial = 0;\r
+                       xevent.ClientMessageEvent.send_event = true;\r
+                       xevent.ClientMessageEvent.window = handle;\r
+                       xevent.ClientMessageEvent.message_type = (IntPtr) net_wm_state;\r
+                       xevent.ClientMessageEvent.format = 32;\r
+                       xevent.ClientMessageEvent.ptr1 = (IntPtr) (Modal ? NetWindowManagerState.Add : NetWindowManagerState.Remove);\r
+                       xevent.ClientMessageEvent.ptr2 = (IntPtr) wm_state_modal;\r
+\r
+                       XSendEvent(DisplayHandle, root_window, false, EventMask.SubstructureRedirectMask | EventMask.SubstructureNotifyMask, ref xevent);\r
                }
 
                internal override void Invalidate (IntPtr handle, Rectangle rc, bool clear) {