Delegate click handling to dock clients

Do not handle click events on dock clients because they are not managed
windows. Dock clients are responsible for sending the message to i3 to
focus a workspace if that is appropriate. i3bar now sends the message to
focus the correct workspace when that is appropriate.

Otherwise, it could interfere with the dock clients own click handling,
which could be an action to focus a different workspace than i3 had
assumed, such as would be the case with a workspace widget.
This commit is contained in:
Tony Crisci 2014-04-29 21:29:17 -04:00 committed by Michael Stapelberg
parent 7a5cf4aa44
commit ab0fae400b
2 changed files with 16 additions and 4 deletions

View File

@ -393,8 +393,20 @@ void handle_button(xcb_button_press_event_t *event) {
}
x -= cur_ws->name_width + logical_px(11);
}
/* Otherwise, focus our currently visible workspace if it is not
* already focused */
if (cur_ws == NULL) {
TAILQ_FOREACH(cur_ws, walk->workspaces, tailq) {
if (cur_ws->visible && !cur_ws->focused)
break;
}
}
/* if there is nothing to focus, we are done */
if (cur_ws == NULL)
return;
break;
default:
return;

View File

@ -171,6 +171,10 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
DLOG("--> OUTCOME = %p\n", con);
DLOG("type = %d, name = %s\n", con->type, con->name);
/* dont handle dockarea cons, they must not be focused */
if (con->parent->type == CT_DOCKAREA)
goto done;
/* Any click in a workspace should focus that workspace. If the
* workspace is on another output we need to do a workspace_show in
* order for i3bar (and others) to notice the change in workspace. */
@ -187,10 +191,6 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
workspace_show(ws);
focused_id = XCB_NONE;
/* dont handle dockarea cons, they must not be focused */
if (con->parent->type == CT_DOCKAREA)
goto done;
/* get the floating con */
Con *floatingcon = con_inside_floating(con);
const bool proportional = (event->state & BIND_SHIFT);