HumbleUI / JWM

Cross-platform window management and OS integration library for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hiding window decorations

dzaima opened this issue · comments

For creating custom popup windows or similar, ability to hide window decorations (also, hiding it from the taskbar) is necessary.

Alternative would be to force everything to use native menus (#193).

For X11, this would involve setting this property with one of a variety of options, e.g.:

Atom type = _NET_WM_WINDOW_TYPE_POPUP_MENU;
XChangeProperty(instance->_windowManager.display,
                instance->_x11Window,
                _NET_WM_WINDOW_TYPE,
                XA_ATOM,
                32,
                PropModeReplace,
                (unsigned char *)&type,
                1);

Noticed that there's setZOrder and setTitlebarVisible, guided by macOS, which together would handle some of that, but would need a 3rd thing to hide from taskbar. X11 does provide separate _NET_WM_STATE_MODAL to disable decorations (i.e. title bar) and _NET_WM_STATE_SKIP_TASKBAR to hide from taskbar, but doesn't seem to provide anything for just inheriting the z-order from a type.

There is also apparently https://developer.apple.com/documentation/appkit/nsapplicationactivationpolicy?language=objc for hiding from the dock on macOS. I haven't messed around with it at all yet.

What would the cross-platform API look like?

The way it seems to me is that in X11 you have to provide a specific window type, whereas macOS and Windows allow more individual control over window features.
https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
https://developer.apple.com/documentation/appkit/nswindowstylemask?language=objc

A possible approach for JWM could be something like setWindowType which takes care of all the necessary details.

Sounds good