diff options
author | Marvin Borner | 2021-06-19 13:12:34 +0200 |
---|---|---|
committer | Marvin Borner | 2021-06-19 13:12:34 +0200 |
commit | 73a55007a44d23be40be681c4882fd6ad1e30b60 (patch) | |
tree | 87f37dff42d8ae51dbb2250f1752a03081298cc3 /apps/wm | |
parent | 02a0c882275959c0fbd58754418ecc1218821e76 (diff) |
Improved bus and device management
Diffstat (limited to 'apps/wm')
-rw-r--r-- | apps/wm/main.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/apps/wm/main.c b/apps/wm/main.c index 3f01922..6a4b9bf 100644 --- a/apps/wm/main.c +++ b/apps/wm/main.c @@ -596,6 +596,7 @@ static void handle_message_new_window(struct message_new_window *msg) struct window *win = window_new((struct client){ .conn = msg->header.bus.conn }, msg->pos, vec2_add(msg->size, vec2(0, BAR_HEIGHT)), WF_BAR); window_bar_draw(win, msg->name); + window_redraw(win); msg->ctx = win->ctx; msg->off = vec2(0, BAR_HEIGHT); @@ -753,8 +754,7 @@ int main(int argc, char **argv) assert(dev_control(DEV_BUS, DEVCTL_BUS_REGISTER, "wm") == EOK); - assert(exec("test", NULL) == EOK); - assert(exec("test", NULL) == EOK); + assert(exec("view", NULL) == EOK); u8 msg[1024] = { 0 }; struct event_keyboard event_keyboard = { 0 }; @@ -763,23 +763,21 @@ int main(int argc, char **argv) while (1) { res poll_ret = 0; - if ((poll_ret = dev_poll(listeners)) >= 0) { - if (poll_ret == DEV_KEYBOARD) { - if (dev_read(DEV_KEYBOARD, &event_keyboard, 0, - sizeof(event_keyboard)) > 0) - handle_event_keyboard(&event_keyboard); - } else if (poll_ret == DEV_MOUSE) { - if (dev_read(DEV_MOUSE, &event_mouse, 0, sizeof(event_mouse)) > 0) - handle_event_mouse(&event_mouse); - } else if (poll_ret == DEV_BUS) { - if (msg_receive(msg, sizeof(msg)) > 0) - handle_message(msg); - } - - window_ping_all(); - continue; + if ((poll_ret = dev_poll(listeners)) < 0) + panic("Poll/read error: %s\n", strerror(errno)); + + if (poll_ret == DEV_KEYBOARD) { + if (dev_read(DEV_KEYBOARD, &event_keyboard, 0, sizeof(event_keyboard)) > 0) + handle_event_keyboard(&event_keyboard); + } else if (poll_ret == DEV_MOUSE) { + if (dev_read(DEV_MOUSE, &event_mouse, 0, sizeof(event_mouse)) > 0) + handle_event_mouse(&event_mouse); + } else if (poll_ret == DEV_BUS) { + if (msg_receive(msg, sizeof(msg)) > 0) + handle_message(msg); } - panic("Poll/read error: %s\n", strerror(errno)); + + window_ping_all(); } return 1; |