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

Commit f41746bf76175ed23ee5f87d78d4441fd757a6aa
Parent: 85060cb7f371ff1c70764a67860652511920bff2
Author: mcol <mcol@posteo.net>
Date: 2021-01-22 00:18:51 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-01-22 00:18:51 +0000

correctly find nearest output when fullscreening window

src/shell.c Modified

@@ -46,6 +46,7 @@
 void fullscreen_xdg_surface(
     struct view *view, struct wlr_xdg_surface *xdg_surface, struct wlr_output *output
 ) {
+    /* output can be NULL, in which case it is calculated using the surface's position */
     struct server *server = view->server;
     struct wlr_box *saved_geo = &server->current_desk->fullscreened_saved_geo;
 
@@ -66,8 +67,8 @@
 	return;
 
     if (!output) {
-	double x = xdg_surface->geometry.width / 2;
-	double y = xdg_surface->geometry.height / 2;
+	double x = view->x + xdg_surface->geometry.width / 2;
+	double y = view->y + xdg_surface->geometry.height / 2;
 	double lx, ly;
 	wlr_output_layout_closest_point(server->output_layout, NULL, x, y, &lx, &ly);
 	output = wlr_output_layout_output_at(server->output_layout, lx, ly);