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 | |
parent | Introduce surface_{enter,leave}_output() (diff) | |
download | sway-9162b536f69cb69466fb4fcfa24d282fa54b122b.tar.gz sway-9162b536f69cb69466fb4fcfa24d282fa54b122b.tar.zst sway-9162b536f69cb69466fb4fcfa24d282fa54b122b.zip |
Add support for fractional-scale-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
-rw-r--r-- | sway/desktop/surface.c | 14 | ||||
-rw-r--r-- | sway/server.c | 2 |
2 files changed, 16 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 @@ | |||
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <time.h> | 3 | #include <time.h> |
4 | #include <wlr/types/wlr_compositor.h> | 4 | #include <wlr/types/wlr_compositor.h> |
5 | #include <wlr/types/wlr_fractional_scale_v1.h> | ||
5 | #include "sway/server.h" | 6 | #include "sway/server.h" |
6 | #include "sway/surface.h" | 7 | #include "sway/surface.h" |
7 | #include "sway/output.h" | 8 | #include "sway/output.h" |
@@ -46,12 +47,25 @@ void handle_compositor_new_surface(struct wl_listener *listener, void *data) { | |||
46 | } | 47 | } |
47 | } | 48 | } |
48 | 49 | ||
50 | static void surface_update_outputs(struct wlr_surface *surface) { | ||
51 | float scale = 1; | ||
52 | struct wlr_surface_output *surface_output; | ||
53 | wl_list_for_each(surface_output, &surface->current_outputs, link) { | ||
54 | if (surface_output->output->scale > scale) { | ||
55 | scale = surface_output->output->scale; | ||
56 | } | ||
57 | } | ||
58 | wlr_fractional_scale_v1_notify_scale(surface, scale); | ||
59 | } | ||
60 | |||
49 | void surface_enter_output(struct wlr_surface *surface, | 61 | void surface_enter_output(struct wlr_surface *surface, |
50 | struct sway_output *output) { | 62 | struct sway_output *output) { |
51 | wlr_surface_send_enter(surface, output->wlr_output); | 63 | wlr_surface_send_enter(surface, output->wlr_output); |
64 | surface_update_outputs(surface); | ||
52 | } | 65 | } |
53 | 66 | ||
54 | void surface_leave_output(struct wlr_surface *surface, | 67 | void surface_leave_output(struct wlr_surface *surface, |
55 | struct sway_output *output) { | 68 | struct sway_output *output) { |
56 | wlr_surface_send_leave(surface, output->wlr_output); | 69 | wlr_surface_send_leave(surface, output->wlr_output); |
70 | surface_update_outputs(surface); | ||
57 | } | 71 | } |
diff --git a/sway/server.c b/sway/server.c index 1ff0b461..244c7aec 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <wlr/types/wlr_data_control_v1.h> | 14 | #include <wlr/types/wlr_data_control_v1.h> |
15 | #include <wlr/types/wlr_drm.h> | 15 | #include <wlr/types/wlr_drm.h> |
16 | #include <wlr/types/wlr_export_dmabuf_v1.h> | 16 | #include <wlr/types/wlr_export_dmabuf_v1.h> |
17 | #include <wlr/types/wlr_fractional_scale_v1.h> | ||
17 | #include <wlr/types/wlr_gamma_control_v1.h> | 18 | #include <wlr/types/wlr_gamma_control_v1.h> |
18 | #include <wlr/types/wlr_idle.h> | 19 | #include <wlr/types/wlr_idle.h> |
19 | #include <wlr/types/wlr_idle_notify_v1.h> | 20 | #include <wlr/types/wlr_idle_notify_v1.h> |
@@ -214,6 +215,7 @@ bool server_init(struct sway_server *server) { | |||
214 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); | 215 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); |
215 | server->content_type_manager_v1 = | 216 | server->content_type_manager_v1 = |
216 | wlr_content_type_manager_v1_create(server->wl_display, 1); | 217 | wlr_content_type_manager_v1_create(server->wl_display, 1); |
218 | wlr_fractional_scale_manager_v1_create(server->wl_display, 1); | ||
217 | 219 | ||
218 | struct wlr_xdg_foreign_registry *foreign_registry = | 220 | struct wlr_xdg_foreign_registry *foreign_registry = |
219 | wlr_xdg_foreign_registry_create(server->wl_display); | 221 | wlr_xdg_foreign_registry_create(server->wl_display); |