mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-06 13:29:48 -05:00
Add keyboard input to terminal.
This commit is contained in:
parent
269d6e3daf
commit
6e83d58153
3 changed files with 155 additions and 21 deletions
13
window.c
13
window.c
|
|
@ -55,6 +55,7 @@ struct window {
|
|||
window_resize_handler_t resize_handler;
|
||||
window_frame_handler_t frame_handler;
|
||||
window_acknowledge_handler_t acknowledge_handler;
|
||||
window_key_handler_t key_handler;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
|
|
@ -293,6 +294,10 @@ event_handler(struct wl_display *display,
|
|||
} else if (button == 0 && state == 0) {
|
||||
window->state = WINDOW_STABLE;
|
||||
}
|
||||
} else if (opcode == 2) {
|
||||
if (window->key_handler)
|
||||
(*window->key_handler)(window, p[0], p[1],
|
||||
window->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -342,6 +347,14 @@ window_set_acknowledge_handler(struct window *window,
|
|||
window->user_data = data;
|
||||
}
|
||||
|
||||
void
|
||||
window_set_key_handler(struct window *window,
|
||||
window_key_handler_t handler, void *data)
|
||||
{
|
||||
window->key_handler = handler;
|
||||
window->user_data = data;
|
||||
}
|
||||
|
||||
void
|
||||
window_set_minimum_size(struct window *window, uint32_t width, int32_t height)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue