From 08ea27de38a28cc2e9f5eab3bed094fc53d48952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 15 Jul 2016 16:19:42 +0200 Subject: Control OnTitlebar ./. OnWindow On concurrent shortcuts OnTitlebar implies OnWindow and was so far resolved to OnWindow while OnTitlebar is the more precise condition. This also requires to exclude buttons from the titlebar context, ie. pass the position to the getContext function on press events BUG: 1035 The patch depends on the patch to correctly resolve the tab under the mouse since we're now passing the actual subwindows around --- src/FbWinFrame.cc | 7 ++++++- src/Window.cc | 16 ++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 3965068..2454141 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -1590,7 +1590,12 @@ int FbWinFrame::getContext(Window win, int x, int y, int last_x, int last_y, boo // /!\ old code: handle = titlebar in motionNotifyEvent but only there ! // handle() as border ?? if (handle().window() == win) return Keys::ON_WINDOWBORDER | Keys::ON_WINDOW; - if (titlebar().window() == win) return context | Keys::ON_TITLEBAR; + if (titlebar().window() == win) { + const int px = x - this->x() - window().borderWidth(); + if (px < label().x() || px > label().x() + label().width()) + return context; // one of the buttons, asked from a grabbed event + return context | Keys::ON_TITLEBAR; + } if (label().window() == win) return context | Keys::ON_TITLEBAR; // internal tabs are on title bar if (tabcontainer().window() == win) diff --git a/src/Window.cc b/src/Window.cc index f1bf1e9..a4f6341 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2402,9 +2402,13 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { m_last_pressed_button = be.button; Keys *k = Fluxbox::instance()->keys(); - int context = frame().getContext(be.window); - if (k->doAction(be.type, be.state, be.button, - context, &winClient(), be.time)) { + int context = 0; + context = frame().getContext(be.subwindow ? be.subwindow : be.window, be.x_root, be.y_root); + if (!context && be.subwindow) + context = frame().getContext(be.window); + + if (k->doAction(be.type, be.state, be.button, context, &winClient(), be.time)) { + XAllowEvents(display, SyncPointer, CurrentTime); return; } @@ -2415,18 +2419,18 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { } + // - refeed the event into the queue so the app or titlebar subwindow gets it + if (be.subwindow) + XAllowEvents(display, ReplayPointer, CurrentTime); // if nothing was bound via keys-file then // - raise() if clickRaise is enabled // - hide open menues // - focus on clickFocus - // - refeed the event into the queue so the app gets it if (frame().window().window() == be.window) { if (screen().clickRaises()) raise(); - XAllowEvents(display, ReplayPointer, CurrentTime); - m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); } -- cgit v0.11.2