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

Commit 4a95d09e3629f944c1611b905718e64397e021ab
Parent: 38b12b7c9c25b2970076d21fee8e1a5de6e337b1
Author: mcol <mcol@posteo.net>
Date: 2021-01-23 11:27:39 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-23 11:27:39 +0000

remove unnecessary DIST macro

src/action.c Modified

@@ -9,8 +9,6 @@
 #include "shell.h"
 #include "types.h"
 
-#define DIST(x, y) ((x) * (x) + (y) * (y))
-
 
 void shutdown(struct server *server, void *data) {
     wl_display_terminate(server->display);
@@ -53,7 +51,7 @@
 
     struct view *next = NULL;
     struct view *view;
-    double vx, vy, vdist, dist;
+    double vx, vy, dx, dy, vdist, dist;
     double x = current->x + current->surface->geometry.width / 2;
     double y = current->y + current->surface->geometry.height / 2;
     double c = y - x;  // y = x + c    / slope
@@ -64,7 +62,9 @@
     wl_list_for_each(view, &server->current_desk->views, link) {
 	vx = view->x + view->surface->geometry.width / 2;
 	vy = view->y + view->surface->geometry.height / 2;
-	vdist = DIST(x - vx, y - vy);
+	dx = x - vx;
+	dy = y - vy;
+	vdist = dx * dx + dy * dy;
 	if (
 	    (above_c ^ (vy - vx < c)) &&
 	    (above_n ^ (vy + vx < n)) &&