summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/TooltipWindow.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/TooltipWindow.cc b/src/TooltipWindow.cc
index 025cc68..42926d8 100644
--- a/src/TooltipWindow.cc
+++ b/src/TooltipWindow.cc
@@ -65,24 +65,24 @@ void TooltipWindow::raiseTooltip() {
65 XQueryPointer(display(), m_screen.rootWindow().window(), 65 XQueryPointer(display(), m_screen.rootWindow().window(),
66 &root_ret, &window_ret, &rx, &ry, &wx, &wy, &mask); 66 &root_ret, &window_ret, &rx, &ry, &wx, &wy, &mask);
67 67
68 // mouse position 68 int head = m_screen.getHead(rx, ry);
69 int mx = rx; 69 int head_top = m_screen.getHeadY(head);
70 int my = ry; 70 int head_left = m_screen.getHeadX(head);
71 int head_right = head_left + m_screen.getHeadWidth(head);
71 72
72 // center the mouse horizontally 73 // center the mouse horizontally
73 rx -= w/2; 74 rx -= w/2;
74 int yoffset = 10; 75 int yoffset = 10;
75 if (ry >= yoffset + h) 76 if (ry - yoffset - h >= head_top)
76 ry -= yoffset + h; 77 ry -= yoffset + h;
77 else 78 else
78 ry += yoffset; 79 ry += yoffset;
79 80
80 // check that we are not out of screen 81 // check that we are not out of screen
81 int outOfBound = rx + w - m_screen.width(); 82 if (rx + w > head_right)
82 if (outOfBound > 0) 83 rx = head_right - w;
83 rx -= outOfBound; 84 if (rx < head_left)
84 if (rx < 0) 85 rx = head_left;
85 rx = 0;
86 86
87 moveResize(rx,ry,w, h); 87 moveResize(rx,ry,w, h);
88 88