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

Commit 0a777ae52efaa44cfaff42f840822ab0f324ee1f
Parent: ba59c57d4ac751fdb186cd90507891ba7e58be1c
Author: mcol <mcol@posteo.net>
Date: 2021-01-31 21:16:38 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-31 21:16:38 +0000

focus highest visible window when going to a mark

src/action.c Modified

@@ -134,8 +134,7 @@
     double dx = motion.dx / desk->zoom;
     double dy = motion.dy / desk->zoom;
     if (motion.is_percentage) {
-	struct wlr_box *extents =
-	    wlr_output_layout_get_box(wimp.output_layout, NULL);
+	struct wlr_box *extents = wlr_output_layout_get_box(wimp.output_layout, NULL);
 	dx = extents->width * (dx / 100);
 	dy = extents->height * (dy / 100);
     }
@@ -270,17 +269,31 @@
 
     wl_list_for_each(mark, &wimp.marks, link) {
 	if (mark->key == sym) {
-	    unfullscreen();
-	    struct motion motion = {
-		.dx = mark->desk->panned_x - mark->x,
-		.dy = mark->desk->panned_y - mark->y,
-		.is_percentage = false,
-	    };
-	    mark->desk->zoom = mark->zoom;
-	    set_desk(mark->desk);
-	    pan_desk(&motion);
-	    return;
+	    break;
+	}
+    }
+
+    unfullscreen();
+    struct motion motion = {
+	.dx = mark->desk->panned_x - mark->x,
+	.dy = mark->desk->panned_y - mark->y,
+	.is_percentage = false,
+    };
+    mark->desk->zoom = mark->zoom;
+    set_desk(mark->desk);
+    pan_desk(&motion);
+
+    struct view *view;
+    struct wlr_box *extents = wlr_output_layout_get_box(wimp.output_layout, NULL);
+    wl_list_for_each(view, &wimp.current_desk->views, link) {
+	if (
+	    view->x + view->surface->geometry.width < 0 || extents->width < view->x ||
+	    view->y + view->surface->geometry.height < 0 || extents->height < view->y
+	) {
+	    continue;
 	}
+	focus_view(view, view->surface->surface);
+	return;
     }
 }
 
@@ -371,6 +384,7 @@
     wlr_xdg_toplevel_set_tiled(view->surface, true);
 }
 
+
 void reload_config(void *data) {
     load_config();
 }