From 764946df5fb9714e6721973f2b119f4307a9f79b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 13 Feb 2009 08:03:35 +0100 Subject: [PATCH] Focus handling for workspaces --- mainx.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mainx.c b/mainx.c index 5474c711..d17bb4dd 100644 --- a/mainx.c +++ b/mainx.c @@ -897,7 +897,9 @@ static void show_workspace(xcb_connection_t *conn, int workspace) { /* Store current_row/current_col */ c_ws->current_row = current_row; c_ws->current_col = current_col; - xcb_grab_server(conn); + + /* TODO: does grabbing the server actually bring us any (speed)advantages? */ + //xcb_grab_server(conn); /* Unmap all clients */ for (cols = 0; cols < c_ws->cols; cols++) @@ -911,7 +913,6 @@ static void show_workspace(xcb_connection_t *conn, int workspace) { current_col = c_ws->current_col; printf("new current row = %d, current col = %d\n", current_row, current_col); - /* Map all clients on the new workspace */ for (cols = 0; cols < c_ws->cols; cols++) for (rows = 0; rows < c_ws->rows; rows++) { @@ -919,7 +920,12 @@ static void show_workspace(xcb_connection_t *conn, int workspace) { xcb_map_window(conn, client->frame); } - xcb_ungrab_server(conn); + /* Restore focus on the new workspace */ + if (CUR_CELL->currently_focused != NULL) + xcb_set_input_focus(conn, XCB_INPUT_FOCUS_NONE, CUR_CELL->currently_focused->child, XCB_CURRENT_TIME); + else xcb_set_input_focus(conn, XCB_INPUT_FOCUS_NONE, root_win, XCB_CURRENT_TIME); + + //xcb_ungrab_server(conn); render_layout(conn); } @@ -1439,6 +1445,14 @@ int main(int argc, char *argv[], char *env[]) { BIND(10, BIND_MOD_1 , "1"); BIND(11, BIND_MOD_1 , "2"); + BIND(12, BIND_MOD_1 , "3"); + BIND(13, BIND_MOD_1 , "4"); + BIND(14, BIND_MOD_1 , "5"); + BIND(15, BIND_MOD_1 , "6"); + BIND(16, BIND_MOD_1 , "7"); + BIND(17, BIND_MOD_1 , "8"); + BIND(18, BIND_MOD_1 , "9"); + BIND(19, BIND_MOD_1 , "0"); Binding *bind; TAILQ_FOREACH(bind, &bindings, bindings) { -- 2.39.5