diff options
author | Benjamin Otte <otte@redhat.com> | 2022-07-05 07:30:51 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2022-07-08 17:33:58 +0200 |
commit | 1ba2ef82f31ec68e34f71259d58c84d201523069 (patch) | |
tree | 96c56be399899636c7fda852343167be408d1982 | |
parent | bcd04595ddcbfc9cf77fcd6354201d14255228b4 (diff) | |
download | gtk+-1ba2ef82f31ec68e34f71259d58c84d201523069.tar.gz |
canvas: scale(-1) the widgets when allocation size is negativewip/otte/canvas
Just flip the widgets, because hey, that makes planarity work!
-rw-r--r-- | gtk/gtkcanvasitem.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gtk/gtkcanvasitem.c b/gtk/gtkcanvasitem.c index 38ff9549a1..077d20f5c8 100644 --- a/gtk/gtkcanvasitem.c +++ b/gtk/gtkcanvasitem.c @@ -305,20 +305,28 @@ gtk_canvas_item_allocate_widget (GtkCanvasItem *self, float dy) { graphene_rect_t allocation; + GskTransform *transform; if (self->widget == NULL) return; gtk_canvas_box_to_rect (&self->allocation, &allocation); - graphene_rect_normalize (&allocation); - - gtk_widget_size_allocate (self->widget, - &(GtkAllocation) { - allocation.origin.x - dx, - allocation.origin.y - dy, - allocation.size.width, - allocation.size.height - }, -1); + + transform = gsk_transform_translate (NULL, + &GRAPHENE_POINT_INIT ( + allocation.origin.x - dx + + (signbit (self->allocation.size.width) ? allocation.size.width : 0), + allocation.origin.y - dy + + (signbit (self->allocation.size.height) ? allocation.size.height : 0))); + transform = gsk_transform_scale (transform, + signbit (self->allocation.size.width) ? -1 : 1, + signbit (self->allocation.size.height) ? -1 : 1); + + gtk_widget_allocate (self->widget, + allocation.size.width, + allocation.size.height, + -1, + transform); } gboolean |