[PATCH 4/6] add surface type for fullscreen mode
juan.j.zhao at linux.intel.com
juan.j.zhao at linux.intel.com
Fri Dec 30 12:21:24 PST 2011
From: Juan Zhao <juan.j.zhao at linux.intel.com>
figure out different surfaces for wlsc_surface, like cursor, and pannel,
for fullscreen mode, it should also be paint but the ohter surfaces
should not be paint.
---
compositor/compositor.c | 34 ++++++++++++++++++++++++++++++++++
compositor/compositor.h | 4 ++++
compositor/shell.c | 1 +
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/compositor/compositor.c b/compositor/compositor.c
index d935ebc..790a284 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -260,6 +260,7 @@ wlsc_surface_create(struct wlsc_compositor *compositor,
surface->fs_support.fs_method = WLSC_SURFACE_FULLSCREEN_NONE;
surface->buffer = NULL;
surface->output = NULL;
+ surface->type = WLSC_SURFACE_TYPE_GENERAL;
pixman_region32_init(&surface->damage);
pixman_region32_init(&surface->opaque);
@@ -843,6 +844,7 @@ wlsc_output_repaint(struct wlsc_output *output)
{
struct wlsc_compositor *ec = output->compositor;
struct wlsc_surface *es;
+ struct wlsc_surface *cursorsurface = NULL, *panelsurface = NULL;
pixman_region32_t opaque, new_damage, total_damage, repaint;
output->prepare_render(output);
@@ -875,6 +877,33 @@ wlsc_output_repaint(struct wlsc_output *output)
es = container_of(ec->surface_list.next, struct wlsc_surface, link);
+ struct wl_list *tlist=(struct wl_list *)ec->surface_list.next;
+ int count=0;
+
+ while((es->type != WLSC_SURFACE_TYPE_GENERAL) && count <1024){
+ tlist=tlist->next;
+ if((tlist == (struct wl_list *)ec->surface_list.next) &&
+ count!=0)
+ break;
+ switch(es->type){
+ case WLSC_SURFACE_TYPE_CURSOR:
+ cursorsurface = es;
+ break;
+ case WLSC_SURFACE_TYPE_PANEL:
+ panelsurface = es;
+ break;
+ default:
+ fprintf(stderr,"unkown surface type!\n");
+ return;
+ }
+ es = container_of(tlist->next, struct wlsc_surface, link);
+ count++;
+ }
+ if(count == 1024) {
+ fprintf(stderr,"too many surfaces!\n");
+ return -1;
+ }
+
if (setup_scanout_surface(output, es) == 0)
/* We're drawing nothing, just let the damage accumulate */
return;
@@ -889,6 +918,10 @@ wlsc_output_repaint(struct wlsc_output *output)
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
wlsc_surface_draw(es, output, &total_damage);
+ if(cursorsurface)
+ wlsc_surface_draw(cursorsurface, output, &total_damage);
+ if(panelsurface)
+ wlsc_surface_draw(panelsurface, output, &total_damage);
} else {
if( output->saved_mode &&
(output->saved_mode->width!=output->current->width ||
@@ -1733,6 +1766,7 @@ input_device_attach(struct wl_client *client,
wlsc_surface_create(compositor,
device->input_device.x,
device->input_device.y, 32, 32);
+ device->sprite->type = WLSC_SURFACE_TYPE_CURSOR;
wl_list_init(&device->sprite->link);
}
diff --git a/compositor/compositor.h b/compositor/compositor.h
index c9a5cae..f61df07 100644
--- a/compositor/compositor.h
+++ b/compositor/compositor.h
@@ -35,6 +35,9 @@
#define WLSC_SURFACE_FULLSCREEN_NONE 0
#define WLSC_SURFACE_FULLSCREEN_FORCE 1
#define WLSC_SURFACE_FULLSCREEN_FILL 2
+#define WLSC_SURFACE_TYPE_CURSOR 0
+#define WLSC_SURFACE_TYPE_PANEL 1
+#define WLSC_SURFACE_TYPE_GENERAL 2
struct wlsc_matrix {
GLfloat d[16];
@@ -255,6 +258,7 @@ struct wlsc_surface {
struct wlsc_transform *transform;
uint32_t alpha;
uint32_t visual;
+ uint32_t type;
struct {
uint32_t fs_method;
diff --git a/compositor/shell.c b/compositor/shell.c
index 94392cf..095936f 100644
--- a/compositor/shell.c
+++ b/compositor/shell.c
@@ -638,6 +638,7 @@ desktop_shell_set_panel(struct wl_client *client,
}
shsurf->type = SHELL_SURFACE_PANEL;
+ surface->type = WLSC_SURFACE_TYPE_PANEL;
shsurf->output = output_resource->data;
wl_list_insert(&shell->panels, &shsurf->link);
--
1.7.2.2
More information about the wayland-devel
mailing list