[PATCH v4 2/4] add fullscreen interface update
juan.j.zhao at linux.intel.com
juan.j.zhao at linux.intel.com
Mon Jan 16 08:47:55 PST 2012
From: Juan Zhao <juan.j.zhao at linux.intel.com>
mainly update shell part here
Signed-off-by: Juan Zhao <juan.j.zhao at linux.intel.com>
Signed-off-by: Zhiwen Wu <zhiwen.wu at linux.intel.com>
---
src/compositor.c | 4 +-
src/compositor.h | 21 ++++++++++++++++++-
src/shell.c | 59 ++++++++++++++++++++++++++++++++++++++---------------
3 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 4a5e51c..945e357 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -228,7 +228,7 @@ weston_surface_create(struct weston_compositor *compositor,
surface->height = height;
surface->alpha = 255;
- surface->fullscreen_output = NULL;
+ surface->fs_support.fullscreen_output = NULL;
surface->buffer = NULL;
surface->output = NULL;
@@ -803,7 +803,7 @@ weston_output_repaint(struct weston_output *output)
/* We're drawing nothing, just let the damage accumulate */
return;
- if (es->fullscreen_output == output) {
+ if (es->fs_support.fullscreen_output == output) {
if (es->width < output->current->width ||
es->height < output->current->height)
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/src/compositor.h b/src/compositor.h
index d21e285..b298ef8 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -32,6 +32,14 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#define WESTON_SURFACE_FULLSCREEN_DEFAULT 0
+#define WESTON_SURFACE_FULLSCREEN_SCALE 1
+#define WESTON_SURFACE_FULLSCREEN_DRIVER 2
+#define WESTON_SURFACE_FULLSCREEN_FILL 3
+#define WESTON_SURFACE_TYPE_CURSOR 0
+#define WESTON_SURFACE_TYPE_PANEL 1
+#define WESTON_SURFACE_TYPE_GENERAL 2
+
struct weston_matrix {
GLfloat d[16];
};
@@ -79,8 +87,10 @@ struct weston_output {
char *make, *model;
uint32_t subpixel;
+ uint32_t fs_dirty;
struct weston_mode *current;
+ struct weston_mode *saved_mode;
struct wl_list mode_list;
struct wl_buffer *scanout_buffer;
struct wl_listener scanout_buffer_destroy_listener;
@@ -94,6 +104,7 @@ struct weston_output {
int (*set_hardware_cursor)(struct weston_output *output,
struct weston_input_device *input);
void (*destroy)(struct weston_output *output);
+ int (*set_mode)(struct weston_output *output_base, int32_t w, int32_t h, uint32_t refresh);
};
struct weston_input_device {
@@ -241,6 +252,15 @@ struct weston_surface {
struct weston_transform *transform;
uint32_t alpha;
uint32_t visual;
+ uint32_t type;
+
+ struct {
+ uint32_t framerate;
+ uint32_t fs_method;
+ struct weston_transform *fs_transform;
+ struct weston_output *fullscreen_output;
+ } fs_support;
+
/*
* Which output to vsync this surface to.
@@ -249,7 +269,6 @@ struct weston_surface {
*/
struct weston_output *output;
- struct weston_output *fullscreen_output;
struct wl_list frame_callback_list;
EGLImageKHR image;
diff --git a/src/shell.c b/src/shell.c
index 9386d1e..01446d5 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -330,7 +330,7 @@ reset_shell_surface_type(struct shell_surface *surface)
case SHELL_SURFACE_FULLSCREEN:
surface->surface->x = surface->saved_x;
surface->surface->y = surface->saved_y;
- surface->surface->fullscreen_output = NULL;
+ surface->surface->fs_support.fullscreen_output = NULL;
break;
case SHELL_SURFACE_PANEL:
case SHELL_SURFACE_BACKGROUND:
@@ -401,7 +401,8 @@ get_default_output(struct weston_compositor *compositor)
static void
shell_surface_set_fullscreen(struct wl_client *client,
- struct wl_resource *resource)
+ struct wl_resource *resource, uint32_t method,
+ uint32_t framerate)
{
struct shell_surface *shsurf = resource->data;
@@ -420,9 +421,37 @@ shell_surface_set_fullscreen(struct wl_client *client,
shsurf->saved_y = es->y;
es->x = (output->current->width - es->width) / 2;
es->y = (output->current->height - es->height) / 2;
- es->fullscreen_output = output;
- weston_surface_damage(es);
+ es->fs_support.fullscreen_output = output;
+ es->fs_support.framerate = framerate;
shsurf->type = SHELL_SURFACE_FULLSCREEN;
+ switch(method){
+ case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT:
+ weston_surface_damage(es);
+ es->fs_support.fs_method = WESTON_SURFACE_FULLSCREEN_DEFAULT;
+ break;
+ case WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE:
+ es->x = 0;
+ es->y = 0;
+ weston_surface_damage(es);
+ es->fs_support.fs_method = WESTON_SURFACE_FULLSCREEN_SCALE;
+ break;
+ case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER:
+ es->x = 0;
+ es->y = 0;
+ weston_surface_damage(es);
+ es->fs_support.fs_method =
+ WESTON_SURFACE_FULLSCREEN_DRIVER;
+ break;
+ case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL:
+ weston_surface_damage(es);
+ es->fs_support.fs_method = WESTON_SURFACE_FULLSCREEN_FILL;
+ default :
+ fprintf(stderr,
+ "unknown parameter for fullscreen support\n");
+ break;
+ }
+ /*will do the real action on the map or paint function*/
+
}
static void
@@ -1092,15 +1121,6 @@ unlock(struct weston_shell *base)
}
static void
-center_on_output(struct weston_surface *surface, struct weston_output *output)
-{
- struct weston_mode *mode = output->current;
-
- surface->x = output->x + (mode->width - surface->width) / 2;
- surface->y = output->y + (mode->height - surface->height) / 2;
-}
-
-static void
map(struct weston_shell *base,
struct weston_surface *surface, int32_t width, int32_t height)
{
@@ -1108,6 +1128,7 @@ map(struct weston_shell *base,
struct weston_compositor *compositor = shell->compositor;
struct wl_list *list;
struct shell_surface *shsurf;
+ struct weston_output *fs_output = surface->fs_support.fullscreen_output;
enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
int do_configure;
@@ -1134,10 +1155,11 @@ map(struct weston_shell *base,
break;
case SHELL_SURFACE_SCREENSAVER:
case SHELL_SURFACE_FULLSCREEN:
- center_on_output(surface, surface->fullscreen_output);
+ weston_surface_set_fullscreen(fs_output, surface);
break;
case SHELL_SURFACE_LOCK:
- center_on_output(surface, get_default_output(compositor));
+ weston_surface_center_on_output(surface,
+ get_default_output(compositor));
break;
default:
;
@@ -1231,6 +1253,9 @@ configure(struct weston_shell *base, struct weston_surface *surface,
int do_configure = !shell->locked;
enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
struct shell_surface *shsurf;
+ struct weston_output *fs_output;
+
+ fs_output = surface->fs_support.fullscreen_output;
shsurf = get_shell_surface(surface);
if (shsurf)
@@ -1244,7 +1269,7 @@ configure(struct weston_shell *base, struct weston_surface *surface,
do_configure = !do_configure;
/* fall through */
case SHELL_SURFACE_FULLSCREEN:
- center_on_output(surface, surface->fullscreen_output);
+ weston_surface_center_on_output(surface, fs_output);
break;
default:
break;
@@ -1348,7 +1373,7 @@ screensaver_set_surface(struct wl_client *client,
surface->type = SHELL_SURFACE_SCREENSAVER;
- surface->surface->fullscreen_output = output;
+ surface->surface->fs_support.fullscreen_output = output;
surface->output = output;
wl_list_insert(shell->screensaver.surfaces.prev, &surface->link);
}
--
1.7.5.4
More information about the wayland-devel
mailing list