mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 05:55:58 +01:00
Update pointer focus when cycling focus
This commit is contained in:
parent
d446c53fe1
commit
59dd1dddba
3 changed files with 15 additions and 3 deletions
|
@ -84,4 +84,6 @@ void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor,
|
|||
void roots_cursor_update_position(struct roots_cursor *cursor,
|
||||
uint32_t time);
|
||||
|
||||
void roots_cursor_update_focus(struct roots_cursor *cursor);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -100,7 +100,7 @@ static void seat_view_deco_button(struct roots_seat_view *view, double sx,
|
|||
}
|
||||
|
||||
static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
||||
uint32_t time) {
|
||||
int64_t time) {
|
||||
bool focus_changed;
|
||||
double sx, sy;
|
||||
struct roots_view *view = NULL;
|
||||
|
@ -108,11 +108,13 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
|||
struct roots_desktop *desktop = seat->input->server->desktop;
|
||||
struct wlr_surface *surface = desktop_surface_at(desktop,
|
||||
cursor->cursor->x, cursor->cursor->y, &sx, &sy, &view);
|
||||
|
||||
struct wl_client *client = NULL;
|
||||
if (surface) {
|
||||
client = wl_resource_get_client(surface->resource);
|
||||
}
|
||||
if (surface && !roots_seat_allow_input(cursor->seat, surface->resource)) {
|
||||
|
||||
if (surface && !roots_seat_allow_input(seat, surface->resource)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,7 +147,7 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
|||
if (surface) {
|
||||
focus_changed = (seat->seat->pointer_state.focused_surface != surface);
|
||||
wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy);
|
||||
if (!focus_changed) {
|
||||
if (!focus_changed && time > 0) {
|
||||
wlr_seat_pointer_notify_motion(seat->seat, time, sx, sy);
|
||||
}
|
||||
} else {
|
||||
|
@ -158,6 +160,10 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
|||
}
|
||||
}
|
||||
|
||||
void roots_cursor_update_focus(struct roots_cursor *cursor) {
|
||||
roots_passthrough_cursor(cursor, -1);
|
||||
}
|
||||
|
||||
void roots_cursor_update_position(struct roots_cursor *cursor,
|
||||
uint32_t time) {
|
||||
struct roots_seat *seat = cursor->seat;
|
||||
|
|
|
@ -1186,6 +1186,8 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
|
|||
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface,
|
||||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1220,6 +1222,8 @@ void roots_seat_set_focus_layer(struct roots_seat *seat,
|
|||
wlr_seat_keyboard_notify_enter(seat->seat, layer->surface,
|
||||
NULL, 0, NULL);
|
||||
}
|
||||
|
||||
roots_cursor_update_focus(seat->cursor);
|
||||
}
|
||||
|
||||
void roots_seat_set_exclusive_client(struct roots_seat *seat,
|
||||
|
|
Loading…
Reference in a new issue