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:
+17
-2
@@ -103,6 +103,7 @@ struct shell_surface {
|
|||||||
struct wl_grab grab;
|
struct wl_grab grab;
|
||||||
uint32_t time;
|
uint32_t time;
|
||||||
int32_t x, y;
|
int32_t x, y;
|
||||||
|
struct weston_transform parent_transform;
|
||||||
int32_t initial_up;
|
int32_t initial_up;
|
||||||
} popup;
|
} popup;
|
||||||
|
|
||||||
@@ -521,8 +522,22 @@ shell_map_popup(struct shell_surface *shsurf, uint32_t time)
|
|||||||
shsurf->popup.grab.interface = &popup_grab_interface;
|
shsurf->popup.grab.interface = &popup_grab_interface;
|
||||||
device = es->compositor->input_device;
|
device = es->compositor->input_device;
|
||||||
|
|
||||||
es->geometry.x = shsurf->parent->surface->geometry.x + shsurf->popup.x;
|
weston_surface_update_transform(parent);
|
||||||
es->geometry.y = shsurf->parent->surface->geometry.y + shsurf->popup.y;
|
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;
|
es->geometry.dirty = 1;
|
||||||
|
|
||||||
shsurf->popup.grab.input_device = device;
|
shsurf->popup.grab.input_device = device;
|
||||||
|
|||||||
Reference in New Issue
Block a user