diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-20 02:30:43 +0200 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-20 14:19:30 +0200 |
commit | 2948f537218fea3a9ae969bcdc0df063f659ce45 (patch) | |
tree | b24519d38abbdcf80587779567cddc946eb95bc6 | |
parent | a1c3636d69fa6fa83d34f38bffc1640b17fed101 (diff) |
example compositor: handle keyboard after we're done with init
the libinput backend does wl_display roundtrips, during which there is a
small window where keystrokes can be handled before the rest of the example
compositor is ready.
Setting the callback later ensures we're not called at this point
-rw-r--r-- | examples/compositor.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/compositor.c b/examples/compositor.c index d1252994..fb00032a 100644 --- a/examples/compositor.c +++ b/examples/compositor.c @@ -143,7 +143,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); @@ -178,6 +177,8 @@ int main() { break; } + compositor.keyboard_key_cb = handle_keyboard_key; + wl_display_run(compositor.display); close(state.keymap_fd); |