Use wl_display_run and refactor example keyboards

This commit is contained in:
Drew DeVault 2017-06-22 11:15:59 -04:00
parent 8ce9237c92
commit f5423a51b5
6 changed files with 6 additions and 51 deletions

View file

@ -38,15 +38,6 @@ void handle_output_frame(struct output_state *output, struct timespec *ts) {
glClear(GL_COLOR_BUFFER_BIT);
}
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);
}
}
int main() {
struct sample_state state = {
.color = { 1.0, 0.0, 0.0 },
@ -55,7 +46,6 @@ int main() {
struct compositor_state compositor = { 0,
.data = &state,
.output_frame_cb = handle_output_frame,
.keyboard_key_cb = handle_keyboard_key,
};
compositor_init(&compositor);
compositor_run(&compositor);