mirror of
https://github.com/labwc/labwc.git
synced 2026-04-13 08:21:15 -04:00
chase(output): support fractional scaling
manually notify scaling at some surfaces like xdg popups and xwayland
This commit is contained in:
parent
e841d44b6f
commit
5825ee31cc
4 changed files with 28 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
#include <wlr/types/wlr_cursor.h>
|
#include <wlr/types/wlr_cursor.h>
|
||||||
#include <wlr/types/wlr_data_device.h>
|
#include <wlr/types/wlr_data_device.h>
|
||||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
#include <wlr/types/wlr_foreign_toplevel_management_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_input_device.h>
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "xwayland.h"
|
#include "xwayland.h"
|
||||||
|
|
||||||
#define LAB_WLR_COMPOSITOR_VERSION (5)
|
#define LAB_WLR_COMPOSITOR_VERSION (5)
|
||||||
|
#define LAB_WLR_FRACTIONAL_SCALE_MANAGER_VERSION (1)
|
||||||
|
|
||||||
static struct wlr_compositor *compositor;
|
static struct wlr_compositor *compositor;
|
||||||
static struct wl_event_source *sighup_source;
|
static struct wl_event_source *sighup_source;
|
||||||
|
|
@ -377,6 +378,8 @@ server_init(struct server *server)
|
||||||
wlr_data_control_manager_v1_create(server->wl_display);
|
wlr_data_control_manager_v1_create(server->wl_display);
|
||||||
wlr_viewporter_create(server->wl_display);
|
wlr_viewporter_create(server->wl_display);
|
||||||
wlr_single_pixel_buffer_manager_v1_create(server->wl_display);
|
wlr_single_pixel_buffer_manager_v1_create(server->wl_display);
|
||||||
|
wlr_fractional_scale_manager_v1_create(
|
||||||
|
server->wl_display, LAB_WLR_FRACTIONAL_SCALE_MANAGER_VERSION);
|
||||||
|
|
||||||
idle_manager_create(server->wl_display, server->seat.seat);
|
idle_manager_create(server->wl_display, server->seat.seat);
|
||||||
|
|
||||||
|
|
|
||||||
16
src/xdg.c
16
src/xdg.c
|
|
@ -125,6 +125,14 @@ handle_commit(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_required) {
|
if (update_required) {
|
||||||
|
wlr_fractional_scale_v1_notify_scale(
|
||||||
|
view->surface,
|
||||||
|
view->output->wlr_output->scale
|
||||||
|
);
|
||||||
|
wlr_surface_set_preferred_buffer_scale(
|
||||||
|
view->surface,
|
||||||
|
ceil(view->output->wlr_output->scale)
|
||||||
|
);
|
||||||
view_impl_apply_geometry(view, size.width, size.height);
|
view_impl_apply_geometry(view, size.width, size.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -307,6 +315,14 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
||||||
* glitches during resize, we apply the same position
|
* glitches during resize, we apply the same position
|
||||||
* adjustments here as in handle_commit().
|
* adjustments here as in handle_commit().
|
||||||
*/
|
*/
|
||||||
|
wlr_fractional_scale_v1_notify_scale(
|
||||||
|
view->surface,
|
||||||
|
view->output->wlr_output->scale
|
||||||
|
);
|
||||||
|
wlr_surface_set_preferred_buffer_scale(
|
||||||
|
view->surface,
|
||||||
|
ceil(view->output->wlr_output->scale)
|
||||||
|
);
|
||||||
view_impl_apply_geometry(view, view->current.width,
|
view_impl_apply_geometry(view, view->current.width,
|
||||||
view->current.height);
|
view->current.height);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,14 @@ handle_commit(struct wl_listener *listener, void *data)
|
||||||
* reducing visual glitches.
|
* reducing visual glitches.
|
||||||
*/
|
*/
|
||||||
if (current->width != state->width || current->height != state->height) {
|
if (current->width != state->width || current->height != state->height) {
|
||||||
|
wlr_fractional_scale_v1_notify_scale(
|
||||||
|
view->surface,
|
||||||
|
view->output->wlr_output->scale
|
||||||
|
);
|
||||||
|
wlr_surface_set_preferred_buffer_scale(
|
||||||
|
view->surface,
|
||||||
|
ceil(view->output->wlr_output->scale)
|
||||||
|
);
|
||||||
view_impl_apply_geometry(view, state->width, state->height);
|
view_impl_apply_geometry(view, state->width, state->height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue