diff options
-rw-r--r-- | backend/multi/backend.c | 4 | ||||
-rw-r--r-- | examples/shared.c | 10 | ||||
-rw-r--r-- | include/wlr/backend/multi.h | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/backend/multi/backend.c b/backend/multi/backend.c index a5913f5d..19839629 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -66,6 +66,10 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session, return backend; } +bool wlr_backend_is_multi(struct wlr_backend *b) { + return b->impl == &backend_impl; +} + static void input_add_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, input_add); diff --git a/examples/shared.c b/examples/shared.c index 27e5b9ca..c66b8a23 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -48,10 +48,12 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) { } 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); + if (wlr_backend_is_multi(kbstate->compositor->backend)) { + 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); + } } } } diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index 048c4043..e8e46bed 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -10,6 +10,8 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session, void wlr_multi_backend_add(struct wlr_backend *multi, struct wlr_backend *backend); +bool wlr_backend_is_multi(struct wlr_backend *backend); + struct wlr_session *wlr_multi_get_session(struct wlr_backend *base); #endif |