diff options
author | Marvin Borner | 2021-05-21 22:41:11 +0200 |
---|---|---|
committer | Marvin Borner | 2021-05-21 22:41:11 +0200 |
commit | 93174e167a6aa313fca43f4cb0e9b975e1618468 (patch) | |
tree | 6fbed7871cb24f38cc714e6838ac6a6cc0f4fc36 /apps/wm | |
parent | 11cdf24db63af9a22786e81e69247f15cc196b0c (diff) |
Better window destroying
Diffstat (limited to 'apps/wm')
-rw-r--r-- | apps/wm/main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/wm/main.c b/apps/wm/main.c index a4727ea..698d0cb 100644 --- a/apps/wm/main.c +++ b/apps/wm/main.c @@ -364,6 +364,16 @@ static void window_destroy(struct window *win) free(win); } +static void window_request_destroy(struct window *win) +{ + struct message_mouse msg = { 0 }; + msg.header.state = MSG_NEED_ANSWER; + msg.id = win->id; + + if (msg_connect_conn(win->client.conn) == EOK) + msg_send(GUI_DESTROY_WINDOW, &msg, sizeof(msg)); +} + /** * Window bar */ @@ -380,7 +390,7 @@ static void window_bar_mousemove(struct window *win, struct event_mouse *event, return; if (pos.x >= win->ctx.size.x - BAR_BUTTONS_WIDTH && event->but.left) - window_destroy(win); + window_request_destroy(win); else if (event->but.left) window_move(win, vec2_sub(mouse_pos, vec2(win->ctx.size.x / 2, BAR_HEIGHT / 2))); } |