aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-02-20 10:15:07 +0100
committerLibravatar Kenny Levinsen <kl@kl.wtf>2023-02-20 12:11:07 +0100
commit7a6c7d60d5dece586654d8855f34da25e92987fa (patch)
treea897af608f5016b311b2c49f397f5062ed5c4a32
parentcontainer: rehome the container_swap function into container.c (diff)
downloadsway-7a6c7d60d5dece586654d8855f34da25e92987fa.tar.gz
sway-7a6c7d60d5dece586654d8855f34da25e92987fa.tar.zst
sway-7a6c7d60d5dece586654d8855f34da25e92987fa.zip
Update surface fractional scale on output change
Closes: https://github.com/swaywm/sway/issues/7464
-rw-r--r--include/sway/surface.h1
-rw-r--r--sway/desktop/output.c7
-rw-r--r--sway/desktop/surface.c2
3 files changed, 9 insertions, 1 deletions
diff --git a/include/sway/surface.h b/include/sway/surface.h
index 50681897..a7a8ec3f 100644
--- a/include/sway/surface.h
+++ b/include/sway/surface.h
@@ -15,6 +15,7 @@ struct sway_surface {
15 struct wl_event_source *frame_done_timer; 15 struct wl_event_source *frame_done_timer;
16}; 16};
17 17
18void surface_update_outputs(struct wlr_surface *surface);
18void surface_enter_output(struct wlr_surface *surface, 19void surface_enter_output(struct wlr_surface *surface,
19 struct sway_output *output); 20 struct sway_output *output);
20void surface_leave_output(struct wlr_surface *surface, 21void surface_leave_output(struct wlr_surface *surface,
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 141edb49..302f9fda 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -859,6 +859,12 @@ static void update_textures(struct sway_container *con, void *data) {
859 container_update_marks_textures(con); 859 container_update_marks_textures(con);
860} 860}
861 861
862static void update_output_scale_iterator(struct sway_output *output,
863 struct sway_view *view, struct wlr_surface *surface,
864 struct wlr_box *box, void *user_data) {
865 surface_update_outputs(surface);
866}
867
862static void handle_commit(struct wl_listener *listener, void *data) { 868static void handle_commit(struct wl_listener *listener, void *data) {
863 struct sway_output *output = wl_container_of(listener, output, commit); 869 struct sway_output *output = wl_container_of(listener, output, commit);
864 struct wlr_output_event_commit *event = data; 870 struct wlr_output_event_commit *event = data;
@@ -873,6 +879,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
873 879
874 if (event->committed & WLR_OUTPUT_STATE_SCALE) { 880 if (event->committed & WLR_OUTPUT_STATE_SCALE) {
875 output_for_each_container(output, update_textures, NULL); 881 output_for_each_container(output, update_textures, NULL);
882 output_for_each_surface(output, update_output_scale_iterator, NULL);
876 } 883 }
877 884
878 if (event->committed & (WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_SCALE)) { 885 if (event->committed & (WLR_OUTPUT_STATE_TRANSFORM | WLR_OUTPUT_STATE_SCALE)) {
diff --git a/sway/desktop/surface.c b/sway/desktop/surface.c
index 949cfdc2..68772ee0 100644
--- a/sway/desktop/surface.c
+++ b/sway/desktop/surface.c
@@ -47,7 +47,7 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) {
47 } 47 }
48} 48}
49 49
50static void surface_update_outputs(struct wlr_surface *surface) { 50void surface_update_outputs(struct wlr_surface *surface) {
51 float scale = 1; 51 float scale = 1;
52 struct wlr_surface_output *surface_output; 52 struct wlr_surface_output *surface_output;
53 wl_list_for_each(surface_output, &surface->current_outputs, link) { 53 wl_list_for_each(surface_output, &surface->current_outputs, link) {