Remove the weston_view.geometry.width/height fields

This has a couple of additional implications for the internal weston API:
 1) weston_view_configure no longer exists.  Use weston_view_set_position
    instead.
 2) The weston_surface.configure callback no longer takes a width and
    height.  If you need these, surface.width/height are set before
    configure is called.  If you need to know when the width/height
    changes, you must track that yourself.
dev
Jason Ekstrand 11 years ago committed by Kristian Høgsberg
parent fdca95c7db
commit 918f2dd4cf
  1. 8
      src/animation.c
  2. 24
      src/compositor-drm.c
  3. 70
      src/compositor.c
  4. 7
      src/compositor.h
  5. 2
      src/data-device.c
  6. 2
      src/gl-renderer.c
  7. 9
      src/input.c
  8. 6
      src/pixman-renderer.c
  9. 4
      src/rpi-renderer.c
  10. 164
      src/shell.c
  11. 6
      src/tablet-shell.c
  12. 4
      tests/surface-global-test.c
  13. 4
      tests/surface-test.c
  14. 7
      tests/weston-test.c

@ -240,12 +240,12 @@ zoom_frame(struct weston_view_animation *animation)
animation->spring.current; animation->spring.current;
weston_matrix_init(&animation->transform.matrix); weston_matrix_init(&animation->transform.matrix);
weston_matrix_translate(&animation->transform.matrix, weston_matrix_translate(&animation->transform.matrix,
-0.5f * es->geometry.width, -0.5f * es->surface->width,
-0.5f * es->geometry.height, 0); -0.5f * es->surface->height, 0);
weston_matrix_scale(&animation->transform.matrix, scale, scale, scale); weston_matrix_scale(&animation->transform.matrix, scale, scale, scale);
weston_matrix_translate(&animation->transform.matrix, weston_matrix_translate(&animation->transform.matrix,
0.5f * es->geometry.width, 0.5f * es->surface->width,
0.5f * es->geometry.height, 0); 0.5f * es->surface->height, 0);
es->alpha = animation->spring.current; es->alpha = animation->spring.current;
if (es->alpha > 1.0) if (es->alpha > 1.0)

@ -777,8 +777,8 @@ drm_output_check_sprite_format(struct drm_sprite *s,
pixman_region32_t r; pixman_region32_t r;
pixman_region32_init_rect(&r, 0, 0, pixman_region32_init_rect(&r, 0, 0,
ev->geometry.width, ev->surface->width,
ev->geometry.height); ev->surface->height);
pixman_region32_subtract(&r, &r, &ev->surface->opaque); pixman_region32_subtract(&r, &r, &ev->surface->opaque);
if (!pixman_region32_not_empty(&r)) if (!pixman_region32_not_empty(&r))
@ -919,18 +919,18 @@ drm_output_prepare_overlay_view(struct weston_output *output_base,
sx1 = 0; sx1 = 0;
if (sy1 < 0) if (sy1 < 0)
sy1 = 0; sy1 = 0;
if (sx2 > wl_fixed_from_int(ev->geometry.width)) if (sx2 > wl_fixed_from_int(ev->surface->width))
sx2 = wl_fixed_from_int(ev->geometry.width); sx2 = wl_fixed_from_int(ev->surface->width);
if (sy2 > wl_fixed_from_int(ev->geometry.height)) if (sy2 > wl_fixed_from_int(ev->surface->height))
sy2 = wl_fixed_from_int(ev->geometry.height); sy2 = wl_fixed_from_int(ev->surface->height);
tbox.x1 = sx1; tbox.x1 = sx1;
tbox.y1 = sy1; tbox.y1 = sy1;
tbox.x2 = sx2; tbox.x2 = sx2;
tbox.y2 = sy2; tbox.y2 = sy2;
tbox = weston_transformed_rect(wl_fixed_from_int(ev->geometry.width), tbox = weston_transformed_rect(wl_fixed_from_int(ev->surface->width),
wl_fixed_from_int(ev->geometry.height), wl_fixed_from_int(ev->surface->height),
ev->surface->buffer_viewport.transform, ev->surface->buffer_viewport.transform,
ev->surface->buffer_viewport.scale, ev->surface->buffer_viewport.scale,
tbox); tbox);
@ -964,7 +964,7 @@ drm_output_prepare_cursor_view(struct weston_output *output_base,
return NULL; return NULL;
if (ev->surface->buffer_ref.buffer == NULL || if (ev->surface->buffer_ref.buffer == NULL ||
!wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) || !wl_shm_buffer_get(ev->surface->buffer_ref.buffer->resource) ||
ev->geometry.width > 64 || ev->geometry.height > 64) ev->surface->width > 64 || ev->surface->height > 64)
return NULL; return NULL;
output->cursor_view = ev; output->cursor_view = ev;
@ -1003,9 +1003,9 @@ drm_output_set_cursor(struct drm_output *output)
stride = wl_shm_buffer_get_stride(buffer->shm_buffer); stride = wl_shm_buffer_get_stride(buffer->shm_buffer);
s = wl_shm_buffer_get_data(buffer->shm_buffer); s = wl_shm_buffer_get_data(buffer->shm_buffer);
wl_shm_buffer_begin_access(buffer->shm_buffer); wl_shm_buffer_begin_access(buffer->shm_buffer);
for (i = 0; i < ev->geometry.height; i++) for (i = 0; i < ev->surface->height; i++)
memcpy(buf + i * 64, s + i * stride, memcpy(buf + i * 64, s + i * stride,
ev->geometry.width * 4); ev->surface->width * 4);
wl_shm_buffer_end_access(buffer->shm_buffer); wl_shm_buffer_end_access(buffer->shm_buffer);
if (gbm_bo_write(bo, buf, sizeof buf) < 0) if (gbm_bo_write(bo, buf, sizeof buf) < 0)
@ -1071,7 +1071,7 @@ drm_assign_planes(struct weston_output *output)
if (c->use_pixman || if (c->use_pixman ||
(es->buffer_ref.buffer && (es->buffer_ref.buffer &&
(!wl_shm_buffer_get(es->buffer_ref.buffer->resource) || (!wl_shm_buffer_get(es->buffer_ref.buffer->resource) ||
(ev->geometry.width <= 64 && ev->geometry.height <= 64)))) (ev->surface->width <= 64 && ev->surface->height <= 64))))
es->keep_buffer = 1; es->keep_buffer = 1;
else else
es->keep_buffer = 0; es->keep_buffer = 0;

@ -863,8 +863,8 @@ weston_view_update_transform_disable(struct weston_view *view)
pixman_region32_init_rect(&view->transform.boundingbox, pixman_region32_init_rect(&view->transform.boundingbox,
view->geometry.x, view->geometry.x,
view->geometry.y, view->geometry.y,
view->geometry.width, view->surface->width,
view->geometry.height); view->surface->height);
if (view->alpha == 1.0) { if (view->alpha == 1.0) {
pixman_region32_copy(&view->transform.opaque, pixman_region32_copy(&view->transform.opaque,
@ -904,8 +904,8 @@ weston_view_update_transform_enable(struct weston_view *view)
return -1; return -1;
} }
view_compute_bbox(view, 0, 0, view->geometry.width, view_compute_bbox(view, 0, 0,
view->geometry.height, view->surface->width, view->surface->height,
&view->transform.boundingbox); &view->transform.boundingbox);
return 0; return 0;
@ -1069,20 +1069,12 @@ weston_surface_damage(struct weston_surface *surface)
weston_surface_schedule_repaint(surface); weston_surface_schedule_repaint(surface);
} }
WL_EXPORT void
weston_view_configure(struct weston_view *view,
float x, float y, int width, int height)
{
view->geometry.x = x;
view->geometry.y = y;
view->geometry.width = width;
view->geometry.height = height;
weston_view_geometry_dirty(view);
}
WL_EXPORT void WL_EXPORT void
weston_view_set_position(struct weston_view *view, float x, float y) weston_view_set_position(struct weston_view *view, float x, float y)
{ {
if (view->geometry.x == x && view->geometry.y == y)
return;
view->geometry.x = x; view->geometry.x = x;
view->geometry.y = y; view->geometry.y = y;
weston_view_geometry_dirty(view); weston_view_geometry_dirty(view);
@ -1140,14 +1132,29 @@ weston_surface_is_mapped(struct weston_surface *surface)
return 0; return 0;
} }
static void
weston_surface_set_size(struct weston_surface *surface,
int32_t width, int32_t height)
{
struct weston_view *view;
if (surface->width == width && surface->height == height)
return;
surface->width = width;
surface->height = height;
wl_list_for_each(view, &surface->views, surface_link)
weston_view_geometry_dirty(view);
}
static void static void
weston_surface_set_size_from_buffer(struct weston_surface *surface) weston_surface_set_size_from_buffer(struct weston_surface *surface)
{ {
int32_t width, height; int32_t width, height;
if (!surface->buffer_ref.buffer) { if (!surface->buffer_ref.buffer) {
surface->width = 0; weston_surface_set_size(surface, 0, 0);
surface->height = 0;
return; return;
} }
@ -1165,8 +1172,9 @@ weston_surface_set_size_from_buffer(struct weston_surface *surface)
break; break;
} }
surface->width = width / surface->buffer_viewport.scale; width = width / surface->buffer_viewport.scale;
surface->height = height / surface->buffer_viewport.scale; height = height / surface->buffer_viewport.scale;
weston_surface_set_size(surface, width, height);
} }
WL_EXPORT uint32_t WL_EXPORT uint32_t
@ -1589,11 +1597,9 @@ view_list_add_subsurface_view(struct weston_compositor *compositor,
wl_list_insert(&sub->surface->views, &view->surface_link); wl_list_insert(&sub->surface->views, &view->surface_link);
} else { } else {
view = weston_view_create(sub->surface); view = weston_view_create(sub->surface);
weston_view_configure(view, weston_view_set_position(view,
sub->position.x, sub->position.x,
sub->position.y, sub->position.y);
sub->surface->width,
sub->surface->height);
weston_view_set_transform_parent(view, parent); weston_view_set_transform_parent(view, parent);
} }
@ -1957,8 +1963,7 @@ weston_surface_commit(struct weston_surface *surface)
if (surface->configure && surface->pending.newly_attached) if (surface->configure && surface->pending.newly_attached)
surface->configure(surface, surface->configure(surface,
surface->pending.sx, surface->pending.sy, surface->pending.sx, surface->pending.sy);
surface->width, surface->height);
if (surface->pending.buffer) if (surface->pending.buffer)
wl_list_remove(&surface->pending.buffer_destroy_listener.link); wl_list_remove(&surface->pending.buffer_destroy_listener.link);
@ -2183,8 +2188,7 @@ weston_subsurface_commit_from_cache(struct weston_subsurface *sub)
weston_surface_set_size_from_buffer(surface); weston_surface_set_size_from_buffer(surface);
if (surface->configure && sub->cached.newly_attached) if (surface->configure && sub->cached.newly_attached)
surface->configure(surface, sub->cached.sx, sub->cached.sy, surface->configure(surface, sub->cached.sx, sub->cached.sy);
surface->width, surface->height);
sub->cached.sx = 0; sub->cached.sx = 0;
sub->cached.sy = 0; sub->cached.sy = 0;
sub->cached.newly_attached = 0; sub->cached.newly_attached = 0;
@ -2355,17 +2359,15 @@ weston_subsurface_parent_commit(struct weston_subsurface *sub,
} }
static void static void
subsurface_configure(struct weston_surface *surface, int32_t dx, int32_t dy, subsurface_configure(struct weston_surface *surface, int32_t dx, int32_t dy)
int32_t width, int32_t height)
{ {
struct weston_compositor *compositor = surface->compositor; struct weston_compositor *compositor = surface->compositor;
struct weston_view *view; struct weston_view *view;
wl_list_for_each(view, &surface->views, surface_link) wl_list_for_each(view, &surface->views, surface_link)
weston_view_configure(view, weston_view_set_position(view,
view->geometry.x + dx, view->geometry.x + dx,
view->geometry.y + dy, view->geometry.y + dy);
width, height);
/* No need to check parent mappedness, because if parent is not /* No need to check parent mappedness, because if parent is not
* mapped, parent is not in a visible layer, so this sub-surface * mapped, parent is not in a visible layer, so this sub-surface

@ -761,7 +761,6 @@ struct weston_view {
*/ */
struct { struct {
float x, y; /* surface translation on display */ float x, y; /* surface translation on display */
int32_t width, height;
/* struct weston_transform */ /* struct weston_transform */
struct wl_list transformation_list; struct wl_list transformation_list;
@ -875,7 +874,7 @@ struct weston_surface {
* a new buffer has been set up for this surface. The integer params * a new buffer has been set up for this surface. The integer params
* are the sx and sy paramerters supplied to surface::attach . * are the sx and sy paramerters supplied to surface::attach .
*/ */
void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height); void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
void *configure_private; void *configure_private;
/* Parent's list of its sub-surfaces, weston_subsurface:parent_link. /* Parent's list of its sub-surfaces, weston_subsurface:parent_link.
@ -1122,10 +1121,6 @@ weston_view_create(struct weston_surface *surface);
void void
weston_view_destroy(struct weston_view *view); weston_view_destroy(struct weston_view *view);
void
weston_view_configure(struct weston_view *view,
float x, float y, int width, int height);
void void
weston_view_set_position(struct weston_view *view, weston_view_set_position(struct weston_view *view,
float x, float y); float x, float y);

@ -218,7 +218,7 @@ drag_surface_configure(struct weston_drag *drag,
fx = wl_fixed_to_double(touch->grab_x) + drag->dx; fx = wl_fixed_to_double(touch->grab_x) + drag->dx;
fy = wl_fixed_to_double(touch->grab_y) + drag->dy; fy = wl_fixed_to_double(touch->grab_y) + drag->dy;
} }
weston_view_configure(drag->icon, fx, fy, width, height); weston_view_set_position(drag->icon, fx, fy);
} }
static void static void

@ -550,7 +550,7 @@ draw_view(struct weston_view *ev, struct weston_output *output,
/* blended region is whole surface minus opaque region: */ /* blended region is whole surface minus opaque region: */
pixman_region32_init_rect(&surface_blend, 0, 0, pixman_region32_init_rect(&surface_blend, 0, 0,
ev->geometry.width, ev->geometry.height); ev->surface->width, ev->surface->height);
pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque);
/* XXX: Should we be using ev->transform.opaque here? */ /* XXX: Should we be using ev->transform.opaque here? */

@ -1431,12 +1431,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
static void static void
pointer_cursor_surface_configure(struct weston_surface *es, pointer_cursor_surface_configure(struct weston_surface *es,
int32_t dx, int32_t dy, int32_t width, int32_t height) int32_t dx, int32_t dy)
{ {
struct weston_pointer *pointer = es->configure_private; struct weston_pointer *pointer = es->configure_private;
int x, y; int x, y;
if (width == 0) if (es->width == 0)
return; return;
assert(es == pointer->sprite->surface); assert(es == pointer->sprite->surface);
@ -1447,7 +1447,7 @@ pointer_cursor_surface_configure(struct weston_surface *es,
x = wl_fixed_to_int(pointer->x) - pointer->hotspot_x; x = wl_fixed_to_int(pointer->x) - pointer->hotspot_x;
y = wl_fixed_to_int(pointer->y) - pointer->hotspot_y; y = wl_fixed_to_int(pointer->y) - pointer->hotspot_y;
weston_view_configure(pointer->sprite, x, y, width, height); weston_view_set_position(pointer->sprite, x, y);
empty_region(&es->pending.input); empty_region(&es->pending.input);
@ -1507,8 +1507,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
pointer->hotspot_y = y; pointer->hotspot_y = y;
if (surface->buffer_ref.buffer) if (surface->buffer_ref.buffer)
pointer_cursor_surface_configure(surface, 0, 0, surface->width, pointer_cursor_surface_configure(surface, 0, 0);
surface->height);
} }
static void static void

@ -257,8 +257,8 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
} }
fw = pixman_int_to_fixed(ev->geometry.width); fw = pixman_int_to_fixed(ev->surface->width);
fh = pixman_int_to_fixed(ev->geometry.height); fh = pixman_int_to_fixed(ev->surface->height);
switch (ev->surface->buffer_viewport.transform) { switch (ev->surface->buffer_viewport.transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED: case WL_OUTPUT_TRANSFORM_FLIPPED:
@ -371,7 +371,7 @@ draw_view(struct weston_view *ev, struct weston_output *output,
} else { } else {
/* blended region is whole surface minus opaque region: */ /* blended region is whole surface minus opaque region: */
pixman_region32_init_rect(&surface_blend, 0, 0, pixman_region32_init_rect(&surface_blend, 0, 0,
ev->geometry.width, ev->geometry.height); ev->surface->width, ev->surface->height);
pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque);
if (pixman_region32_not_empty(&ev->surface->opaque)) { if (pixman_region32_not_empty(&ev->surface->opaque)) {

@ -732,8 +732,8 @@ rpir_view_compute_rects(struct rpir_view *view,
} }
} }
p2.f[0] = view->view->geometry.width; p2.f[0] = view->view->surface->width;
p2.f[1] = view->view->geometry.height; p2.f[1] = view->view->surface->height;
/* transform top-left and bot-right corner into screen coordinates */ /* transform top-left and bot-right corner into screen coordinates */
weston_matrix_transform(&matrix, &p1); weston_matrix_transform(&matrix, &p1);

@ -295,6 +295,7 @@ struct shell_surface {
struct weston_surface *surface; struct weston_surface *surface;
struct weston_view *view; struct weston_view *view;
int32_t last_width, last_height;
struct wl_listener surface_destroy_listener; struct wl_listener surface_destroy_listener;
struct weston_surface *parent; struct weston_surface *parent;
struct wl_list children_list; /* child surfaces of this one */ struct wl_list children_list; /* child surfaces of this one */
@ -620,8 +621,7 @@ get_default_output(struct weston_compositor *compositor)
/* no-op func for checking focus surface */ /* no-op func for checking focus surface */
static void static void
focus_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, focus_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
int32_t width, int32_t height)
{ {
} }
@ -671,8 +671,9 @@ create_focus_surface(struct weston_compositor *ec,
fsurf->view = weston_view_create (surface); fsurf->view = weston_view_create (surface);
fsurf->view->output = output; fsurf->view->output = output;
weston_view_configure(fsurf->view, output->x, output->y, surface->width = output->width;
output->width, output->height); surface->height = output->height;
weston_view_set_position(fsurf->view, output->x, output->y);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
pixman_region32_fini(&surface->opaque); pixman_region32_fini(&surface->opaque);
pixman_region32_init_rect(&surface->opaque, output->x, output->y, pixman_region32_init_rect(&surface->opaque, output->x, output->y,
@ -1478,9 +1479,7 @@ touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time,
es = shsurf->surface; es = shsurf->surface;
weston_view_configure(shsurf->view, dx, dy, weston_view_set_position(shsurf->view, dx, dy);
shsurf->view->geometry.width,
shsurf->view->geometry.height);
weston_compositor_schedule_repaint(es->compositor); weston_compositor_schedule_repaint(es->compositor);
} }
@ -1552,9 +1551,7 @@ move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
if (!shsurf) if (!shsurf)
return; return;
weston_view_configure(shsurf->view, dx, dy, weston_view_set_position(shsurf->view, dx, dy);
shsurf->view->geometry.width,
shsurf->view->geometry.height);
weston_compositor_schedule_repaint(shsurf->surface->compositor); weston_compositor_schedule_repaint(shsurf->surface->compositor);
} }
@ -2080,7 +2077,7 @@ get_output_panel_height(struct desktop_shell *shell,
wl_list_for_each(view, &shell->panel_layer.view_list, layer_link) { wl_list_for_each(view, &shell->panel_layer.view_list, layer_link) {
if (view->surface->output == output) { if (view->surface->output == output) {
panel_height = view->geometry.height; panel_height = view->surface->height;
break; break;
} }
} }
@ -2537,7 +2534,7 @@ shell_surface_get_shell(struct shell_surface *shsurf)
} }
static void static void
black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height); black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy);
static struct weston_view * static struct weston_view *
create_black_surface(struct weston_compositor *ec, create_black_surface(struct weston_compositor *ec,
@ -2566,10 +2563,10 @@ create_black_surface(struct weston_compositor *ec,
pixman_region32_init_rect(&surface->opaque, 0, 0, w, h); pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
pixman_region32_fini(&surface->input); pixman_region32_fini(&surface->input);
pixman_region32_init_rect(&surface->input, 0, 0, w, h); pixman_region32_init_rect(&surface->input, 0, 0, w, h);
surface->width = w; surface->width = w;
surface->height = h; surface->height = h;
weston_view_set_position(view, x, y);
weston_view_configure(view, x, y, w, h);
return view; return view;
} }
@ -2667,11 +2664,11 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
weston_view_set_position(shsurf->view, weston_view_set_position(shsurf->view,
output->x - surf_x, output->x - surf_x,
output->y - surf_y); output->y - surf_y);
weston_view_configure(shsurf->fullscreen.black_view, shsurf->fullscreen.black_view->surface->width = output->width;
output->x - surf_x, shsurf->fullscreen.black_view->surface->height = output->height;
output->y - surf_y, weston_view_set_position(shsurf->fullscreen.black_view,
output->width, output->x - surf_x,
output->height); output->y - surf_y);
break; break;
} else { } else {
restore_output_mode(output); restore_output_mode(output);
@ -3002,7 +2999,7 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
} }
static void static void
shell_surface_configure(struct weston_surface *, int32_t, int32_t, int32_t, int32_t); shell_surface_configure(struct weston_surface *, int32_t, int32_t);
static struct shell_surface * static struct shell_surface *
get_shell_surface(struct weston_surface *surface) get_shell_surface(struct weston_surface *surface)
@ -3179,13 +3176,10 @@ terminate_screensaver(struct desktop_shell *shell)
} }
static void static void
configure_static_view(struct weston_view *ev, struct weston_layer *layer, int32_t width, int32_t height) configure_static_view(struct weston_view *ev, struct weston_layer *layer)
{ {
struct weston_view *v, *next; struct weston_view *v, *next;
if (width == 0)
return;
wl_list_for_each_safe(v, next, &layer->view_list, layer_link) { wl_list_for_each_safe(v, next, &layer->view_list, layer_link) {
if (v->output == ev->output && v != ev) { if (v->output == ev->output && v != ev) {
weston_view_unmap(v); weston_view_unmap(v);
@ -3193,7 +3187,7 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer, int32_
} }
} }
weston_view_configure(ev, ev->output->x, ev->output->y, width, height); weston_view_set_position(ev, ev->output->x, ev->output->y);
if (wl_list_empty(&ev->layer_link)) { if (wl_list_empty(&ev->layer_link)) {
wl_list_insert(&layer->view_list, &ev->layer_link); wl_list_insert(&layer->view_list, &ev->layer_link);
@ -3202,14 +3196,14 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer, int32_
} }
static void static void
background_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height) background_configure(struct weston_surface *es, int32_t sx, int32_t sy)
{ {
struct desktop_shell *shell = es->configure_private; struct desktop_shell *shell = es->configure_private;
struct weston_view *view; struct weston_view *view;
view = container_of(es->views.next, struct weston_view, surface_link); view = container_of(es->views.next, struct weston_view, surface_link);
configure_static_view(view, &shell->background_layer, width, height); configure_static_view(view, &shell->background_layer);
} }
static void static void
@ -3245,14 +3239,14 @@ desktop_shell_set_background(struct wl_client *client,
} }
static void static void
panel_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height) panel_configure(struct weston_surface *es, int32_t sx, int32_t sy)
{ {
struct desktop_shell *shell = es->configure_private; struct desktop_shell *shell = es->configure_private;
struct weston_view *view; struct weston_view *view;
view = container_of(es->views.next, struct weston_view, surface_link); view = container_of(es->views.next, struct weston_view, surface_link);
configure_static_view(view, &shell->panel_layer, width, height); configure_static_view(view, &shell->panel_layer);
} }
static void static void
@ -3288,20 +3282,16 @@ desktop_shell_set_panel(struct wl_client *client,
} }
static void static void
lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy, int32_t width, int32_t height) lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
{ {
struct desktop_shell *shell = surface->configure_private; struct desktop_shell *shell = surface->configure_private;
struct weston_view *view; struct weston_view *view;
view = container_of(surface->views.next, struct weston_view, surface_link); view = container_of(surface->views.next, struct weston_view, surface_link);
if (width == 0) if (surface->width == 0)
return; return;
surface->width = width;
surface->height = height;
view->geometry.width = width;
view->geometry.height = height;
center_on_output(view, get_default_output(shell->compositor)); center_on_output(view, get_default_output(shell->compositor));
if (!weston_surface_is_mapped(surface)) { if (!weston_surface_is_mapped(surface)) {
@ -3488,16 +3478,16 @@ resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *d
wl_fixed_to_int(seat->pointer->grab_y), wl_fixed_to_int(seat->pointer->grab_y),
&x, &y); &x, &y);
if (x < shsurf->view->geometry.width / 3) if (x < shsurf->surface->width / 3)
edges |= WL_SHELL_SURFACE_RESIZE_LEFT; edges |= WL_SHELL_SURFACE_RESIZE_LEFT;
else if (x < 2 * shsurf->view->geometry.width / 3) else if (x < 2 * shsurf->surface->width / 3)
edges |= 0; edges |= 0;
else else
edges |= WL_SHELL_SURFACE_RESIZE_RIGHT; edges |= WL_SHELL_SURFACE_RESIZE_RIGHT;
if (y < shsurf->view->geometry.height / 3) if (y < shsurf->surface->height / 3)
edges |= WL_SHELL_SURFACE_RESIZE_TOP; edges |= WL_SHELL_SURFACE_RESIZE_TOP;
else if (y < 2 * shsurf->view->geometry.height / 3) else if (y < 2 * shsurf->surface->height / 3)
edges |= 0; edges |= 0;
else else
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM; edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
@ -3817,15 +3807,15 @@ alt_tab_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
weston_view_damage_below(v); weston_view_damage_below(v);
weston_surface_damage(v->surface); weston_surface_damage(v->surface);
weston_view_configure(v, x, y, view->geometry.width, view->geometry.height); weston_view_set_position(v, x, y);
preview->listener.notify = alt_tab_handle_surface_destroy; preview->listener.notify = alt_tab_handle_surface_destroy;
wl_signal_add(&v->destroy_signal, &preview->listener); wl_signal_add(&v->destroy_signal, &preview->listener);
if (view->geometry.width > view->geometry.height) if (view->surface->width > view->surface->height)
scale = side / (float) view->geometry.width; scale = side / (float) view->surface->width;
else else
scale = side / (float) view->geometry.height; scale = side / (float) view->surface->height;
wl_list_insert(&v->geometry.transformation_list, wl_list_insert(&v->geometry.transformation_list,
&preview->transform.link); &preview->transform.link);
@ -3864,8 +3854,8 @@ rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
if (!shsurf) if (!shsurf)
return; return;
cx = 0.5f * shsurf->view->geometry.width; cx = 0.5f * shsurf->surface->width;
cy = 0.5f * shsurf->view->geometry.height; cy = 0.5f * shsurf->surface->height;
dx = wl_fixed_to_double(pointer->x) - rotate->center.x; dx = wl_fixed_to_double(pointer->x) - rotate->center.x;
dy = wl_fixed_to_double(pointer->y) - rotate->center.y; dy = wl_fixed_to_double(pointer->y) - rotate->center.y;
@ -3963,8 +3953,8 @@ surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
return; return;
weston_view_to_global_float(surface->view, weston_view_to_global_float(surface->view,
surface->view->geometry.width * 0.5f, surface->surface->width * 0.5f,
surface->view->geometry.height * 0.5f, surface->surface->height * 0.5f,
&rotate->center.x, &rotate->center.y); &rotate->center.x, &rotate->center.y);
dx = wl_fixed_to_double(seat->pointer->x) - rotate->center.x; dx = wl_fixed_to_double(seat->pointer->x) - rotate->center.x;
@ -4078,7 +4068,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
/* no-op func for checking black surface */ /* no-op func for checking black surface */
static void static void
black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height) black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
{ {
} }
@ -4221,7 +4211,9 @@ shell_fade_create_surface(struct desktop_shell *shell)
return NULL; return NULL;
} }
weston_view_configure(view, 0, 0, 8192, 8192); surface->width = 8192;
surface->height = 8192;
weston_view_set_position(view, 0, 0);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0); weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
wl_list_insert(&compositor->fade_layer.view_list, wl_list_insert(&compositor->fade_layer.view_list,
&view->layer_link); &view->layer_link);
@ -4380,7 +4372,7 @@ show_input_panels(struct wl_listener *listener, void *data)
weston_view_geometry_dirty(ipsurf->view); weston_view_geometry_dirty(ipsurf->view);
weston_view_update_transform(ipsurf->view); weston_view_update_transform(ipsurf->view);
weston_surface_damage(ipsurf->surface); weston_surface_damage(ipsurf->surface);
weston_slide_run(ipsurf->view, ipsurf->view->geometry.height, weston_slide_run(ipsurf->view, ipsurf->surface->height,
0, NULL, NULL); 0, NULL, NULL);
} }
} }
@ -4427,7 +4419,7 @@ center_on_output(struct weston_view *view, struct weston_output *output)
x = output->x + (output->width - width) / 2 - surf_x / 2; x = output->x + (output->width - width) / 2 - surf_x / 2;
y = output->y + (output->height - height) / 2 - surf_y / 2; y = output->y + (output->height - height) / 2 - surf_y / 2;
weston_view_configure(view, x, y, width, height); weston_view_set_position(view, x, y);
} }
static void static void
@ -4472,9 +4464,9 @@ weston_view_set_initial_position(struct weston_view *view,
* output. * output.
*/ */
panel_height = get_output_panel_height(shell, target_output); panel_height = get_output_panel_height(shell, target_output);
range_x = target_output->width - view->geometry.width; range_x = target_output->width - view->surface->width;
range_y = (target_output->height - panel_height) - range_y = (target_output->height - panel_height) -
view->geometry.height; view->surface->height;
if (range_x > 0) if (range_x > 0)
dx = random() % range_x; dx = random() % range_x;
@ -4494,17 +4486,13 @@ weston_view_set_initial_position(struct weston_view *view,
static void static void
map(struct desktop_shell *shell, struct shell_surface *shsurf, map(struct desktop_shell *shell, struct shell_surface *shsurf,
int32_t width, int32_t height, int32_t sx, int32_t sy) int32_t sx, int32_t sy)
{ {
struct weston_compositor *compositor = shell->compositor; struct weston_compositor *compositor = shell->compositor;
struct weston_seat *seat; struct weston_seat *seat;
int panel_height = 0; int panel_height = 0;
int32_t surf_x, surf_y; int32_t surf_x, surf_y;
shsurf->view->geometry.width = width;
shsurf->view->geometry.height = height;
weston_view_geometry_dirty(shsurf->view);
/* initial positioning, see also configure() */ /* initial positioning, see also configure() */
switch (shsurf->type) { switch (shsurf->type) {
case SHELL_SURFACE_TOPLEVEL: case SHELL_SURFACE_TOPLEVEL:
@ -4587,24 +4575,17 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
static void static void
configure(struct desktop_shell *shell, struct weston_surface *surface, configure(struct desktop_shell *shell, struct weston_surface *surface,
float x, float y, int32_t width, int32_t height) float x, float y)
{ {
enum shell_surface_type surface_type = SHELL_SURFACE_NONE; enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct weston_view *view; struct weston_view *view;
int32_t surf_x, surf_y; int32_t mx, my, surf_x, surf_y;
shsurf = get_shell_surface(surface); shsurf = get_shell_surface(surface);
if (shsurf) if (shsurf)
surface_type = shsurf->type; surface_type = shsurf->type;
/* TODO:
* This should probably be changed to be more shell_surface
* dependent
*/
wl_list_for_each(view, &surface->views, surface_link)
weston_view_configure(view, x, y, width, height);
switch (surface_type) { switch (surface_type) {
case SHELL_SURFACE_FULLSCREEN: case SHELL_SURFACE_FULLSCREEN:
shell_configure_fullscreen(shsurf); shell_configure_fullscreen(shsurf);
@ -4613,9 +4594,10 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
/* setting x, y and using configure to change that geometry */ /* setting x, y and using configure to change that geometry */
surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y, surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y,
NULL, NULL); NULL, NULL);
shsurf->view->geometry.x = shsurf->output->x - surf_x; mx = shsurf->output->x - surf_x;
shsurf->view->geometry.y = shsurf->output->y + my = shsurf->output->y +
get_output_panel_height(shell,shsurf->output) - surf_y; get_output_panel_height(shell,shsurf->output) - surf_y;
weston_view_set_position(shsurf->view, mx, my);
break; break;
case SHELL_SURFACE_TOPLEVEL: case SHELL_SURFACE_TOPLEVEL:
case SHELL_SURFACE_TRANSIENT: case SHELL_SURFACE_TRANSIENT:
@ -4623,6 +4605,7 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
case SHELL_SURFACE_XWAYLAND: case SHELL_SURFACE_XWAYLAND:
case SHELL_SURFACE_NONE: case SHELL_SURFACE_NONE:
default: default:
weston_view_set_position(shsurf->view, x, y);
break; break;
} }
@ -4637,7 +4620,7 @@ configure(struct desktop_shell *shell, struct weston_surface *surface,
} }
static void static void
shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32_t width, int32_t height) shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
{ {
struct shell_surface *shsurf = get_shell_surface(es); struct shell_surface *shsurf = get_shell_surface(es);
struct desktop_shell *shell = shsurf->shell; struct desktop_shell *shell = shsurf->shell;
@ -4649,7 +4632,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32
remove_popup_grab(shsurf); remove_popup_grab(shsurf);
} }
if (width == 0) if (es->width == 0)
return; return;
if (shsurf->next_type != SHELL_SURFACE_NONE && if (shsurf->next_type != SHELL_SURFACE_NONE &&
@ -4659,10 +4642,12 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32
} }
if (!weston_surface_is_mapped(es)) { if (!weston_surface_is_mapped(es)) {
map(shell, shsurf, width, height, sx, sy); map(shell, shsurf, sx, sy);
} else if (type_changed || sx != 0 || sy != 0 || } else if (type_changed || sx != 0 || sy != 0 ||
shsurf->view->geometry.width != width || shsurf->last_width != es->width ||
shsurf->view->geometry.height != height) { shsurf->last_height != es->height) {
shsurf->last_width = es->width;
shsurf->last_height = es->height;
float from_x, from_y; float from_x, from_y;
float to_x, to_y; float to_x, to_y;
@ -4670,8 +4655,7 @@ shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, int32
weston_view_to_global_float(shsurf->view, sx, sy, &to_x, &to_y); weston_view_to_global_float(shsurf->view, sx, sy, &to_x, &to_y);
configure(shell, es, configure(shell, es,
shsurf->view->geometry.x + to_x - from_x, shsurf->view->geometry.x + to_x - from_x,
shsurf->view->geometry.y + to_y - from_y, shsurf->view->geometry.y + to_y - from_y);
width, height);
} }
} }
@ -4771,12 +4755,12 @@ bind_desktop_shell(struct wl_client *client,
} }
static void static void
screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy, int32_t width, int32_t height) screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
{ {
struct desktop_shell *shell = surface->configure_private; struct desktop_shell *shell = surface->configure_private;
struct weston_view *view; struct weston_view *view;
if (width == 0) if (surface->width == 0)
return; return;
/* XXX: starting weston-screensaver beforehand does not work */ /* XXX: starting weston-screensaver beforehand does not work */
@ -4853,14 +4837,14 @@ bind_screensaver(struct wl_client *client,
} }
static void static void
input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, int32_t width, int32_t height) input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
{ {
struct input_panel_surface *ip_surface = surface->configure_private; struct input_panel_surface *ip_surface = surface->configure_private;
struct desktop_shell *shell = ip_surface->shell; struct desktop_shell *shell = ip_surface->shell;
float x, y; float x, y;
uint32_t show_surface = 0; uint32_t show_surface = 0;
if (width == 0) if (surface->width == 0)
return; return;
if (!weston_surface_is_mapped(surface)) { if (!weston_surface_is_mapped(surface)) {
@ -4876,18 +4860,18 @@ input_panel_configure(struct weston_surface *surface, int32_t sx, int32_t sy, in
x = get_default_view(shell->text_input.surface)->geometry.x + shell->text_input.cursor_rectangle.x2; x = get_default_view(shell->text_input.surface)->geometry.x + shell->text_input.cursor_rectangle.x2;
y = get_default_view(shell->text_input.surface)->geometry.y + shell->text_input.cursor_rectangle.y2; y = get_default_view(shell->text_input.surface)->geometry.y + shell->text_input.cursor_rectangle.y2;
} else { } else {
x = ip_surface->output->x + (ip_surface->output->width - width) / 2; x = ip_surface->output->x + (ip_surface->output->width - surface->width) / 2;
y = ip_surface->output->y + ip_surface->output->height - height; y = ip_surface->output->y + ip_surface->output->height - surface->height;
} }
weston_view_configure(ip_surface->view, x, y, width, height); weston_view_set_position(ip_surface->view, x, y);
if (show_surface) { if (show_surface) {
wl_list_insert(&shell->input_panel_layer.view_list, wl_list_insert(&shell->input_panel_layer.view_list,
&ip_surface->view->layer_link); &ip_surface->view->layer_link);
weston_view_update_transform(ip_surface->view); weston_view_update_transform(ip_surface->view);
weston_surface_damage(surface); weston_surface_damage(surface);
weston_slide_run(ip_surface->view, ip_surface->view->geometry.height, 0, NULL, NULL); weston_slide_run(ip_surface->view, ip_surface->view->surface->height, 0, NULL, NULL);
} }
} }
@ -5474,12 +5458,12 @@ exposay_layout(struct desktop_shell *shell)
if (esurface->row == shell->exposay.grid_size - 1) if (esurface->row == shell->exposay.grid_size - 1)
esurface->x += (shell->exposay.surface_size + shell->exposay.padding_inner) * last_row_removed / 2; esurface->x += (shell->exposay.surface_size + shell->exposay.padding_inner) * last_row_removed / 2;
if (view->geometry.width > view->geometry.height) if (view->surface->width > view->surface->height)
esurface->scale = shell->exposay.surface_size / (float) view->geometry.width; esurface->scale = shell->exposay.surface_size / (float) view->surface->width;
else else
esurface->scale = shell->exposay.surface_size / (float) view->geometry.height; esurface->scale = shell->exposay.surface_size / (float) view->surface->height;
esurface->width = view->geometry.width * esurface->scale; esurface->width = view->surface->width * esurface->scale;
esurface->height = view->geometry.height * esurface->scale; esurface->height = view->surface->height * esurface->scale;
if (shell->exposay.focus_current == esurface->view) if (shell->exposay.focus_current == esurface->view)
exposay_highlight_surface(shell, esurface); exposay_highlight_surface(shell, esurface);

@ -143,13 +143,13 @@ get_surface_view(struct weston_surface *surface, int create)
static void static void
tablet_shell_surface_configure(struct weston_surface *surface, tablet_shell_surface_configure(struct weston_surface *surface,
int32_t sx, int32_t sy, int32_t width, int32_t height) int32_t sx, int32_t sy)
{ {
struct tablet_shell *shell = get_shell(surface->compositor); struct tablet_shell *shell = get_shell(surface->compositor);
struct weston_view *view = get_surface_view(surface, 0); struct weston_view *view = get_surface_view(surface, 0);
assert(view); assert(view);
if (weston_surface_is_mapped(surface) || width == 0) if (weston_surface_is_mapped(surface) || surface->width == 0)
return; return;
if (surface == shell->lockscreen_surface) { if (surface == shell->lockscreen_surface) {
@ -178,7 +178,7 @@ tablet_shell_surface_configure(struct weston_surface *surface,
} }
if (view) { if (view) {
weston_view_configure(view, 0, 0, width, height); weston_view_set_position(view, 0, 0);
weston_view_update_transform(view); weston_view_update_transform(view);
} }
} }

@ -38,7 +38,9 @@ surface_to_from_global(void *data)
assert(surface); assert(surface);
view = weston_view_create(surface); view = weston_view_create(surface);
assert(view); assert(view);
weston_view_configure(view, 5, 10, 50, 50); surface->width = 50;
surface->height = 50;
weston_view_set_position(view, 5, 10);
weston_view_update_transform(view); weston_view_update_transform(view);
weston_view_to_global_float(view, 33, 22, &x, &y); weston_view_to_global_float(view, 33, 22, &x, &y);

@ -38,7 +38,9 @@ surface_transform(void *data)
assert(surface); assert(surface);
view = weston_view_create(surface); view = weston_view_create(surface);
assert(view); assert(view);
weston_view_configure(view, 100, 100, 200, 200); surface->width = 200;
surface->height = 200;
weston_view_set_position(view, 100, 100);
weston_view_update_transform(view); weston_view_update_transform(view);
weston_view_to_global_float(view, 20, 20, &x, &y); weston_view_to_global_float(view, 20, 20, &x, &y);

@ -75,7 +75,7 @@ notify_pointer_position(struct weston_test *test, struct wl_resource *resource)
} }
static void static void
test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy, int32_t width, int32_t height) test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
{ {
struct weston_test_surface *test_surface = surface->configure_private; struct weston_test_surface *test_surface = surface->configure_private;
struct weston_test *test = test_surface->test; struct weston_test *test = test_surface->test;
@ -84,9 +84,8 @@ test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy, i
wl_list_insert(&test->layer.view_list, wl_list_insert(&test->layer.view_list,
&test_surface->view->layer_link); &test_surface->view->layer_link);
weston_view_configure(test_surface->view, weston_view_set_position(test_surface->view,
test_surface->x, test_surface->y, test_surface->x, test_surface->y);
width, height);
weston_view_update_transform(test_surface->view); weston_view_update_transform(test_surface->view);
} }

Loading…
Cancel
Save