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

Commit 9c6f2f518ca09c7e1fc060e59cd502daf02aa4b1
Parent: 0612dc453a2e54d6ce0d7c048cb95662d4f999c5
Author: mcol <mcol@posteo.net>
Date: 2021-01-30 17:52:13 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-30 17:52:13 +0000

Take into account zoom when panning to view

Fixes #20

src/shell.c Modified

@@ -50,6 +50,7 @@
     double width = view->surface->geometry.width + border_width * 2;
     double height = view->surface->geometry.height + border_width * 2;
     struct wlr_box *extents = wlr_output_layout_get_box(wimp.output_layout, NULL);
+    double zoom = wimp.current_desk->zoom;
     struct motion motion = {
 	.dx = 0,
 	.dy = 0,
@@ -57,14 +58,14 @@
     };
 
     if (x < 0) {
-	motion.dx = x;
-    } else if (x + width > extents->width) {
-	motion.dx = x + width - extents->width;
+	motion.dx = x * zoom;
+    } else if (x + width > extents->width / zoom) {
+	motion.dx = (x + width) * zoom - extents->width;
     }
     if (y < 0) {
-	motion.dy = y;
-    } else if (y + height > extents->height) {
-	motion.dy = y + height - extents->height;
+	motion.dy = y * zoom;
+    } else if (y + height > extents->height / zoom) {
+	motion.dy = (y + height) * zoom - extents->height;
     }
     pan_desk(&motion);
 }