diff options
author | Las <las@protonmail.ch> | 2018-08-06 11:39:34 +0200 |
---|---|---|
committer | Las <las@protonmail.ch> | 2018-09-18 10:14:33 +0200 |
commit | cf9debf82e9b01b11b82c2a65426b909ac222340 (patch) | |
tree | a623fe422cf346fa18392b3f991e610c8e27fc03 | |
parent | 252bcce2f373bc5f0e29a4820ce23373b836e3bb (diff) |
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.
-rw-r--r-- | include/rootston/cursor.h | 1 | ||||
-rw-r--r-- | 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 && |