[PATCH 2/2] xdg-shell: fix maximizing in multi-head setup

Marek Chalupa mchqwerty at gmail.com
Mon Sep 1 08:13:13 PDT 2014


Set the right position of maximized window. Up until now we ignored
output's "position" and were using only the working area
of output which is in output-relative coordinates. This led to
showing the maximized window always on the first output.

This, along with the previous patch, fixes
https://bugs.freedesktop.org/show_bug.cgi?id=82967

Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
---
 desktop-shell/shell.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 11c893a..9c0e721 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2389,22 +2389,6 @@ shell_surface_set_parent(struct shell_surface *shsurf,
 }
 
 static void
-shell_surface_set_output(struct shell_surface *shsurf,
-                         struct weston_output *output)
-{
-	struct weston_surface *es = shsurf->surface;
-
-	/* get the default output, if the client set it as NULL
-	   check whether the ouput is available */
-	if (output)
-		shsurf->output = output;
-	else if (es->output)
-		shsurf->output = es->output;
-	else
-		shsurf->output = get_default_output(es->compositor);
-}
-
-static void
 surface_clear_next_states(struct shell_surface *shsurf)
 {
 	shsurf->next_state.maximized = false;
@@ -5130,15 +5114,16 @@ set_maximized_position(struct desktop_shell *shell,
 {
 	int32_t surf_x, surf_y;
 	pixman_rectangle32_t area;
+	pixman_box32_t *e;
 
-	/* use surface configure to set the geometry */
 	get_output_work_area(shell, shsurf->output, &area);
 	surface_subsurfaces_boundingbox(shsurf->surface,
 					&surf_x, &surf_y, NULL, NULL);
+	e = pixman_region32_extents(&shsurf->output->region);
 
 	weston_view_set_position(shsurf->view,
-				 area.x - surf_x,
-				 area.y - surf_y);
+				 e->x1 + area.x - surf_x,
+				 e->y1 + area.y - surf_y);
 }
 
 static void
-- 
1.9.3



More information about the wayland-devel mailing list