mirror of https://github.com/buggins/dlangui.git
Merge pull request #470 from FreeSlave/borderless_window
Borderless window
This commit is contained in:
commit
c41db7af76
|
@ -54,6 +54,8 @@ enum WindowFlag : uint {
|
||||||
Modal = 4,
|
Modal = 4,
|
||||||
/// measure window size on window.show() - helps if you want scrollWindow but on show() you want to set window to mainWidget measured size
|
/// measure window size on window.show() - helps if you want scrollWindow but on show() you want to set window to mainWidget measured size
|
||||||
MeasureSize = 8,
|
MeasureSize = 8,
|
||||||
|
/// window without decorations
|
||||||
|
Borderless = 16,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Window states
|
/// Window states
|
||||||
|
|
|
@ -249,6 +249,8 @@ class SDLWindow : Window {
|
||||||
windowFlags |= SDL_WINDOW_RESIZABLE;
|
windowFlags |= SDL_WINDOW_RESIZABLE;
|
||||||
if (flags & WindowFlag.Fullscreen)
|
if (flags & WindowFlag.Fullscreen)
|
||||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
if (flags & WindowFlag.Borderless)
|
||||||
|
windowFlags = SDL_WINDOW_BORDERLESS;
|
||||||
windowFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
windowFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
static if (ENABLE_OPENGL) {
|
static if (ENABLE_OPENGL) {
|
||||||
if (_enableOpengl)
|
if (_enableOpengl)
|
||||||
|
|
|
@ -282,6 +282,9 @@ class Win32Window : Window {
|
||||||
_dy = screenRc.height;
|
_dy = screenRc.height;
|
||||||
ws = WS_POPUP;
|
ws = WS_POPUP;
|
||||||
}
|
}
|
||||||
|
if (flags & WindowFlag.Borderless) {
|
||||||
|
ws = WS_POPUP | WS_SYSMENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_hwnd = CreateWindowW(toUTF16z(WIN_CLASS_NAME), // window class name
|
_hwnd = CreateWindowW(toUTF16z(WIN_CLASS_NAME), // window class name
|
||||||
|
|
|
@ -44,6 +44,28 @@ static if (ENABLE_OPENGL) {
|
||||||
alias XWindow = x11.Xlib.Window;
|
alias XWindow = x11.Xlib.Window;
|
||||||
alias DWindow = dlangui.platforms.common.platform.Window;
|
alias DWindow = dlangui.platforms.common.platform.Window;
|
||||||
|
|
||||||
|
private struct MwmHints
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
int functions;
|
||||||
|
int decorations;
|
||||||
|
int input_mode;
|
||||||
|
int status;
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum
|
||||||
|
{
|
||||||
|
MWM_HINTS_FUNCTIONS = (1L << 0),
|
||||||
|
MWM_HINTS_DECORATIONS = (1L << 1),
|
||||||
|
|
||||||
|
MWM_FUNC_ALL = (1L << 0),
|
||||||
|
MWM_FUNC_RESIZE = (1L << 1),
|
||||||
|
MWM_FUNC_MOVE = (1L << 2),
|
||||||
|
MWM_FUNC_MINIMIZE = (1L << 3),
|
||||||
|
MWM_FUNC_MAXIMIZE = (1L << 4),
|
||||||
|
MWM_FUNC_CLOSE = (1L << 5)
|
||||||
|
}
|
||||||
|
|
||||||
private __gshared
|
private __gshared
|
||||||
{
|
{
|
||||||
Display * x11display;
|
Display * x11display;
|
||||||
|
@ -74,6 +96,8 @@ private __gshared
|
||||||
Atom atom_NET_WM_STATE_HIDDEN;
|
Atom atom_NET_WM_STATE_HIDDEN;
|
||||||
Atom atom_NET_WM_STATE_FULLSCREEN;
|
Atom atom_NET_WM_STATE_FULLSCREEN;
|
||||||
|
|
||||||
|
Atom atom_MOTIF_WM_HINTS;
|
||||||
|
|
||||||
Atom atom_DLANGUI_TIMER_EVENT;
|
Atom atom_DLANGUI_TIMER_EVENT;
|
||||||
Atom atom_DLANGUI_TASK_EVENT;
|
Atom atom_DLANGUI_TASK_EVENT;
|
||||||
Atom atom_DLANGUI_CLOSE_WINDOW_EVENT;
|
Atom atom_DLANGUI_CLOSE_WINDOW_EVENT;
|
||||||
|
@ -98,6 +122,7 @@ static void setupX11Atoms()
|
||||||
atom_NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(x11display, "_NET_WM_STATE_MAXIMIZED_HORZ", True);
|
atom_NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(x11display, "_NET_WM_STATE_MAXIMIZED_HORZ", True);
|
||||||
atom_NET_WM_STATE_HIDDEN = XInternAtom(x11display, "_NET_WM_STATE_HIDDEN", True);
|
atom_NET_WM_STATE_HIDDEN = XInternAtom(x11display, "_NET_WM_STATE_HIDDEN", True);
|
||||||
atom_NET_WM_STATE_FULLSCREEN = XInternAtom(x11display, "_NET_WM_STATE_FULLSCREEN", True);
|
atom_NET_WM_STATE_FULLSCREEN = XInternAtom(x11display, "_NET_WM_STATE_FULLSCREEN", True);
|
||||||
|
atom_MOTIF_WM_HINTS = XInternAtom(x11display, "_MOTIF_WM_HINTS", True);
|
||||||
|
|
||||||
atom_DLANGUI_TIMER_EVENT = XInternAtom(x11display, "DLANGUI_TIMER_EVENT", False);
|
atom_DLANGUI_TIMER_EVENT = XInternAtom(x11display, "DLANGUI_TIMER_EVENT", False);
|
||||||
atom_DLANGUI_TASK_EVENT = XInternAtom(x11display, "DLANGUI_TASK_EVENT", False);
|
atom_DLANGUI_TASK_EVENT = XInternAtom(x11display, "DLANGUI_TASK_EVENT", False);
|
||||||
|
@ -335,6 +360,13 @@ class X11Window : DWindow {
|
||||||
else
|
else
|
||||||
Log.w("Missing _NET_WM_STATE_FULLSCREEN atom");
|
Log.w("Missing _NET_WM_STATE_FULLSCREEN atom");
|
||||||
}
|
}
|
||||||
|
if (flags & WindowFlag.Borderless) {
|
||||||
|
if (atom_MOTIF_WM_HINTS != None) {
|
||||||
|
MwmHints hints;
|
||||||
|
hints.flags = MWM_HINTS_DECORATIONS;
|
||||||
|
XChangeProperty(x11display, _win, atom_MOTIF_WM_HINTS, atom_MOTIF_WM_HINTS, 32, PropModeReplace, cast(ubyte*)&hints, hints.sizeof / 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (flags & WindowFlag.Modal) {
|
if (flags & WindowFlag.Modal) {
|
||||||
if (_parent) {
|
if (_parent) {
|
||||||
XSetTransientForHint(x11display, _win, _parent._win);
|
XSetTransientForHint(x11display, _win, _parent._win);
|
||||||
|
|
Loading…
Reference in New Issue