Skip to content

Commit

Permalink
Merge branch 'master' into NSBrowser_bindings_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Dec 10, 2024
2 parents aac04a1 + 7855252 commit 2bcc354
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 203 deletions.
7 changes: 3 additions & 4 deletions ColorPickers/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ BUNDLE_NAME = StandardPicker NamedPicker WheelPicker

BUNDLE_INSTALL_DIR = $(GNUSTEP_LIBRARY)/ColorPickers

ADDITIONAL_INCLUDE_DIRS += -I../Headers/Additions -I../Headers
ADDITIONAL_INCLUDE_DIRS += -I../Headers/Additions -I../Headers -I../Source

ADDITIONAL_LIB_DIRS += -L../Source/$(GNUSTEP_OBJ_DIR) -L../Models/$(GNUSTEP_OBJ_DIR)

Expand All @@ -43,10 +43,9 @@ StandardPicker_OBJC_FILES = GSStandardColorPicker.m \
GSRGBColorPicker.m \
GSCMYKColorPicker.m \
GSHSBColorPicker.m \
GSGrayColorPicker.m \
GSColorSliderCell.m
GSGrayColorPicker.m
NamedPicker_OBJC_FILES = GSNamedColorPicker.m
WheelPicker_OBJC_FILES = GSWheelColorPicker.m GSColorSliderCell.m
WheelPicker_OBJC_FILES = GSWheelColorPicker.m

# The class to load
StandardPicker_PRINCIPAL_CLASS = GSStandardColorPicker
Expand Down
3 changes: 2 additions & 1 deletion Source/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ GSCSLinearExpression.m \
GSCSStrength.m \
GSCSEditInfo.m \
GSCSEditVariableManager.m \
GSCSTableau.m
GSCSTableau.m \
GSColorSliderCell.m

# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
# but does not implement <NSObject>'s methods itself (it inherits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <AppKit/NSSliderCell.h>

APPKIT_EXPORT_CLASS
@interface GSColorSliderCell : NSSliderCell
{
int mode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* GSStandardColorPicker.m
/* GSColorSliderCell.m
Copyright (C) 2007 Free Software Foundation, Inc.
Expand Down
45 changes: 33 additions & 12 deletions Source/NSBezierPath.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,21 @@ - (id) init

- (void) dealloc
{
GSIArrayEmpty(_pathElements);
NSZoneFree([self zone], _pathElements);
if (_pathElements)
{
GSIArrayEmpty(_pathElements);
NSZoneFree([self zone], _pathElements);
}

if (_cacheImage != nil)
RELEASE(_cacheImage);
if (_cacheImage)
{
RELEASE(_cacheImage);
}

if (_dash_pattern != NULL)
NSZoneFree([self zone], _dash_pattern);
if (_dash_pattern)
{
NSZoneFree([self zone], _dash_pattern);
}

[super dealloc];
}
Expand Down Expand Up @@ -2066,22 +2073,36 @@ - (id)initWithCoder:(NSCoder *)aCoder
//
// NSCopying Protocol
//
- (id)copyWithZone:(NSZone *)zone
- (id) copyWithZone: (NSZone *)zone
{
NSBezierPath *path = (NSBezierPath*)NSCopyObject (self, 0, zone);
NSBezierPath *path = (NSBezierPath*)NSCopyObject(self, 0, zone);

/* Get the zone actually usd by the copy so we can use it consistently.
*/
zone = [path zone];

if (_cachesBezierPath && _cacheImage)
path->_cacheImage = [_cacheImage copy];
{
// FIXME ... should this retain rather than copy?
path->_cacheImage = [_cacheImage copyWithZone: zone];
}
else
{
path->_cacheImage = nil;
}

if (_dash_pattern != NULL)
if (_dash_pattern)
{
CGFloat *pattern = NSZoneMalloc(zone, _dash_count * sizeof(CGFloat));

memcpy(pattern, _dash_pattern, _dash_count * sizeof(CGFloat));
_dash_pattern = pattern;
path->_dash_pattern = pattern;
}

path->_pathElements = GSIArrayCopyWithZone(_pathElements, zone);
if (_pathElements)
{
path->_pathElements = GSIArrayCopyWithZone(_pathElements, zone);
}

return path;
}
Expand Down
19 changes: 17 additions & 2 deletions Source/NSClipView.m
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,24 @@ - (void) setFrameOrigin: (NSPoint)aPoint

- (void) setFrame: (NSRect)rect
{
BOOL changedOrigin = NO;
BOOL changedSize = NO;
if (NSEqualPoints(_frame.origin, rect.origin) == NO)
{
changedOrigin = YES;
}
if (NSEqualSizes(_frame.size, rect.size) == NO)
{
changedSize = YES;
}
[super setFrame: rect];
[self setBoundsOrigin: [self constrainScrollPoint: _bounds.origin]];
[_super_view reflectScrolledClipView: self];

if (changedOrigin || changedSize)
{
NSPoint proposedPoint = [self constrainScrollPoint: _bounds.origin];
[self setBoundsOrigin: proposedPoint];
[_super_view reflectScrolledClipView: self];
}
}

- (void) translateOriginToPoint: (NSPoint)aPoint
Expand Down
7 changes: 5 additions & 2 deletions Source/NSCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex
NSRect itemFrame = NSMakeRect (0,0,0,0);
NSInteger index;
NSUInteger count = [_items count];
CGFloat x = _horizontalMargin;
CGFloat x = 0;
CGFloat y = -_itemSize.height;

if (_maxNumberOfColumns > 0 && _maxNumberOfRows > 0)
Expand All @@ -700,7 +700,7 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex
{
if (index % _numberOfColumns == 0)
{
x = _horizontalMargin;
x = 0;
y += _verticalMargin + _itemSize.height;
}

Expand Down Expand Up @@ -731,6 +731,9 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex

x += _itemSize.width + _horizontalMargin;
}
if(_maxNumberOfColumns == 1) {
itemFrame.size.width = self.frame.size.width;
}
return itemFrame;
}

Expand Down
5 changes: 5 additions & 0 deletions Source/NSMenuView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@ - (BOOL) _trackWithEvent: (NSEvent*)event
inMode: NSEventTrackingRunLoopMode
dequeue: YES];
type = [event type];
if (type == NSLeftMouseUp || type == NSRightMouseUp || type == NSOtherMouseUp)
{
shouldFinish = YES;
break; // Exit the loop to proceed to StopPeriodicEvents
}
if (type == NSAppKitDefined)
{
[[event window] sendEvent: event];
Expand Down
12 changes: 3 additions & 9 deletions Tests/gui/GSCodingFlags/GSCellFlags.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@ int main()
mask.flags.useUserKeyEquivalent = 1;
mask.flags.truncateLastLine = 1;

#if GS_WORDS_BIGENDIAN == 1
pass(mask.value == 0b00010010000000000001110000001001, "mask.flags translates to mask.value");
#else
pass(mask.value == 0b10010000001110000000000001001000, "mask.flags translates to mask.value");
#endif

// reset mask
mask.value = 0;
mask.flags = (GSCellFlags){0};

// now make sure values translate to flags
#if GS_WORDS_BIGENDIAN == 1
mask.value = 0b00010010000000000001110000001001;
#else
mask.value = 0b10010000001110000000000001001000;
#endif

pass(mask.flags.state == 1, "state is correctly set");
pass(mask.flags.selectable == 1, "selectable is correctly set");
Expand All @@ -48,4 +42,4 @@ int main()

DESTROY(arp);
return 0;
}
}
Loading

0 comments on commit 2bcc354

Please sign in to comment.