From 28de7741cd96f603613a09e14dd7b8707dcda7dd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 17 Aug 2010 15:52:49 +0200 Subject: [PATCH] Remove globalconf.screen_focus This moves the appropriate fields for client focus from screen_t to globalconf since only the first screen's fields were used anyway. Signed-off-by: Uli Schlachter --- ewmh.c | 4 ++-- globalconf.h | 6 ++++-- objects/client.c | 30 ++++++++++++++---------------- screen.c | 1 - screen.h | 4 ---- stack.c | 2 +- 6 files changed, 21 insertions(+), 26 deletions(-) diff --git a/ewmh.c b/ewmh.c index 20d80f44..a4995625 100644 --- a/ewmh.c +++ b/ewmh.c @@ -115,8 +115,8 @@ ewmh_update_net_active_window(lua_State *L) { xcb_window_t win; - if(globalconf.screen_focus->client_focus) - win = globalconf.screen_focus->client_focus->window; + if(globalconf.client_focus) + win = globalconf.client_focus->window; else win = XCB_NONE; diff --git a/globalconf.h b/globalconf.h index a0f885ad..b833f2bf 100644 --- a/globalconf.h +++ b/globalconf.h @@ -88,8 +88,10 @@ typedef struct int keygrabber; /** The mouse pointer grabber function */ int mousegrabber; - /** Focused screen */ - screen_t *screen_focus; + /** Previously focused client */ + client_t *prev_client_focus; + /** Focused client */ + client_t *client_focus; /** Wiboxes */ wibox_array_t wiboxes; /** The startup notification display struct */ diff --git a/objects/client.c b/objects/client.c index 803702db..db1dffa0 100644 --- a/objects/client.c +++ b/objects/client.c @@ -253,7 +253,7 @@ client_getbyframewin(xcb_window_t w) void client_unfocus_update(client_t *c) { - globalconf.screens.tab[0].client_focus = NULL; + globalconf.client_focus = NULL; luaA_object_push(globalconf.L, c); luaA_class_emit_signal(globalconf.L, &client_class, "unfocus", 1); @@ -311,11 +311,11 @@ client_set_focus(client_t *c, bool set_input_focus) */ void client_ban_unfocus(client_t *c) { - if(globalconf.screens.tab[0].prev_client_focus == c) - globalconf.screens.tab[0].prev_client_focus = NULL; + if(globalconf.prev_client_focus == c) + globalconf.prev_client_focus = NULL; /* Wait until the last moment to take away the focus from the window. */ - if(globalconf.screens.tab[0].client_focus == c) + if(globalconf.client_focus == c) client_unfocus(c); } @@ -379,23 +379,21 @@ client_focus_update(client_t *c) if(!client_maybevisible(c, c->screen)) { /* Focus previously focused client */ - client_focus(globalconf.screen_focus->prev_client_focus); + client_focus(globalconf.prev_client_focus); return; } - if(globalconf.screen_focus - && globalconf.screen_focus->client_focus) + if(globalconf.client_focus) { - if (globalconf.screen_focus->client_focus != c) - client_unfocus_update(globalconf.screen_focus->client_focus); + if (globalconf.client_focus != c) + client_unfocus_update(globalconf.client_focus); else /* Already focused */ return; } - globalconf.screen_focus = &globalconf.screens.tab[0]; - globalconf.screen_focus->prev_client_focus = c; - globalconf.screen_focus->client_focus = c; + globalconf.prev_client_focus = c; + globalconf.client_focus = c; /* according to EWMH, we have to remove the urgent state from a client */ luaA_object_push(globalconf.L, c); @@ -1037,10 +1035,10 @@ client_unmanage(client_t *c) tc->transient_for = NULL; } - if(globalconf.screens.tab[0].prev_client_focus == c) - globalconf.screens.tab[0].prev_client_focus = NULL; + if(globalconf.prev_client_focus == c) + globalconf.prev_client_focus = NULL; - if(globalconf.screens.tab[0].client_focus == c) + if(globalconf.client_focus == c) client_unfocus(c); /* remove client from global list and everywhere else */ @@ -1784,7 +1782,7 @@ luaA_client_module_index(lua_State *L) switch(a_tokenize(buf, len)) { case A_TK_FOCUS: - return luaA_object_push(globalconf.L, globalconf.screen_focus->client_focus); + return luaA_object_push(globalconf.L, globalconf.client_focus); break; default: return 0; diff --git a/screen.c b/screen.c index 1cd01db2..4bda44a0 100644 --- a/screen.c +++ b/screen.c @@ -234,7 +234,6 @@ screen_scan(void) if(!screen_scan_randr() && !screen_scan_xinerama()) screen_scan_x11(); - globalconf.screen_focus = globalconf.screens.tab; globalconf.visual = screen_default_visual(globalconf.screen); } diff --git a/screen.h b/screen.h index 5d4e19e2..3daea159 100644 --- a/screen.h +++ b/screen.h @@ -34,10 +34,6 @@ struct a_screen area_t geometry; /** Tag list */ tag_array_t tags; - /** Previously focused client */ - client_t *prev_client_focus; - /** Focused client */ - client_t *client_focus; /** The signals emitted by screen objects */ signal_array_t signals; /** True if the banning on this screen needs to be updated */ diff --git a/stack.c b/stack.c index 86c50d37..3758c13c 100644 --- a/stack.c +++ b/stack.c @@ -134,7 +134,7 @@ client_layer_translator(client_t *c) if(c->ontop) return WINDOW_LAYER_ONTOP; /* Fullscreen windows only get their own layer when they have the focus */ - else if(c->fullscreen && globalconf.screen_focus->client_focus == c) + else if(c->fullscreen && globalconf.client_focus == c) return WINDOW_LAYER_FULLSCREEN; else if(c->above) return WINDOW_LAYER_ABOVE;