Revision: 14096
          http://sourceforge.net/p/skim-app/code/14096
Author:   hofman
Date:     2024-03-10 17:09:15 +0000 (Sun, 10 Mar 2024)
Log Message:
-----------
get constraints from superview implicitly

Modified Paths:
--------------
    trunk/SKStatusBar.m

Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2024-03-07 16:39:53 UTC (rev 14095)
+++ trunk/SKStatusBar.m 2024-03-10 17:09:15 UTC (rev 14096)
@@ -48,7 +48,7 @@
 #define SEPARATION          4.0
 #define ICON_OFFSET         1.0
 
-static inline NSLayoutConstraint *bottomLayoutConstraint(NSArray *constraints, 
NSView *view);
+static inline NSLayoutConstraint *bottomLayoutConstraint(NSView *view);
 
 @interface SKStatusTextField : NSTextField
 @end
@@ -137,7 +137,7 @@
     
     NSView *contentView = [view superview];
     BOOL visible = (nil == [self superview]);
-    NSLayoutConstraint *bottomConstraint = bottomLayoutConstraint([contentView 
constraints], visible ? view : self);
+    NSLayoutConstraint *bottomConstraint = nil;
     CGFloat statusHeight = NSHeight([self frame]);
     NSArray *constraints;
     
@@ -149,12 +149,13 @@
             [[contentView trailingAnchor]constraintEqualToAnchor:[self 
trailingAnchor]],
             [[contentView bottomAnchor] constraintEqualToAnchor:[self 
bottomAnchor] constant:animate ? -statusHeight : 0.0],
             [[self topAnchor] constraintEqualToAnchor:[view bottomAnchor]]];
-        [bottomConstraint setActive:NO];
+        [bottomLayoutConstraint(view) setActive:NO];
         [NSLayoutConstraint activateConstraints:constraints];
         [contentView layoutSubtreeIfNeeded];
         bottomConstraint = [constraints objectAtIndex:2];
     } else {
         constraints = @[[[contentView bottomAnchor] 
constraintEqualToAnchor:[view bottomAnchor]]];
+        bottomConstraint = bottomLayoutConstraint(self);
     }
     
     if (animate) {
@@ -425,8 +426,8 @@
 
 @end
 
-static inline NSLayoutConstraint *bottomLayoutConstraint(NSArray *constraints, 
NSView *view) {
-    for (NSLayoutConstraint *constraint in constraints) {
+static inline NSLayoutConstraint *bottomLayoutConstraint(NSView *view) {
+    for (NSLayoutConstraint *constraint in [[view superview] constraints]) {
         if ([constraint secondItem] == view && [constraint secondAttribute] == 
NSLayoutAttributeBottom)
             return constraint;
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to