Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorKarl <5079870+PreferLinux@users.noreply.github.com>2020-01-27 15:41:00 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2020-01-27 15:41:00 +0300
commitba3b6a169bc221d93de967755a66afb7f1c2949e (patch)
tree330b7cc141e0f380a15335ec10c2689f0577793e /mcs/class
parent23b8f10cb89b18e2cc37ea49abfa60c3166081d3 (diff)
[Winforms] X11 Fix bounds change from within bounds-related events (#18513)
The real change here is, in `XplatUIX11.SetWindowPos()`, simply moving the `SendMessage` call to the end instead of earlier. The problem with it earlier is that any change in bounds from any of the bounds-related events (OnLocationChanged / OnMove, OnSizeChanged / OnResize, OnLayout, OnClientSizeChanged) will be overridden. When `SendMessage` is called, `UpdateBounds` is run, and that raises those events as relevant. After those events finish, `SetWindowPos` continues with setting the size of the window to the value originally specified – which is now potentially wrong. So send the message later on. There is also no point that I can see in writing the values to `hwnd` twice, because as far as I can see the only one that can be changed is `hwnd.ClientRect` (set by `PerformNCCalc`).
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs11
1 files changed, 1 insertions, 10 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
index 63021f5f87b..32b64fd7579 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
@@ -6039,7 +6039,6 @@ namespace System.Windows.Forms {
hwnd.y = y;
hwnd.width = width;
hwnd.height = height;
- SendMessage(hwnd.client_window, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero);
if (!hwnd.zero_sized) {
if (hwnd.fixed_size) {
@@ -6054,15 +6053,7 @@ namespace System.Windows.Forms {
}
}
- // Update our position/size immediately, so
- // that future calls to SetWindowPos aren't
- // kept from calling XMoveResizeWindow (by the
- // "Save a server roundtrip" block above).
- hwnd.x = x;
- hwnd.y = y;
- hwnd.width = width;
- hwnd.height = height;
- hwnd.ClientRect = Rectangle.Empty;
+ SendMessage(hwnd.client_window, Msg.WM_WINDOWPOSCHANGED, IntPtr.Zero, IntPtr.Zero);
}
internal override void SetWindowState(IntPtr handle, FormWindowState state)