summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r--video/out/wayland_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 0a7e6128d7..a0e734703b 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -68,7 +68,7 @@ static int spawn_cursor(struct vo_wayland_state *wl)
return 0;
}
-static int set_cursor_visibility(struct vo_wayland_state *wl, int on)
+static int set_cursor_visibility(struct vo_wayland_state *wl, bool on)
{
if (!wl->pointer)
return VO_NOTAVAIL;
@@ -100,7 +100,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
wl->pointer = pointer;
wl->pointer_id = serial;
- set_cursor_visibility(wl, 1);
+ set_cursor_visibility(wl, true);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
}
@@ -574,6 +574,10 @@ static void output_handle_scale(void* data, struct wl_output *wl_output,
int32_t factor)
{
struct vo_wayland_output *output = data;
+ if (!factor) {
+ MP_ERR(output->wl, "Invalid output scale given by the compositor!\n");
+ return;
+ }
output->scale = factor;
}
@@ -790,6 +794,7 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
output->wl = wl;
output->id = id;
+ output->scale = 1;
output->output = wl_registry_bind(reg, id, &wl_output_interface, 2);
wl_output_add_listener(output->output, &output_listener, output);
@@ -1167,7 +1172,8 @@ int vo_wayland_reconfig(struct vo *vo)
wl_surface_commit(wl->surface);
wl->pending_vo_events |= VO_EVENT_RESIZE;
if (!wl->configured) {
- spawn_cursor(wl);
+ if (spawn_cursor(wl))
+ return false;
wl_display_roundtrip(wl->display);
wl->configured = true;
}