Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[X11] Improved WindowBorder.Fixed detection

This now works even without having to map the window first.
  • Loading branch information...
commit cfb2d45b8bdf529527fc1bc09d3a10970afffc5e 1 parent d6426f2
@thefiddler thefiddler authored
Showing with 6 additions and 25 deletions.
  1. +6 −25 Source/OpenTK/Platform/X11/X11GLNative.cs
View
31 Source/OpenTK/Platform/X11/X11GLNative.cs
@@ -194,9 +194,6 @@ internal sealed class X11GLNative : NativeWindowBase
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 @@ internal sealed class X11GLNative : NativeWindowBase
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 @@ bool IsWindowBorderResizable
{
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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.