X11: Fix decoration enabling after window creation

From upstream: 5fc4c01302
This commit is contained in:
Kovid Goyal 2019-10-31 09:04:45 +05:30
parent ab8975f4da
commit 82e88b54c7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

19
glfw/x11_window.c vendored
View File

@ -52,6 +52,10 @@
#define Button6 6 #define Button6 6
#define Button7 7 #define Button7 7
// Motif WM hints flags
#define MWM_HINTS_DECORATIONS 2
#define MWM_DECOR_ALL 1
#define _GLFW_XDND_VERSION 5 #define _GLFW_XDND_VERSION 5
@ -2351,14 +2355,6 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, bool enabled UNUSED)
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled) void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
{ {
if (enabled)
{
XDeleteProperty(_glfw.x11.display,
window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS);
}
else
{
struct struct
{ {
unsigned long flags; unsigned long flags;
@ -2366,10 +2362,10 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
unsigned long decorations; unsigned long decorations;
long input_mode; long input_mode;
unsigned long status; unsigned long status;
} hints; } hints = {0};
hints.flags = 2; // Set decorations hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0; // No decorations hints.decorations = enabled ? MWM_DECOR_ALL : 0;
XChangeProperty(_glfw.x11.display, window->x11.handle, XChangeProperty(_glfw.x11.display, window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS, _glfw.x11.MOTIF_WM_HINTS,
@ -2377,7 +2373,6 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, bool enabled)
PropModeReplace, PropModeReplace,
(unsigned char*) &hints, (unsigned char*) &hints,
sizeof(hints) / sizeof(long)); sizeof(hints) / sizeof(long));
}
} }
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled) void _glfwPlatformSetWindowFloating(_GLFWwindow* window, bool enabled)