mirror of
https://github.com/labwc/labwc.git
synced 2026-04-03 07:15:34 -04:00
cycle: factor out get_osd_impl()
This commit is contained in:
parent
7527717caa
commit
1783b805e1
1 changed files with 18 additions and 18 deletions
|
|
@ -257,18 +257,29 @@ preview_selected_view(struct view *view)
|
||||||
wlr_scene_node_raise_to_top(cycle->preview_node);
|
wlr_scene_node_raise_to_top(cycle->preview_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct cycle_osd_impl *
|
||||||
|
get_osd_impl(void)
|
||||||
|
{
|
||||||
|
switch (rc.window_switcher.style) {
|
||||||
|
case CYCLE_OSD_STYLE_CLASSIC:
|
||||||
|
return &cycle_osd_classic_impl;
|
||||||
|
case CYCLE_OSD_STYLE_THUMBNAIL:
|
||||||
|
return &cycle_osd_thumbnail_impl;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_osd_on_output(struct server *server, struct output *output,
|
update_osd_on_output(struct output *output, struct wl_array *views)
|
||||||
struct cycle_osd_impl *osd_impl, struct wl_array *views)
|
|
||||||
{
|
{
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!output->cycle_osd.tree) {
|
if (!output->cycle_osd.tree) {
|
||||||
osd_impl->create(output, views);
|
get_osd_impl()->create(output, views);
|
||||||
assert(output->cycle_osd.tree);
|
assert(output->cycle_osd.tree);
|
||||||
}
|
}
|
||||||
osd_impl->update(output);
|
get_osd_impl()->update(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -278,16 +289,6 @@ update_cycle(struct server *server)
|
||||||
wl_array_init(&views);
|
wl_array_init(&views);
|
||||||
view_array_append(server, &views, rc.window_switcher.criteria);
|
view_array_append(server, &views, rc.window_switcher.criteria);
|
||||||
|
|
||||||
struct cycle_osd_impl *osd_impl = NULL;
|
|
||||||
switch (rc.window_switcher.style) {
|
|
||||||
case CYCLE_OSD_STYLE_CLASSIC:
|
|
||||||
osd_impl = &cycle_osd_classic_impl;
|
|
||||||
break;
|
|
||||||
case CYCLE_OSD_STYLE_THUMBNAIL:
|
|
||||||
osd_impl = &cycle_osd_thumbnail_impl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wl_array_len(&views) || !server->cycle.selected_view) {
|
if (!wl_array_len(&views) || !server->cycle.selected_view) {
|
||||||
cycle_finish(server, /*switch_focus*/ false);
|
cycle_finish(server, /*switch_focus*/ false);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -299,13 +300,12 @@ update_cycle(struct server *server)
|
||||||
case CYCLE_OSD_OUTPUT_ALL: {
|
case CYCLE_OSD_OUTPUT_ALL: {
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &server->outputs, link) {
|
wl_list_for_each(output, &server->outputs, link) {
|
||||||
update_osd_on_output(server, output, osd_impl, &views);
|
update_osd_on_output(output, &views);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CYCLE_OSD_OUTPUT_POINTER:
|
case CYCLE_OSD_OUTPUT_POINTER:
|
||||||
update_osd_on_output(server,
|
update_osd_on_output(output_nearest_to_cursor(server), &views);
|
||||||
output_nearest_to_cursor(server), osd_impl, &views);
|
|
||||||
break;
|
break;
|
||||||
case CYCLE_OSD_OUTPUT_KEYBOARD: {
|
case CYCLE_OSD_OUTPUT_KEYBOARD: {
|
||||||
struct output *output;
|
struct output *output;
|
||||||
|
|
@ -315,7 +315,7 @@ update_cycle(struct server *server)
|
||||||
/* Fallback to pointer, if there is no active_view */
|
/* Fallback to pointer, if there is no active_view */
|
||||||
output = output_nearest_to_cursor(server);
|
output = output_nearest_to_cursor(server);
|
||||||
}
|
}
|
||||||
update_osd_on_output(server, output, osd_impl, &views);
|
update_osd_on_output(output, &views);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue