screen: Delay the request::wallpaper and desktop_decoration for the DPI.

With this, there is plenty of palces where the DPI can be set before
those signals are sent. This allows wallpaper with the proper DPI to
work with screens created using `fake_add`. In turn, this will allow
screen rules to control the DPI. In "the past", the DPI used for those
handler was the native DPI of the screen with no opportunity to change
it before hand.
This commit is contained in:
Emmanuel Lepage Vallee 2019-07-10 16:31:36 -04:00
parent d4ce5706c7
commit cd6998b18d
2 changed files with 19 additions and 4 deletions

View File

@ -882,6 +882,8 @@ end
-- function(viewport --[[, args]])
-- local geo = viewport.geometry
-- local s = screen.fake_add(geo.x, geo.y, geo.width, geo.height)
-- s:emit_signal("request::desktop_decoration")
-- s:emit_signal("request::wallpaper")
-- end
--
-- If you implement this by hand, you must also implement handler for the
@ -934,9 +936,15 @@ end
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)
-- 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 capi.screen.automatic_factory then
s:emit_signal("request::desktop_decoration")
s:emit_signal("request::wallpaper")
--end
end)
-- Resize the wallpaper(s)
@ -948,15 +956,19 @@ end
-- Create the bar for existing screens when an handler is added
capi.screen.connect_signal("request::desktop_decoration::connected", function(new_handler)
for s in capi.screen do
new_handler(s)
if capi.screen.automatic_factory then
for s in capi.screen do
new_handler(s)
end
end
end)
-- Set the wallpaper when an handler is added.
capi.screen.connect_signal("request::wallpaper::connected", function(new_handler)
for s in capi.screen do
new_handler(s)
if capi.screen.automatic_factory then
for s in capi.screen do
new_handler(s)
end
end
end)

View File

@ -156,6 +156,9 @@ function module.create_screen_handler(viewport)
)
update_screen_viewport(s)
--s:emit_signal("request::desktop_decoration")
--s:emit_signal("request::wallpaper")
end
function module.remove_screen_handler(viewport)