core: 添加 output 索引循环切换接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "core/state.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <zdwm/types.h>
|
||||
|
||||
@@ -267,6 +268,14 @@ bool state_output_valid(const state_t *state, output_id_t id) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void state_cycle_current_output(state_t *state, int delta) {
|
||||
int64_t count = (int64_t)state->output_count;
|
||||
int64_t current = (int64_t)state->current_output_index;
|
||||
int64_t next = (current + (int64_t)delta) % count;
|
||||
if (next < 0) next += count;
|
||||
state->current_output_index = (size_t)next;
|
||||
}
|
||||
|
||||
static inline void window_set_geometry_mode(
|
||||
window_t *window, window_geometry_mode_t geometry_mode) {
|
||||
window->geometry_mode = geometry_mode;
|
||||
|
||||
Reference in New Issue
Block a user