From 1fc58386d10be728bf608c4e6b6a1e0d44b943b9 Mon Sep 17 00:00:00 2001 From: Alexander Preisinger Date: Fri, 22 Mar 2013 19:37:28 +0100 Subject: wayland: fully support cursor autohide options I missed the special cases in the previous commits. --- video/out/wayland_common.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'video') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 449214ea4f..b1f08fce4d 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -61,8 +61,8 @@ static int lookupkey(int key); -static void hide_cursor(struct vo_wayland_display * display); -static void show_cursor(struct vo_wayland_display * display); +static void hide_cursor(struct vo_wayland_state * wl); +static void show_cursor(struct vo_wayland_state * wl); /*** wayland interface ***/ @@ -386,10 +386,10 @@ static void pointer_handle_enter(void *data, * because after moving the shell surface no release event is sent */ mplayer_put_key(wl->vo->key_fifo, MP_MOUSE_BTN0); - if (wl->window->type == TYPE_FULLSCREEN) - hide_cursor(display); + if (wl->window->type == TYPE_FULLSCREEN || wl->vo->opts->cursor_autohide_delay == -2) + hide_cursor(wl); else if (display->cursor.default_cursor) { - show_cursor(display); + show_cursor(wl); } } @@ -412,7 +412,7 @@ static void pointer_handle_motion(void *data, display->cursor.pointer = pointer; if (wl->window->type == TYPE_FULLSCREEN) { - show_cursor(display); + show_cursor(wl); struct itimerspec its; int ms = wl->vo->opts->cursor_autohide_delay; @@ -631,18 +631,20 @@ static int lookupkey(int key) return mpkey; } -static void hide_cursor (struct vo_wayland_display *display) +static void hide_cursor (struct vo_wayland_state *wl) { - if (!display->cursor.pointer) + struct vo_wayland_display *display = wl->display; + if (!display->cursor.pointer || wl->vo->opts->cursor_autohide_delay == -1) return; wl_pointer_set_cursor(display->cursor.pointer, display->cursor.serial, NULL, 0, 0); } -static void show_cursor (struct vo_wayland_display *display) +static void show_cursor (struct vo_wayland_state *wl) { - if (!display->cursor.pointer) + struct vo_wayland_display *display = wl->display; + if (!display->cursor.pointer || wl->vo->opts->cursor_autohide_delay == -2) return; struct wl_buffer *buffer; @@ -707,10 +709,8 @@ static void cursor_timer_func(struct vo_wayland_task *task, uint32_t events, struct vo_wayland_state *wl) { - struct vo_wayland_display *display = wl->display; - if (wl->window->type == TYPE_FULLSCREEN) - hide_cursor(display); + hide_cursor(wl); } static void keyboard_timer_func(struct vo_wayland_task *task, @@ -939,7 +939,7 @@ void vo_wayland_fullscreen (struct vo *vo) wl->window->type = TYPE_FULLSCREEN; vo->opts->fs = true; - hide_cursor(wl->display); + hide_cursor(wl); } else { @@ -949,7 +949,7 @@ void vo_wayland_fullscreen (struct vo *vo) wl->window->type = TYPE_TOPLEVEL; vo->opts->fs = false; - show_cursor(wl->display); + show_cursor(wl); } } -- cgit v1.2.3