mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Merge branch 'master' into NSFontCollection_branch
This commit is contained in:
commit
bd1a349c0a
9 changed files with 253 additions and 149 deletions
|
@ -5,16 +5,16 @@ compiler:
|
|||
- gcc
|
||||
env:
|
||||
- LIBRARY_COMBO=gnu-gnu-gnu
|
||||
- LIBRARY_COMBO=ng-gnu-gnu
|
||||
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi
|
||||
- LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-1.9
|
||||
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-1.9
|
||||
- LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
|
||||
- LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-2.0
|
||||
matrix:
|
||||
exclude:
|
||||
- compiler: gcc
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-1.9
|
||||
- compiler: gcc
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu BASE_ABI=--disable-mixedabi RUNTIME_VERSION=gnustep-1.9
|
||||
- compiler: gcc
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
|
||||
- compiler: gcc
|
||||
|
|
46
ChangeLog
46
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2020-02-23 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m
|
||||
(applicationDidChangeScreenParameters:): quit while loop after
|
||||
screen was found.
|
||||
(sendEvent:): use `_screen` ivar to get screen befor frame change.
|
||||
|
||||
* Source/NSMenu.m (windowDidChangeScreen:): join two if statements.
|
||||
|
||||
2020-02-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSXibLoading.h,
|
||||
* Source/GSXib5KeyedUnarchiver.m,
|
||||
* Source/GSXibLoading.m: Move more behaviour from the
|
||||
IBActionConnection5 and IBOutletConnection5 classes
|
||||
to the original ones.
|
||||
|
||||
2020-02-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* .travis.yml
|
||||
* travis-deps.sh: Try to keep up with Niels' changes in base.
|
||||
|
||||
2020-02-20 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSMenu.m (_setGeometry): take into account main screen
|
||||
|
@ -6,6 +28,30 @@
|
|||
* Source/NSApplication.m (_appIconInit): take into account main screen
|
||||
origin when placing application icon.
|
||||
|
||||
2020-02-13 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (setFrame:display:): use _screeForFrame: here
|
||||
to prevent `_screen` reassign - it will be reassigned in
|
||||
sendEvent: (GSAppKitWindowMoved event) after call to [self screen].
|
||||
(setFrameFromString:): removed unused code because _screenForFrame:
|
||||
never returns `nil`. Do not reassign `_screen` here.
|
||||
|
||||
2020-02-12 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (sendEvent:): set current screen to ivar and
|
||||
send WindowDidChangeScreen notification if window was moved to other
|
||||
screen.
|
||||
|
||||
* Source/NSScreen.m (mainScreen): returns screen of main menu if no
|
||||
key window exists. With this implementation default screen (screen at
|
||||
index 0 in screens array) should never be returned.
|
||||
|
||||
* Source/NSMenu.m (initWithTitle:): observe WindowDidBecomeKey and
|
||||
WindowDidChangeScreen notifications.
|
||||
(windowDidChangeScreen:): new method to handle observed notification
|
||||
added above. Moves menu to screen of key window for both cases: when
|
||||
key window moved to or activated on different screen.
|
||||
|
||||
2020-02-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSFontDescriptor.m: Correct key for encoding and decoding.
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
|
||||
@interface IBActionConnection: IBConnection
|
||||
{
|
||||
NSString *trigger;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -113,118 +113,6 @@ static NSString *ApplicationClass = nil;
|
|||
|
||||
@end
|
||||
|
||||
@interface IBActionConnection5 : IBActionConnection
|
||||
{
|
||||
NSString *trigger;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation IBActionConnection5
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
trigger = nil;
|
||||
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// label and source string tags have changed for XIB5...
|
||||
ASSIGN(label, [coder decodeObjectForKey: @"selector"]);
|
||||
ASSIGN(source, [coder decodeObjectForKey: @"target"]);
|
||||
// destination string tag is still the same (so far) and loaded
|
||||
// by base class...
|
||||
//ASSIGN(destination, [coder decodeObjectForKey: @"destination"]);
|
||||
|
||||
// Looks like the 'trigger' attribute should be used to override the
|
||||
// target/action setup method...
|
||||
if ([coder containsValueForKey: @"trigger"])
|
||||
ASSIGN(trigger, [coder decodeObjectForKey: @"trigger"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Can't decode %@ with %@.",NSStringFromClass([self class]),
|
||||
NSStringFromClass([coder class])];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*) trigger
|
||||
{
|
||||
return trigger;
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
{
|
||||
if (trigger && [trigger length])
|
||||
{
|
||||
SEL sel = NSSelectorFromString(label);
|
||||
NSString *selName = [NSString stringWithFormat: @"set%@%@:",
|
||||
[[trigger substringToIndex: 1] uppercaseString],
|
||||
[trigger substringFromIndex: 1]];
|
||||
SEL trigsel = NSSelectorFromString(selName);
|
||||
|
||||
if (sel && trigsel && [destination respondsToSelector: trigsel])
|
||||
{
|
||||
NSWarnMLog(@"setting trigger %@ to selector %@", selName, label);
|
||||
//[destination setTarget: source]; // Not needed???
|
||||
[destination performSelector: trigsel withObject: (id)sel];
|
||||
}
|
||||
else if (!sel)
|
||||
{
|
||||
NSWarnMLog(@"label %@ does not correspond to any selector", label);
|
||||
}
|
||||
else if (!trigsel)
|
||||
{
|
||||
NSWarnMLog(@"trigger %@ does not correspond to any selector", trigger);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSWarnMLog(@"destination class (%@) does not respond to trigger selector %@",
|
||||
NSStringFromClass([destination class]), selName);
|
||||
}
|
||||
|
||||
// PREMATURE RETURN...
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise invoke the super class' method...
|
||||
[super establishConnection];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface IBOutletConnection5 : IBOutletConnection
|
||||
@end
|
||||
|
||||
@implementation IBOutletConnection5
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// label string tag has changed for XIB5...
|
||||
ASSIGN(label, [coder decodeObjectForKey: @"property"]);
|
||||
// destination and source string tags are still the same (so far) and loaded
|
||||
// by base class...
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Can't decode %@ with %@.",NSStringFromClass([self class]),
|
||||
NSStringFromClass([coder class])];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface IBUserDefinedRuntimeAttribute5 : IBUserDefinedRuntimeAttribute
|
||||
@end
|
||||
|
@ -313,8 +201,8 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSSegmentItem", @"segment",
|
||||
@"NSCell", @"customCell",
|
||||
@"NSCustomObject5", @"customObject",
|
||||
@"IBOutletConnection5", @"outlet",
|
||||
@"IBActionConnection5", @"action",
|
||||
@"IBOutletConnection", @"outlet",
|
||||
@"IBActionConnection", @"action",
|
||||
@"NSNibBindingConnector", @"binding",
|
||||
@"NSWindowTemplate", @"window",
|
||||
@"NSView", @"tableCellView",
|
||||
|
@ -3122,7 +3010,7 @@ didStartElement: (NSString*)elementName
|
|||
return flag;
|
||||
}
|
||||
|
||||
- (NSPoint) decodePointForKey:(NSString *)key
|
||||
- (NSPoint) decodePointForKey: (NSString *)key
|
||||
{
|
||||
NSPoint point = NSZeroPoint;
|
||||
|
||||
|
|
|
@ -421,18 +421,117 @@
|
|||
|
||||
@implementation IBActionConnection
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
DESTROY(trigger);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// label and source string tags have changed for XIB5...
|
||||
if ([coder containsValueForKey: @"selector"])
|
||||
{
|
||||
ASSIGN(label, [coder decodeObjectForKey: @"selector"]);
|
||||
}
|
||||
if ([coder containsValueForKey: @"target"])
|
||||
{
|
||||
ASSIGN(source, [coder decodeObjectForKey: @"target"]);
|
||||
}
|
||||
|
||||
// Looks like the 'trigger' attribute should be used to override the
|
||||
// action setup method...
|
||||
if ([coder containsValueForKey: @"trigger"])
|
||||
{
|
||||
ASSIGN(trigger, [coder decodeObjectForKey: @"trigger"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Can't decode %@ with %@.", NSStringFromClass([self class]),
|
||||
NSStringFromClass([coder class])];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*) trigger
|
||||
{
|
||||
return trigger;
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
{
|
||||
SEL sel = NSSelectorFromString(label);
|
||||
|
||||
[destination setTarget: source];
|
||||
[destination setAction: sel];
|
||||
|
||||
if (trigger && [trigger length])
|
||||
{
|
||||
NSString *selName = [NSString stringWithFormat: @"set%@%@:",
|
||||
[[trigger substringToIndex: 1] uppercaseString],
|
||||
[trigger substringFromIndex: 1]];
|
||||
SEL trigsel = NSSelectorFromString(selName);
|
||||
|
||||
if (sel && trigsel && [destination respondsToSelector: trigsel])
|
||||
{
|
||||
NSWarnMLog(@"setting trigger %@ to selector %@", selName, label);
|
||||
[destination performSelector: trigsel withObject: (id)sel];
|
||||
}
|
||||
else if (!sel)
|
||||
{
|
||||
NSWarnMLog(@"label %@ does not correspond to any selector", label);
|
||||
}
|
||||
else if (!trigsel)
|
||||
{
|
||||
NSWarnMLog(@"trigger %@ does not correspond to any selector", trigger);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSWarnMLog(@"destination class (%@) does not respond to trigger selector %@",
|
||||
NSStringFromClass([destination class]), selName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise invoke the normal method...
|
||||
[destination setAction: sel];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation IBOutletConnection
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// label string tag has changed for XIB5...
|
||||
if ([coder containsValueForKey: @"property"])
|
||||
{
|
||||
ASSIGN(label, [coder decodeObjectForKey: @"property"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Can't decode %@ with %@.", NSStringFromClass([self class]),
|
||||
NSStringFromClass([coder class])];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
{
|
||||
NS_DURING
|
||||
|
|
|
@ -1803,6 +1803,23 @@ static BOOL menuBarVisible = YES;
|
|||
[[supermenu menuRepresentation] setHighlightedItemIndex: -1];
|
||||
supermenu->_attachedMenu = nil;
|
||||
}
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowDidChangeScreen:)
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: nil];
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowDidChangeScreen:)
|
||||
name: NSWindowDidChangeScreenNotification
|
||||
object: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[nc removeObserver: self
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: nil];
|
||||
[nc removeObserver: self
|
||||
name: NSWindowDidChangeScreenNotification
|
||||
object: nil];
|
||||
}
|
||||
[_view update];
|
||||
}
|
||||
|
@ -1850,6 +1867,18 @@ static BOOL menuBarVisible = YES;
|
|||
[[GSTheme theme] updateAllWindowsWithMenu: [NSApp mainMenu]];
|
||||
}
|
||||
[self _showTornOffMenuIfAny: notification];
|
||||
|
||||
if ([NSApp mainMenu] == self)
|
||||
{
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowDidChangeScreen:)
|
||||
name: NSWindowDidBecomeKeyNotification
|
||||
object: nil];
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowDidChangeScreen:)
|
||||
name: NSWindowDidChangeScreenNotification
|
||||
object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _showOnActivateApp: (NSNotification*)notification
|
||||
|
@ -1862,6 +1891,38 @@ static BOOL menuBarVisible = YES;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) windowDidChangeScreen: (NSNotification*)notification
|
||||
{
|
||||
NSWindow *window = [notification object];
|
||||
NSRect frame;
|
||||
NSRect oldScreenFrame;
|
||||
NSRect newScreenFrame;
|
||||
CGFloat yOffset;
|
||||
|
||||
if ([window isKindOfClass: [NSPanel class]]
|
||||
|| window == _aWindow
|
||||
|| [window isKeyWindow] == NO
|
||||
|| [_aWindow screen] == [window screen]
|
||||
|| [_aWindow isVisible] == NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
oldScreenFrame = [[_aWindow screen] frame];
|
||||
newScreenFrame = [[window screen] frame];
|
||||
frame = [_aWindow frame];
|
||||
|
||||
// Keep left offset fixed
|
||||
frame.origin.x += newScreenFrame.origin.x - oldScreenFrame.origin.x;
|
||||
|
||||
// Keep top offset fixed
|
||||
yOffset = NSMaxY(oldScreenFrame) - NSMaxY(frame);
|
||||
frame.origin.y = NSMaxY(newScreenFrame) - yOffset - frame.size.height;
|
||||
|
||||
// setFrame: changes _screen value.
|
||||
[self nestedSetFrameOrigin: frame.origin];
|
||||
}
|
||||
|
||||
- (BOOL) isTransient
|
||||
{
|
||||
return _menu.transient;
|
||||
|
|
|
@ -122,6 +122,11 @@ static NSMutableArray *screenArray = nil;
|
|||
NSWindow *keyWindow;
|
||||
|
||||
keyWindow = [NSApp keyWindow];
|
||||
if (keyWindow == nil)
|
||||
{
|
||||
keyWindow = [[NSApp mainMenu] window];
|
||||
}
|
||||
|
||||
if (keyWindow != nil)
|
||||
{
|
||||
return [keyWindow screen];
|
||||
|
|
|
@ -2249,12 +2249,13 @@ titleWithRepresentedFilename(NSString *representedFilename)
|
|||
{
|
||||
frameRect.size.height = _minimumSize.height;
|
||||
}
|
||||
|
||||
|
||||
/* Windows need to be constrained when displayed or resized - but only
|
||||
titled windows are constrained */
|
||||
if (_styleMask & NSTitledWindowMask)
|
||||
{
|
||||
frameRect = [self constrainFrameRect: frameRect toScreen: [self screen]];
|
||||
frameRect = [self constrainFrameRect: frameRect
|
||||
toScreen: [self _screenForFrame: frameRect]];
|
||||
}
|
||||
|
||||
// If nothing changes, don't send it to the backend and don't redisplay
|
||||
|
@ -2721,7 +2722,10 @@ titleWithRepresentedFilename(NSString *representedFilename)
|
|||
while ((scr = [e nextObject]))
|
||||
{
|
||||
if ([scr screenNumber] == screenNumber)
|
||||
ASSIGN(_screen, scr);
|
||||
{
|
||||
ASSIGN(_screen, scr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not adjust frame for mini and appicon windows - it's a WM's job.
|
||||
|
@ -4170,16 +4174,27 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
switch (sub)
|
||||
{
|
||||
case GSAppKitWindowMoved:
|
||||
_frame.origin.x = (CGFloat)[theEvent data1];
|
||||
_frame.origin.y = (CGFloat)[theEvent data2];
|
||||
NSDebugLLog(@"Moving", @"Move event: %d %@",
|
||||
(int)_windowNum, NSStringFromPoint(_frame.origin));
|
||||
if (_autosaveName != nil)
|
||||
{
|
||||
[self saveFrameUsingName: _autosaveName];
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidMoveNotification
|
||||
object: self];
|
||||
{
|
||||
NSScreen *oldScreen;
|
||||
NSScreen *newScreen;
|
||||
oldScreen = _screen;
|
||||
_frame.origin.x = (CGFloat)[theEvent data1];
|
||||
_frame.origin.y = (CGFloat)[theEvent data2];
|
||||
newScreen = [self screen];
|
||||
NSDebugLLog(@"Moving", @"Move event: %d %@",
|
||||
(int)_windowNum, NSStringFromPoint(_frame.origin));
|
||||
if (_autosaveName != nil)
|
||||
{
|
||||
[self saveFrameUsingName: _autosaveName];
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidMoveNotification
|
||||
object: self];
|
||||
if (newScreen != oldScreen)
|
||||
{
|
||||
[nc postNotificationName: NSWindowDidChangeScreenNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GSAppKitWindowResized:
|
||||
|
@ -4961,16 +4976,6 @@ current key view.<br />
|
|||
* the window could be placed (ie a rectangle excluding the dock).
|
||||
*/
|
||||
screen = [self _screenForFrame: fRect];
|
||||
|
||||
// Check whether a portion is showing somewhere...
|
||||
if (screen == nil)
|
||||
{
|
||||
// If the window doesn't show up on any screen then we need
|
||||
// to move it so it can be seen and assign it to the main
|
||||
// screen...
|
||||
screen = [NSScreen mainScreen];
|
||||
NSDebugLLog(@"NSWindow", @"%s: re-assigning to main screen\n", __PRETTY_FUNCTION__);
|
||||
}
|
||||
nRect = [screen visibleFrame];
|
||||
|
||||
/*
|
||||
|
@ -5022,9 +5027,6 @@ current key view.<br />
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure we are using the new screen we are applying to...
|
||||
ASSIGN(_screen, screen);
|
||||
|
||||
/*
|
||||
* Set frame.
|
||||
*/
|
||||
|
|
|
@ -11,10 +11,12 @@ install_gnustep_make() {
|
|||
cd tools-make
|
||||
if [ -n "$RUNTIME_VERSION" ]
|
||||
then
|
||||
echo "RUNTIME_VERSION=$RUNTIME_VERSION" > GNUstep.conf
|
||||
WITH_RUNTIME_ABI="--with-runtime-abi=${RUNTIME_VERSION}"
|
||||
else
|
||||
WITH_RUNTIME_ABI=""
|
||||
fi
|
||||
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO --with-user-config-file=$PWD/GNUstep.conf
|
||||
make install
|
||||
./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO $WITH_RUNTIME_ABI
|
||||
make install
|
||||
echo Objective-C build flags: `$HOME/staging/bin/gnustep-config --objc-flags`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue