osd: allow clicking an osd item to focus the window

This commit is contained in:
tokyo4j 2025-10-30 03:22:45 +09:00 committed by Johan Malm
parent 00f0a46ef7
commit 9197eb468a
9 changed files with 55 additions and 1 deletions

View file

@ -47,7 +47,7 @@ enum lab_node_type {
LAB_NODE_FRAME,
LAB_NODE_ROOT,
LAB_NODE_MENUITEM,
LAB_NODE_OSD,
LAB_NODE_OSD_ITEM,
LAB_NODE_LAYER_SURFACE,
LAB_NODE_UNMANAGED,
LAB_NODE_ALL,

View file

@ -52,6 +52,13 @@ struct lab_layer_surface *node_layer_surface_from_node(
struct menuitem *node_menuitem_from_node(
struct wlr_scene_node *wlr_scene_node);
/**
* node_osd_item_from_node - return osd item struct from node
* @wlr_scene_node: wlr_scene_node from which to return data
*/
struct osd_item *node_osd_item_from_node(
struct wlr_scene_node *wlr_scene_node);
/**
* node_try_ssd_button_from_node - return ssd_button or NULL from node
* @wlr_scene_node: wlr_scene_node from which to return data

View file

@ -45,6 +45,7 @@ struct window_switcher_field {
struct buf;
struct view;
struct server;
struct wlr_scene_node;
/* Begin window switcher */
void osd_begin(struct server *server, enum lab_cycle_dir direction);
@ -58,6 +59,9 @@ void osd_finish(struct server *server, bool switch_focus);
/* Notify OSD about a destroying view */
void osd_on_view_destroy(struct view *view);
/* Focus the clicked window and close OSD */
void osd_on_cursor_release(struct server *server, struct wlr_scene_node *node);
/* Used by osd.c internally to render window switcher fields */
void osd_field_get_content(struct window_switcher_field *field,
struct buf *buf, struct view *view);