Skip to content
Commits on Source (5)
......@@ -2101,6 +2101,8 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
}
}
weston_view_update_transform(shsurf->view);
if (shsurf->state.fullscreen) {
shell_configure_fullscreen(shsurf);
} else if (shsurf->state.maximized) {
......@@ -2614,6 +2616,11 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy)
view = container_of(es->views.next, struct weston_view, surface_link);
/* XXX delete me eventually - it would be better if we didn't get here
* with a dirty transform at all, but for now just make sure the
* transform is updated here. */
weston_view_update_transform(view);
get_panel_size(shell, view, &width, &height);
switch (shell->panel_position) {
case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP:
......
......@@ -425,6 +425,7 @@ weston_view_create(struct weston_surface *surface)
pixman_region32_init(&view->geometry.scissor);
pixman_region32_init(&view->transform.boundingbox);
view->transform.dirty = 1;
weston_view_update_transform(view);
return view;
}
......@@ -648,26 +649,16 @@ WL_EXPORT void
weston_view_to_global_float(struct weston_view *view,
float sx, float sy, float *x, float *y)
{
if (view->transform.enabled) {
struct weston_vector v = { { sx, sy, 0.0f, 1.0f } };
struct weston_vector v = { { sx, sy, 0.0f, 1.0f } };
weston_matrix_transform(&view->transform.matrix, &v);
assert(!view->transform.dirty);
if (fabsf(v.f[3]) < 1e-6) {
weston_log("warning: numerical instability in "
"%s(), divisor = %g\n", __func__,
v.f[3]);
*x = 0;
*y = 0;
return;
}
weston_matrix_transform(&view->transform.matrix, &v);
*x = v.f[0] / v.f[3];
*y = v.f[1] / v.f[3];
} else {
*x = sx + view->geometry.x;
*y = sy + view->geometry.y;
}
assert(fabs(v.f[3]) > 1e-6);
*x = v.f[0] / v.f[3];
*y = v.f[1] / v.f[3];
}
WL_EXPORT pixman_box32_t
......@@ -1464,26 +1455,16 @@ WL_EXPORT void
weston_view_from_global_float(struct weston_view *view,
float x, float y, float *vx, float *vy)
{
if (view->transform.enabled) {
struct weston_vector v = { { x, y, 0.0f, 1.0f } };
struct weston_vector v = { { x, y, 0.0f, 1.0f } };
weston_matrix_transform(&view->transform.inverse, &v);
assert(!view->transform.dirty);
if (fabsf(v.f[3]) < 1e-6) {
weston_log("warning: numerical instability in "
"weston_view_from_global(), divisor = %g\n",
v.f[3]);
*vx = 0;
*vy = 0;
return;
}
weston_matrix_transform(&view->transform.inverse, &v);
*vx = v.f[0] / v.f[3];
*vy = v.f[1] / v.f[3];
} else {
*vx = x - view->geometry.x;
*vy = y - view->geometry.y;
}
assert(fabs(v.f[3]) > 1e-6);
*vx = v.f[0] / v.f[3];
*vy = v.f[1] / v.f[3];
}
WL_EXPORT void
......@@ -1778,6 +1759,8 @@ weston_view_matches_output_entirely(struct weston_view *ev,
pixman_box32_t *extents =
pixman_region32_extents(&ev->transform.boundingbox);
assert(!ev->transform.dirty);
if (extents->x1 != output->x ||
extents->y1 != output->y ||
extents->x2 != output->x + output->width ||
......@@ -1961,6 +1944,8 @@ weston_compositor_pick_view(struct weston_compositor *compositor,
/* Can't use paint node list: occlusion by input regions, not opaque. */
wl_list_for_each(view, &compositor->view_list, link) {
weston_view_update_transform(view);
if (!pixman_region32_contains_point(
&view->transform.boundingbox, ix, iy, NULL))
continue;
......@@ -2654,6 +2639,8 @@ view_accumulate_damage(struct weston_view *view,
{
pixman_region32_t damage;
assert(!view->transform.dirty);
pixman_region32_init(&damage);
if (view->transform.enabled) {
pixman_box32_t *extents;
......
......@@ -465,6 +465,7 @@ default_grab_pointer_focus(struct weston_pointer_grab *grab)
pointer->x, pointer->y);
if (view && view == pointer->focus) {
weston_view_update_transform(view);
weston_view_from_global_fixed(view, pointer->x, pointer->y,
&sx, &sy);
if (pointer->sx != sx || pointer->sy != sy)
......@@ -549,6 +550,7 @@ weston_pointer_send_motion(struct weston_pointer *pointer,
weston_pointer_motion_to_abs(pointer, event, &x, &y);
old_sx = pointer->sx;
old_sy = pointer->sy;
weston_view_update_transform(pointer->focus);
weston_view_from_global_fixed(pointer->focus, x, y,
&pointer->sx, &pointer->sy);
}
......@@ -3769,6 +3771,7 @@ maybe_enable_pointer_constraint(struct weston_pointer_constraint *constraint)
if (!keyboard || keyboard->focus != surface)
return;
weston_view_update_transform(view);
/* Postpone constraint if the pointer is not within the
* constraint region.
*/
......