aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-07-15 14:19:42 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2016-08-27 07:34:01 (GMT)
commit08ea27de38a28cc2e9f5eab3bed094fc53d48952 (patch)
treecc27127edf8dd5867fc864825edae870130f34d1
parenta1d3065994daba4bb0d1b437981afff358377bd4 (diff)
downloadfluxbox-08ea27de38a28cc2e9f5eab3bed094fc53d48952.zip
fluxbox-08ea27de38a28cc2e9f5eab3bed094fc53d48952.tar.bz2
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
-rw-r--r--src/FbWinFrame.cc7
-rw-r--r--src/Window.cc16
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
1590 // /!\ old code: handle = titlebar in motionNotifyEvent but only there ! 1590 // /!\ old code: handle = titlebar in motionNotifyEvent but only there !
1591 // handle() as border ?? 1591 // handle() as border ??
1592 if (handle().window() == win) return Keys::ON_WINDOWBORDER | Keys::ON_WINDOW; 1592 if (handle().window() == win) return Keys::ON_WINDOWBORDER | Keys::ON_WINDOW;
1593 if (titlebar().window() == win) return context | Keys::ON_TITLEBAR; 1593 if (titlebar().window() == win) {
1594 const int px = x - this->x() - window().borderWidth();
1595 if (px < label().x() || px > label().x() + label().width())
1596 return context; // one of the buttons, asked from a grabbed event
1597 return context | Keys::ON_TITLEBAR;
1598 }
1594 if (label().window() == win) return context | Keys::ON_TITLEBAR; 1599 if (label().window() == win) return context | Keys::ON_TITLEBAR;
1595 // internal tabs are on title bar 1600 // internal tabs are on title bar
1596 if (tabcontainer().window() == win) 1601 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) {
2402 m_last_pressed_button = be.button; 2402 m_last_pressed_button = be.button;
2403 2403
2404 Keys *k = Fluxbox::instance()->keys(); 2404 Keys *k = Fluxbox::instance()->keys();
2405 int context = frame().getContext(be.window); 2405 int context = 0;
2406 if (k->doAction(be.type, be.state, be.button, 2406 context = frame().getContext(be.subwindow ? be.subwindow : be.window, be.x_root, be.y_root);
2407 context, &winClient(), be.time)) { 2407 if (!context && be.subwindow)
2408 context = frame().getContext(be.window);
2409
2410 if (k->doAction(be.type, be.state, be.button, context, &winClient(), be.time)) {
2411 XAllowEvents(display, SyncPointer, CurrentTime);
2408 return; 2412 return;
2409 } 2413 }
2410 2414
@@ -2415,18 +2419,18 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2415 } 2419 }
2416 2420
2417 2421
2422 // - refeed the event into the queue so the app or titlebar subwindow gets it
2423 if (be.subwindow)
2424 XAllowEvents(display, ReplayPointer, CurrentTime);
2418 2425
2419 // if nothing was bound via keys-file then 2426 // if nothing was bound via keys-file then
2420 // - raise() if clickRaise is enabled 2427 // - raise() if clickRaise is enabled
2421 // - hide open menues 2428 // - hide open menues
2422 // - focus on clickFocus 2429 // - focus on clickFocus
2423 // - refeed the event into the queue so the app gets it
2424 if (frame().window().window() == be.window) { 2430 if (frame().window().window() == be.window) {
2425 if (screen().clickRaises()) 2431 if (screen().clickRaises())
2426 raise(); 2432 raise();
2427 2433
2428 XAllowEvents(display, ReplayPointer, CurrentTime);
2429
2430 m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); 2434 m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth();
2431 m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); 2435 m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth();
2432 } 2436 }