diff --git a/redo/reredo/darwin/autolayout.m b/redo/reredo/darwin/autolayout.m index ff0ed89d..58203738 100644 --- a/redo/reredo/darwin/autolayout.m +++ b/redo/reredo/darwin/autolayout.m @@ -27,13 +27,12 @@ void setHuggingPri(NSView *view, NSLayoutPriority priority, NSLayoutConstraintOr [view setContentHuggingPriority:priority forOrientation:orientation]; } +// precondition: constraints must have been removed from superview already void layoutSingleView(NSView *superview, NSView *subview, int margined) { NSDictionary *views; NSString *constraint; - [superview removeConstraints:[superview constraints]]; - views = NSDictionaryOfVariableBindings(subview); constraint = @"H:|[subview]|"; diff --git a/redo/reredo/darwin/group.m b/redo/reredo/darwin/group.m index 36d6a0ff..5e79852d 100644 --- a/redo/reredo/darwin/group.m +++ b/redo/reredo/darwin/group.m @@ -41,6 +41,7 @@ static void groupRelayout(uiDarwinControl *c) if (g->child == NULL) return; + [g->box removeConstraints:[g->box constraints]]; cc = uiDarwinControl(g->child); childView = (NSView *) uiControlHandle(g->child); // first relayout the child diff --git a/redo/reredo/darwin/tab.m b/redo/reredo/darwin/tab.m index ea927762..14cf44c0 100644 --- a/redo/reredo/darwin/tab.m +++ b/redo/reredo/darwin/tab.m @@ -61,6 +61,7 @@ static void tabRelayout(uiDarwinControl *c) child = (uiControl *) [v pointerValue]; view = (NSView *) [t->views objectAtIndex:i]; childView = (NSView *) uiControlHandle(child); + [view removeConstraints:[view constraints]]; margined = (NSNumber *) [t->margined objectAtIndex:i]; // first lay out the child cc = uiDarwinControl(child); diff --git a/redo/reredo/darwin/window.m b/redo/reredo/darwin/window.m index 785db77b..686bf148 100644 --- a/redo/reredo/darwin/window.m +++ b/redo/reredo/darwin/window.m @@ -125,15 +125,18 @@ static void windowRelayout(uiDarwinControl *c) uiWindow *w = uiWindow(c); uiDarwinControl *cc; NSView *childView; + NSView *contentView; if (w->child == NULL) return; cc = uiDarwinControl(w->child); childView = (NSView *) uiControlHandle(w->child); + contentView = [w->window contentView]; + [contentView removeConstraints:[contentView constraints]]; // first relayout the child (*(cc->Relayout))(cc); // now relayout ourselves - layoutSingleView([w->window contentView], childView, w->margined); + layoutSingleView(contentView, childView, w->margined); } char *uiWindowTitle(uiWindow *w)