mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
Fixed VT switching
This commit is contained in:
parent
3373ec5fc8
commit
4d4da18437
3 changed files with 19 additions and 2 deletions
|
@ -113,3 +113,11 @@ void wlr_multi_backend_add(struct wlr_backend *multi,
|
|||
|
||||
list_add(multi->state->backends, sub);
|
||||
}
|
||||
|
||||
struct wlr_session *wlr_multi_get_session(struct wlr_backend *base) {
|
||||
if (base->impl != &backend_impl)
|
||||
return NULL;
|
||||
|
||||
struct wlr_backend_state *multi = base->state;
|
||||
return multi->session;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <wayland-server-protocol.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/session.h>
|
||||
#include <wlr/backend/multi.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
@ -44,8 +45,14 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
wl_display_terminate(kbstate->compositor->display);
|
||||
} 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);
|
||||
} else if (key_state == WLR_KEY_PRESSED &&
|
||||
sym >= XKB_KEY_XF86Switch_VT_1 &&
|
||||
sym <= XKB_KEY_XF86Switch_VT_12) {
|
||||
struct wlr_session *session =
|
||||
wlr_multi_get_session(kbstate->compositor->backend);
|
||||
if (session) {
|
||||
wlr_session_change_vt(session, sym - XKB_KEY_XF86Switch_VT_1 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
xkb_state_update_key(kbstate->xkb_state, keycode,
|
||||
|
|
|
@ -10,4 +10,6 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session,
|
|||
void wlr_multi_backend_add(struct wlr_backend *multi,
|
||||
struct wlr_backend *backend);
|
||||
|
||||
struct wlr_session *wlr_multi_get_session(struct wlr_backend *base);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue