mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
Check for multi backend before using it
This commit is contained in:
parent
f1a069d50d
commit
5bf61ca7ed
3 changed files with 12 additions and 4 deletions
|
@ -66,6 +66,10 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session,
|
||||||
return backend;
|
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) {
|
static void input_add_reemit(struct wl_listener *listener, void *data) {
|
||||||
struct subbackend_state *state = wl_container_of(listener,
|
struct subbackend_state *state = wl_container_of(listener,
|
||||||
state, input_add);
|
state, input_add);
|
||||||
|
|
|
@ -48,6 +48,7 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
} else if (key_state == WLR_KEY_PRESSED &&
|
} else if (key_state == WLR_KEY_PRESSED &&
|
||||||
sym >= XKB_KEY_XF86Switch_VT_1 &&
|
sym >= XKB_KEY_XF86Switch_VT_1 &&
|
||||||
sym <= XKB_KEY_XF86Switch_VT_12) {
|
sym <= XKB_KEY_XF86Switch_VT_12) {
|
||||||
|
if (wlr_backend_is_multi(kbstate->compositor->backend)) {
|
||||||
struct wlr_session *session =
|
struct wlr_session *session =
|
||||||
wlr_multi_get_session(kbstate->compositor->backend);
|
wlr_multi_get_session(kbstate->compositor->backend);
|
||||||
if (session) {
|
if (session) {
|
||||||
|
@ -55,6 +56,7 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
xkb_state_update_key(kbstate->xkb_state, keycode,
|
xkb_state_update_key(kbstate->xkb_state, keycode,
|
||||||
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
|
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||||
keyboard_led_update(kbstate);
|
keyboard_led_update(kbstate);
|
||||||
|
|
|
@ -10,6 +10,8 @@ struct wlr_backend *wlr_multi_backend_create(struct wlr_session *session,
|
||||||
void wlr_multi_backend_add(struct wlr_backend *multi,
|
void wlr_multi_backend_add(struct wlr_backend *multi,
|
||||||
struct wlr_backend *backend);
|
struct wlr_backend *backend);
|
||||||
|
|
||||||
|
bool wlr_backend_is_multi(struct wlr_backend *backend);
|
||||||
|
|
||||||
struct wlr_session *wlr_multi_get_session(struct wlr_backend *base);
|
struct wlr_session *wlr_multi_get_session(struct wlr_backend *base);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue