struct buf;
struct view;
struct server;
+enum lab_cycle_dir;
+
+/* Begin window switcher */
+void osd_begin(struct server *server, enum lab_cycle_dir direction);
+
+/* Cycle the selected view in the window switcher */
+void osd_cycle(struct server *server, enum lab_cycle_dir direction);
/* Updates onscreen display 'alt-tab' buffer */
void osd_update(struct server *server);
return !strcmp(branch, "then");
}
-static bool
-shift_is_pressed(struct server *server)
-{
- uint32_t modifiers = wlr_keyboard_get_modifiers(
- &server->seat.keyboard_group->keyboard);
- return modifiers & WLR_MODIFIER_SHIFT;
-}
-
-static void
-start_window_cycling(struct server *server, enum lab_cycle_dir direction)
-{
- if (server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
- return;
- }
-
- /* Remember direction so it can be followed by subsequent key presses */
- server->osd_state.initial_direction = direction;
- server->osd_state.initial_keybind_contained_shift =
- shift_is_pressed(server);
- server->osd_state.cycle_view = desktop_cycle_view(server,
- server->osd_state.cycle_view, direction);
-
- seat_focus_override_begin(&server->seat,
- LAB_INPUT_STATE_WINDOW_SWITCHER, LAB_CURSOR_DEFAULT);
- osd_update(server);
-}
-
static struct output *
get_target_output(struct output *output, struct server *server,
struct action *action)
}
break;
case ACTION_TYPE_NEXT_WINDOW:
- start_window_cycling(server, LAB_CYCLE_DIR_FORWARD);
+ osd_begin(server, LAB_CYCLE_DIR_FORWARD);
break;
case ACTION_TYPE_PREVIOUS_WINDOW:
- start_window_cycling(server, LAB_CYCLE_DIR_BACKWARD);
+ osd_begin(server, LAB_CYCLE_DIR_BACKWARD);
break;
case ACTION_TYPE_RECONFIGURE:
kill(getpid(), SIGHUP);
/* Only one direction modifier is allowed, either arrow keys OR shift */
miss_shift_toggle:
-
- server->osd_state.cycle_view = desktop_cycle_view(server,
- server->osd_state.cycle_view, direction);
- osd_update(server);
+ osd_cycle(server, direction);
}
}
}
}
+static bool
+shift_is_pressed(struct server *server)
+{
+ uint32_t modifiers = wlr_keyboard_get_modifiers(
+ &server->seat.keyboard_group->keyboard);
+ return modifiers & WLR_MODIFIER_SHIFT;
+}
+
+void
+osd_begin(struct server *server, enum lab_cycle_dir direction)
+{
+ if (server->input_mode != LAB_INPUT_STATE_PASSTHROUGH) {
+ return;
+ }
+
+ /* Remember direction so it can be followed by subsequent key presses */
+ server->osd_state.initial_direction = direction;
+ server->osd_state.initial_keybind_contained_shift =
+ shift_is_pressed(server);
+ server->osd_state.cycle_view = desktop_cycle_view(server,
+ server->osd_state.cycle_view, direction);
+
+ seat_focus_override_begin(&server->seat,
+ LAB_INPUT_STATE_WINDOW_SWITCHER, LAB_CURSOR_DEFAULT);
+ osd_update(server);
+}
+
+void
+osd_cycle(struct server *server, enum lab_cycle_dir direction)
+{
+ assert(server->input_mode == LAB_INPUT_STATE_WINDOW_SWITCHER);
+
+ server->osd_state.cycle_view = desktop_cycle_view(server,
+ server->osd_state.cycle_view, direction);
+ osd_update(server);
+}
+
void
osd_finish(struct server *server)
{