Skip to content

Commit

Permalink
Merge pull request #296 from LGFae/fix-initial-black-screen
Browse files Browse the repository at this point in the history
fix initial black screen due to late configuration
  • Loading branch information
LGFae authored Apr 27, 2024
2 parents 9caa6df + 776fa46 commit 13c0e76
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions daemon/src/wallpaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,23 @@ impl Wallpaper {
}
}

if (inner.width, inner.height, inner.scale_factor)
== (staging.width, staging.height, staging.scale_factor)
{
// just the name and descriptions changed
if staging.scale_factor != inner.scale_factor {
match staging.scale_factor {
Scale::Whole(i) => {
// unset destination
self.wp_viewport.set_destination(-1, -1);
self.wl_surface.set_buffer_scale(i.get());
}
Scale::Fractional(_) => {
self.wl_surface.set_buffer_scale(1);
self.wp_viewport
.set_destination(staging.width.get(), staging.height.get());
}
}
}

if (inner.width, inner.height) == (staging.width, staging.height) {
inner.scale_factor = staging.scale_factor;
inner.name = staging.name.clone();
inner.desc = staging.desc.clone();
return;
Expand All @@ -300,17 +313,6 @@ impl Wallpaper {

self.stop_animations();

match scale_factor {
Scale::Whole(i) => {
// unset destination
self.wp_viewport.set_destination(-1, -1);
self.wl_surface.set_buffer_scale(i.get());
}
Scale::Fractional(_) => {
self.wl_surface.set_buffer_scale(1);
self.wp_viewport.set_destination(width.get(), height.get());
}
}
self.layer_surface
.set_size(width.get() as u32, height.get() as u32);

Expand Down

0 comments on commit 13c0e76

Please sign in to comment.