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 <ppaalanen@gmail.com>
This commit is contained in:
parent
44ab69cfa3
commit
938269af21
19
src/shell.c
19
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;
|
||||
|
Loading…
Reference in New Issue
Block a user