summaryrefslogtreecommitdiff
path: root/src/wayland
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland')
-rw-r--r--src/wayland/buffer.c25
-rw-r--r--src/wayland/keyboard.c3
2 files changed, 16 insertions, 12 deletions
diff --git a/src/wayland/buffer.c b/src/wayland/buffer.c
index 0561da3..4cddfa5 100644
--- a/src/wayland/buffer.c
+++ b/src/wayland/buffer.c
@@ -200,24 +200,27 @@ static const struct wp_fractional_scale_v1_listener frac_scale_listener = {
.preferred_scale = fractional_preferred_scale,
};
-static void surface_follow_refresh(struct wayland_surface *w)
+void surface_follow_outputs(struct wayland_surface *w)
{
uint32_t refresh = 0;
- for (const struct wl_conn_output *o = w->conn->outputs; o; o = o->next)
- if ((o->mask & w->outputs) && o->refresh_ns &&
- (!refresh || o->refresh_ns < refresh))
- refresh = o->refresh_ns;
+ int32_t max_scale = 0;
+ bool need_scale = !w->frac_scale && !surface_gets_preferred_scale(w->surface);
+
+ for (const struct wl_conn_output *o = w->conn->outputs; o; o = o->next) {
+ if (o->mask & w->outputs) {
+ if (o->refresh_ns && (!refresh || o->refresh_ns < refresh))
+ refresh = o->refresh_ns;
+ if (need_scale && o->scale > max_scale)
+ max_scale = o->scale;
+ }
+ }
if (!refresh && w->conn->outputs)
refresh = w->conn->outputs->refresh_ns;
if (refresh)
w->clock.refresh_ns = refresh;
-}
-void surface_follow_outputs(struct wayland_surface *w)
-{
- surface_follow_refresh(w);
- if (!w->frac_scale && !surface_gets_preferred_scale(w->surface))
- surface_request_scale(w, conn_output_scale_120(w->conn, w->outputs));
+ if (need_scale)
+ surface_request_scale(w, (uint32_t)max_scale * YASL_SCALE_UNIT);
}
static void surface_enter(void *data, struct wl_surface *surface, struct wl_output *output)
diff --git a/src/wayland/keyboard.c b/src/wayland/keyboard.c
index f7e2691..11c7f3f 100644
--- a/src/wayland/keyboard.c
+++ b/src/wayland/keyboard.c
@@ -170,7 +170,8 @@ static void seat_settle_focus(struct seat *s)
void keyboard_settle_focus(struct wayland_display *c)
{
for (struct seat *s = c->seats; s; s = s->next)
- seat_settle_focus(s);
+ if (s->focus_leaving)
+ seat_settle_focus(s);
}
static void keyboard_leave(void *data, struct wl_keyboard *keyboard,