* Source/GSXibLoader.m (-awake:inContainer:withContext:): Allow

for subclasses of NSApplication as rootObjects.
        Based on patch by Marcian Lytwyn <gna@advcsi.com>.
        * Source/NSWindow.m (-userSpaceScaleFactor): Handle case where
        _screen is nil.
        Patch by Doug Simons (dsimons@testplant.com).
        * Source/NSWindow.m (-_screenForFrame:): Require real overlapp.
        Patch by Doug Simons (dsimons@testplant.com).
        * Source/NSTextField.m (-textDidChange:): Improve editing
        behavior when formatter returns a new string.
        Patch by Doug Simons (dsimons@testplant.com).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37830 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2014-05-03 21:45:47 +00:00
parent fc150231a2
commit 38af0dc88b
4 changed files with 52 additions and 19 deletions

View file

@ -1,9 +1,23 @@
2014-05-03 Fred Kiefer <FredKiefer@gmx.de> 2014-05-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m: (-setFrame:): Revert last change. * Source/GSXibLoader.m (-awake:inContainer:withContext:): Allow
* Source/NSWindow.m: (-encodeWithCoder:, -initWithCoder:): Use for subclasses of NSApplication as rootObjects.
Based on patch by Marcian Lytwyn <gna@advcsi.com>.
* Source/NSWindow.m (-userSpaceScaleFactor): Handle case where
_screen is nil.
Patch by Doug Simons (dsimons@testplant.com).
* Source/NSWindow.m (-_screenForFrame:): Require real overlapp.
Patch by Doug Simons (dsimons@testplant.com).
* Source/NSTextField.m (-textDidChange:): Improve editing behavior
when formatter returns a new string.
Patch by Doug Simons (dsimons@testplant.com).
2014-05-03 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m (-setFrame:): Revert last change.
* Source/NSWindow.m (-encodeWithCoder:, -initWithCoder:): Use
content min/max size instead of min/max size. content min/max size instead of min/max size.
* Source/NSWindow.m: (+initialize): Increase version number to 3. * Source/NSWindow.m (+initialize): Increase version number to 3.
* Source/GSNibLoading.m (NSWindowTemplate -encodeWithCoder:, * Source/GSNibLoading.m (NSWindowTemplate -encodeWithCoder:,
-initWithCoder:): Use NSWindowContentMinSize/NSWindowContentMaxSize -initWithCoder:): Use NSWindowContentMinSize/NSWindowContentMaxSize
instead of NSMinSize/NSMaxSize. instead of NSMinSize/NSMaxSize.

View file

@ -865,20 +865,35 @@
id owner = [context objectForKey: NSNibOwner]; id owner = [context objectForKey: NSNibOwner];
id first = nil; id first = nil;
id app = nil; id app = nil;
NSCustomObject *object;
// Get the file's owner and NSApplication object references... NSString *className;
if ([[(NSCustomObject*)[rootObjects objectAtIndex: 1] className] isEqualToString: @"FirstResponder"])
first = [(NSCustomObject*)[rootObjects objectAtIndex: 1] realObject];
else
NSLog(@"%s:first responder missing\n", __PRETTY_FUNCTION__);
if ([[(NSCustomObject*)[rootObjects objectAtIndex: 2] className] isEqualToString: @"NSApplication"]) // Get the file's owner and NSApplication object references...
app = [(NSCustomObject*)[rootObjects objectAtIndex: 2] realObject]; object = (NSCustomObject*)[rootObjects objectAtIndex: 1];
if ([[object className] isEqualToString: @"FirstResponder"])
{
first = [object realObject];
}
else else
NSLog(@"%s:NSApplication missing\n", __PRETTY_FUNCTION__); {
NSLog(@"%s:first responder missing\n", __PRETTY_FUNCTION__);
}
object = (NSCustomObject*)[rootObjects objectAtIndex: 2];
className = [object className];
if ([className isEqualToString: @"NSApplication"] ||
[NSClassFromString(className) isSubclassOfClass:[NSApplication class]])
{
app = [object realObject];
}
else
{
NSLog(@"%s:NSApplication missing\n", __PRETTY_FUNCTION__);
}
// Use the owner as first root object // Use the owner as first root object
[(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner]; [(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner];
en = [rootObjects objectEnumerator]; en = [rootObjects objectEnumerator];
while ((obj = [en nextObject]) != nil) while ((obj = [en nextObject]) != nil)
{ {

View file

@ -573,9 +573,8 @@ static Class textFieldCellClass;
if (newString != nil) if (newString != nil)
{ {
NSLog (@"Unimplemented: should set string to %@", newString); // This resets editing with insertion point after the string, which is what Cocoa does
// FIXME ! This would reset editing ! [_text_object setString: newString];
//[_text_object setString: newString];
} }
else else
{ {

View file

@ -389,7 +389,7 @@ has blocked and waited for events.
*/ */
- (NSScreen *) _screenForFrame: (NSRect)frame - (NSScreen *) _screenForFrame: (NSRect)frame
{ {
NSInteger largest = -1; CGFloat largest = 0.0;
NSArray *screens = [NSScreen screens]; NSArray *screens = [NSScreen screens];
NSInteger index = 0; NSInteger index = 0;
NSScreen *theScreen = nil; NSScreen *theScreen = nil;
@ -399,7 +399,8 @@ has blocked and waited for events.
NSScreen *screen = [screens objectAtIndex: index]; NSScreen *screen = [screens objectAtIndex: index];
NSRect sframe = [screen frame]; NSRect sframe = [screen frame];
NSRect iframe = NSIntersectionRect(frame, sframe); NSRect iframe = NSIntersectionRect(frame, sframe);
NSInteger isize = NSWidth(iframe) * NSHeight(iframe); CGFloat isize = NSWidth(iframe) * NSHeight(iframe);
if (isize > largest) if (isize > largest)
{ {
largest = isize; largest = isize;
@ -1386,9 +1387,13 @@ titleWithRepresentedFilename(NSString *representedFilename)
{ {
return 1.0; return 1.0;
} }
else if (_screen != nil)
{
return [_screen userSpaceScaleFactor];
}
else else
{ {
return [_screen userSpaceScaleFactor]; return 1.0;
} }
} }
@ -2117,7 +2122,7 @@ titleWithRepresentedFilename(NSString *representedFilename)
difference = NSMaxY (screenRect) - NSMaxY (frameRect); difference = NSMaxY (screenRect) - NSMaxY (frameRect);
if (_styleMask & NSResizableWindowMask) if (_styleMask & NSResizableWindowMask)
{ {
float difference2; CGFloat difference2;
difference2 = screenRect.origin.y - frameRect.origin.y; difference2 = screenRect.origin.y - frameRect.origin.y;
difference2 -= difference; difference2 -= difference;