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

Commit a3db1001b57a3a58cb887ec2664e1728af5e358d
Parent: 8b7237a5a68d848184ea37b6e3b9faf6ec3c08df
Author: mcol <mcol@posteo.net>
Date: 2021-01-28 23:59:53 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-28 23:59:53 +0000

simplify view_at

src/cursor.c Modified

@@ -45,36 +45,25 @@
 }
 
 
-static bool _view_at(
-    struct view *view, double lx, double ly, struct wlr_surface **surface,
-    double *sx, double *sy
-) {
-    double view_sx = lx - view->x;
-    double view_sy = ly - view->y;
-
-    double _sx, _sy;
-    struct wlr_surface *_surface = NULL;
-    _surface = wlr_xdg_surface_surface_at(
-	view->surface, view_sx, view_sy, &_sx, &_sy
-    );
-    if (_surface != NULL) {
-	*sx = _sx;
-	*sy = _sy;
-	*surface = _surface;
-	return true;
-    }
-    return false;
-}
-
-
 struct view *view_at(
     double lx, double ly, struct wlr_surface **surface, double *sx, double *sy
 ) {
     struct view *view;
     lx /= wimp.current_desk->zoom;
     ly /= wimp.current_desk->zoom;
+    double _sx, _sy;
+
     wl_list_for_each(view, &wimp.current_desk->views, link) {
-	if (_view_at(view, lx, ly, surface, sx, sy)) {
+	double view_sx = lx - view->x;
+	double view_sy = ly - view->y;
+	struct wlr_surface *_surface = NULL;
+	_surface = wlr_xdg_surface_surface_at(
+	    view->surface, view_sx, view_sy, &_sx, &_sy
+	);
+	if (_surface != NULL) {
+	    *sx = _sx;
+	    *sy = _sy;
+	    *surface = _surface;
 	    return view;
 	}
     }