commit 31b742e473b15a2087be740d1de28bc2afd47a4d
parent c8f2963abc375f5427f9ad1dd3477cb4b2430d6e
Author: Willy Goiffon <dev@z3bra.org>
Date: Sun, 1 Nov 2020 18:36:31 +0100
Handle new/resize with negative cursor coordinates
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/output.c b/output.c
@@ -269,6 +269,7 @@ static void render_layer(
}
static void output_frame(struct wl_listener *listener, void *data) {
+ double x1, x2, y1, y2;
struct wio_output *output = wl_container_of(listener, output, frame);
struct wio_server *server = output->server;
struct wlr_renderer *renderer = server->renderer;
@@ -350,11 +351,16 @@ static void output_frame(struct wl_listener *listener, void *data) {
break;
case INPUT_STATE_NEW_END:
case INPUT_STATE_RESIZE_END:
- render_view_border(renderer, output, NULL,
- server->interactive.sx, server->interactive.sy,
- server->cursor->x - server->interactive.sx,
- server->cursor->y - server->interactive.sy,
- 1);
+ x1 = server->cursor->x < server->interactive.sx ?
+ server->cursor->x : server->interactive.sx;
+ y1 = server->cursor->y < server->interactive.sy ?
+ server->cursor->y : server->interactive.sy;
+ x2 = server->cursor->x > server->interactive.sx ?
+ server->cursor->x : server->interactive.sx;
+ y2 = server->cursor->y > server->interactive.sy ?
+ server->cursor->y : server->interactive.sy;
+
+ render_view_border(renderer, output, NULL, x1, y1, x2 - x1, y2 - y1, 1);
break;
default:
break;