Author: rolf
Date: 2007-03-06 10:33:54 -0500 (Tue, 06 Mar 2007)
New Revision: 73817
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowManager.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
* XplatUIWin32.cs: When faking styles don't remove the WS_VISIBLE flag.
* Form.cs: Don't recreate handle when creating FormWindowManager, just
update window styles. In CreateParams us VisibleInternal instead of
VIsible to get the actual visible flag set for this form.
* FormWindowManager.cs: Activate the form whenever the mouse clicks on
the nc area. Fixes #81042. Also fix HandleTitleBarDoubleClick to
handle the case when the form is already maximized, in which case
it should be restored. Fixes #81043.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-06 15:19:09 UTC (rev 73816)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-06 15:33:54 UTC (rev 73817)
@@ -1,5 +1,16 @@
2007-03-06 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+ * XplatUIWin32.cs: When faking styles don't remove the WS_VISIBLE flag.
+ * Form.cs: Don't recreate handle when creating FormWindowManager, just
+ update window styles. In CreateParams us VisibleInternal instead of
+ VIsible to get the actual visible flag set for this form.
+ * FormWindowManager.cs: Activate the form whenever the mouse clicks on
+ the nc area. Fixes #81042. Also fix HandleTitleBarDoubleClick to
+ handle the case when the form is already maximized, in which case
+ it should be restored. Fixes #81043.
+
+2007-03-06 Rolf Bjarne Kvinge <[EMAIL PROTECTED]>
+
* XplatUIX11.cs: Tool windows still get wm styles. Fixes toolwindows
showing up with double decorations.
2007-03-05 Jackson Harper <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-03-06 15:19:09 UTC (rev 73816)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2007-03-06 15:33:54 UTC (rev 73817)
@@ -192,12 +192,14 @@
}
if (new_parent == null) {
- window_manager = null;
+ window_manager = null;
} else if (new_parent is MdiClient) {
window_manager = new MdiWindowManager (this,
(MdiClient) new_parent);
} else {
window_manager = new FormWindowManager (this);
- RecreateHandle ();
+ if (IsHandleCreated) {
+ XplatUI.SetWindowStyle (Handle,
CreateParams);
+ }
}
if (window_manager != null) {
@@ -1259,7 +1261,7 @@
cp.ExStyle |=
(int)WindowExStyles.WS_EX_CONTEXTHELP;
}
- if (Visible)
+ if (VisibleInternal)
cp.Style |=
(int)WindowStyles.WS_VISIBLE;
if (opacity < 1.0 || TransparencyKey !=
Color.Empty) {
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowManager.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowManager.cs
2007-03-06 15:19:09 UTC (rev 73816)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FormWindowManager.cs
2007-03-06 15:33:54 UTC (rev 73817)
@@ -33,20 +33,42 @@
{
internal class FormWindowManager : InternalWindowManager
{
+ private bool pending_activation;
public FormWindowManager (Form form) : base (form)
{
-
+
+ form.MouseCaptureChanged += new EventHandler
(HandleCaptureChanged);
}
+ void HandleCaptureChanged (object sender, EventArgs e)
+ {
+ if (pending_activation && !form.Capture) {
+ form.BringToFront ();
+ pending_activation = false;
+ }
+ }
+
public override void PointToClient (ref int x, ref int y)
{
XplatUI.ScreenToClient (Form.Parent.Handle, ref x, ref
y);
}
+
+ protected override bool HandleNCLButtonDown (ref Message m)
+ {
+ // MS seems to be doing this on mouse up, but we don't
get WM_NCLBUTTONUP when anything is captured
+ // so work around this using MouseCaptureChanged.
+ pending_activation = true;
+
+ return base.HandleNCLButtonDown (ref m);
+ }
+
protected override void HandleTitleBarDoubleClick (int x, int y)
{
if (IconRectangleContains (x, y)) {
form.Close ();
+ } else if (form.WindowState ==
FormWindowState.Maximized) {
+ form.WindowState = FormWindowState.Normal;
} else {
form.WindowState = FormWindowState.Maximized;
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2007-03-06 15:19:09 UTC (rev 73816)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
2007-03-06 15:33:54 UTC (rev 73817)
@@ -2100,7 +2100,10 @@
private void FakeStyles (CreateParams cp)
{
if (cp.HasWindowManager) {
- cp.Style = (int)WindowStyles.WS_CHILD |
(int)WindowStyles.WS_CLIPCHILDREN | (int)WindowStyles.WS_CLIPSIBLINGS;
+ // Remove all styles but WS_VISIBLE.
+ cp.WindowStyle &= WindowStyles.WS_VISIBLE;
+ // Set styles that enables us to use the window
manager.
+ cp.WindowStyle |= WindowStyles.WS_CHILD |
WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS;
cp.ExStyle = 0;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches