Commit a7af7043 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Kristian H. Kristensen

Split the geometry information from weston_surface out into weston_view

The weston_surface structure is split into two structures:

 * The weston_surface structure storres everything required for a
   client-side or server-side surface.  This includes buffers; callbacks;
   backend private data; input, damage, and opaque regions; and a few other
   bookkeeping bits.

 * The weston_view structure represents an entity in the scenegraph and
   storres all of the geometry information.  This includes clip region,
   alpha, position, and the transformation list as well as all of the
   temporary information derived from the geometry state.  Because a view,
   and not a surface, is a scenegraph element, the view is what is placed
   in layers and planes.

There are a few things worth noting about the surface/view split:

 1. This is *not* a modification to the protocol.  It is, instead, a
    modification to Weston's internal scenegraph to allow a single surface
    to exist in multiple places at a time.  Clients are completely unaware
    of how many views to a particular surface exist.

 2. A view is considered a direct child of a surface and is destroyed when
    the surface is destroyed.  Because of this, the view.surface pointer is
    always valid and non-null.

 3. The compositor's surface_list is replaced with a view_list.  Due to
    subsurfaces, building the view list is a little more complicated than
    it used to be and involves building a tree of views on the fly whenever
    subsurfaces are used.  However, this means that backends can remain
    completely subsurface-agnostic.

 4. Surfaces and views both keep track of which outputs they are on.

 5. The weston_surface structure now has width and height fields.  These
    are populated when a new buffer is attached before surface.configure
    is called.  This is because there are many surface-based operations
    that really require the width and height and digging through the views
    didn't work well.
Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
parent d4c1cd77
......@@ -34,7 +34,7 @@
WL_EXPORT void
weston_spring_init(struct weston_spring *spring,
double k, double current, double target)
double k, double current, double target)
{
spring->k = k;
spring->friction = 400.0;
......@@ -114,52 +114,52 @@ weston_spring_done(struct weston_spring *spring)
fabs(spring->current - spring->target) < 0.002;
}
typedef void (*weston_surface_animation_frame_func_t)(struct weston_surface_animation *animation);
typedef void (*weston_view_animation_frame_func_t)(struct weston_view_animation *animation);
struct weston_surface_animation {
struct weston_surface *surface;
struct weston_view_animation {
struct weston_view *view;
struct weston_animation animation;
struct weston_spring spring;
struct weston_transform transform;
struct wl_listener listener;
float start, stop;
weston_surface_animation_frame_func_t frame;
weston_surface_animation_frame_func_t reset;
weston_surface_animation_done_func_t done;
weston_view_animation_frame_func_t frame;
weston_view_animation_frame_func_t reset;
weston_view_animation_done_func_t done;
void *data;
};
static void
weston_surface_animation_destroy(struct weston_surface_animation *animation)
weston_view_animation_destroy(struct weston_view_animation *animation)
{
wl_list_remove(&animation->animation.link);
wl_list_remove(&animation->listener.link);
wl_list_remove(&animation->transform.link);
if (animation->reset)
animation->reset(animation);
weston_surface_geometry_dirty(animation->surface);
weston_view_geometry_dirty(animation->view);
if (animation->done)
animation->done(animation, animation->data);
free(animation);
}
static void
handle_animation_surface_destroy(struct wl_listener *listener, void *data)
handle_animation_view_destroy(struct wl_listener *listener, void *data)
{
struct weston_surface_animation *animation =
struct weston_view_animation *animation =
container_of(listener,
struct weston_surface_animation, listener);
struct weston_view_animation, listener);
weston_surface_animation_destroy(animation);
weston_view_animation_destroy(animation);
}
static void
weston_surface_animation_frame(struct weston_animation *base,
struct weston_output *output, uint32_t msecs)
weston_view_animation_frame(struct weston_animation *base,
struct weston_output *output, uint32_t msecs)
{
struct weston_surface_animation *animation =
struct weston_view_animation *animation =
container_of(base,
struct weston_surface_animation, animation);
struct weston_view_animation, animation);
if (base->frame_counter <= 1)
animation->spring.timestamp = msecs;
......@@ -167,32 +167,32 @@ weston_surface_animation_frame(struct weston_animation *base,
weston_spring_update(&animation->spring, msecs);
if (weston_spring_done(&animation->spring)) {
weston_surface_animation_destroy(animation);
weston_view_animation_destroy(animation);
return;
}
if (animation->frame)
animation->frame(animation);
weston_surface_geometry_dirty(animation->surface);
weston_compositor_schedule_repaint(animation->surface->compositor);
weston_view_geometry_dirty(animation->view);
weston_view_schedule_repaint(animation->view);
}
static struct weston_surface_animation *
weston_surface_animation_run(struct weston_surface *surface,
float start, float stop,
weston_surface_animation_frame_func_t frame,
weston_surface_animation_frame_func_t reset,
weston_surface_animation_done_func_t done,
void *data)
static struct weston_view_animation *
weston_view_animation_run(struct weston_view *view,
float start, float stop,
weston_view_animation_frame_func_t frame,
weston_view_animation_frame_func_t reset,
weston_view_animation_done_func_t done,
void *data)
{
struct weston_surface_animation *animation;
struct weston_view_animation *animation;
animation = malloc(sizeof *animation);
if (!animation)
return NULL;
animation->surface = surface;
animation->view = view;
animation->frame = frame;
animation->reset = reset;
animation->done = done;
......@@ -200,35 +200,35 @@ weston_surface_animation_run(struct weston_surface *surface,
animation->start = start;
animation->stop = stop;
weston_matrix_init(&animation->transform.matrix);
wl_list_insert(&surface->geometry.transformation_list,
wl_list_insert(&view->geometry.transformation_list,
&animation->transform.link);
weston_spring_init(&animation->spring, 200.0, 0.0, 1.0);
animation->spring.friction = 700;
animation->animation.frame_counter = 0;
animation->animation.frame = weston_surface_animation_frame;
weston_surface_animation_frame(&animation->animation, NULL, 0);
animation->animation.frame = weston_view_animation_frame;
weston_view_animation_frame(&animation->animation, NULL, 0);
animation->listener.notify = handle_animation_surface_destroy;
wl_signal_add(&surface->destroy_signal, &animation->listener);
animation->listener.notify = handle_animation_view_destroy;
wl_signal_add(&view->destroy_signal, &animation->listener);
wl_list_insert(&surface->output->animation_list,
wl_list_insert(&view->output->animation_list,
&animation->animation.link);
return animation;
}
static void
reset_alpha(struct weston_surface_animation *animation)
reset_alpha(struct weston_view_animation *animation)
{
struct weston_surface *surface = animation->surface;
struct weston_view *view = animation->view;
surface->alpha = animation->stop;
view->alpha = animation->stop;
}
static void
zoom_frame(struct weston_surface_animation *animation)
zoom_frame(struct weston_view_animation *animation)
{
struct weston_surface *es = animation->surface;
struct weston_view *es = animation->view;
float scale;
scale = animation->start +
......@@ -248,15 +248,15 @@ zoom_frame(struct weston_surface_animation *animation)
es->alpha = 1.0;
}
WL_EXPORT struct weston_surface_animation *
weston_zoom_run(struct weston_surface *surface, float start, float stop,
weston_surface_animation_done_func_t done, void *data)
WL_EXPORT struct weston_view_animation *
weston_zoom_run(struct weston_view *view, float start, float stop,
weston_view_animation_done_func_t done, void *data)
{
struct weston_surface_animation *zoom;
struct weston_view_animation *zoom;
zoom = weston_surface_animation_run(surface, start, stop,
zoom_frame, reset_alpha,
done, data);
zoom = weston_view_animation_run(view, start, stop,
zoom_frame, reset_alpha,
done, data);
weston_spring_init(&zoom->spring, 300.0, start, stop);
zoom->spring.friction = 1400;
......@@ -266,45 +266,45 @@ weston_zoom_run(struct weston_surface *surface, float start, float stop,
}
static void
fade_frame(struct weston_surface_animation *animation)
fade_frame(struct weston_view_animation *animation)
{
if (animation->spring.current > 0.999)
animation->surface->alpha = 1;
animation->view->alpha = 1;
else if (animation->spring.current < 0.001 )
animation->surface->alpha = 0;
animation->view->alpha = 0;
else
animation->surface->alpha = animation->spring.current;
animation->view->alpha = animation->spring.current;
}
WL_EXPORT struct weston_surface_animation *
weston_fade_run(struct weston_surface *surface,
WL_EXPORT struct weston_view_animation *
weston_fade_run(struct weston_view *view,
float start, float end, float k,
weston_surface_animation_done_func_t done, void *data)
weston_view_animation_done_func_t done, void *data)
{
struct weston_surface_animation *fade;
struct weston_view_animation *fade;
fade = weston_surface_animation_run(surface, 0, end,
fade_frame, reset_alpha,
done, data);
fade = weston_view_animation_run(view, 0, end,
fade_frame, reset_alpha,
done, data);
weston_spring_init(&fade->spring, k, start, end);
fade->spring.friction = 1400;
fade->spring.previous = -(end - start) * 0.03;
surface->alpha = start;
view->alpha = start;
return fade;
}
WL_EXPORT void
weston_fade_update(struct weston_surface_animation *fade, float target)
weston_fade_update(struct weston_view_animation *fade, float target)
{
fade->spring.target = target;
}
static void
slide_frame(struct weston_surface_animation *animation)
slide_frame(struct weston_view_animation *animation)
{
float scale;
......@@ -315,15 +315,15 @@ slide_frame(struct weston_surface_animation *animation)
weston_matrix_translate(&animation->transform.matrix, 0, scale, 0);
}
WL_EXPORT struct weston_surface_animation *
weston_slide_run(struct weston_surface *surface, float start, float stop,
weston_surface_animation_done_func_t done, void *data)
WL_EXPORT struct weston_view_animation *
weston_slide_run(struct weston_view *view, float start, float stop,
weston_view_animation_done_func_t done, void *data)
{
struct weston_surface_animation *animation;
struct weston_view_animation *animation;
animation = weston_surface_animation_run(surface, start, stop,
slide_frame, NULL, done,
data);
animation = weston_view_animation_run(view, start, stop,
slide_frame, NULL, done,
data);
if (!animation)
return NULL;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -26,6 +26,7 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include "compositor.h"
......@@ -33,11 +34,11 @@ struct weston_drag {
struct wl_client *client;
struct weston_data_source *data_source;
struct wl_listener data_source_listener;
struct weston_surface *focus;
struct weston_view *focus;
struct wl_resource *focus_resource;
struct wl_listener focus_listener;
struct weston_pointer_grab grab;
struct weston_surface *icon;
struct weston_view *icon;
struct wl_listener icon_destroy_listener;
int32_t dx, dy;
};
......@@ -178,14 +179,17 @@ drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_
struct wl_list *list;
float fx, fy;
assert(es->configure == drag_surface_configure);
if (!weston_surface_is_mapped(es) && es->buffer_ref.buffer) {
if (pointer->sprite && weston_surface_is_mapped(pointer->sprite))
if (pointer->sprite && weston_view_is_mapped(pointer->sprite))
list = &pointer->sprite->layer_link;
else
list = &es->compositor->cursor_layer.surface_list;
list = &es->compositor->cursor_layer.view_list;
wl_list_insert(list, &es->layer_link);
weston_surface_update_transform(es);
wl_list_remove(&drag->icon->layer_link);
wl_list_insert(list, &drag->icon->layer_link);
weston_view_update_transform(drag->icon);
empty_region(&es->pending.input);
}
......@@ -194,7 +198,7 @@ drag_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_
fx = wl_fixed_to_double(pointer->x) + drag->dx;
fy = wl_fixed_to_double(pointer->y) + drag->dy;
weston_surface_configure(es, fx, fy, width, height);
weston_view_configure(drag->icon, fx, fy, width, height);
}
static void
......@@ -207,7 +211,7 @@ destroy_drag_focus(struct wl_listener *listener, void *data)
}
static void
weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
weston_drag_set_focus(struct weston_drag *drag, struct weston_view *view,
wl_fixed_t sx, wl_fixed_t sy)
{
struct weston_pointer *pointer = drag->grab.pointer;
......@@ -215,6 +219,11 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
struct wl_display *display = pointer->seat->compositor->wl_display;
uint32_t serial;
if (drag->focus && view && drag->focus->surface == view->surface) {
drag->focus = view;
return;
}
if (drag->focus_resource) {
wl_data_device_send_leave(drag->focus_resource);
wl_list_remove(&drag->focus_listener.link);
......@@ -222,15 +231,15 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
drag->focus = NULL;
}
if (!surface)
if (!view || !view->surface->resource)
return;
if (!drag->data_source &&
wl_resource_get_client(surface->resource) != drag->client)
wl_resource_get_client(view->surface->resource) != drag->client)
return;
resource = wl_resource_find_for_client(&pointer->seat->drag_resource_list,
wl_resource_get_client(surface->resource));
wl_resource_get_client(view->surface->resource));
if (!resource)
return;
......@@ -243,10 +252,10 @@ weston_drag_set_focus(struct weston_drag *drag, struct weston_surface *surface,
return;
}
wl_data_device_send_enter(resource, serial, surface->resource,
wl_data_device_send_enter(resource, serial, view->surface->resource,
sx, sy, offer);
drag->focus = surface;
drag->focus = view;
drag->focus_listener.notify = destroy_drag_focus;
wl_resource_add_destroy_listener(resource, &drag->focus_listener);
drag->focus_resource = resource;
......@@ -258,14 +267,14 @@ drag_grab_focus(struct weston_pointer_grab *grab)
struct weston_drag *drag =
container_of(grab, struct weston_drag, grab);
struct weston_pointer *pointer = grab->pointer;
struct weston_surface *surface;
struct weston_view *view;
wl_fixed_t sx, sy;
surface = weston_compositor_pick_surface(pointer->seat->compositor,
pointer->x, pointer->y,
&sx, &sy);
if (drag->focus != surface)
weston_drag_set_focus(drag, surface, sx, sy);
view = weston_compositor_pick_view(pointer->seat->compositor,
pointer->x, pointer->y,
&sx, &sy);
if (drag->focus != view)
weston_drag_set_focus(drag, view, sx, sy);
}
static void
......@@ -280,14 +289,14 @@ drag_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
if (drag->icon) {
fx = wl_fixed_to_double(pointer->x) + drag->dx;
fy = wl_fixed_to_double(pointer->y) + drag->dy;
weston_surface_set_position(drag->icon, fx, fy);
weston_surface_schedule_repaint(drag->icon);
weston_view_set_position(drag->icon, fx, fy);
weston_view_schedule_repaint(drag->icon);
}
if (drag->focus_resource) {
weston_surface_from_global_fixed(drag->focus,
pointer->x, pointer->y,
&sx, &sy);
weston_view_from_global_fixed(drag->focus,
pointer->x, pointer->y,
&sx, &sy);
wl_data_device_send_motion(drag->focus_resource, time, sx, sy);
}
......@@ -297,12 +306,13 @@ static void
data_device_end_drag_grab(struct weston_drag *drag)
{
if (drag->icon) {
if (weston_surface_is_mapped(drag->icon))
weston_surface_unmap(drag->icon);
if (weston_view_is_mapped(drag->icon))
weston_view_unmap(drag->icon);
drag->icon->configure = NULL;
empty_region(&drag->icon->pending.input);
drag->icon->surface->configure = NULL;
empty_region(&drag->icon->surface->pending.input);
wl_list_remove(&drag->icon_destroy_listener.link);
weston_view_destroy(drag->icon);
}
weston_drag_set_focus(drag, NULL, 0, 0);
......@@ -373,21 +383,28 @@ weston_seat_start_drag(struct weston_seat *seat,
drag->grab.interface = &drag_grab_interface;
drag->client = client;
drag->data_source = source;
drag->icon = icon;
if (source) {
drag->data_source_listener.notify = destroy_data_device_source;
wl_signal_add(&source->destroy_signal,
&drag->data_source_listener);
}
if (icon) {
drag->icon = weston_view_create(icon);
if (drag->icon == NULL) {
free(drag);
return -1;
}
drag->icon_destroy_listener.notify = handle_drag_icon_destroy;
wl_signal_add(&icon->destroy_signal,
&drag->icon_destroy_listener);
icon->configure = drag_surface_configure;
icon->configure_private = drag;
} else {
drag->icon = NULL;
}
if (source) {
drag->data_source_listener.notify = destroy_data_device_source;
wl_signal_add(&source->destroy_signal,
&drag->data_source_listener);
}
weston_pointer_set_focus(seat->pointer, NULL,
......@@ -409,7 +426,8 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
if (seat->pointer->button_count == 0 ||
seat->pointer->grab_serial != serial ||
seat->pointer->focus != wl_resource_get_user_data(origin_resource))
!seat->pointer->focus ||
seat->pointer->focus->surface != wl_resource_get_user_data(origin_resource))
return;
/* FIXME: Check that the data source type array isn't empty. */
......
This diff is collapsed.
This diff is collapsed.
......@@ -223,16 +223,16 @@ region_global_to_output(struct weston_output *output, pixman_region32_t *region)
#define D2F(v) pixman_double_to_fixed((double)v)
static void
repaint_region(struct weston_surface *es, struct weston_output *output,
repaint_region(struct weston_view *ev, struct weston_output *output,
pixman_region32_t *region, pixman_region32_t *surf_region,
pixman_op_t pixman_op)
{
struct pixman_renderer *pr =
(struct pixman_renderer *) output->compositor->renderer;
struct pixman_surface_state *ps = get_surface_state(es);
struct pixman_surface_state *ps = get_surface_state(ev->surface);
struct pixman_output_state *po = get_output_state(output);
pixman_region32_t final_region;
float surface_x, surface_y;
float view_x, view_y;
pixman_transform_t transform;
pixman_fixed_t fw, fh;
......@@ -246,11 +246,11 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
pixman_region32_copy(&final_region, surf_region);
/* Convert from surface to global coordinates */
if (!es->transform.enabled) {
pixman_region32_translate(&final_region, es->geometry.x, es->geometry.y);
if (!ev->transform.enabled) {
pixman_region32_translate(&final_region, ev->geometry.x, ev->geometry.y);
} else {
weston_surface_to_global_float(es, 0, 0, &surface_x, &surface_y);
pixman_region32_translate(&final_region, (int)surface_x, (int)surface_y);
weston_view_to_global_float(ev, 0, 0, &view_x, &view_y);
pixman_region32_translate(&final_region, (int)view_x, (int)view_y);
}
/* We need to paint the intersection */
......@@ -314,22 +314,22 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
pixman_double_to_fixed (output->x),
pixman_double_to_fixed (output->y));
if (es->transform.enabled) {
if (ev->transform.enabled) {
/* Pixman supports only 2D transform matrix, but Weston uses 3D,
* so we're omitting Z coordinate here
*/
pixman_transform_t surface_transform = {{
{ D2F(es->transform.matrix.d[0]),
D2F(es->transform.matrix.d[4]),
D2F(es->transform.matrix.d[12]),
{ D2F(ev->transform.matrix.d[0]),
D2F(ev->transform.matrix.d[4]),
D2F(ev->transform.matrix.d[12]),
},
{ D2F(es->transform.matrix.d[1]),
D2F(es->transform.matrix.d[5]),
D2F(es->transform.matrix.d[13]),
{ D2F(ev->transform.matrix.d[1]),
D2F(ev->transform.matrix.d[5]),
D2F(ev->transform.matrix.d[13]),
},
{ D2F(es->transform.matrix.d[3]),
D2F(es->transform.matrix.d[7]),
D2F(es->transform.matrix.d[15]),
{ D2F(ev->transform.matrix.d[3]),
D2F(ev->transform.matrix.d[7]),
D2F(ev->transform.matrix.d[15]),
}
}};
......@@ -337,15 +337,15 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
pixman_transform_multiply (&transform, &surface_transform, &transform);
} else {
pixman_transform_translate(&transform, NULL,
pixman_double_to_fixed ((double)-es->geometry.x),
pixman_double_to_fixed ((double)-es->geometry.y));
pixman_double_to_fixed ((double)-ev->geometry.x),
pixman_double_to_fixed ((double)-ev->geometry.y));
}
fw = pixman_int_to_fixed(es->geometry.width);
fh = pixman_int_to_fixed(es->geometry.height);
fw = pixman_int_to_fixed(ev->geometry.width);
fh = pixman_int_to_fixed(ev->geometry.height);
switch (es->buffer_transform) {
switch (ev->surface->buffer_transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
......@@ -357,7 +357,7 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
break;
}
switch (es->buffer_transform) {
switch (ev->surface->buffer_transform) {
default:
case WL_OUTPUT_TRANSFORM_NORMAL:
case WL_OUTPUT_TRANSFORM_FLIPPED:
......@@ -380,12 +380,12 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
}
pixman_transform_scale(&transform, NULL,
pixman_double_to_fixed ((double)es->buffer_scale),
pixman_double_to_fixed ((double)es->buffer_scale));
pixman_double_to_fixed ((double)ev->surface->buffer_scale),
pixman_double_to_fixed ((double)ev->surface->buffer_scale));
pixman_image_set_transform(ps->image, &transform);
if (es->transform.enabled || output->current_scale != es->buffer_scale)
if (ev->transform.enabled || output->current_scale != ev->surface->buffer_scale)
pixman_image_set_filter(ps->image, PIXMAN_FILTER_BILINEAR, NULL, 0);
else
pixman_image_set_filter(ps->image, PIXMAN_FILTER_NEAREST, NULL, 0);
......@@ -417,10 +417,10 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
}
static void
draw_surface(struct weston_surface *es, struct weston_output *output,
pixman_region32_t *damage) /* in global coordinates */
draw_view(struct weston_view *ev, struct weston_output *output,
pixman_region32_t *damage) /* in global coordinates */
{
struct pixman_surface_state *ps = get_surface_state(es);
struct pixman_surface_state *ps = get_surface_state(ev->surface);
/* repaint bounding region in global coordinates: */
pixman_region32_t repaint;
/* non-opaque region in surface coordinates: */
......@@ -432,8 +432,8 @@ draw_surface(struct weston_surface *es, struct weston_output *output,
pixman_region32_init(&repaint);
pixman_region32_intersect(&repaint,
&es->transform.boundingbox, damage);
pixman_region32_subtract(&repaint, &repaint, &es->clip);
&ev->transform.boundingbox, damage);
pixman_region32_subtract(&repaint, &repaint, &ev->clip);
if (!pixman_region32_not_empty(&repaint))
goto out;
......@@ -444,21 +444,21 @@ draw_surface(struct weston_surface *es, struct weston_output *output,
}
/* TODO: Implement repaint_region_complex() using pixman_composite_trapezoids() */
if (es->transform.enabled &&
es->transform.matrix.type != WESTON_MATRIX_TRANSFORM_TRANSLATE) {
repaint_region(es, output, &repaint, NULL, PIXMAN_OP_OVER);
if (ev->transform.enabled &&
ev->transform.matrix.type != WESTON_MATRIX_TRANSFORM_TRANSLATE) {
repaint_region(ev, output, &repaint, NULL, PIXMAN_OP_OVER);
} else {
/* blended region is whole surface minus opaque region: */
pixman_region32_init_rect(&surface_blend, 0, 0,
es->geometry.width, es->geometry.height);
pixman_region32_subtract(&surface_blend, &surface_blend, &es->opaque);
ev->geometry.width, ev->geometry.height);
pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque);
if (pixman_region32_not_empty(&es->opaque)) {
repaint_region(es, output, &repaint, &es->opaque, PIXMAN_OP_SRC);
if (pixman_region32_not_empty(&ev->surface->opaque)) {
repaint_region(ev, output, &repaint, &ev->surface->opaque, PIXMAN_OP_SRC);
}
if (pixman_region32_not_empty(&surface_blend)) {
repaint_region(es, output, &repaint, &surface_blend, PIXMAN_OP_OVER);
repaint_region(ev, output, &repaint, &surface_blend, PIXMAN_OP_OVER);
}
pixman_region32_fini(&surface_blend);
}
......@@ -471,11 +471,11 @@ static void
repaint_surfaces(struct weston_output *output, pixman_region32_t *damage)
{
struct weston_compositor *compositor = output->compositor;
struct weston_surface *surface;
struct weston_view *view;
wl_list_for_each_reverse(surface, &compositor->surface_list, link)
if (surface->plane == &compositor->primary_plane)
draw_surface(surface, output, damage);
wl_list_for_each_reverse(view, &compositor->view_list, link)
if (view->plane == &compositor->primary_plane)
draw_view(view, output, damage);
}
static void
......
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,7 @@
#include "compositor.h"
WL_EXPORT void
weston_surface_geometry_dirty(struct weston_surface *surface)
weston_view_geometry_dirty(struct weston_view *view)
{
}
......@@ -36,7 +36,7 @@ weston_log(const char *fmt, ...)
}
WL_EXPORT void
weston_compositor_schedule_repaint(struct weston_compositor *compositor)
weston_view_schedule_repaint(struct weston_view *view)
{
}
......
......@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include <linux/input.h>
#include <assert.h>
#include "compositor.h"
#include "tablet-shell-server-protocol.h"
......@@ -124,27 +125,43 @@ tablet_shell_set_state(struct tablet_shell *shell, int state)
shell->state = state;
}
static struct weston_view *
get_surface_view(struct weston_surface *surface, int create)
{
if (!surface)
return NULL;
if (wl_list_empty(&surface->views)) {
if (create)
return weston_view_create(surface);
else
return NULL;
}
return container_of