From ebaad339a9f8dc4cb8b56131491659b7597236dc Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Sat, 18 May 2013 21:05:08 +0200 Subject: [PATCH] Fixed Window::getPosition() on Linux (#346) --- src/SFML/Window/Linux/WindowImplX11.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index c7e06ed9..2bad4684 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -285,9 +285,14 @@ void WindowImplX11::processEvents() //////////////////////////////////////////////////////////// Vector2i WindowImplX11::getPosition() const { - XWindowAttributes attributes; - XGetWindowAttributes(m_display, m_window, &attributes); - return Vector2i(attributes.x, attributes.y); + ::Window root, child; + int localX, localY, x, y; + unsigned int width, height, border, depth; + + XGetGeometry(m_display, m_window, &root, &localX, &localY, &width, &height, &border, &depth); + XTranslateCoordinates(m_display, m_window, root, localX, localY, &x, &y, &child); + + return Vector2i(x, y); }