mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 18:50:58 +00:00
Tidied window movement and resize
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4521 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6de1f395d4
commit
489e24d900
3 changed files with 46 additions and 40 deletions
|
@ -1,13 +1,17 @@
|
||||||
Tue Jul 6 12:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Tue Jul 6 13:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Headers/AppKit/NSEvent.h: Added event subtypes for appkit events
|
* Headers/AppKit/NSEvent.h: Added event subtypes for appkit events
|
||||||
|
* Headers/AppKit/NSWindow.h: Removed ([_setFrame:]) - achieve same
|
||||||
|
effect using the event queue.
|
||||||
* Source/Functions.m: Rewrite for new event types.
|
* Source/Functions.m: Rewrite for new event types.
|
||||||
|
* Source/NSWindow.m: Handle AppKit defined events for window movement
|
||||||
|
and resizing.
|
||||||
|
|
||||||
Tue Jul 6 6:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Tue Jul 6 6:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Headers/AppKit/NSGraphicsContext.h: New method for window control -
|
* Headers/AppKit/NSGraphicsContext.h: New method for window control -
|
||||||
([_setFrame:forWindow:])
|
([_setFrame:forWindow:])
|
||||||
* Headers/AppKit/NSWindow.m: New ivar 'autosave_name' and new method
|
* Headers/AppKit/NSWindow.h: New ivar 'autosave_name' and new method
|
||||||
([_setFrame:]) for backend to call when window frame has changed.
|
([_setFrame:]) for backend to call when window frame has changed.
|
||||||
* Source/NSGraphicsContext.m: Dummy implementation of new method.
|
* Source/NSGraphicsContext.m: Dummy implementation of new method.
|
||||||
* Source/NSWindow.m: Rewrite all moving/sizing methods and methods
|
* Source/NSWindow.m: Rewrite all moving/sizing methods and methods
|
||||||
|
|
|
@ -459,7 +459,6 @@ extern NSSize NSTokenSize;
|
||||||
+ (NSWindow*) _windowWithTag: (int)windowNumber;
|
+ (NSWindow*) _windowWithTag: (int)windowNumber;
|
||||||
|
|
||||||
- (void) setWindowNumber: (int)windowNum;
|
- (void) setWindowNumber: (int)windowNum;
|
||||||
- (void) _setFrame: (NSRect)newFrame;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mouse capture/release
|
* Mouse capture/release
|
||||||
|
|
|
@ -681,42 +681,6 @@ static NSRecursiveLock *windowsLock;
|
||||||
[self display];
|
[self display];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Method called by graphics engine to notify window of a change to
|
|
||||||
* it's real frame.
|
|
||||||
*/
|
|
||||||
- (void) _setFrame: (NSRect)newFrame
|
|
||||||
{
|
|
||||||
if (NSEqualRects(frame, newFrame) == NO)
|
|
||||||
{
|
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
||||||
NSRect old = frame;
|
|
||||||
|
|
||||||
if (autosave_name != nil)
|
|
||||||
{
|
|
||||||
[self saveFrameUsingName: autosave_name];
|
|
||||||
}
|
|
||||||
frame = newFrame;
|
|
||||||
if (NSEqualSizes(old.size, frame.size) == NO)
|
|
||||||
{
|
|
||||||
if (content_view)
|
|
||||||
{
|
|
||||||
NSView *wv = [content_view superview];
|
|
||||||
NSRect rect = [self frame];
|
|
||||||
|
|
||||||
rect.origin = NSZeroPoint;
|
|
||||||
[wv setFrame: rect];
|
|
||||||
[wv setNeedsDisplay: YES];
|
|
||||||
}
|
|
||||||
[nc postNotificationName: NSWindowDidResizeNotification object: self];
|
|
||||||
}
|
|
||||||
if (NSEqualPoints(old.origin, frame.origin) == NO)
|
|
||||||
{
|
|
||||||
[nc postNotificationName: NSWindowDidMoveNotification object: self];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setFrameOrigin: (NSPoint)aPoint
|
- (void) setFrameOrigin: (NSPoint)aPoint
|
||||||
{
|
{
|
||||||
NSRect r = frame;
|
NSRect r = frame;
|
||||||
|
@ -1534,8 +1498,47 @@ static NSRecursiveLock *windowsLock;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSPeriodic:
|
|
||||||
case NSAppKitDefined:
|
case NSAppKitDefined:
|
||||||
|
{
|
||||||
|
GSAppKitSubtype sub = [theEvent subtype];
|
||||||
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
|
switch (sub)
|
||||||
|
{
|
||||||
|
case GSAppKitWindowMoved:
|
||||||
|
frame.origin.x = (float)[theEvent data1];
|
||||||
|
frame.origin.y = (float)[theEvent data2];
|
||||||
|
if (autosave_name != nil)
|
||||||
|
{
|
||||||
|
[self saveFrameUsingName: autosave_name];
|
||||||
|
}
|
||||||
|
[nc postNotificationName: NSWindowDidMoveNotification
|
||||||
|
object: self];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSAppKitWindowResized:
|
||||||
|
frame.size.width = (float)[theEvent data1];
|
||||||
|
frame.size.height = (float)[theEvent data2];
|
||||||
|
if (content_view)
|
||||||
|
{
|
||||||
|
NSView *wv = [content_view superview];
|
||||||
|
NSRect rect = frame;
|
||||||
|
|
||||||
|
rect.origin = NSZeroPoint;
|
||||||
|
[wv setFrame: rect];
|
||||||
|
[wv setNeedsDisplay: YES];
|
||||||
|
}
|
||||||
|
[nc postNotificationName: NSWindowDidResizeNotification
|
||||||
|
object: self];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSPeriodic:
|
||||||
case NSSystemDefined:
|
case NSSystemDefined:
|
||||||
case NSApplicationDefined:
|
case NSApplicationDefined:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue