From 489e24d900eb8115aa547afe5cd3ba3de9b3592d Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 6 Jul 1999 11:56:22 +0000 Subject: [PATCH] Tidied window movement and resize git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4521 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 +++- Headers/gnustep/gui/NSWindow.h | 1 - Source/NSWindow.m | 77 ++++++++++++++++++---------------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f80b7f27..e8c65c968 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,17 @@ -Tue Jul 6 12:06:00 1999 Richard Frith-Macdonald +Tue Jul 6 13:06:00 1999 Richard Frith-Macdonald * 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/NSWindow.m: Handle AppKit defined events for window movement + and resizing. Tue Jul 6 6:45:00 1999 Richard Frith-Macdonald * Headers/AppKit/NSGraphicsContext.h: New method for window control - ([_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. * Source/NSGraphicsContext.m: Dummy implementation of new method. * Source/NSWindow.m: Rewrite all moving/sizing methods and methods diff --git a/Headers/gnustep/gui/NSWindow.h b/Headers/gnustep/gui/NSWindow.h index d65b45436..4533c6cd8 100644 --- a/Headers/gnustep/gui/NSWindow.h +++ b/Headers/gnustep/gui/NSWindow.h @@ -459,7 +459,6 @@ extern NSSize NSTokenSize; + (NSWindow*) _windowWithTag: (int)windowNumber; - (void) setWindowNumber: (int)windowNum; -- (void) _setFrame: (NSRect)newFrame; /* * Mouse capture/release diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 70d012baa..6eff6a0d7 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -681,42 +681,6 @@ static NSRecursiveLock *windowsLock; [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 { NSRect r = frame; @@ -1534,8 +1498,47 @@ static NSRecursiveLock *windowsLock; } break; - case NSPeriodic: 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 NSApplicationDefined: break;