diff options
Diffstat (limited to 'src/Slit.cc')
-rw-r--r-- | src/Slit.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index fbab1e6..f5f1158 100644 --- a/src/Slit.cc +++ b/src/Slit.cc | |||
@@ -1010,26 +1010,25 @@ void Slit::handleEvent(XEvent &event) { | |||
1010 | } | 1010 | } |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void Slit::buttonPressEvent(XButtonEvent &e) { | 1013 | void Slit::buttonPressEvent(XButtonEvent &be) { |
1014 | if (e.window != frame.window.window()) | 1014 | if (be.window != frame.window.window()) |
1015 | return; | 1015 | return; |
1016 | 1016 | ||
1017 | if (e.button == Button3) { | 1017 | if (be.button == Button3) { |
1018 | if (! m_slitmenu.isVisible()) { | 1018 | if (! m_slitmenu.isVisible()) { |
1019 | int x = e.x_root - (m_slitmenu.width() / 2), | 1019 | int head = screen().getHead(be.x_root, be.y_root); |
1020 | y = e.y_root - (m_slitmenu.height() / 2); | 1020 | int borderw = m_slitmenu.fbwindow().borderWidth(); |
1021 | 1021 | pair<int, int> m = screen().clampToHead(head, | |
1022 | if (x < 0) | 1022 | be.x_root - (m_slitmenu.width() / 2), |
1023 | x = 0; | 1023 | be.y_root - (m_slitmenu.titleWindow().height() / 2), |
1024 | else if (x + m_slitmenu.width() > screen().width()) | 1024 | m_slitmenu.width() + 2*borderw, |
1025 | x = screen().width() - m_slitmenu.width(); | 1025 | m_slitmenu.height() + 2*borderw); |
1026 | 1026 | ||
1027 | if (y < 0) | 1027 | m_slitmenu.setScreen(screen().getHeadX(head), |
1028 | y = 0; | 1028 | screen().getHeadY(head), |
1029 | else if (y + m_slitmenu.height() > screen().height()) | 1029 | screen().getHeadWidth(head), |
1030 | y = screen().height() - m_slitmenu.height(); | 1030 | screen().getHeadHeight(head)); |
1031 | 1031 | m_slitmenu.move(m.first, m.second); | |
1032 | m_slitmenu.move(x, y); | ||
1033 | m_slitmenu.show(); | 1032 | m_slitmenu.show(); |
1034 | m_slitmenu.grabInputFocus(); | 1033 | m_slitmenu.grabInputFocus(); |
1035 | } else | 1034 | } else |