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
This commit is contained in:
Thomas Lübking 2016-07-15 16:19:42 +02:00
parent a1d3065994
commit 08ea27de38
2 changed files with 16 additions and 7 deletions

View file

@ -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)

View file

@ -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();
}