From 4aafdea5a7c8b44ddeb523d0b9ae37a9e3f2eccf Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 17 Aug 2016 01:11:32 +0200 Subject: [PATCH] X11: Fix glfw*WindowPos operating on window frame Fixes #800. --- README.md | 2 ++ src/x11_window.c | 17 +++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7a7fa4d0..e62f7300 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,8 @@ information on what to include when reporting a bug. was set to `GLFW_DONT_CARE` (#805) - [X11] Bugfix: Input focus was set before window was visible, causing `BadMatch` on some non-reparenting WMs (#789,#798) + - [X11] Bugfix: `glfwGetWindowPos` and `glfwSetWindowPos` operated on the + window frame instead of the client area (#800) - [WGL] Added reporting of errors from `WGL_ARB_create_context` extension - [GLX] Bugfix: Dynamically loaded entry points were not verified - [EGL] Added `lib` prefix matching between EGL and OpenGL ES library binaries diff --git a/src/x11_window.c b/src/x11_window.c index 7a68fe10..077eebb6 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -289,6 +289,9 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height) } } + hints->flags |= PWinGravity; + hints->win_gravity = StaticGravity; + XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } @@ -1712,21 +1715,11 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window, void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { - Window child; + Window dummy; int x, y; XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root, - 0, 0, &x, &y, &child); - - if (child) - { - int left, top; - XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child, - 0, 0, &left, &top, &child); - - x -= left; - y -= top; - } + 0, 0, &x, &y, &dummy); if (xpos) *xpos = x;