From cf9debf82e9b01b11b82c2a65426b909ac222340 Mon Sep 17 00:00:00 2001 From: Las Date: Mon, 6 Aug 2018 11:39:34 +0200 Subject: [PATCH] Make roots_cursor::pointer_view available even if there is a surface To find out whether there was a surface or not before a movement, the member roots_cursor::wlr_surface has been added. --- include/rootston/cursor.h | 1 + rootston/cursor.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index 2c687a39..52c72a44 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -28,6 +28,7 @@ struct roots_cursor { uint32_t resize_edges; struct roots_seat_view *pointer_view; + struct wlr_surface *wlr_surface; struct wl_listener motion; struct wl_listener motion_absolute; diff --git a/rootston/cursor.c b/rootston/cursor.c index 2b8d9a3e..239acf9c 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -125,17 +125,23 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor, if (view) { struct roots_seat_view *seat_view = roots_seat_view_from_view(seat, view); - if (cursor->pointer_view && (surface || - seat_view != cursor->pointer_view)) { + + if (cursor->pointer_view && + !cursor->wlr_surface && (surface || seat_view != cursor->pointer_view)) { seat_view_deco_leave(cursor->pointer_view); - cursor->pointer_view = NULL; } + + cursor->pointer_view = seat_view; + if (!surface) { - cursor->pointer_view = seat_view; seat_view_deco_motion(seat_view, sx, sy); } + } else { + cursor->pointer_view = NULL; } + cursor->wlr_surface = surface; + if (surface) { focus_changed = (seat->seat->pointer_state.focused_surface != surface); wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy); @@ -262,7 +268,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, } else { if (view && !surface && cursor->pointer_view) { seat_view_deco_button(cursor->pointer_view, - sx, sy, button, state); + sx, sy, button, state); } if (state == WLR_BUTTON_RELEASED &&