diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-10 18:07:26 +0100 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2023-02-10 20:36:15 +0100 |
commit | 9162b536f69cb69466fb4fcfa24d282fa54b122b (patch) | |
tree | 57b2f8552fd626abce2e1e443e297cc97a09841e /sway/desktop | |
parent | 1cab17ada243385798b3340f88144f64ac33ee63 (diff) |
Add support for fractional-scale-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/surface.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c index a5a18917..949cfdc2 100644 --- a/sway/desktop/surface.c +++ b/sway/desktop/surface.c @@ -2,6 +2,7 @@ #include <stdlib.h> #include <time.h> #include <wlr/types/wlr_compositor.h> +#include <wlr/types/wlr_fractional_scale_v1.h> #include "sway/server.h" #include "sway/surface.h" #include "sway/output.h" @@ -46,12 +47,25 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) { } } +static void surface_update_outputs(struct wlr_surface *surface) { + float scale = 1; + struct wlr_surface_output *surface_output; + wl_list_for_each(surface_output, &surface->current_outputs, link) { + if (surface_output->output->scale > scale) { + scale = surface_output->output->scale; + } + } + wlr_fractional_scale_v1_notify_scale(surface, scale); +} + void surface_enter_output(struct wlr_surface *surface, struct sway_output *output) { wlr_surface_send_enter(surface, output->wlr_output); + surface_update_outputs(surface); } void surface_leave_output(struct wlr_surface *surface, struct sway_output *output) { wlr_surface_send_leave(surface, output->wlr_output); + surface_update_outputs(surface); } |