Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constraints for sidebar are weird on macOS 12 #215

Open
NattyNarwhal opened this issue Aug 24, 2024 · 0 comments
Open

constraints for sidebar are weird on macOS 12 #215

NattyNarwhal opened this issue Aug 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@NattyNarwhal
Copy link
Member

macOS 12 seems to have an issue with the autoresizing constraint translation where it adds to the initial width of the sidebar NSOutlineView that doesn't seem needed on macOS 14. Can be worked around with some hacks I'm not entirely comfortable with:

diff --git a/Submariner/SBDatabaseController.m b/Submariner/SBDatabaseController.m
index da15a5e..85967a5 100644
--- a/Submariner/SBDatabaseController.m
+++ b/Submariner/SBDatabaseController.m
@@ -330,6 +330,8 @@ - (void)windowDidLoad {
         [self toggleInspector: self];
     }
     
+    NSLog(@"Constraint fuckery: %@\nSource list/superview frame, %@/%@", sourceList.constraints, NSStringFromRect(sourceList.frame), NSStringFromRect(sourceList.superview.frame));
+    
     [resourcesController addObserver:self
                           forKeyPath:@"content"
                              options:NSKeyValueObservingOptionNew
@@ -391,6 +393,14 @@ - (void)awakeFromNib {
     [splitVC.view.leftAnchor constraintEqualToAnchor:((NSLayoutGuide*)self.window.contentLayoutGuide).leftAnchor].active=YES;
     [splitVC.view.rightAnchor constraintEqualToAnchor:((NSLayoutGuide*)self.window.contentLayoutGuide).rightAnchor].active=YES;
     
+    //sourceList.frame.size = sourceList.superview.frame.size;
+    NSLayoutConstraint *sourceListWidth = [sourceList.widthAnchor constraintEqualToAnchor: sourceList.superview.widthAnchor];
+    sourceListWidth.active = YES;
+    NSLayoutConstraint *sourceListHeight = [sourceList.heightAnchor constraintEqualToAnchor: sourceList.superview.heightAnchor];
+    sourceListWidth.active = YES;
+    //sourceList.superview.translatesAutoresizingMaskIntoConstraints = NO;
+    NSLog(@"SV Constraint fuckery: %@\nSource list/superview frame, %@/%@", sourceList.superview.constraints, NSStringFromRect(sourceList.frame), NSStringFromRect(sourceList.superview.frame));
+    
     // Need to set both for some reason? And after assignment to the parent?
     splitVC.splitView.autosaveName = @"DatabaseWindowSplitViewController";
     splitVC.splitView.identifier = @"SBDatabaseWindowSplitViewController";
@@ -746,6 +757,7 @@ - (IBAction)stop:(id)sender {
 }
 
 - (IBAction)nextTrack:(id)sender {
+    NSLog(@"SV Constraint fuckery: %@\nSource list/superview frame, %@/%@", sourceList.superview.constraints, NSStringFromRect(sourceList.frame), NSStringFromRect(sourceList.superview.frame));
     [[SBPlayer sharedInstance] next];
 }
 

Where it basically just removes the automatically made constraints and makes up its own.

@NattyNarwhal NattyNarwhal added the bug Something isn't working label Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant