mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
cursor: Update focus at various additional points
- When XDG and XWayland views are positioned (view_moved()). - When unmanaged XWayland surfaces are mapped, unmapped, or moved. Do not update cursor focus during an out-of-surface drag. Along with the existing call in desktop_move_to_front(), this should hopefully cover the majority of cases where the cursor focus could get out-of-date, with the possible exception of layer-shell surfaces.
This commit is contained in:
parent
2e81cc13d4
commit
469adc46d6
3 changed files with 11 additions and 1 deletions
|
|
@ -27,6 +27,11 @@ is_surface(enum ssd_part_type view_area)
|
|||
void
|
||||
cursor_rebase(struct seat *seat, uint32_t time_msec, bool force)
|
||||
{
|
||||
if (seat->pressed.surface) {
|
||||
/* Don't leave surface while a button is pressed */
|
||||
return;
|
||||
}
|
||||
|
||||
double sx, sy;
|
||||
struct wlr_scene_node *node;
|
||||
enum ssd_part_type view_area = LAB_SSD_NONE;
|
||||
|
|
@ -41,7 +46,7 @@ cursor_rebase(struct seat *seat, uint32_t time_msec, bool force)
|
|||
if (surface) {
|
||||
if (!force && surface == seat->seat->pointer_state.focused_surface) {
|
||||
/*
|
||||
* Usually we prevent re-entering an already focued surface
|
||||
* Usually we prevent re-entering an already focused surface
|
||||
* because it sends useless leave and enter events.
|
||||
*
|
||||
* They may also seriously confuse clients if sent between
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ view_moved(struct view *view)
|
|||
wlr_scene_node_set_position(&view->scene_tree->node, view->x, view->y);
|
||||
view_discover_output(view);
|
||||
ssd_update_geometry(view);
|
||||
cursor_update_focus(view->server);
|
||||
}
|
||||
|
||||
/* N.B. Use view_move() if not resizing. */
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ unmanaged_handle_request_configure(struct wl_listener *listener, void *data)
|
|||
wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, ev->width, ev->height);
|
||||
if (unmanaged->node) {
|
||||
wlr_scene_node_set_position(unmanaged->node, ev->x, ev->y);
|
||||
cursor_update_focus(unmanaged->server);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +23,7 @@ unmanaged_handle_set_geometry(struct wl_listener *listener, void *data)
|
|||
struct wlr_xwayland_surface *xsurface = unmanaged->xwayland_surface;
|
||||
if (unmanaged->node) {
|
||||
wlr_scene_node_set_position(unmanaged->node, xsurface->x, xsurface->y);
|
||||
cursor_update_focus(unmanaged->server);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,6 +51,7 @@ unmanaged_handle_map(struct wl_listener *listener, void *data)
|
|||
unmanaged->server->unmanaged_tree,
|
||||
xsurface->surface)->buffer->node;
|
||||
wlr_scene_node_set_position(unmanaged->node, xsurface->x, xsurface->y);
|
||||
cursor_update_focus(unmanaged->server);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -102,6 +105,7 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
|
|||
seat_reset_pressed(seat);
|
||||
}
|
||||
unmanaged->node = NULL;
|
||||
cursor_update_focus(unmanaged->server);
|
||||
|
||||
if (seat->seat->keyboard_state.focused_surface == xsurface->surface) {
|
||||
focus_next_surface(unmanaged->server, xsurface);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue