From b93177c1a89767b3e7a9b0693fcf7a082f900642 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 14 Jun 2020 23:36:17 +0200 Subject: [PATCH] sokol: fullscreen linux --- thirdparty/sokol/sokol_app.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/thirdparty/sokol/sokol_app.h b/thirdparty/sokol/sokol_app.h index 2dca54b26d..0df3ef799b 100755 --- a/thirdparty/sokol/sokol_app.h +++ b/thirdparty/sokol/sokol_app.h @@ -6781,8 +6781,13 @@ _SOKOL_PRIVATE void _sapp_x11_query_window_size(void) { _SOKOL_PRIVATE void _sapp_x11_create_window(Visual* visual, int depth) { _sapp_x11_colormap = XCreateColormap(_sapp_x11_display, _sapp_x11_root, visual, AllocNone); + + + + XSetWindowAttributes wa; memset(&wa, 0, sizeof(wa)); + //wa.override_redirect = 1; const uint32_t wamask = CWBorderPixel | CWColormap | CWEventMask; wa.colormap = _sapp_x11_colormap; wa.border_pixel = 0; @@ -6807,6 +6812,26 @@ _SOKOL_PRIVATE void _sapp_x11_create_window(Visual* visual, int depth) { _sapp_fail("X11: Failed to create window"); } + if (_sapp.desc.fullscreen) { + Atom wm_state = XInternAtom(_sapp_x11_display, "_NET_WM_STATE", False); + Atom fullscreen = XInternAtom(_sapp_x11_display, "_NET_WM_STATE_FULLSCREEN", False); + + XEvent xev; + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = _sapp_x11_window; + xev.xclient.message_type = wm_state; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; + xev.xclient.data.l[1] = fullscreen; + xev.xclient.data.l[2] = 0; + + XMapWindow(_sapp_x11_display, _sapp_x11_window); + + XSendEvent (_sapp_x11_display, DefaultRootWindow(_sapp_x11_display), False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); + } + Atom protocols[] = { _sapp_x11_WM_DELETE_WINDOW };