This allows forcing an application to re-set their desired cursor image.
/**
* cursor_update_focus - update cursor focus, may update the cursor icon
* @server - server
- * Use it to force an update of the cursor icon and to send an enter event
- * to the surface below the cursor.
+ * @force_reenter - re-enter a surface if it already owns the cursor focus
+ *
+ * This can be used to give the mouse focus to the surface under the cursor
+ * or to force an update of the cursor icon by sending an exit and enter
+ * event to an already focused surface when @force_reenter is true.
*/
-void cursor_update_focus(struct server *server);
+void cursor_update_focus(struct server *server, bool force_reenter);
void cursor_init(struct seat *seat);
void cursor_finish(struct seat *seat);
}
void
-cursor_update_focus(struct server *server)
+cursor_update_focus(struct server *server, bool force_reenter)
{
double sx, sy;
struct wlr_scene_node *node = NULL;
ssd_update_button_hover(node, &seat->server->ssd_hover_state);
/* Focus surface under cursor if it isn't already focused */
- cursor_rebase(seat, node, surface, sx, sy, msec(&now), false);
+ cursor_rebase(seat, node, surface, sx, sy, msec(&now), force_reenter);
}
void
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
/* Make sure we are sending the events to the surface under the cursor */
- cursor_update_focus(seat->server);
+ cursor_update_focus(seat->server, false);
/* Notify the client with pointer focus of the axis event. */
wlr_seat_pointer_notify_axis(seat->seat, event->time_msec,
#if HAVE_XWAYLAND
move_xwayland_sub_views_to_front(view);
#endif
- cursor_update_focus(view->server);
+ cursor_update_focus(view->server, false);
}
static void
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);
+ cursor_update_focus(view->server, false);
}
/* N.B. Use view_move() if not resizing. */
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);
+ cursor_update_focus(unmanaged->server, false);
}
}
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);
+ cursor_update_focus(unmanaged->server, false);
}
}
unmanaged->server->unmanaged_tree,
xsurface->surface)->buffer->node;
wlr_scene_node_set_position(unmanaged->node, xsurface->x, xsurface->y);
- cursor_update_focus(unmanaged->server);
+ cursor_update_focus(unmanaged->server, false);
}
static void
seat_reset_pressed(seat);
}
unmanaged->node = NULL;
- cursor_update_focus(unmanaged->server);
+ cursor_update_focus(unmanaged->server, false);
if (seat->seat->keyboard_state.focused_surface == xsurface->surface) {
focus_next_surface(unmanaged->server, xsurface);