fix tooltip windows for xinerama

This commit is contained in:
Mark Tiefenbruck 2008-05-05 06:37:35 -07:00
parent 8f0b031aa3
commit 969133c067

View file

@ -65,24 +65,24 @@ void TooltipWindow::raiseTooltip() {
XQueryPointer(display(), m_screen.rootWindow().window(), XQueryPointer(display(), m_screen.rootWindow().window(),
&root_ret, &window_ret, &rx, &ry, &wx, &wy, &mask); &root_ret, &window_ret, &rx, &ry, &wx, &wy, &mask);
// mouse position int head = m_screen.getHead(rx, ry);
int mx = rx; int head_top = m_screen.getHeadY(head);
int my = ry; int head_left = m_screen.getHeadX(head);
int head_right = head_left + m_screen.getHeadWidth(head);
// center the mouse horizontally // center the mouse horizontally
rx -= w/2; rx -= w/2;
int yoffset = 10; int yoffset = 10;
if (ry >= yoffset + h) if (ry - yoffset - h >= head_top)
ry -= yoffset + h; ry -= yoffset + h;
else else
ry += yoffset; ry += yoffset;
// check that we are not out of screen // check that we are not out of screen
int outOfBound = rx + w - m_screen.width(); if (rx + w > head_right)
if (outOfBound > 0) rx = head_right - w;
rx -= outOfBound; if (rx < head_left)
if (rx < 0) rx = head_left;
rx = 0;
moveResize(rx,ry,w, h); moveResize(rx,ry,w, h);