diff options
author | Marvin Borner | 2020-09-14 18:38:44 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-14 18:38:44 +0200 |
commit | 096f9be4ac328ae39bd794c36a9a04ff68c2b844 (patch) | |
tree | 7228f9d1631fd126c1942bafb878cca381ff336b /apps | |
parent | 18a0cc60d46d8ab22479e9683c27459703195480 (diff) |
Some GUI fixes
Diffstat (limited to 'apps')
-rw-r--r-- | apps/wm.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -97,10 +97,8 @@ static void handle_mouse(struct event_mouse *event) if (event->but1 && !mouse_pressed[1]) { mouse_pressed[0] = 1; if (focused && !(focused->flags & WF_NO_DRAG)) { - if (focused->x + event->diff_x >= 0) - focused->x += event->diff_x; - if (focused->y - event->diff_y >= 0) - focused->y -= event->diff_y; + focused->x = mouse_x; + focused->y = mouse_y; if (mouse_skip % MOUSE_SKIP == 0) { mouse_skip = 0; redraw_all(); // TODO: Function to redraw one window @@ -113,15 +111,15 @@ static void handle_mouse(struct event_mouse *event) // Window size if (event->but2 && !mouse_pressed[0]) { - if (!mouse_pressed[1]) { + if (focused && !mouse_pressed[1]) { mouse_x = focused->x + focused->width; mouse_y = focused->y + focused->height; } else if (focused && !(focused->flags & WF_NO_RESIZE) && mouse_skip % MOUSE_SKIP == 0) { mouse_skip = 0; - if (mouse_x - focused->x >= 0) + if (mouse_x - focused->x > 0) focused->width = mouse_x - focused->x; - if (mouse_y - focused->y >= 0) + if (mouse_y - focused->y > 0) focused->height = mouse_y - focused->y; redraw_all(); // TODO: Function to redraw one window } |