~sircmpwn/wio

Selection when reshaping view is now representative v1 PROPOSED

Leon Plickat
Leon Plickat: 1
 Selection when reshaping view is now representative

 1 files changed, 5 insertions(+), 5 deletions(-)
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/6137/mbox | git am -3
Learn more about email & git

[PATCH] Selection when reshaping view is now representative Export this patch

Leon Plickat
The view was moved to far in the x and y direction compared to the
selection outline by exactly the size of the window border.

(Ammend to this and the previous patch, because apparantly I am blind
and did not see that the variable I was substracting was simply added to
the coordinates a few lines down. Was this added on purpose? Either way,
the selection being precise should be the correct way.)
---
 input.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/input.c b/input.c
index 99d1b4b..f90ee94 100644
--- a/input.c
+++ b/input.c
@@ -205,8 +205,8 @@ static void view_end_interactive(struct wio_server *server) {
 }
 
 static void new_view(struct wio_server *server) {
-	int x1 = server->interactive.sx - window_border, x2 = server->cursor->x - window_border;
-	int y1 = server->interactive.sy - window_border, y2 = server->cursor->y - window_border;
+	int x1 = server->interactive.sx, x2 = server->cursor->x;
+	int y1 = server->interactive.sy, y2 = server->cursor->y;
 	if (x2 < x1) {
 		int _ = x1;
 		x1 = x2;
@@ -218,8 +218,8 @@ static void new_view(struct wio_server *server) {
 		y2 = _;
 	}
 	struct wio_new_view *view = calloc(1, sizeof(struct wio_new_view));
-	view->box.x = x1 + window_border;
-	view->box.y = y1 + window_border;
+	view->box.x = x1;
+	view->box.y = y1;
 	view->box.width = x2 - x1;
 	view->box.height = y2 - y1;
 	int fd[2];
@@ -345,7 +345,7 @@ static void handle_button_internal(
 			y2 = _;
 		}
 		wio_view_move(server->interactive.view,
-				x1 + window_border, y1 + window_border);
+				x1, y1);
 		uint32_t width = x2 - x1, height = y2 - y1;
 		if (width < 100) {
 			width = 100;
-- 
2.22.0
View this thread in the archives