mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
Switch back to compositor cursor when switching from one view to another
This commit is contained in:
parent
f44c44502d
commit
8492174088
2 changed files with 9 additions and 10 deletions
|
@ -79,7 +79,7 @@ struct roots_input {
|
||||||
struct wlr_xcursor_theme *theme;
|
struct wlr_xcursor_theme *theme;
|
||||||
struct wlr_xcursor *xcursor;
|
struct wlr_xcursor *xcursor;
|
||||||
struct wlr_seat *wl_seat;
|
struct wlr_seat *wl_seat;
|
||||||
bool client_cursor;
|
struct roots_view *client_cursor_view;
|
||||||
|
|
||||||
enum roots_cursor_mode mode;
|
enum roots_cursor_mode mode;
|
||||||
struct roots_view *active_view, *last_active_view;
|
struct roots_view *active_view, *last_active_view;
|
||||||
|
|
|
@ -69,8 +69,6 @@ static void cursor_set_xcursor_image(struct roots_input *input,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input->client_cursor = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_update_position(struct roots_input *input, uint32_t time) {
|
void cursor_update_position(struct roots_input *input, uint32_t time) {
|
||||||
|
@ -82,15 +80,16 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
|
||||||
case ROOTS_CURSOR_PASSTHROUGH:
|
case ROOTS_CURSOR_PASSTHROUGH:
|
||||||
view = view_at(desktop, input->cursor->x, input->cursor->y, &surface,
|
view = view_at(desktop, input->cursor->x, input->cursor->y, &surface,
|
||||||
&sx, &sy);
|
&sx, &sy);
|
||||||
|
if (view != input->client_cursor_view) {
|
||||||
|
wlr_log(L_DEBUG, "Switching to compositor cursor");
|
||||||
|
cursor_set_xcursor_image(input, input->xcursor->images[0]);
|
||||||
|
input->client_cursor_view = NULL;
|
||||||
|
}
|
||||||
if (view) {
|
if (view) {
|
||||||
wlr_seat_pointer_notify_enter(input->wl_seat, surface, sx, sy);
|
wlr_seat_pointer_notify_enter(input->wl_seat, surface, sx, sy);
|
||||||
wlr_seat_pointer_notify_motion(input->wl_seat, time, sx, sy);
|
wlr_seat_pointer_notify_motion(input->wl_seat, time, sx, sy);
|
||||||
} else {
|
} else {
|
||||||
wlr_seat_pointer_clear_focus(input->wl_seat);
|
wlr_seat_pointer_clear_focus(input->wl_seat);
|
||||||
if (input->client_cursor) {
|
|
||||||
wlr_log(L_DEBUG, "Switching to compositor cursor");
|
|
||||||
cursor_set_xcursor_image(input, input->xcursor->images[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROOTS_CURSOR_MOVE:
|
case ROOTS_CURSOR_MOVE:
|
||||||
|
@ -301,8 +300,8 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
||||||
|
|
||||||
struct wlr_surface *focused_surface = NULL;
|
struct wlr_surface *focused_surface = NULL;
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
view_at(input->server->desktop, input->cursor->x, input->cursor->y,
|
struct roots_view *focused_view = view_at(input->server->desktop,
|
||||||
&focused_surface, &sx, &sy);
|
input->cursor->x, input->cursor->y, &focused_surface, &sx, &sy);
|
||||||
bool ok = focused_surface != NULL;
|
bool ok = focused_surface != NULL;
|
||||||
if (focused_surface != NULL) {
|
if (focused_surface != NULL) {
|
||||||
struct wl_client *focused_client =
|
struct wl_client *focused_client =
|
||||||
|
@ -322,7 +321,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
||||||
event->hotspot_x, event->hotspot_y);
|
event->hotspot_x, event->hotspot_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
input->client_cursor = true;
|
input->client_cursor_view = focused_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursor_initialize(struct roots_input *input) {
|
void cursor_initialize(struct roots_input *input) {
|
||||||
|
|
Loading…
Reference in a new issue