~sircmpwn/wio

wio: Fix for selections with "negative" width or height v1 PROPOSED

When using the "New" or "Resize" elements, wio crash then the cursor
goes to the left of the window, or above it.
This patch takes the
absolute value of the X and Y distance between the top-left corner of
the window and the cursor to draw the new area, thus preventing crashes
when going the "negative way" with the cursor.

Willy Goiffon (1):
  Handle new/resize with negative cursor coordinates

 output.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

-- 
2.26.2
Thanks!

To git@git.sr.ht:~sircmpwn/wio
   31b742e..  master -> master
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/wio/patches/14677/mbox | git am -3
Learn more about email & git

[PATCH wio 1/1] Handle new/resize with negative cursor coordinates Export this patch

From: Willy Goiffon <dev@z3bra.org>

---
 output.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/output.c b/output.c
index 6a059f5..c0877fe 100644
--- 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;
-- 
2.26.2
Thanks!

To git@git.sr.ht:~sircmpwn/wio
   31b742e..  master -> master