From a6a5fa937c5edf9600a3b9e8e27dc051de57d974 Mon Sep 17 00:00:00 2001 From: arturo Date: Tue, 30 Jul 2013 15:52:23 +0200 Subject: [PATCH] Fixed window position being incorrect on some WMs. --- README.md | 3 +++ src/x11_window.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 2a073d2a..d2dc5e72 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/). of the actual resolution of the selected video mode - [X11] Bugfix: Screensaver override for full screen windows had a possible race condition + - [X11] Bugfix: The reported window position did not account for the size of + the window frame on some WMs ## Contact @@ -151,6 +153,7 @@ skills. - Bobyshev Alexander - artblanc + - arturo - Matt Arsenault - Keith Bauer - John Bartholomew diff --git a/src/x11_window.c b/src/x11_window.c index 44ebd620..c8eeeb74 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -985,6 +985,17 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) XTranslateCoordinates(_glfw.x11.display, window->x11.handle, _glfw.x11.root, 0, 0, &x, &y, &child); + if (child != None) + { + int left, top; + + XTranslateCoordinates(_glfw.x11.display, window->x11.handle, child, + 0, 0, &left, &top, &child); + + x -= left; + y -= top; + } + if (xpos) *xpos = x; if (ypos)