From b3fafef621bb4404208e65ff1f78e15da3b216f7 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 21 Jan 2021 17:04:15 +0100 Subject: Implementing new features... --- apps/wm.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/wm.c b/apps/wm.c index 469e824..9b7631d 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -285,11 +285,22 @@ int main(int argc, char **argv) gfx_load_image(&cursor, "/res/cursor.png", 0, 0); redraw_all(); - /* event_register(EVENT_MOUSE); */ - /* event_register(EVENT_KEYBOARD); */ - struct message msg = { 0 }; + struct event_keyboard kbd_event = { 0 }; + struct event_mouse mouse_event = { 0 }; while (1) { + if (read("/dev/kbd", &kbd_event, 0, sizeof(struct event_keyboard))) + handle_keyboard(&kbd_event); + /* else if (read("/dev/mouse", &mouse_event, 0, sizeof(struct event_mouse))) */ + /* handle_mouse(&mouse_event); */ + /* else if (msg_receive(&msg)) { */ + /* handle_message(&msg); */ + /* } */ + else { + yield(); + continue; + } + //if (!msg_receive(&msg)) { yield(); continue; @@ -323,12 +334,6 @@ int main(int argc, char **argv) case GFX_REDRAW_FOCUSED: redraw_focused(); break; - case EVENT_MOUSE: - handle_mouse(msg.data); - break; - case EVENT_KEYBOARD: - handle_keyboard(msg.data); - break; default: break; } -- cgit v1.2.3