aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Rostislav Pehlivanov <atomnuker@gmail.com>2017-10-11 19:47:03 +0100
committerGravatar Rostislav Pehlivanov <atomnuker@gmail.com>2017-10-11 19:59:42 +0100
commit91ebc3434438df5e33550d0bb4ab956742b0612d (patch)
tree1853792110144e0d3e5001a28e30122fcd58e444
parentb3178eb59e69d604012ac7463a93353d4817bc99 (diff)
wayland_common: require wl_output v2 and send MP_INPUT_RELEASE_ALL on uninit
Every compositor (including toy compositors) has had support for wl_output v2 since forever, so there's little point in supporting degraded output for 5 year old releases (especially considering we require zxdg6 which is far more recent).
-rw-r--r--video/out/wayland_common.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 4daf4570f6..b723f376c0 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -758,15 +758,12 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
wl_callback_add_listener(wl->frame_callback, &frame_listener, wl);
}
- if (!strcmp(interface, wl_output_interface.name) && found++) {
+ if (!strcmp(interface, wl_output_interface.name) && (ver >= 2) && found++) {
struct vo_wayland_output *output = talloc_zero(wl, struct vo_wayland_output);
- output->wl = wl;
- output->id = id;
- output->scale = 1;
- output->geometry = (struct mp_rect){ -1, -1, -1, -1 };
- output->output = wl_registry_bind(reg, id, &wl_output_interface,
- MPMIN(2, ver));
+ output->wl = wl;
+ output->id = id;
+ output->output = wl_registry_bind(reg, id, &wl_output_interface, 2);
wl_output_add_listener(output->output, &output_listener, output);
wl_list_insert(&wl->output_list, &output->link);
@@ -799,7 +796,7 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
}
if (found > 1)
- MP_VERBOSE(wl, "Registered for protocol %s, ver %i\n", interface, ver);
+ MP_VERBOSE(wl, "Registered for protocol %s\n", interface);
}
static void remove_output(struct vo_wayland_output *out)
@@ -999,6 +996,12 @@ int vo_wayland_init(struct vo *vo)
return false;
}
+ if (!wl_list_length(&wl->output_list)) {
+ MP_FATAL(wl, "No outputs found or compositor doesn't support %s (ver. 2)\n",
+ wl_output_interface.name);
+ return false;
+ }
+
/* Can't be initialized during registry, as they depend on 2 or more protocols */
if (spawn_cursor(wl))
return false;
@@ -1037,6 +1040,8 @@ void vo_wayland_uninit(struct vo *vo)
if (!wl)
return;
+ mp_input_put_key(wl->vo->input_ctx, MP_INPUT_RELEASE_ALL);
+
if (wl->cursor_theme)
wl_cursor_theme_destroy(wl->cursor_theme);