1
0
Fork 0

source/Platform/Unix/X11Display.cpp: Fix getPosition() as it did not take border width into account.

This commit is contained in:
Henrik Hautakoski 2022-10-01 16:02:10 +02:00
parent 46bc8eb5d8
commit 1c7cc31b52

View file

@ -132,14 +132,20 @@ void X11Display::setPosition(unsigned int x, unsigned int y)
Vector2u X11Display::getPosition() const
{
Vector2u pos(0, 0);
XWindowAttributes attr;
int x, y;
unsigned int w, h, bw, d;
::Display* disp = Xlib::getDisplay();
::Window ancestor = m_win;
::Window root = DefaultRootWindow(disp);
if (XGetWindowAttributes(Xlib::getDisplay(), m_win, &attr)) {
pos.x = attr.x;
pos.y = attr.y;
while (Xlib::getParentWindow(ancestor) != root) {
// Next window up (parent window).
ancestor = Xlib::getParentWindow(ancestor);
}
return pos;
::XGetGeometry(disp, ancestor, &root, &x, &y, &w, &h, &bw, &d);
return Vector2u(x, y);
}
void X11Display::setVisible(bool visible)