Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wayland: match x11 cursor behavior #6525

Merged
2 commits merged into from
Sep 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion video/out/wayland_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static int set_cursor_visibility(struct vo_wayland_state *wl, bool on)
{
if (!wl->pointer)
return VO_NOTAVAIL;
wl->cursor_visible = on;
if (on) {
if (spawn_cursor(wl))
return VO_FALSE;
Expand Down Expand Up @@ -100,7 +101,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
wl->pointer = pointer;
wl->pointer_id = serial;

set_cursor_visibility(wl, true);
set_cursor_visibility(wl, wl->cursor_visible);
mp_input_put_key(wl->vo->input_ctx, MP_KEY_MOUSE_ENTER);
}

Expand All @@ -115,7 +116,12 @@ static void pointer_handle_motion(void *data, struct wl_pointer *pointer,
uint32_t time, wl_fixed_t sx, wl_fixed_t sy)
{
struct vo_wayland_state *wl = data;
if (!wl->prev_fullscreen && wl->fullscreen) {
wl->prev_fullscreen = wl->fullscreen;
return;
}

wl->prev_fullscreen = wl->fullscreen;
wl->mouse_x = wl_fixed_to_int(sx) * wl->scaling;
wl->mouse_y = wl_fixed_to_int(sy) * wl->scaling;

Expand Down Expand Up @@ -997,6 +1003,8 @@ int vo_wayland_init(struct vo *vo)
.scaling = 1,
.wakeup_pipe = {-1, -1},
.dnd_fd = -1,
.cursor_visible = true,
.prev_fullscreen = vo->opts->fullscreen,
};

wl_list_init(&wl->output_list);
Expand Down
2 changes: 2 additions & 0 deletions video/out/wayland_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ struct vo_wayland_state {
struct wl_cursor *default_cursor;
struct wl_surface *cursor_surface;
int allocated_cursor_scale;
bool cursor_visible;
bool prev_fullscreen;
};

int vo_wayland_init(struct vo *vo);
Expand Down