source/Platform/Unix/X11Display.cpp: Fix getPosition() as it did not take border width into account.
This commit is contained in:
parent
46bc8eb5d8
commit
1c7cc31b52
1 changed files with 12 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue