summaryrefslogtreecommitdiff
path: root/mcs/class/Managed.Windows.Forms
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs2
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuStrip.cs2
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs13
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs5
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs42
5 files changed, 36 insertions, 28 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
index 404c0e2156..505a41a044 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
@@ -76,6 +76,7 @@ namespace System.Windows.Forms {
internal bool whacky_wm;
internal bool fixed_size;
internal bool zombie; /* X11 only flag. true if the X windows have been destroyed but we haven't been Disposed */
+ internal bool topmost; /* X11 only. */
internal Region user_clip;
internal XEventQueue queue;
internal WindowExStyles initial_ex_style;
@@ -122,6 +123,7 @@ namespace System.Windows.Forms {
children = new ArrayList ();
resizing_or_moving = false;
whacky_wm = false;
+ topmost = false;
}
public void Dispose() {
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuStrip.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuStrip.cs
index 8cad840c4e..8470f2987b 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuStrip.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuStrip.cs
@@ -173,6 +173,8 @@ namespace System.Windows.Forms
this.MenuDroppedDown = false;
base.Dismiss (reason);
+
+ this.FireMenuDeactivate ();
}
internal void FireMenuActivate ()
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
index 45f3ff801f..30c0d89f5f 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
@@ -894,7 +894,7 @@ namespace System.Windows.Forms
if (this is MenuStrip && mouse_currently_over is ToolStripMenuItem && !(mouse_currently_over as ToolStripMenuItem).HasDropDownItems)
return;
} else {
- this.HideMenus (true, ToolStripDropDownCloseReason.AppClicked);
+ this.Dismiss (ToolStripDropDownCloseReason.AppClicked);
}
if (this is MenuStrip)
@@ -1503,17 +1503,6 @@ namespace System.Windows.Forms
this.GetTopLevelToolStrip ().Dismiss (ToolStripDropDownCloseReason.ItemClicked);
}
- internal void HideMenus (bool release, ToolStripDropDownCloseReason reason)
- {
- if (this is MenuStrip && release && menu_selected)
- (this as MenuStrip).FireMenuDeactivate ();
-
- if (release)
- menu_selected = false;
-
- NotifySelectedChanged (null);
- }
-
internal void NotifySelectedChanged (ToolStripItem tsi)
{
foreach (ToolStripItem tsi2 in this.DisplayedItems)
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs
index da16b149ad..4df3397908 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs
@@ -315,12 +315,9 @@ namespace System.Windows.Forms
protected override void OnMouseUp (MouseEventArgs e)
{
if (this.close_on_mouse_release) {
- this.DropDown.Dismiss (ToolStripDropDownCloseReason.ItemClicked);
+ this.Parent.Dismiss (ToolStripDropDownCloseReason.ItemClicked);
this.Invalidate ();
this.close_on_mouse_release = false;
-
- if (!this.IsOnDropDown && this.Parent is MenuStrip)
- (this.Parent as MenuStrip).MenuDroppedDown = false;
}
if (!this.HasDropDownItems && Enabled)
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 9b6c13014a..be29661572 100644
--- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
+++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
@@ -1619,11 +1619,23 @@ namespace System.Windows.Forms {
if (hwnd.zombie)
return;
- if ((windows & WindowType.Whole) != 0) {
- XMapWindow(DisplayHandle, hwnd.whole_window);
- }
- if ((windows & WindowType.Client) != 0) {
- XMapWindow(DisplayHandle, hwnd.client_window);
+ if (hwnd.topmost) {
+ // Most window managers will respect the _NET_WM_STATE property.
+ // If not, use XMapRaised to map the window at the top level as
+ // a last ditch effort.
+ if ((windows & WindowType.Whole) != 0) {
+ XMapRaised(DisplayHandle, hwnd.whole_window);
+ }
+ if ((windows & WindowType.Client) != 0) {
+ XMapRaised(DisplayHandle, hwnd.client_window);
+ }
+ } else {
+ if ((windows & WindowType.Whole) != 0) {
+ XMapWindow(DisplayHandle, hwnd.whole_window);
+ }
+ if ((windows & WindowType.Client) != 0) {
+ XMapWindow(DisplayHandle, hwnd.client_window);
+ }
}
hwnd.mapped = true;
@@ -2972,13 +2984,8 @@ namespace System.Windows.Forms {
XSelectInput(DisplayHandle, hwnd.client_window, new IntPtr ((int)(SelectInputMask | EventMask.StructureNotifyMask | Keyboard.KeyEventMask)));
}
- if (ExStyleSet (cp.ExStyle, WindowExStyles.WS_EX_TOPMOST)) {
- atoms = new int[2];
- atoms[0] = _NET_WM_WINDOW_TYPE_NORMAL.ToInt32();
- XChangeProperty(DisplayHandle, hwnd.whole_window, _NET_WM_WINDOW_TYPE, (IntPtr)Atom.XA_ATOM, 32, PropertyMode.Replace, atoms, 1);
-
- XSetTransientForHint (DisplayHandle, hwnd.whole_window, RootWindow);
- }
+ if (ExStyleSet (cp.ExStyle, WindowExStyles.WS_EX_TOPMOST))
+ SetTopmost(hwnd.whole_window, true);
SetWMStyles(hwnd, cp);
@@ -5787,6 +5794,7 @@ namespace System.Windows.Forms {
{
Hwnd hwnd = Hwnd.ObjectFromHandle(handle);
+ hwnd.topmost = enabled;
if (enabled) {
lock (XlibLock) {
@@ -6405,6 +6413,13 @@ namespace System.Windows.Forms {
DebugHelper.TraceWriteLine ("XMapWindow");
return _XMapWindow(display, window);
}
+ [DllImport ("libX11", EntryPoint="XMapRaised")]
+ internal extern static int _XMapRaised(IntPtr display, IntPtr window);
+ internal static int XMapRaised(IntPtr display, IntPtr window)
+ {
+ DebugHelper.TraceWriteLine ("XMapRaised");
+ return _XMapRaised(display, window);
+ }
[DllImport ("libX11", EntryPoint="XUnmapWindow")]
internal extern static int _XUnmapWindow(IntPtr display, IntPtr window);
internal static int XUnmapWindow(IntPtr display, IntPtr window)
@@ -7255,6 +7270,9 @@ namespace System.Windows.Forms {
[DllImport ("libX11", EntryPoint="XMapWindow")]
internal extern static int XMapWindow(IntPtr display, IntPtr window);
+ [DllImport ("libX11", EntryPoint="XMapRaised")]
+ internal extern static int XMapRaised(IntPtr display, IntPtr window);
+
[DllImport ("libX11", EntryPoint="XUnmapWindow")]
internal extern static int XUnmapWindow(IntPtr display, IntPtr window);