From a01f5143e2a2ba612628963b844ad6596854c4be Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 3 Jun 2007 20:29:35 +0000 Subject: open slit menu properly wrt xinerama --- ChangeLog | 2 ++ src/Slit.cc | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index a903f27..37cd23a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 1.1: *07/06/03: + * Submenus of slit menu were misbehaving with xinerama (Mark) + Slit.cc * Also send transient windows when sending a window to another workspace, bug #1716900 (Mark) Screen.cc 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) { } } -void Slit::buttonPressEvent(XButtonEvent &e) { - if (e.window != frame.window.window()) +void Slit::buttonPressEvent(XButtonEvent &be) { + if (be.window != frame.window.window()) return; - if (e.button == Button3) { + if (be.button == Button3) { if (! m_slitmenu.isVisible()) { - int x = e.x_root - (m_slitmenu.width() / 2), - y = e.y_root - (m_slitmenu.height() / 2); - - if (x < 0) - x = 0; - else if (x + m_slitmenu.width() > screen().width()) - x = screen().width() - m_slitmenu.width(); - - if (y < 0) - y = 0; - else if (y + m_slitmenu.height() > screen().height()) - y = screen().height() - m_slitmenu.height(); - - m_slitmenu.move(x, y); + int head = screen().getHead(be.x_root, be.y_root); + int borderw = m_slitmenu.fbwindow().borderWidth(); + pair m = screen().clampToHead(head, + be.x_root - (m_slitmenu.width() / 2), + be.y_root - (m_slitmenu.titleWindow().height() / 2), + m_slitmenu.width() + 2*borderw, + m_slitmenu.height() + 2*borderw); + + m_slitmenu.setScreen(screen().getHeadX(head), + screen().getHeadY(head), + screen().getHeadWidth(head), + screen().getHeadHeight(head)); + m_slitmenu.move(m.first, m.second); m_slitmenu.show(); m_slitmenu.grabInputFocus(); } else -- cgit v0.11.2