aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2024-04-29 21:01:44 -0400
committerSimon Ser <contact@emersion.fr>2024-05-07 16:18:43 +0200
commitdcdb72757a5ec591c692df5e96c57c51758dbd8f (patch)
tree593098c3313e0aefd617ff0ee5fe0490f28982f3
parent30f5c3a9117be3e4911cba02693f7b45a197da93 (diff)
desktop/layer_shell: provide fractional scale on creation
Also, send a matching wl_surface.preferred_buffer_scale event.
-rw-r--r--sway/desktop/layer_shell.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index 4b2584b6..6221b7b9 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <wayland-server-core.h>
+#include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
@@ -432,6 +433,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
surface->output = output;
+ // now that the surface's output is known, we can advertise its scale
+ wlr_fractional_scale_v1_notify_scale(surface->layer_surface->surface,
+ layer_surface->output->scale);
+ wlr_surface_set_preferred_buffer_scale(surface->layer_surface->surface,
+ ceil(layer_surface->output->scale));
+
surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&layer_surface->surface->events.commit,
&surface->surface_commit);