2ZRKX4A24W4WNSLJNPKP3FWB3Y3UCYLWWESTC65P45BQFSJKS4PQC
typedef union {
int i;
unsigned int ui;
float f;
const void *v;
} Arg;
typedef struct {
uint32_t mod;
xkb_keysym_t keysym;
void (*func)(struct dwl_server *, const Arg *);
const Arg arg;
} Key;
static void focusnext(struct dwl_server *, const Arg *);
static void quit(struct dwl_server *, const Arg *);
static bool handle_keybinding(struct dwl_server *server, xkb_keysym_t sym) {
static void quit(struct dwl_server *server, const Arg *unused) {
wl_display_terminate(server->wl_display);
}
static void focusnext(struct dwl_server *server, const Arg *unused) {
/* Cycle to the next view */
if (wl_list_length(&server->views) < 2) {
return;
}
struct dwl_view *current_view = wl_container_of(
server->views.next, current_view, link);
struct dwl_view *next_view = wl_container_of(
current_view->link.next, next_view, link);
focus_view(next_view, next_view->xdg_surface->surface);
/* Move the previous view to the end of the list */
wl_list_remove(¤t_view->link);
wl_list_insert(server->views.prev, ¤t_view->link);
}
static bool handle_keybinding(struct dwl_server *server, uint32_t mods, xkb_keysym_t sym) {
/* Cycle to the next view */
if (wl_list_length(&server->views) < 2) {
break;
}
struct dwl_view *current_view = wl_container_of(
server->views.next, current_view, link);
struct dwl_view *next_view = wl_container_of(
current_view->link.next, next_view, link);
focus_view(next_view, next_view->xdg_surface->surface);
/* Move the previous view to the end of the list */
wl_list_remove(¤t_view->link);
wl_list_insert(server->views.prev, ¤t_view->link);
focusnext(server, NULL);
uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard->device->keyboard);
if ((modifiers & WLR_MODIFIER_ALT) && event->state == WLR_KEY_PRESSED) {
/* If alt is held down and this button was _pressed_, we attempt to
* process it as a compositor keybinding. */
uint32_t mods = wlr_keyboard_get_modifiers(keyboard->device->keyboard);
if (event->state == WLR_KEY_PRESSED) {
/* On _press_, attempt to process a compositor keybinding. */
#define MODKEY WLR_MODIFIER_ALT
static const Key keys[] = {
{ MODKEY, XKB_KEY_Escape, quit, {0} },
{ MODKEY, XKB_KEY_F1, focusnext, {0} },
};