mirror of
https://github.com/labwc/labwc.git
synced 2026-03-20 05:34:12 -04:00
osd: make desktop_cycle_view() private in osd.c
This commit is contained in:
parent
6fe688b3e4
commit
a98b535362
3 changed files with 35 additions and 39 deletions
|
|
@ -481,14 +481,6 @@ struct view *desktop_topmost_focusable_view(struct server *server);
|
||||||
*/
|
*/
|
||||||
void desktop_update_top_layer_visiblity(struct server *server);
|
void desktop_update_top_layer_visiblity(struct server *server);
|
||||||
|
|
||||||
/**
|
|
||||||
* desktop_cycle_view - return view to 'cycle' to
|
|
||||||
* @start_view: reference point for finding next view to cycle to
|
|
||||||
* Note: If !start_view, the second focusable view is returned
|
|
||||||
*/
|
|
||||||
struct view *desktop_cycle_view(struct server *server, struct view *start_view,
|
|
||||||
enum lab_cycle_dir dir);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* desktop_focus_topmost_view() - focus the topmost view on the current
|
* desktop_focus_topmost_view() - focus the topmost view on the current
|
||||||
* workspace, skipping views that claim not to want focus (those can
|
* workspace, skipping views that claim not to want focus (those can
|
||||||
|
|
|
||||||
|
|
@ -108,34 +108,6 @@ desktop_focus_view_or_surface(struct seat *seat, struct view *view,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *
|
|
||||||
desktop_cycle_view(struct server *server, struct view *start_view,
|
|
||||||
enum lab_cycle_dir dir)
|
|
||||||
{
|
|
||||||
struct view *(*iter)(struct wl_list *head, struct view *view,
|
|
||||||
enum lab_view_criteria criteria);
|
|
||||||
bool forwards = dir == LAB_CYCLE_DIR_FORWARD;
|
|
||||||
iter = forwards ? view_next_no_head_stop : view_prev_no_head_stop;
|
|
||||||
|
|
||||||
enum lab_view_criteria criteria = rc.window_switcher.criteria;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Views are listed in stacking order, topmost first. Usually the
|
|
||||||
* topmost view is already focused, so when iterating in the forward
|
|
||||||
* direction we pre-select the view second from the top:
|
|
||||||
*
|
|
||||||
* View #1 (on top, currently focused)
|
|
||||||
* View #2 (pre-selected)
|
|
||||||
* View #3
|
|
||||||
* ...
|
|
||||||
*/
|
|
||||||
if (!start_view && forwards) {
|
|
||||||
start_view = iter(&server->views, NULL, criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
return iter(&server->views, start_view, criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct view *
|
struct view *
|
||||||
desktop_topmost_focusable_view(struct server *server)
|
desktop_topmost_focusable_view(struct server *server)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
38
src/osd.c
38
src/osd.c
|
|
@ -54,6 +54,38 @@ osd_update_preview_outlines(struct view *view)
|
||||||
wlr_scene_node_set_position(&rect->tree->node, geo.x, geo.y);
|
wlr_scene_node_set_position(&rect->tree->node, geo.x, geo.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the view to select next in the window switcher.
|
||||||
|
* If !start_view, the second focusable view is returned.
|
||||||
|
*/
|
||||||
|
static struct view *
|
||||||
|
get_next_cycle_view(struct server *server, struct view *start_view,
|
||||||
|
enum lab_cycle_dir dir)
|
||||||
|
{
|
||||||
|
struct view *(*iter)(struct wl_list *head, struct view *view,
|
||||||
|
enum lab_view_criteria criteria);
|
||||||
|
bool forwards = dir == LAB_CYCLE_DIR_FORWARD;
|
||||||
|
iter = forwards ? view_next_no_head_stop : view_prev_no_head_stop;
|
||||||
|
|
||||||
|
enum lab_view_criteria criteria = rc.window_switcher.criteria;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Views are listed in stacking order, topmost first. Usually the
|
||||||
|
* topmost view is already focused, so when iterating in the forward
|
||||||
|
* direction we pre-select the view second from the top:
|
||||||
|
*
|
||||||
|
* View #1 (on top, currently focused)
|
||||||
|
* View #2 (pre-selected)
|
||||||
|
* View #3
|
||||||
|
* ...
|
||||||
|
*/
|
||||||
|
if (!start_view && forwards) {
|
||||||
|
start_view = iter(&server->views, NULL, criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return iter(&server->views, start_view, criteria);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
osd_on_view_destroy(struct view *view)
|
osd_on_view_destroy(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
@ -72,7 +104,7 @@ osd_on_view_destroy(struct view *view)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Also resets preview node */
|
/* Also resets preview node */
|
||||||
osd_state->cycle_view = desktop_cycle_view(view->server,
|
osd_state->cycle_view = get_next_cycle_view(view->server,
|
||||||
osd_state->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
osd_state->cycle_view, LAB_CYCLE_DIR_BACKWARD);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -147,7 +179,7 @@ osd_begin(struct server *server, enum lab_cycle_dir direction)
|
||||||
server->osd_state.initial_direction = direction;
|
server->osd_state.initial_direction = direction;
|
||||||
server->osd_state.initial_keybind_contained_shift =
|
server->osd_state.initial_keybind_contained_shift =
|
||||||
shift_is_pressed(server);
|
shift_is_pressed(server);
|
||||||
server->osd_state.cycle_view = desktop_cycle_view(server,
|
server->osd_state.cycle_view = get_next_cycle_view(server,
|
||||||
server->osd_state.cycle_view, direction);
|
server->osd_state.cycle_view, direction);
|
||||||
|
|
||||||
seat_focus_override_begin(&server->seat,
|
seat_focus_override_begin(&server->seat,
|
||||||
|
|
@ -160,7 +192,7 @@ osd_cycle(struct server *server, enum lab_cycle_dir direction)
|
||||||
{
|
{
|
||||||
assert(server->input_mode == LAB_INPUT_STATE_WINDOW_SWITCHER);
|
assert(server->input_mode == LAB_INPUT_STATE_WINDOW_SWITCHER);
|
||||||
|
|
||||||
server->osd_state.cycle_view = desktop_cycle_view(server,
|
server->osd_state.cycle_view = get_next_cycle_view(server,
|
||||||
server->osd_state.cycle_view, direction);
|
server->osd_state.cycle_view, direction);
|
||||||
osd_update(server);
|
osd_update(server);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue