gimp but for windows: a wayland compositor
git clone https://github.com/m-col/wimp
Files | Refs | Readme

Commit 2a74e038048162fbc53dcb6990fb62be1e8330d8
Parent: 40d6ef029cfd2bfb3251139ae8efdb745d6ee4bc
Author: mcol <mcol@posteo.net>
Date: 2021-03-01 15:08:48 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-03-01 15:08:48 +0000

don't move grabbed_view if cursor was blocked by layout constraints

src/cursor.c Modified

@@ -358,7 +358,7 @@
 
 static void on_cursor_motion(struct wl_listener *listener, void *data){
     struct wlr_event_pointer_motion *event = data;
-    if (wimp.grabbed_view) {
+    if (wimp.resize_edges) {
 	if (wimp.resize_edges & WLR_EDGE_TOP) {
 	    if (wimp.grabbed_view->surface->geometry.height <= CORNER && event->delta_y > 0) {
 		event->delta_y = 0;
@@ -378,7 +378,17 @@
 	    }
 	}
     }
+
+    double x = wimp.cursor->x;
+    double y = wimp.cursor->y;
     wlr_cursor_move(wimp.cursor, event->device, event->delta_x, event->delta_y);
+    if (x == wimp.cursor->x) {
+	event->delta_x = 0;
+    }
+    if (y == wimp.cursor->y) {
+	event->delta_y = 0;
+    }
+
     process_cursor_motion(event->time_msec, event->delta_x, event->delta_y);
 }
 
@@ -421,6 +431,7 @@
 	    }
 	    wimp.grabbed_view = NULL;
 	    wimp.can_snap = false;
+	    wimp.resize_edges = 0;
 	}
     }