1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

X11: Fix decoration enabling after window creation

This fixes the enabling of window decorations after creation.  Instead
of removing the _MOTIF_WM_HINTS property, we now set or unset the
MWM_DECOR_ALL bit of the decorations field.

Fixes #1566.

(cherry picked from commit 5fc4c01302)
This commit is contained in:
Camilla Löwy 2019-09-26 18:29:37 +02:00
parent f9a9bb6747
commit 1bf892f603
2 changed files with 20 additions and 24 deletions

View File

@ -132,6 +132,7 @@ information on what to include when reporting a bug.
- [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480)
- [X11] Bugfix: Key names were not updated when the keyboard layout changed - [X11] Bugfix: Key names were not updated when the keyboard layout changed
(#1462,#1528) (#1462,#1528)
- [X11] Bugfix: Decorations could not be enabled after window creation (#1566)
## Contact ## Contact

View File

@ -50,6 +50,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
@ -2535,14 +2539,6 @@ void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
} }
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
{
if (enabled)
{
XDeleteProperty(_glfw.x11.display,
window->x11.handle,
_glfw.x11.MOTIF_WM_HINTS);
}
else
{ {
struct struct
{ {
@ -2551,10 +2547,10 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool 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,
@ -2563,7 +2559,6 @@ void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
(unsigned char*) &hints, (unsigned char*) &hints,
sizeof(hints) / sizeof(long)); sizeof(hints) / sizeof(long));
} }
}
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
{ {