diff options
author | Ivan Zlatev <ivan@ivanz.com> | 2008-09-18 14:21:13 +0400 |
---|---|---|
committer | Ivan Zlatev <ivan@ivanz.com> | 2008-09-18 14:21:13 +0400 |
commit | c03811205fd6c7ab5b71f30f224c1929063b6e80 (patch) | |
tree | 4727fa8b983cb28c97407fd3e0a536f9ed475b46 | |
parent | 081c1c9c506ee0b88a868f0a2e5a859e022a6d37 (diff) |
2008-09-18 Ivan N. Zlatev <contact@i-nz.net>
* XplatUIX11.cs:
- Do not set _NET_WM_WINDOW_TYPE_DIALOG for modal forms, because this
leads to the window manager overriding our border style and zorder.
- Allow the activation of non-modal forms, which are children of a
modal form.
[Fixes bug #423417]
svn path=/trunk/mcs/; revision=113396
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog | 9 | ||||
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs | 24 |
2 files changed, 26 insertions, 7 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 30c264c0e01..9d6ccd4a46f 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,12 @@ +2008-09-18 Ivan N. Zlatev <contact@i-nz.net> + + * XplatUIX11.cs: + - Do not set _NET_WM_WINDOW_TYPE_DIALOG for modal forms, because this + leads to the window manager overriding our border style and zorder. + - Allow the activation of non-modal forms, which are children of a + modal form. + [Fixes bug #423417] + 2008-09-17 Ivan N. Zlatev <contact@i-nz.net> * XplatUIX11.cs, X11Structs.cs: For mapped windows SetTopMost should diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs index 6e91d4e7262..9859c681fbb 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs @@ -1073,8 +1073,6 @@ namespace System.Windows.Forms { // needed! map toolwindows to _NET_WM_WINDOW_TYPE_UTILITY to make newer metacity versions happy // and get those windows in front of their parents window_type = _NET_WM_WINDOW_TYPE_UTILITY; - } else if (form != null && form.Modal) { - window_type = _NET_WM_WINDOW_TYPE_DIALOG; } else { window_type = _NET_WM_WINDOW_TYPE_NORMAL; } @@ -1786,11 +1784,23 @@ namespace System.Windows.Forms { if (ModalWindows.Count == 0) { break; } else { - // Modality handling, if we are modal and the new active window is one - // of ours but not the modal one, switch back to the modal window - - if (NativeWindow.FromHandle(ActiveWindow) != null) { - if (ActiveWindow != (IntPtr)ModalWindows.Peek()) { + // Modality Handling + // + // If there is a modal window on the stack and the new active + // window is MWF window, but not the modal one and not a non-modal + // child of the modal one, switch back to the modal window. + // + // To identify if a non-modal form is child of a modal form + // we match their ApplicationContexts, which will be the same. + // This is because each modal form runs the loop with a + // new ApplicationContext, which is inherited by the non-modal + // forms. + + Form activeForm = Control.FromHandle (ActiveWindow) as Form; + if (activeForm != null) { + Form modalForm = Control.FromHandle ((IntPtr)ModalWindows.Peek()) as Form; + if (ActiveWindow != (IntPtr)ModalWindows.Peek() && + (modalForm == null || activeForm.context == modalForm.context)) { Activate((IntPtr)ModalWindows.Peek()); } } |