[PATCH 2/2] shell: Avoid unnecessary raising for fullscreen surface in configure()

zhiwen.wu at linux.intel.com zhiwen.wu at linux.intel.com
Fri Mar 2 02:07:36 PST 2012


From: Alex Wu <zhiwen.wu at linux.intel.com>

If configure() is triggered by a change of buffer size, and the
fullscreen surface has alreay switched from non-fullscreen. An
unnecessary shell_stack_fullscreen() will be called.
---
 src/shell.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index 25a4bd2..58af426 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -115,6 +115,7 @@ struct shell_surface {
 		struct weston_transform transform; /* matrix from x, y */
 		uint32_t framerate;
 		struct weston_surface *black_surface;
+		bool do_raise;
 	} fullscreen;
 
 	struct weston_output *fullscreen_output;
@@ -633,8 +634,12 @@ shell_surface_set_fullscreen(struct wl_client *client,
 	shsurf->fullscreen.framerate = framerate;
 	shsurf->type = SHELL_SURFACE_FULLSCREEN;
 
-	if (es->output)
+	if (es->output) {
 		shsurf->surface->force_configure = 1;
+		if (shsurf->prev_type != SHELL_SURFACE_FULLSCREEN)
+			shsurf->fullscreen.do_raise = true;
+
+	}
 
 	wl_resource_post_event(resource,
 			       WL_SHELL_SURFACE_CONFIGURE,
@@ -845,6 +850,7 @@ shell_get_shell_surface(struct wl_client *client,
 	shsurf->fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
 	shsurf->fullscreen.framerate = 0;
 	shsurf->fullscreen.black_surface = NULL;
+	shsurf->fullscreen.do_raise = false;
 	wl_list_init(&shsurf->fullscreen.transform.link);
 
 	shsurf->surface_destroy_listener.func = shell_handle_surface_destroy;
@@ -1692,14 +1698,11 @@ configure(struct weston_shell *base, struct weston_surface *surface,
 {
 	struct wl_shell *shell = container_of(base, struct wl_shell, shell);
 	enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
-	enum shell_surface_type prev_surface_type = SHELL_SURFACE_NONE;
 	struct shell_surface *shsurf;
 
 	shsurf = get_shell_surface(surface);
-	if (shsurf) {
+	if (shsurf)
 		surface_type = shsurf->type;
-		prev_surface_type = shsurf->prev_type;
-	}
 
 	surface->geometry.x = x;
 	surface->geometry.y = y;
@@ -1713,8 +1716,10 @@ configure(struct weston_shell *base, struct weston_surface *surface,
 		break;
 	case SHELL_SURFACE_FULLSCREEN:
 		shell_configure_fullscreen(shsurf);
-		if (prev_surface_type != SHELL_SURFACE_FULLSCREEN)
+		if (shsurf->fullscreen.do_raise) {
 			shell_stack_fullscreen(shsurf);
+			shsurf->fullscreen.do_raise = false;
+		}
 		break;
 	case SHELL_SURFACE_MAXIMIZED:
 		/* setting x, y and using configure to change that geometry */
-- 
1.7.5.4



More information about the wayland-devel mailing list