aboutsummaryrefslogtreecommitdiff
path: root/example/shared.c
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-06-22 17:23:17 +0200
committernyorain <nyorain@gmail.com>2017-06-22 17:23:31 +0200
commit0813c1dd39942613d9dd47a60922820b6f1610ef (patch)
tree2ced93162e0fedadf0ce754eabb90a7ade307738 /example/shared.c
parentd26a9ba968472cb5c78d9ea0aea3d8f5ff02fbf5 (diff)
parentbb16025318e1c3d3844e71e6e8f29b1e8634ec3e (diff)
Merge branch 'master' into wayland-input
Diffstat (limited to 'example/shared.c')
-rw-r--r--example/shared.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/example/shared.c b/example/shared.c
index b9689f1c..c4ec4ffe 100644
--- a/example/shared.c
+++ b/example/shared.c
@@ -42,6 +42,11 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
if (kbstate->compositor->keyboard_key_cb) {
kbstate->compositor->keyboard_key_cb(kbstate, sym, key_state);
}
+ 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);
+ }
}
xkb_state_update_key(kbstate->xkb_state, keycode,
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
@@ -470,10 +475,7 @@ void compositor_init(struct compositor_state *state) {
}
void compositor_run(struct compositor_state *state) {
- while (!state->exit) {
- wl_event_loop_dispatch(state->event_loop, 0);
- }
-
+ wl_display_run(state->display);
wlr_backend_destroy(state->backend);
wlr_session_finish(state->session);
wl_display_destroy(state->display);