[PATCH 1/2] shell: Fix setting a random position when buffer size changed.

wuzhiwen zhiwen.wu at linux.intel.com
Tue Mar 13 02:22:32 PDT 2012


Sorry for re-sending this patch, you can just ignore it.

>-----Original Message-----
>From:
>wayland-devel-bounces+zhiwen.wu=linux.intel.com at lists.freedesktop.org
>[mailto:wayland-devel-bounces+zhiwen.wu=linux.intel.com at lists.freedesktop.o
>rg] On Behalf Of zhiwen.wu at linux.intel.com
>Sent: Tuesday, March 13, 2012 5:13 PM
>To: wayland-devel at lists.freedesktop.org
>Cc: krh at bitplanet.net; Alex Wu
>Subject: [PATCH 1/2] shell: Fix setting a random position when buffer size
>changed.
>
>From: Alex Wu <zhiwen.wu at linux.intel.com>
>
>When the configure() is triggered by a change of buffer size, a toplevel
surface
>which has not ever been switched to maximazied or fullscreen will set a
random
>position.
>
>Modified the position restoring logic for toplevel surface. Store the
surface
>position when it switches from toplevel to other types and restore the
saved
>position in shell_surface_set_toplevel.
>---
> src/shell.c |   35 ++++++++++-------------------------
> 1 files changed, 10 insertions(+), 25 deletions(-)
>
>diff --git a/src/shell.c b/src/shell.c
>index 5abfdb5..25a4bd2 100644
>--- a/src/shell.c
>+++ b/src/shell.c
>@@ -405,8 +405,12 @@ reset_shell_surface_type(struct shell_surface
>*surface)
> 				       WL_DISPLAY_ERROR_INVALID_METHOD,
> 				       "cannot reassign surface type");
> 		return -1;
>-	case SHELL_SURFACE_NONE:
> 	case SHELL_SURFACE_TOPLEVEL:
>+		surface->saved_x = surface->surface->geometry.x;
>+		surface->saved_y = surface->surface->geometry.y;
>+		surface->saved_position_valid = true;
>+		break;
>+	case SHELL_SURFACE_NONE:
> 	case SHELL_SURFACE_TRANSIENT:
> 	case SHELL_SURFACE_POPUP:
> 		break;
>@@ -427,6 +431,11 @@ shell_surface_set_toplevel(struct wl_client *client,
> 	if (reset_shell_surface_type(surface))
> 		return;
>
>+	if (surface->saved_position_valid)
>+		weston_surface_set_position(surface->surface,
>+					    surface->saved_x,
>+					    surface->saved_y);
>+
> 	surface->type = SHELL_SURFACE_TOPLEVEL;  }
>
>@@ -499,10 +508,6 @@ shell_surface_set_maximized(struct wl_client *client,
> 	if (reset_shell_surface_type(shsurf))
> 		return;
>
>-	shsurf->saved_x = es->geometry.x;
>-	shsurf->saved_y = es->geometry.y;
>-	shsurf->saved_position_valid = true;
>-
> 	wlshell = shell_surface_get_shell(shsurf);
> 	panel_height = get_output_panel_height(wlshell, es->output);
> 	edges =
>WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
>@@ -623,12 +628,6 @@ shell_surface_set_fullscreen(struct wl_client *client,
> 	if (reset_shell_surface_type(shsurf))
> 		return;
>
>-	if (shsurf->prev_type != SHELL_SURFACE_FULLSCREEN) {
>-		shsurf->saved_x = es->geometry.x;
>-		shsurf->saved_y = es->geometry.y;
>-		shsurf->saved_position_valid = true;
>-	}
>-
> 	shsurf->fullscreen_output = shsurf->output;
> 	shsurf->fullscreen.type = method;
> 	shsurf->fullscreen.framerate = framerate; @@ -1723,20 +1722,6 @@
>configure(struct weston_shell *base, struct weston_surface *surface,
> 		surface->geometry.y = surface->output->y +
> 			get_output_panel_height(shell,surface->output);
> 		break;
>-	case SHELL_SURFACE_TOPLEVEL:
>-		if (prev_surface_type != SHELL_SURFACE_TOPLEVEL) {
>-			if (shsurf->saved_position_valid &&
>-			    shsurf->saved_x != surface->geometry.x &&
>-			    shsurf->saved_y != surface->geometry.y) {
>-				weston_surface_set_position(surface,
>-							    shsurf->saved_x,
>-
shsurf->saved_y);
>-			} else if (!shsurf->saved_position_valid) {
>-				weston_surface_set_position(surface, 10 +
random() % 400,
>-							    10 + random() %
400);
>-			}
>-		}
>-		break;
> 	default:
> 		break;
> 	}
>--
>1.7.5.4
>
>_______________________________________________
>wayland-devel mailing list
>wayland-devel at lists.freedesktop.org
>http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list