[PATCH v2 1/2] shell: update shsurf->output when it might changed

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


When we are moving window or its state changed, update the
output, so that configure event and maximizing/fullscreening actions
have up-to-date information.

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

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 26f13cc..d5996a3 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -474,6 +474,22 @@ shell_surface_state_changed(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
 shell_grab_end(struct shell_grab *grab)
 {
 	if (grab->shsurf) {
@@ -484,6 +500,8 @@ shell_grab_end(struct shell_grab *grab)
 			grab->shsurf->resize_edges = 0;
 			shell_surface_state_changed(grab->shsurf);
 		}
+
+		shell_surface_set_output(grab->shsurf, NULL);
 	}
 
 	weston_pointer_end_grab(grab->grab.pointer);
@@ -2371,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;
@@ -5227,9 +5229,6 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
 	if (surface->output) {
 		wl_list_for_each(view, &surface->views, surface_link)
 			weston_view_update_transform(view);
-
-		if (shsurf->state.maximized)
-			surface->output = shsurf->output;
 	}
 }
 
@@ -5277,6 +5276,8 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 		float from_x, from_y;
 		float to_x, to_y;
 
+		shell_surface_set_output(shsurf, NULL);
+
 		if (shsurf->resize_edges) {
 			sx = 0;
 			sy = 0;
-- 
1.9.3



More information about the wayland-devel mailing list