From: Juan Zhao <juan.j.z...@linux.intel.com>

---
 src/compositor.h |    2 ++
 src/shell.c      |   30 +++++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/compositor.h b/src/compositor.h
index aa62c81..94f5cc3 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -292,6 +292,8 @@ struct weston_surface {
                uint32_t framerate;
                uint32_t fs_method;
                struct weston_output *fullscreen_output;
+               struct weston_transform fullscreen_transform; /* matrix from x, 
y */
+               int setted;
        } fs_support;
 
        /*
diff --git a/src/shell.c b/src/shell.c
index 03c4059..1d95313 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -352,6 +352,10 @@ reset_shell_surface_type(struct shell_surface *surface)
                                            surface->saved_x,
                                            surface->saved_y);
                surface->surface->fs_support.fullscreen_output = NULL;
+               surface->surface->fs_support.setted = 0;
+               if (surface->surface->fs_support.fullscreen_transform.link.prev 
||
+                   surface->surface->fs_support.fullscreen_transform.link.next)
+                       
wl_list_remove(&surface->surface->fs_support.fullscreen_transform.link);
                break;
        case SHELL_SURFACE_PANEL:
        case SHELL_SURFACE_BACKGROUND:
@@ -1303,14 +1307,30 @@ static int
 weston_surface_set_fullscreen(struct weston_surface *surface)
 {
        struct weston_output *output = surface->fs_support.fullscreen_output;
+       struct weston_matrix *matrix = 
&surface->fs_support.fullscreen_transform.matrix;
+       struct shell_surface *shsurf;
+
        center_on_output(surface, output);
+       surface->output = output;
 
        switch(surface->fs_support.fs_method) {
        case WESTON_SURFACE_FULLSCREEN_DEFAULT:
                weston_surface_damage(surface);
                break;
        case WESTON_SURFACE_FULLSCREEN_SCALE:
+               if (!surface->fs_support.setted){
+                       
wl_list_init(&surface->fs_support.fullscreen_transform.link);
+                       weston_matrix_init(matrix);
+                       weston_matrix_scale(matrix,
+                                 
(float)output->current->width/(float)surface->geometry.width,
+                                 
(float)output->current->width/(float)surface->geometry.width,
+                                 1.0);
+                       
wl_list_insert(surface->geometry.transformation_list.prev,
+                                      
&surface->fs_support.fullscreen_transform.link);
+               }
+               weston_surface_set_position(surface, output->x, output->y);
                weston_surface_damage(surface);
+               weston_output_damage(output);
                break;
        case WESTON_SURFACE_FULLSCREEN_DRIVER:
                break;
@@ -1321,6 +1341,8 @@ weston_surface_set_fullscreen(struct weston_surface 
*surface)
                break;
        }
 
+       surface->fs_support.setted = 1;
+
        return 0;
 }
 
@@ -1365,14 +1387,11 @@ top_regular_surface (struct weston_shell *base)
 static bool
 is_fullscreen_surface (struct weston_surface *base)
 {
-       struct shell_surface *shsurf;
        enum shell_surface_type surf_type;
-       
+
        if (!base) {
                return false;
        }
-
-       shsurf = get_shell_surface (base);
        surf_type = get_shell_surface_type (base);
 
        if (surf_type == SHELL_SURFACE_FULLSCREEN)
@@ -1393,7 +1412,7 @@ prepare_repaint (struct weston_shell *base, struct 
weston_output *output)
 
        top_regular_surf = top_regular_surface (base);
 
-       if (is_fullscreen_surface (top_regular_surf)){ 
+       if (is_fullscreen_surface (top_regular_surf)){
                if (wl_list_empty (&shell->hidden_panels) && !wl_list_empty 
(&shell->panels)) {
                        /*hide panels*/
                        wl_list_for_each(panel, &shell->panels, link) {
@@ -1403,6 +1422,7 @@ prepare_repaint (struct weston_shell *base, struct 
weston_output *output)
                        }
                        do_damage = true;
                }
+               weston_surface_set_fullscreen(top_regular_surf);
        } else {
                if (!wl_list_empty (&shell->hidden_panels)) {
                        /*unhide panels*/
-- 
1.7.5.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to