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

Commit 90d7e3fd70b5bf77e60fd2cae6fcdcd2d96bde3f
Parent: 61f846c784e5c7e9eb68da669fe1cbebcebc9a05
Author: mcol <mcol@posteo.net>
Date: 2021-01-24 22:48:54 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-24 22:48:54 +0000

use zoom factor when finding view at a coordinate

src/cursor.c Modified

@@ -67,9 +67,11 @@
 
 
 static struct view *desktop_view_at(
-    double lx, double ly, struct wlr_surface **surface, double *sx, double *sy
+    double lx, double ly, struct wlr_surface **surface, double *sx, double *sy, double zoom
 ) {
     struct view *view;
+    lx /= zoom;
+    ly /= zoom;
     wl_list_for_each(view, &wimp.current_desk->views, link) {
 	if (view_at(view, lx, ly, surface, sx, sy)) {
 	    return view;
@@ -92,8 +94,7 @@
 	case CURSOR_PASSTHROUGH:
 	    seat = wimp.seat;
 	    surface = NULL;
-	    view = desktop_view_at(wimp.cursor->x / zoom,
-		wimp.cursor->y / zoom, &surface, &sx, &sy);
+	    view = desktop_view_at(wimp.cursor->x, wimp.cursor->y, &surface, &sx, &sy, zoom);
 	    if (!view) {
 		wlr_xcursor_manager_set_cursor_image(wimp.cursor_manager, "left_ptr", wimp.cursor);
 	    }
@@ -154,7 +155,7 @@
 	double sx, sy;
 	struct wlr_surface *surface;
 	struct view *view = desktop_view_at(
-	    wimp.cursor->x, wimp.cursor->y, &surface, &sx, &sy
+	    wimp.cursor->x, wimp.cursor->y, &surface, &sx, &sy, wimp.current_desk->zoom
 	);
 	focus_view(view, surface);
     }