Remove some gcc compiler warnings

This commit is contained in:
Fred Kiefer 2023-12-28 14:45:16 +01:00
parent 7fce63432a
commit 3a6dce02be
6 changed files with 85 additions and 86 deletions

View file

@ -369,6 +369,7 @@ typedef NSInteger GSLayoutViewAttribute;
newConstraint = [GSCSConstraint constraintWithLeftVariable: firstItemConstraintVariable operator: GSCSConstraintOperatorLessThanOrEqual rightConstant: [constraint constant]];
break;
case NSLayoutRelationEqual:
default:
newConstraint = [GSCSConstraint constraintWithLeftVariable: firstItemConstraintVariable operator: GSCSConstraintOperatorEqual rightConstant: [constraint constant]];
break;
case NSLayoutRelationGreaterThanOrEqual:
@ -1290,4 +1291,4 @@ typedef NSInteger GSLayoutViewAttribute;
[super dealloc];
}
@end
@end

View file

@ -33,6 +33,7 @@
#import "AppKit/NSAttributedString.h"
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSButton.h"
#import "AppKit/NSButtonCell.h"
#import "AppKit/NSBrowser.h"
#import "AppKit/NSBrowserCell.h"

View file

@ -425,9 +425,6 @@
{
if (closeButton == nil)
{
NSSize viewSize;
NSSize buttonSize;
[[GSTheme theme] setName: nil forElement: [closeButton cell] temporary: NO];
ASSIGN(closeButton,
[NSWindow standardWindowButton:

View file

@ -30,74 +30,6 @@ static NSUInteger minYAttribute = 33;
static NSUInteger maxXAttribute = 36;
static NSUInteger maxYAttribute = 37;
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
+ (NSAutoresizingMaskLayoutConstraint *)
_xConstraintForAutoresizingMask: (NSAutoresizingMaskOptions)autoresizingMask
subitem: (NSView *)subItem
@ -292,4 +224,72 @@ static NSUInteger maxYAttribute = 37;
}
}
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
@end

View file

@ -1605,6 +1605,15 @@ static NSString *_placeholderItem = nil;
/* Creating Collection view Items */
- (NSNib *) _nibForClass: (Class)cls
{
NSString *clsName = NSStringFromClass(cls);
NSNib *nib = [[NSNib alloc] initWithNibNamed: clsName
bundle: [NSBundle bundleForClass: cls]];
AUTORELEASE(nib);
return nib;
}
- (NSCollectionViewItem *) makeItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
forIndexPath: (NSIndexPath *)indexPath
{
@ -1703,15 +1712,6 @@ static NSString *_placeholderItem = nil;
/* Configuring the Collection view */
- (NSNib *) _nibForClass: (Class)cls
{
NSString *clsName = NSStringFromClass(cls);
NSNib *nib = [[NSNib alloc] initWithNibNamed: clsName
bundle: [NSBundle bundleForClass: cls]];
AUTORELEASE(nib);
return nib;
}
- (NSView *) backgroundView
{
return _backgroundView;

View file

@ -620,17 +620,17 @@ static NSMutableArray *activeConstraints = nil;
@implementation NSWindow (NSConstraintBasedLayoutCoreMethods)
- (void) updateConstraintsIfNeeded
{
[[self contentView] updateConstraintsForSubtreeIfNeeded];
}
- (void) layoutIfNeeded
{
[self updateConstraintsIfNeeded];
[[self contentView] _layoutViewAndSubViews];
}
- (void) updateConstraintsIfNeeded
{
[[self contentView] updateConstraintsForSubtreeIfNeeded];
}
- (void) _bootstrapAutoLayout
{
GSAutoLayoutEngine *layoutEngine = [[GSAutoLayoutEngine alloc] init];