introduce client_set_scale()

This commit is contained in:
Leonardo Hernández Hernández 2024-08-09 22:05:04 -06:00
parent b616476c85
commit 43016bdad8
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
2 changed files with 8 additions and 4 deletions

View File

@ -331,6 +331,12 @@ client_set_fullscreen(Client *c, int fullscreen)
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen); wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
} }
static inline void
client_set_scale(struct wlr_surface *s, float scale) {
wlr_fractional_scale_v1_notify_scale(s, scale);
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
}
static inline uint32_t static inline uint32_t
client_set_size(Client *c, uint32_t width, uint32_t height) client_set_size(Client *c, uint32_t width, uint32_t height)
{ {

6
dwl.c
View File

@ -759,8 +759,7 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
struct wlr_layer_surface_v1_state old_state; struct wlr_layer_surface_v1_state old_state;
if (l->layer_surface->initial_commit) { if (l->layer_surface->initial_commit) {
wlr_fractional_scale_v1_notify_scale(layer_surface->surface, l->mon->wlr_output->scale); client_set_scale(layer_surface->surface, l->mon->wlr_output->scale);
wlr_surface_set_preferred_buffer_scale(layer_surface->surface, (int32_t)ceilf(l->mon->wlr_output->scale));
/* Temporarily set the layer's current state to pending /* Temporarily set the layer's current state to pending
* so that we can easily arrange it */ * so that we can easily arrange it */
@ -800,8 +799,7 @@ commitnotify(struct wl_listener *listener, void *data)
*/ */
applyrules(c); applyrules(c);
if (c->mon) { if (c->mon) {
wlr_surface_set_preferred_buffer_scale(client_surface(c), (int)ceilf(c->mon->wlr_output->scale)); client_set_scale(client_surface(c), c->mon->wlr_output->scale);
wlr_fractional_scale_v1_notify_scale(client_surface(c), c->mon->wlr_output->scale);
} }
setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */ setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */