screen.c: Always emit "primary_changed" when needed

Without RandR telling us what the primary screen is, we just pick the
first one. However, the code here did not emit the right signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-03-03 13:04:48 +01:00
parent edd9415df6
commit 7d2a83f7d0
1 changed files with 7 additions and 0 deletions

View File

@ -1010,7 +1010,14 @@ screen_t *
screen_get_primary(void)
{
if (!globalconf.primary_screen && globalconf.screens.len > 0)
{
globalconf.primary_screen = globalconf.screens.tab[0];
lua_State *L = globalconf_get_lua_State();
luaA_object_push(L, globalconf.primary_screen);
luaA_object_emit_signal(L, -1, "primary_changed", 0);
lua_pop(L, 1);
}
return globalconf.primary_screen;
}