mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
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:
parent
252bcce2f3
commit
cf9debf82e
2 changed files with 12 additions and 5 deletions
|
@ -28,6 +28,7 @@ struct roots_cursor {
|
||||||
uint32_t resize_edges;
|
uint32_t resize_edges;
|
||||||
|
|
||||||
struct roots_seat_view *pointer_view;
|
struct roots_seat_view *pointer_view;
|
||||||
|
struct wlr_surface *wlr_surface;
|
||||||
|
|
||||||
struct wl_listener motion;
|
struct wl_listener motion;
|
||||||
struct wl_listener motion_absolute;
|
struct wl_listener motion_absolute;
|
||||||
|
|
|
@ -125,17 +125,23 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
||||||
if (view) {
|
if (view) {
|
||||||
struct roots_seat_view *seat_view =
|
struct roots_seat_view *seat_view =
|
||||||
roots_seat_view_from_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);
|
seat_view_deco_leave(cursor->pointer_view);
|
||||||
cursor->pointer_view = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor->pointer_view = seat_view;
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
cursor->pointer_view = seat_view;
|
|
||||||
seat_view_deco_motion(seat_view, sx, sy);
|
seat_view_deco_motion(seat_view, sx, sy);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cursor->pointer_view = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor->wlr_surface = surface;
|
||||||
|
|
||||||
if (surface) {
|
if (surface) {
|
||||||
focus_changed = (seat->seat->pointer_state.focused_surface != surface);
|
focus_changed = (seat->seat->pointer_state.focused_surface != surface);
|
||||||
wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy);
|
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 {
|
} else {
|
||||||
if (view && !surface && cursor->pointer_view) {
|
if (view && !surface && cursor->pointer_view) {
|
||||||
seat_view_deco_button(cursor->pointer_view,
|
seat_view_deco_button(cursor->pointer_view,
|
||||||
sx, sy, button, state);
|
sx, sy, button, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == WLR_BUTTON_RELEASED &&
|
if (state == WLR_BUTTON_RELEASED &&
|
||||||
|
|
Loading…
Reference in a new issue