mirror of
https://github.com/labwc/labwc.git
synced 2026-03-15 05:33:53 -04:00
cycle: add and use get_outputs_by_filter()
This function can be reused for filtering windows to cycle through.
This commit is contained in:
parent
64af206114
commit
c9b088e343
1 changed files with 38 additions and 26 deletions
|
|
@ -266,14 +266,36 @@ get_osd_impl(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static uint64_t
|
||||||
create_osd_on_output(struct output *output)
|
get_outputs_by_filter(struct server *server,
|
||||||
|
enum cycle_output_filter output_filter)
|
||||||
{
|
{
|
||||||
if (!output_is_usable(output)) {
|
struct output *output = NULL;
|
||||||
return;
|
|
||||||
|
switch (output_filter) {
|
||||||
|
case CYCLE_OUTPUT_ALL:
|
||||||
|
break;
|
||||||
|
case CYCLE_OUTPUT_CURSOR:
|
||||||
|
output = output_nearest_to_cursor(server);
|
||||||
|
break;
|
||||||
|
case CYCLE_OUTPUT_FOCUSED: {
|
||||||
|
struct view *view = server->active_view;
|
||||||
|
if (view && output_is_usable(view->output)) {
|
||||||
|
output = view->output;
|
||||||
|
} else {
|
||||||
|
/* Fallback to pointer */
|
||||||
|
output = output_nearest_to_cursor(server);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output) {
|
||||||
|
return output->id_bit;
|
||||||
|
} else {
|
||||||
|
/* bitmask for all outputs */
|
||||||
|
return UINT64_MAX;
|
||||||
}
|
}
|
||||||
get_osd_impl()->create(output);
|
|
||||||
assert(output->cycle_osd.tree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -309,28 +331,18 @@ init_cycle(struct server *server)
|
||||||
|
|
||||||
if (rc.window_switcher.osd.show) {
|
if (rc.window_switcher.osd.show) {
|
||||||
/* Create OSD */
|
/* Create OSD */
|
||||||
switch (rc.window_switcher.osd.output_filter) {
|
uint64_t osd_outputs = get_outputs_by_filter(server,
|
||||||
case CYCLE_OUTPUT_ALL: {
|
rc.window_switcher.osd.output_filter);
|
||||||
struct output *output;
|
struct output *output;
|
||||||
wl_list_for_each(output, &server->outputs, link) {
|
wl_list_for_each(output, &server->outputs, link) {
|
||||||
create_osd_on_output(output);
|
if (!(osd_outputs & output->id_bit)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
if (!output_is_usable(output)) {
|
||||||
}
|
continue;
|
||||||
case CYCLE_OUTPUT_CURSOR:
|
|
||||||
create_osd_on_output(output_nearest_to_cursor(server));
|
|
||||||
break;
|
|
||||||
case CYCLE_OUTPUT_FOCUSED: {
|
|
||||||
struct output *output;
|
|
||||||
if (server->active_view) {
|
|
||||||
output = server->active_view->output;
|
|
||||||
} else {
|
|
||||||
/* Fallback to pointer, if there is no active_view */
|
|
||||||
output = output_nearest_to_cursor(server);
|
|
||||||
}
|
}
|
||||||
create_osd_on_output(output);
|
get_osd_impl()->create(output);
|
||||||
break;
|
assert(output->cycle_osd.tree);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue