~sircmpwn/wio

Use *cursor in view_begin_interative() v1 PROPOSED

Leon Plickat
Leon Plickat: 3
 Use *cursor in view_begin_interative()
 Selection when spawning new view is now representative
 Selection when reshaping view is now representative

 3 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/6134/mbox | git am -3
Learn more about email & git

[PATCH 1/3] Use *cursor in view_begin_interative() Export this patch

Leon Plickat
The variable is passed to the function but was not used. I assume it is
intended to be used.
---
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/input.c b/input.c
index bc04104..40c4d9e 100644
--- a/input.c
+++ b/input.c
@@ -193,7 +193,7 @@ static void view_begin_interactive(struct wio_view *view,
 	view->server->interactive.sy = (int)sy;
 	view->server->input_state = state;
 	wlr_xcursor_manager_set_cursor_image(view->server->cursor_mgr,
-			"grabbing", view->server->cursor);
+			cursor, view->server->cursor);
 }
 
 static void view_end_interactive(struct wio_server *server) {
-- 
2.22.0

[PATCH 2/3] Selection when spawning new view is now representative Export this patch

Leon Plickat
The new view was spawned to far in the x and y directions compared to
the selection outline by exactly the size of the window border. I decided
to move the new view instead of the selection as I think the selection
looks good placement-wise in relation to the pointer.
---
 input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/input.c b/input.c
index 40c4d9e..99d1b4b 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, x2 = server->cursor->x;
-	int y1 = server->interactive.sy, y2 = server->cursor->y;
+	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;
 	if (x2 < x1) {
 		int _ = x1;
 		x1 = x2;
-- 
2.22.0

[PATCH 3/3] 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.
---
 input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/input.c b/input.c
index 99d1b4b..b4d8d13 100644
--- a/input.c
+++ b/input.c
@@ -332,8 +332,8 @@ static void handle_button_internal(
 		}
 		break;
 	case INPUT_STATE_RESIZE_END:
-		x1 = server->interactive.sx, x2 = server->cursor->x;
-		y1 = server->interactive.sy, y2 = server->cursor->y;
+		x1 = server->interactive.sx - window_border, x2 = server->cursor->x - window_border;
+		y1 = server->interactive.sy - window_border, y2 = server->cursor->y - window_border;
 		if (x2 < x1) {
 			int _ = x1;
 			x1 = x2;
-- 
2.22.0
View this thread in the archives