diff --git a/example/pointer.c b/example/pointer.c index 8735c61e..9aeb41a7 100644 --- a/example/pointer.c +++ b/example/pointer.c @@ -50,6 +50,8 @@ static void handle_keyboard_key(struct keyboard_state *kbstate, xkb_keysym_t sym, enum wlr_key_state key_state) { if (sym == XKB_KEY_Escape) { kbstate->compositor->exit = true; + } else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) { + wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1); } } diff --git a/example/rotation.c b/example/rotation.c index d7b6b169..412a81ca 100644 --- a/example/rotation.c +++ b/example/rotation.c @@ -123,6 +123,10 @@ static void handle_keyboard_key(struct keyboard_state *kbstate, update_velocities(kbstate->compositor, 0, 16); break; } + + if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) { + wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1); + } } } diff --git a/example/tablet.c b/example/tablet.c index 6be006f0..4d64b638 100644 --- a/example/tablet.c +++ b/example/tablet.c @@ -78,6 +78,8 @@ static void handle_keyboard_key(struct keyboard_state *kbstate, xkb_keysym_t sym, enum wlr_key_state key_state) { if (sym == XKB_KEY_Escape) { kbstate->compositor->exit = true; + } else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) { + wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1); } } diff --git a/example/touch.c b/example/touch.c index 1b4233bb..2b6cb173 100644 --- a/example/touch.c +++ b/example/touch.c @@ -59,6 +59,8 @@ static void handle_keyboard_key(struct keyboard_state *kbstate, xkb_keysym_t sym, enum wlr_key_state key_state) { if (sym == XKB_KEY_Escape) { kbstate->compositor->exit = true; + } else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) { + wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1); } }