From: Fraser Waters Date: Tue, 12 May 2015 13:15:33 +0000 (+0100) Subject: X11: Fix so ClientSize can resize windows with fixed borders X-Git-Tag: 2.0-0~60^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fb149f97b6bcb52898eb6a08d5b9f0240e488c1;p=platform%2Fcore%2Fcsapi%2Fopentk.git X11: Fix so ClientSize can resize windows with fixed borders Also fixes issue that NativeWindowBase.Height was setting non-client height but Width was setting client Width. Both now set client size. Fixes #259 --- diff --git a/Source/OpenTK/Platform/NativeWindowBase.cs b/Source/OpenTK/Platform/NativeWindowBase.cs index a6ba2c2..231d8f3 100644 --- a/Source/OpenTK/Platform/NativeWindowBase.cs +++ b/Source/OpenTK/Platform/NativeWindowBase.cs @@ -417,8 +417,7 @@ namespace OpenTK.Platform } set { - Rectangle old = ClientRectangle; - ClientRectangle = new Rectangle(old.X, old.Y, value, old.Height); + ClientSize = new Size(value, ClientSize.Height); } } @@ -430,8 +429,7 @@ namespace OpenTK.Platform } set { - Rectangle old = ClientRectangle; - Bounds = new Rectangle(old.X, old.Y, old.Width, value); + ClientSize = new Size(ClientSize.Width, value); } } diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index 822b02b..5b4e38f 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -1072,11 +1072,25 @@ namespace OpenTK.Platform.X11 } set { + bool is_size_changed = client_rectangle.Size != value; + + int width = value.Width; + int height = value.Height; + + if (WindowBorder != WindowBorder.Resizable) + { + SetWindowMinMax(width, height, width, height); + } + using (new XLock(window.Display)) { - Functions.XResizeWindow(window.Display, window.Handle, - value.Width, value.Height); + if (is_size_changed) + { + Functions.XResizeWindow(window.Display, window.Handle, + width, height); + } } + ProcessEvents(); } }