diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/chess/main.c | 6 | ||||
-rw-r--r-- | apps/wm/main.c | 11 |
2 files changed, 10 insertions, 7 deletions
diff --git a/apps/chess/main.c b/apps/chess/main.c index e5a8799..b0da8d1 100644 --- a/apps/chess/main.c +++ b/apps/chess/main.c @@ -68,14 +68,12 @@ static void load_image(struct piece *tile) icon); } -static void mouseclick(u32 widget_id, vec2 pos) +static void mouseclick(struct gui_event_mouse *event) { - UNUSED(pos); - vec2 clicked = vec2(0, 0); for (u32 x = 0; x < SIZE; x++) for (u32 y = 0; y < SIZE; y++) - if (tiles[x][y].widget == widget_id) + if (tiles[x][y].widget == event->widget) clicked = vec2(x, y); struct piece *clicked_piece = &tiles[clicked.x][clicked.y]; diff --git a/apps/wm/main.c b/apps/wm/main.c index 0e47af4..a4727ea 100644 --- a/apps/wm/main.c +++ b/apps/wm/main.c @@ -347,6 +347,8 @@ static void window_redraw(struct window *win) static void window_move(struct window *win, vec2 pos) { + if (!win) + return; win->pos_prev = win->pos; win->pos = pos; window_redraw(win); @@ -463,7 +465,7 @@ static void handle_event_mouse(struct event_mouse *event) focused = win; if (focused && !(focused->flags & WF_NO_DRAG) && event->but.left && special_keys.alt) { - window_move(win, mouse.pos); + window_move(focused, mouse.pos); return; } else if (!vec2_eq(cursor->pos, cursor->pos_prev)) { window_redraw(cursor); @@ -486,7 +488,10 @@ static void handle_event_mouse(struct event_mouse *event) msg.header.state = MSG_GO_ON; msg.id = win->id; msg.pos = relative_pos; - msg.bits.click = event->but.left; + msg.scroll = event->scroll; + msg.but.left = event->but.left; + msg.but.right = event->but.right; + msg.but.middle = event->but.middle; if (msg_connect_conn(win->client.conn) == EOK) msg_send(GUI_MOUSE, &msg, sizeof(msg)); @@ -632,7 +637,7 @@ int main(int argc, char **argv) assert(io_control(IO_BUS, IOCTL_BUS_REGISTER, "wm") == EOK); - assert(exec("chess", NULL) == EOK); + assert(exec("paint", NULL) == EOK); u8 msg[1024] = { 0 }; struct event_keyboard event_keyboard = { 0 }; |