summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-11 17:54:40 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-11 17:54:40 +0300
commitdea66025b91832df59c435afd9b72966ef1e61b1 (patch)
treed17d19463081a0e0ee0698bc725dec5274b3c46d
parent20e00806e518d3d33093158df3a7d2f5d9c0160e (diff)
Fixed centering a sheet not under root
-rw-r--r--src/ui/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 71539fa0..36fd91eb 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -484,7 +484,10 @@ iWidget *makeSheet_Widget(const char *id) {
484void centerSheet_Widget(iWidget *sheet) { 484void centerSheet_Widget(iWidget *sheet) {
485 arrange_Widget(sheet); 485 arrange_Widget(sheet);
486 const iInt2 rootSize = rootSize_Window(get_Window()); 486 const iInt2 rootSize = rootSize_Window(get_Window());
487 sheet->rect.pos.x = rootSize.x / 2 - sheet->rect.size.x / 2; 487 const iInt2 orig = localCoord_Widget(
488 sheet->parent,
489 init_I2(rootSize.x / 2 - sheet->rect.size.x / 2, bounds_Widget(sheet).pos.y));
490 sheet->rect.pos = orig;
488 postRefresh_App(); 491 postRefresh_App();
489} 492}
490 493