mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
Add support for fractional-scale-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
This commit is contained in:
parent
1cab17ada2
commit
9162b536f6
|
@ -2,6 +2,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||||
#include "sway/server.h"
|
#include "sway/server.h"
|
||||||
#include "sway/surface.h"
|
#include "sway/surface.h"
|
||||||
#include "sway/output.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,
|
void surface_enter_output(struct wlr_surface *surface,
|
||||||
struct sway_output *output) {
|
struct sway_output *output) {
|
||||||
wlr_surface_send_enter(surface, output->wlr_output);
|
wlr_surface_send_enter(surface, output->wlr_output);
|
||||||
|
surface_update_outputs(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void surface_leave_output(struct wlr_surface *surface,
|
void surface_leave_output(struct wlr_surface *surface,
|
||||||
struct sway_output *output) {
|
struct sway_output *output) {
|
||||||
wlr_surface_send_leave(surface, output->wlr_output);
|
wlr_surface_send_leave(surface, output->wlr_output);
|
||||||
|
surface_update_outputs(surface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <wlr/types/wlr_data_control_v1.h>
|
#include <wlr/types/wlr_data_control_v1.h>
|
||||||
#include <wlr/types/wlr_drm.h>
|
#include <wlr/types/wlr_drm.h>
|
||||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||||
|
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||||
#include <wlr/types/wlr_idle.h>
|
#include <wlr/types/wlr_idle.h>
|
||||||
#include <wlr/types/wlr_idle_notify_v1.h>
|
#include <wlr/types/wlr_idle_notify_v1.h>
|
||||||
|
@ -214,6 +215,7 @@ bool server_init(struct sway_server *server) {
|
||||||
wlr_single_pixel_buffer_manager_v1_create(server->wl_display);
|
wlr_single_pixel_buffer_manager_v1_create(server->wl_display);
|
||||||
server->content_type_manager_v1 =
|
server->content_type_manager_v1 =
|
||||||
wlr_content_type_manager_v1_create(server->wl_display, 1);
|
wlr_content_type_manager_v1_create(server->wl_display, 1);
|
||||||
|
wlr_fractional_scale_manager_v1_create(server->wl_display, 1);
|
||||||
|
|
||||||
struct wlr_xdg_foreign_registry *foreign_registry =
|
struct wlr_xdg_foreign_registry *foreign_registry =
|
||||||
wlr_xdg_foreign_registry_create(server->wl_display);
|
wlr_xdg_foreign_registry_create(server->wl_display);
|
||||||
|
|
Loading…
Reference in a new issue