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.
This commit is contained in:
Las 2018-08-06 11:39:34 +02:00
parent 252bcce2f3
commit cf9debf82e
2 changed files with 12 additions and 5 deletions

View File

@ -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;

View File

@ -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 &&