From: thefiddler Date: Mon, 19 May 2014 07:22:27 +0000 (+0200) Subject: [X11] Improved WindowBorder.Fixed detection X-Git-Tag: 2.0-0~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cfb2d45b8bdf529527fc1bc09d3a10970afffc5e;p=platform%2Fcore%2Fcsapi%2Fopentk.git [X11] Improved WindowBorder.Fixed detection This now works even without having to map the window first. --- diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index e2cd6e2..658eb00 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -194,9 +194,6 @@ namespace OpenTK.Platform.X11 Functions.XStoreName(window.Display, window.Handle, title); } - // Set the window hints - SetWindowMinMax(_min_width, _min_height, -1, -1); - XSizeHints hints = new XSizeHints(); hints.base_width = width; hints.base_height = height; @@ -217,6 +214,8 @@ namespace OpenTK.Platform.X11 Functions.XSetClassHint(window.Display, window.Handle, ref class_hint); } + SetWindowMinMax(_min_width, _min_height, -1, -1); + // Set the initial window size to ensure X, Y, Width, Height and the rest // return the correct values inside the constructor and the Load event. XEvent e = new XEvent(); @@ -395,33 +394,15 @@ namespace OpenTK.Platform.X11 { get { - IntPtr actual_atom; - int actual_format; - IntPtr nitems; - IntPtr bytes_after; - IntPtr prop = IntPtr.Zero; - IntPtr atom; - //XWindowAttributes attributes; - using (new XLock(window.Display)) { - Functions.XGetWindowProperty(window.Display, window.Handle, - _atom_net_wm_allowed_actions, IntPtr.Zero, new IntPtr(256), false, - IntPtr.Zero, out actual_atom, out actual_format, out nitems, - out bytes_after, ref prop); - if ((long)nitems > 0 && prop != IntPtr.Zero) + XSizeHints hints = new XSizeHints(); + IntPtr dummy; + if (Functions.XGetWMNormalHints(window.Display, window.Handle, ref hints, out dummy) != 0) { - for (int i = 0; i < (long)nitems; i++) - { - atom = (IntPtr)Marshal.ReadIntPtr(prop, i * IntPtr.Size); - - if (atom == _atom_net_wm_action_resize) - return true; - } - Functions.XFree(prop); + return hints.min_width != hints.max_width || hints.min_height != hints.max_height; } } - return false; } }