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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-17 15:52:49 +02:00
parent 16286f0b75
commit 28de7741cd
6 changed files with 21 additions and 26 deletions

4
ewmh.c
View File

@ -115,8 +115,8 @@ ewmh_update_net_active_window(lua_State *L)
{ {
xcb_window_t win; xcb_window_t win;
if(globalconf.screen_focus->client_focus) if(globalconf.client_focus)
win = globalconf.screen_focus->client_focus->window; win = globalconf.client_focus->window;
else else
win = XCB_NONE; win = XCB_NONE;

View File

@ -88,8 +88,10 @@ typedef struct
int keygrabber; int keygrabber;
/** The mouse pointer grabber function */ /** The mouse pointer grabber function */
int mousegrabber; int mousegrabber;
/** Focused screen */ /** Previously focused client */
screen_t *screen_focus; client_t *prev_client_focus;
/** Focused client */
client_t *client_focus;
/** Wiboxes */ /** Wiboxes */
wibox_array_t wiboxes; wibox_array_t wiboxes;
/** The startup notification display struct */ /** The startup notification display struct */

View File

@ -253,7 +253,7 @@ client_getbyframewin(xcb_window_t w)
void void
client_unfocus_update(client_t *c) client_unfocus_update(client_t *c)
{ {
globalconf.screens.tab[0].client_focus = NULL; globalconf.client_focus = NULL;
luaA_object_push(globalconf.L, c); luaA_object_push(globalconf.L, c);
luaA_class_emit_signal(globalconf.L, &client_class, "unfocus", 1); 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) void client_ban_unfocus(client_t *c)
{ {
if(globalconf.screens.tab[0].prev_client_focus == c) if(globalconf.prev_client_focus == c)
globalconf.screens.tab[0].prev_client_focus = NULL; globalconf.prev_client_focus = NULL;
/* Wait until the last moment to take away the focus from the window. */ /* 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); client_unfocus(c);
} }
@ -379,23 +379,21 @@ client_focus_update(client_t *c)
if(!client_maybevisible(c, c->screen)) if(!client_maybevisible(c, c->screen))
{ {
/* Focus previously focused client */ /* Focus previously focused client */
client_focus(globalconf.screen_focus->prev_client_focus); client_focus(globalconf.prev_client_focus);
return; return;
} }
if(globalconf.screen_focus if(globalconf.client_focus)
&& globalconf.screen_focus->client_focus)
{ {
if (globalconf.screen_focus->client_focus != c) if (globalconf.client_focus != c)
client_unfocus_update(globalconf.screen_focus->client_focus); client_unfocus_update(globalconf.client_focus);
else else
/* Already focused */ /* Already focused */
return; return;
} }
globalconf.screen_focus = &globalconf.screens.tab[0]; globalconf.prev_client_focus = c;
globalconf.screen_focus->prev_client_focus = c; globalconf.client_focus = c;
globalconf.screen_focus->client_focus = c;
/* according to EWMH, we have to remove the urgent state from a client */ /* according to EWMH, we have to remove the urgent state from a client */
luaA_object_push(globalconf.L, c); luaA_object_push(globalconf.L, c);
@ -1037,10 +1035,10 @@ client_unmanage(client_t *c)
tc->transient_for = NULL; tc->transient_for = NULL;
} }
if(globalconf.screens.tab[0].prev_client_focus == c) if(globalconf.prev_client_focus == c)
globalconf.screens.tab[0].prev_client_focus = NULL; globalconf.prev_client_focus = NULL;
if(globalconf.screens.tab[0].client_focus == c) if(globalconf.client_focus == c)
client_unfocus(c); client_unfocus(c);
/* remove client from global list and everywhere else */ /* remove client from global list and everywhere else */
@ -1784,7 +1782,7 @@ luaA_client_module_index(lua_State *L)
switch(a_tokenize(buf, len)) switch(a_tokenize(buf, len))
{ {
case A_TK_FOCUS: 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; break;
default: default:
return 0; return 0;

View File

@ -234,7 +234,6 @@ screen_scan(void)
if(!screen_scan_randr() && !screen_scan_xinerama()) if(!screen_scan_randr() && !screen_scan_xinerama())
screen_scan_x11(); screen_scan_x11();
globalconf.screen_focus = globalconf.screens.tab;
globalconf.visual = screen_default_visual(globalconf.screen); globalconf.visual = screen_default_visual(globalconf.screen);
} }

View File

@ -34,10 +34,6 @@ struct a_screen
area_t geometry; area_t geometry;
/** Tag list */ /** Tag list */
tag_array_t tags; tag_array_t tags;
/** Previously focused client */
client_t *prev_client_focus;
/** Focused client */
client_t *client_focus;
/** The signals emitted by screen objects */ /** The signals emitted by screen objects */
signal_array_t signals; signal_array_t signals;
/** True if the banning on this screen needs to be updated */ /** True if the banning on this screen needs to be updated */

View File

@ -134,7 +134,7 @@ client_layer_translator(client_t *c)
if(c->ontop) if(c->ontop)
return WINDOW_LAYER_ONTOP; return WINDOW_LAYER_ONTOP;
/* Fullscreen windows only get their own layer when they have the focus */ /* 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; return WINDOW_LAYER_FULLSCREEN;
else if(c->above) else if(c->above)
return WINDOW_LAYER_ABOVE; return WINDOW_LAYER_ABOVE;