[PATCH 3/3] shell: Implement "driver" method of fullsceen.
zhiwen.wu at linux.intel.com
zhiwen.wu at linux.intel.com
Wed Mar 7 01:01:27 PST 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
Using the switch_mode hook to change the display mode.
---
src/shell.c | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/src/shell.c b/src/shell.c
index 5d2c239..c8cb41e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -121,6 +121,7 @@ struct shell_surface {
struct weston_transform transform; /* matrix from x, y */
uint32_t framerate;
struct weston_surface *black_surface;
+ struct weston_mode *saved_mode;
} fullscreen;
struct weston_output *fullscreen_output;
@@ -372,6 +373,14 @@ static void
shell_unset_fullscreen(struct shell_surface *shsurf)
{
/* undo all fullscreen things here */
+ if (shsurf->fullscreen.saved_mode) {
+ shsurf->fullscreen_output->switch_mode(shsurf->fullscreen_output,
+ shsurf->fullscreen.saved_mode->width,
+ shsurf->fullscreen.saved_mode->height,
+ shsurf->fullscreen.saved_mode->refresh);
+ shsurf->fullscreen.saved_mode = NULL;
+ }
+
shsurf->fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
shsurf->fullscreen.framerate = 0;
wl_list_remove(&shsurf->fullscreen.transform.link);
@@ -572,7 +581,23 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
weston_surface_set_position(surface, output->x, output->y);
break;
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER:
- break;
+ if (output->current->width == surface->geometry.width &&
+ output->current->height == surface->geometry.height)
+ break;
+
+ shsurf->fullscreen.saved_mode = output->current;
+ if (output->switch_mode &&
+ output->switch_mode(output,
+ surface->geometry.width,
+ surface->geometry.height,
+ shsurf->fullscreen.framerate) == 0) {
+ weston_surface_set_position(surface, output->x, output->y);
+ break;
+ } else {
+ shsurf->fullscreen.saved_mode = NULL;
+ fprintf(stderr, "failed to switch to mode (%dx%d, %u), fallback to FILL method.\n",
+ surface->geometry.width, surface->geometry.height, shsurf->fullscreen.framerate);
+ }
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL:
break;
default:
@@ -774,6 +799,12 @@ destroy_shell_surface(struct wl_resource *resource)
if (shsurf->surface)
wl_list_remove(&shsurf->surface_destroy_listener.link);
+ if (shsurf->fullscreen.saved_mode)
+ shsurf->fullscreen_output->switch_mode(shsurf->fullscreen_output,
+ shsurf->fullscreen.saved_mode->width,
+ shsurf->fullscreen.saved_mode->height,
+ shsurf->fullscreen.saved_mode->refresh);
+
wl_list_remove(&shsurf->link);
free(shsurf);
}
@@ -841,6 +872,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.saved_mode = NULL;
wl_list_init(&shsurf->fullscreen.transform.link);
shsurf->surface_destroy_listener.func = shell_handle_surface_destroy;
--
1.7.5.4
More information about the wayland-devel
mailing list