screen: Move the "added" signal from CAPI to Lua.
When the screens are created from the viewport in Lua, the signal is sent too early and the DPI and outputs have not yet been added. This cause the `connect_for_each_screen` callbacks to be called with a partially initialized screen object. It also causes the drawables to be repainted too early. CAPI now emits "_added" and "awful.screen" takes care of emitting "added".
This commit is contained in:
parent
3e19251d14
commit
aa76b11b81
|
@ -937,11 +937,12 @@ require("awful.screen.dpi")(screen, data)
|
|||
|
||||
-- Set the wallpaper(s) and create the bar(s) for new screens
|
||||
|
||||
capi.screen.connect_signal("added", function(s)
|
||||
capi.screen.connect_signal("_added", function(s)
|
||||
-- If it was emited from here when screens are created with fake_add,
|
||||
-- the Lua code would not have an opportunity to polutate the screen
|
||||
-- metadata. Thus, the DPI may be wrong when setting the wallpaper.
|
||||
if s._managed ~= "Lua" then
|
||||
s:emit_signal("added")
|
||||
s:emit_signal("request::desktop_decoration")
|
||||
s:emit_signal("request::wallpaper")
|
||||
end
|
||||
|
|
|
@ -160,6 +160,9 @@ function module.create_screen_handler(viewport)
|
|||
|
||||
s:emit_signal("request::desktop_decoration")
|
||||
s:emit_signal("request::wallpaper")
|
||||
|
||||
-- Will call all `connect_for_each_screen`.
|
||||
s:emit_signal("added")
|
||||
end
|
||||
|
||||
function module.remove_screen_handler(viewport)
|
||||
|
|
|
@ -949,7 +949,7 @@ screen_added(lua_State *L, screen_t *screen)
|
|||
screen->workarea = screen->geometry;
|
||||
screen->valid = true;
|
||||
luaA_object_push(L, screen);
|
||||
luaA_object_emit_signal(L, -1, "added", 0);
|
||||
luaA_object_emit_signal(L, -1, "_added", 0);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue