From 938269af211f1ac48c7539fd7feab8e53703ade8 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 7 Feb 2012 14:19:01 +0200 Subject: [PATCH] compositor: simple menu transform Transform a menu popup the same as its parent surface. The parent's transformation is snapshotted at the popup map() time, and does not follow further parent motion. Signed-off-by: Pekka Paalanen --- src/shell.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/shell.c b/src/shell.c index 78120ef..53b192c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -103,6 +103,7 @@ struct shell_surface { struct wl_grab grab; uint32_t time; int32_t x, y; + struct weston_transform parent_transform; int32_t initial_up; } popup; @@ -521,8 +522,22 @@ shell_map_popup(struct shell_surface *shsurf, uint32_t time) shsurf->popup.grab.interface = &popup_grab_interface; device = es->compositor->input_device; - es->geometry.x = shsurf->parent->surface->geometry.x + shsurf->popup.x; - es->geometry.y = shsurf->parent->surface->geometry.y + shsurf->popup.y; + weston_surface_update_transform(parent); + if (parent->transform.enabled) { + shsurf->popup.parent_transform.matrix = + parent->transform.matrix; + } else { + /* construct x, y translation matrix */ + weston_matrix_init(&shsurf->popup.parent_transform.matrix); + shsurf->popup.parent_transform.matrix.d[12] = + parent->geometry.x; + shsurf->popup.parent_transform.matrix.d[13] = + parent->geometry.y; + } + wl_list_insert(es->geometry.transformation_list.prev, + &shsurf->popup.parent_transform.link); + es->geometry.x = shsurf->popup.x; + es->geometry.y = shsurf->popup.y; es->geometry.dirty = 1; shsurf->popup.grab.input_device = device; -- 2.7.4