summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-04 09:14:30 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-04 09:14:30 +0200
commit1d735299127aaf0474d8fc2a1c5ec4947c1dca9a (patch)
tree926f4d136a2799c5fcf62589259ede57c04c35a9 /src/ui/widget.c
parent2f6fd59952ce3d76b15a4b7b8f526e27edd39775 (diff)
Changing UI scaling at runtime
UI scaling factor is applied when closing the Preferences dialog. IssueID #83
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 386ba6d6..f9c84c7a 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -397,17 +397,20 @@ void arrange_Widget(iWidget *d) {
397 else { 397 else {
398 /* Evenly size all children. */ 398 /* Evenly size all children. */
399 iInt2 childSize = innerRect_Widget_(d).size; 399 iInt2 childSize = innerRect_Widget_(d).size;
400 iInt2 unpaddedChildSize = d->rect.size;
400 if (d->flags & arrangeHorizontal_WidgetFlag) { 401 if (d->flags & arrangeHorizontal_WidgetFlag) {
401 childSize.x /= childCount; 402 childSize.x /= childCount;
403 unpaddedChildSize.x /= childCount;
402 } 404 }
403 else if (d->flags & arrangeVertical_WidgetFlag) { 405 else if (d->flags & arrangeVertical_WidgetFlag) {
404 childSize.y /= childCount; 406 childSize.y /= childCount;
407 unpaddedChildSize.y /= childCount;
405 } 408 }
406 iForEach(ObjectList, i, d->children) { 409 iForEach(ObjectList, i, d->children) {
407 iWidget *child = as_Widget(i.object); 410 iWidget *child = as_Widget(i.object);
408 if (!isCollapsed_Widget_(child) && ~child->flags & parentCannotResize_WidgetFlag) { 411 if (!isCollapsed_Widget_(child) && ~child->flags & parentCannotResize_WidgetFlag) {
409 if (dirs.x) setWidth_Widget_(child, childSize.x); 412 if (dirs.x) setWidth_Widget_(child, child->flags & unpadded_WidgetFlag ? unpaddedChildSize.x : childSize.x);
410 if (dirs.y) setHeight_Widget_(child, childSize.y); 413 if (dirs.y) setHeight_Widget_(child, child->flags & unpadded_WidgetFlag ? unpaddedChildSize.y : childSize.y);
411 } 414 }
412 } 415 }
413 } 416 }
@@ -441,7 +444,7 @@ void arrange_Widget(iWidget *d) {
441 pos.y += child->rect.size.y; 444 pos.y += child->rect.size.y;
442 } 445 }
443 } 446 }
444 else if (d->flags & resizeChildren_WidgetFlag) { 447 else if ((d->flags & resizeChildren_WidgetFlag) == resizeChildren_WidgetFlag) {
445 child->rect.pos = pos; 448 child->rect.pos = pos;
446 } 449 }
447 } 450 }