public static Size GetWindowSize(IntPtr window) { #if LINUX XSizeHints size_hints = new XSizeHints(); XGetWMNormalHints(display, window, ref size_hints, out IntPtr supplied_return); return(new Size(size_hints.width, size_hints.height)); #else throw new NotImplementedException(); #endif }
public static Point GetWindowPosition(IntPtr window) { #if LINUX XSizeHints size_hints = new XSizeHints(); XGetWMNormalHints(display, window, ref size_hints, out IntPtr supplied_return); return(new Point(size_hints.x, size_hints.y)); #else throw new NotImplementedException(); #endif }
public RCode CreateWindowPane(VectorI2d vWindowPos, VectorI2d vWindowSize, bool bFullScreen) { display = Xlib.XOpenDisplay(null); screen = Xlib.XDefaultScreen(display); root = Xlib.XRootWindow(display, screen); mainWindow = Xlib.XCreateSimpleWindow( display, root, vWindowPos.x, vWindowPos.y, (uint)vWindowSize.x, (uint)vWindowSize.y, 1, Xlib.XBlackPixel(display, screen), Xlib.XWhitePixel(display, screen)); EventMask eventMask = // Keyboard EventMask.KeyPressMask | EventMask.KeyReleaseMask | // Mouse EventMask.PointerMotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | // Window EventMask.FocusChangeMask | EventMask.EnterWindowMask | EventMask.LeaveWindowMask; Xlib.XSelectInput(display, mainWindow, eventMask); Xlib.XMapWindow(display, mainWindow); // Disable windows re-sizing XSizeHints sizeHints = new XSizeHints() { flags = XSizeHintsFlags.PMaxSize | XSizeHintsFlags.PMinSize, min_width = vWindowSize.x, max_width = vWindowSize.x, min_height = vWindowSize.y, max_height = vWindowSize.y }; XlibExt.XSetWMNormalHints(display, mainWindow, ref sizeHints); // Setup delete message when the user closes the window deleteWindowMessage = XlibExt.XInternAtom(display, "WM_DELETE_WINDOW", false); XlibExt.XSetWMProtocols(display, mainWindow, new Atom[] { deleteWindowMessage }, 1); return(RCode.OK); }
void UpdateSizeHints(PixelSize?preResize) { var min = _minMaxSize.minSize; var max = _minMaxSize.maxSize; if (!_canResize) { max = min = _realSize; } if (preResize.HasValue) { var desired = preResize.Value; max = new PixelSize(Math.Max(desired.Width, max.Width), Math.Max(desired.Height, max.Height)); min = new PixelSize(Math.Min(desired.Width, min.Width), Math.Min(desired.Height, min.Height)); } var hints = new XSizeHints { min_width = min.Width, min_height = min.Height }; hints.height_inc = hints.width_inc = 1; var flags = XSizeHintsFlags.PMinSize | XSizeHintsFlags.PResizeInc; // People might be passing double.MaxValue if (max.Width < 100000 && max.Height < 100000) { hints.max_width = max.Width; hints.max_height = max.Height; flags |= XSizeHintsFlags.PMaxSize; } hints.flags = (IntPtr)flags; XSetWMNormalHints(_x11.Display, _handle, ref hints); }
public static extern void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints);
public static extern void XGetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints, out IntPtr supplied_return);
public extern static void XSetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints);
public extern static void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints);
public extern static void XGetWMNormalHints(IntPtr display, IntPtr window, ref XSizeHints hints, out IntPtr supplied_return);
internal extern static void XSetZoomHints(IntPtr display, IntPtr window, ref XSizeHints hints);
internal static extern void XSetWMNormalHints(PDISPLAY display, WINDOW window, ref XSizeHints hints);
internal static extern int XGetWMNormalHints(PDISPLAY display, WINDOW window, out XSizeHints hints, out LONG supplied_return);
public static unsafe extern void XSetWMNormalHints(IntPtr display, IntPtr w, XSizeHints* hints);