mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Merge branch 'master' into NSFontCollection_branch
This commit is contained in:
commit
2756be99e5
4 changed files with 61 additions and 15 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2020-01-27 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (applicationDidChangeScreenParameters): take into
|
||||
account screen origin change during window position recalculation.
|
||||
|
||||
2020-01-26 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSWindow.m (initWithContentRect:styleMask:backing:defer:):
|
||||
added observer of NSApplicationDidChangeScreenParametersNotification.
|
||||
(applicationDidChangeScreenParameters:): callback for added notification -
|
||||
updates window position, set new screen object and saves frame if
|
||||
autosave name exists.
|
||||
|
||||
2020-01-23 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSXib5KeyedUnarchiver.m: Remove NSWindowTemplate5.
|
||||
|
|
|
@ -866,10 +866,10 @@
|
|||
|
||||
- (NSString*) description
|
||||
{
|
||||
return [NSString stringWithFormat:
|
||||
@"%@ - sourceID: %@: maxID: %@: objectRecords: %@: flattenedProperties: %@: connectionRecords: %@: ",
|
||||
[super description], sourceID, maxID, objectRecords,
|
||||
flattenedProperties, connectionRecords];
|
||||
return [NSString stringWithFormat: @"%@ - sourceID: %@: maxID: %d:"
|
||||
@" objectRecords: %@: flattenedProperties: %@: connectionRecords: %@: ",
|
||||
[super description], sourceID, maxID,
|
||||
objectRecords, flattenedProperties, connectionRecords];
|
||||
}
|
||||
|
||||
- (NSEnumerator*) connectionRecordEnumerator
|
||||
|
|
|
@ -60,12 +60,7 @@
|
|||
if (self == [NSScreen class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_resetScreens:)
|
||||
name: NSApplicationDidChangeScreenParametersNotification
|
||||
object: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static NSMutableArray *screenArray = nil;
|
||||
|
@ -73,11 +68,6 @@ static NSMutableArray *screenArray = nil;
|
|||
/**
|
||||
* Resets the cached list of screens.
|
||||
*/
|
||||
+ (void) _resetScreens: (NSNotification*)notification
|
||||
{
|
||||
[self resetScreens];
|
||||
}
|
||||
|
||||
+ (void) resetScreens
|
||||
{
|
||||
DESTROY(screenArray);
|
||||
|
|
|
@ -1106,6 +1106,10 @@ many times.
|
|||
selector: @selector(colorListChanged:)
|
||||
name: NSColorListDidChangeNotification
|
||||
object: nil];
|
||||
[nc addObserver: self
|
||||
selector: @selector(applicationDidChangeScreenParameters:)
|
||||
name: NSApplicationDidChangeScreenParametersNotification
|
||||
object: NSApp];
|
||||
|
||||
NSDebugLLog(@"NSWindow", @"NSWindow end of init\n");
|
||||
return self;
|
||||
|
@ -2701,6 +2705,45 @@ titleWithRepresentedFilename(NSString *representedFilename)
|
|||
return _screen;
|
||||
}
|
||||
|
||||
- (void) applicationDidChangeScreenParameters: (NSNotification *)aNotif
|
||||
{
|
||||
NSRect oldScreenFrame = [_screen frame];
|
||||
int screenNumber = [_screen screenNumber];
|
||||
NSRect newScreenFrame;
|
||||
NSRect newFrame;
|
||||
NSEnumerator *e;
|
||||
NSScreen *scr;
|
||||
|
||||
// We need to get new screen from renewed screen list because
|
||||
// [NSScreen mainScreen] returns NSScreen object of key window and that object
|
||||
// will never be released.
|
||||
e = [[NSScreen screens] objectEnumerator];
|
||||
while ((scr = [e nextObject]))
|
||||
{
|
||||
if ([scr screenNumber] == screenNumber)
|
||||
ASSIGN(_screen, scr);
|
||||
}
|
||||
|
||||
// Do not adjust frame for mini and appicon windows - it's a WM's job.
|
||||
if ([self isKindOfClass: [NSMiniWindow class]] || self == [NSApp iconWindow])
|
||||
return;
|
||||
|
||||
newScreenFrame = [_screen frame];
|
||||
|
||||
newFrame = _frame;
|
||||
// Screen Y origin change.
|
||||
newFrame.origin.y += newScreenFrame.origin.y - oldScreenFrame.origin.y;
|
||||
// Screen height change.
|
||||
newFrame.origin.y += newScreenFrame.size.height - oldScreenFrame.size.height;
|
||||
// Screen X origin change. Screen width change shouldn't affect our frame.
|
||||
newFrame.origin.x += newScreenFrame.origin.x - oldScreenFrame.origin.x;
|
||||
[self setFrame: newFrame display: NO];
|
||||
if (_autosaveName != nil)
|
||||
{
|
||||
[self saveFrameUsingName: _autosaveName];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setDepthLimit: (NSWindowDepth)limit
|
||||
{
|
||||
if (limit == 0)
|
||||
|
|
Loading…
Reference in a new issue