Give pointer focus to layer shell surfaces as well

This commit is contained in:
tiosgz 2021-09-10 21:06:41 +00:00
parent 21062c0224
commit 5537a445be

View file

@ -282,8 +282,8 @@ cursor_refresh_focus(
struct kiwmi_desktop *desktop = &cursor->server->desktop; struct kiwmi_desktop *desktop = &cursor->server->desktop;
struct wlr_seat *seat = cursor->server->input.seat->seat; struct wlr_seat *seat = cursor->server->input.seat->seat;
double ox = 0; double ox = cursor->cursor->x;
double oy = 0; double oy = cursor->cursor->y;
struct wlr_output *wlr_output = wlr_output_layout_output_at( struct wlr_output *wlr_output = wlr_output_layout_output_at(
desktop->output_layout, cursor->cursor->x, cursor->cursor->y); desktop->output_layout, cursor->cursor->x, cursor->cursor->y);
@ -299,19 +299,50 @@ cursor_refresh_focus(
struct kiwmi_layer *layer = layer_at( struct kiwmi_layer *layer = layer_at(
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
&surface, &surface,
cursor->cursor->x, ox,
cursor->cursor->y, oy,
&sx, &sx,
&sy); &sy);
struct kiwmi_view *view;
if (!layer) { if (!layer) {
struct kiwmi_view *view = view_at( layer = layer_at(
desktop, cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
&surface,
ox,
oy,
&sx,
&sy);
}
if (!view) { if (!layer) {
wlr_xcursor_manager_set_cursor_image( view = view_at(
cursor->xcursor_manager, "left_ptr", cursor->cursor); desktop, cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
} }
if (!layer) {
layer = layer_at(
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM],
&surface,
ox,
oy,
&sx,
&sy);
}
if (!layer) {
layer = layer_at(
&output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND],
&surface,
ox,
oy,
&sx,
&sy);
}
if (!layer && !view) {
wlr_xcursor_manager_set_cursor_image(
cursor->xcursor_manager, "left_ptr", cursor->cursor);
} }
if (surface && surface != seat->pointer_state.focused_surface) { if (surface && surface != seat->pointer_state.focused_surface) {