From 643875c8827194e0d270ee29db7c03fa28d4c08e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 24 Oct 2014 19:13:18 -0400 Subject: [PATCH] Used the alignment rect instead of the frame for laying out and sizing controls on Mac OS X. Also updated the future plans document. --- container_darwin.m | 2 ++ control_darwin.m | 3 ++- future | 7 ++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/container_darwin.m b/container_darwin.m index 1dfa7cb..b8c61b0 100644 --- a/container_darwin.m +++ b/container_darwin.m @@ -41,6 +41,8 @@ void moveControl(id c, intptr_t x, intptr_t y, intptr_t width, intptr_t height) // mac os x coordinate system has (0,0) in the lower-left v = toNSView(c); frame.origin.y = ([[v superview] bounds].size.height - frame.size.height) - frame.origin.y; + // here's the magic: what we specified was what we want the alignment rect to be; make it the actual frame + frame = [v frameForAlignmentRect:frame]; [v setFrame:frame]; } diff --git a/control_darwin.m b/control_darwin.m index 4ff8777..54588a1 100644 --- a/control_darwin.m +++ b/control_darwin.m @@ -37,7 +37,8 @@ struct xsize controlPreferredSize(id control) c = toNSControl(control); [c sizeToFit]; - r = [c frame]; + // use alignmentRect here instead of frame because we'll be resizing based on that + r = [c alignmentRectForFrame:[c frame]]; s.width = (intptr_t) r.size.width; s.height = (intptr_t) r.size.height; return s; diff --git a/future b/future index 0ac0c35..e316a33 100644 --- a/future +++ b/future @@ -1,13 +1,11 @@ mac os x sizing is now completely broken - need to catch window initial sizes - need to catch tab changes - - can't just resize every tab to the current tab size; that'll just cause weirdness - - rect should be based on the alignment rect, not the frame rect + - can't just resize every tab to the current tab size; that doesn't seem to work mac os x - Table, Textbox + Textbox refuse first responder - Table still works because it's entirely mouse based Textbox does not work at all new control stuff @@ -126,5 +124,4 @@ gtk+, mac os x - figure out how dialogs and Areas work together - once that is done, document the behavior of Areas all - - make spaced settable somehow - rename Selected to Selection?