/// <inheritdoc /> /// <exception cref="ObjectDisposedException"><see cref="IsEnabled" /> was <c>true</c> but the instance has already been disposed.</exception> public override void Disable() { if (IsEnabled) { var wmHints = new XWMHints { flags = InputHint, input = False }; _ = XSetWMHints(XlibDispatchProvider.Instance.Display, Handle, &wmHints); } }
/// <inheritdoc /> /// <exception cref="ExternalException">The call to <see cref="XGetWMHints(IntPtr, nuint)" /> failed.</exception> /// <exception cref="ObjectDisposedException"><see cref="IsEnabled" /> was <c>false</c> but the instance has already been disposed.</exception> public override void Enable() { if (!IsEnabled) { var wmHints = new XWMHints { flags = InputHint, input = True }; _ = XSetWMHints(XlibDispatchService.Instance.Display, Handle, &wmHints); } }
public static void ShowWindow(IntPtr display, nuint window, int initialState = NormalState) { var wmHints = new XWMHints { flags = StateHint, initial_state = initialState, }; _ = XSetWMHints(display, window, &wmHints); _ = XMapWindow(display, window); }
/// <inheritdoc /> /// <exception cref="ExternalException">The call to <see cref="XGetWMHints(IntPtr, nuint)" /> failed.</exception> /// <exception cref="ObjectDisposedException"><see cref="IsEnabled" /> was <c>false</c> but the instance has already been disposed.</exception> public override void Enable() { if (_isEnabled == false) { var wmHints = new XWMHints { flags = InputHint, input = True }; _ = XSetWMHints(XlibDispatchProvider.Instance.Display, Handle, &wmHints); _isEnabled = true; } }
/// <summary>Disables the instance.</summary> /// <exception cref="ObjectDisposedException"><see cref="IsEnabled" /> was <c>true</c> but the instance has already been disposed.</exception> public void Disable() { if (_isEnabled) { var wmHints = new XWMHints { flags = (IntPtr)InputHint, input = False }; _ = XSetWMHints(DispatchProvider.Instance.Display, Handle, &wmHints); _isEnabled = false; } }
/// <inheritdoc /> /// <exception cref="ObjectDisposedException"><see cref="WindowState" /> was not <see cref="WindowState.Normal" /> but the instance has already been disposed.</exception> public override void Restore() { var windowState = _windowState; if (windowState != WindowState.Normal) { var dispatchService = XlibDispatchService.Instance; var display = dispatchService.Display; var window = Handle; if (windowState == WindowState.Minimized) { _ = XUnmapWindow(display, window); windowState = WindowState.Hidden; } if (windowState == WindowState.Hidden) { var wmHints = new XWMHints { flags = StateHint, initial_state = NormalState, }; _ = XSetWMHints(display, window, &wmHints); _ = XMapWindow(display, window); } if (dispatchService.GetAtomIsSupported(_NET_WM_STATE_MAXIMIZED_HORZ) && dispatchService.GetAtomIsSupported(_NET_WM_STATE_MAXIMIZED_VERT)) { SendClientMessage( display, dispatchService.DefaultRootWindow, SubstructureNotifyMask | SubstructureRedirectMask, window, dispatchService.GetAtom(_NET_WM_STATE), _NET_WM_STATE_REMOVE, (nint)dispatchService.GetAtom(_NET_WM_STATE_MAXIMIZED_HORZ), (nint)dispatchService.GetAtom(_NET_WM_STATE_MAXIMIZED_VERT), SourceApplication ); } else { throw new NotImplementedException(); } } }
public static extern void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints);
internal extern static void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints);
public static extern void XSetWMHints(Display display, Window w, ref XWMHints wmhints);
public extern static void XSetWMHints(IntPtr display, IntPtr window, ref XWMHints wmhints);
extern public static int XSetWMHints(IntPtr display, IntPtr w, ref XWMHints wmhints);