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:
parent
16286f0b75
commit
28de7741cd
4
ewmh.c
4
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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
1
screen.c
1
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);
|
||||
}
|
||||
|
||||
|
|
4
screen.h
4
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 */
|
||||
|
|
2
stack.c
2
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;
|
||||
|
|
Loading…
Reference in New Issue