diff --git a/ChangeLog b/ChangeLog index e88247516..823ed01ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Fri Nov 14 09:34:45 1997 Scott Christley + + * Headers/gnustep/gui/NSApplication.h (-getNextEvent): Method + no longer returns a value. + * Headers/gnustep/gui/NSWindowView.h: New file. + * Source/NSWindowView.m: New file. + * Source/NSView.m (-displayRect:): Remove debug code. + * Source/NSWindow.m: Use new class which represents the + view the window uses to draw its frame and title. Many + changes throughout the file to update the window view instead + of the content view. + * Source/GNUmakefile: Don't install the config.h file. Compile + and install NSWindowView. + * Source/NSApplication.m + (-nextEventMatchingMask:untilDate:inMode:dequeue:): Rearrange + code so that that the flushing of windows is done before + runloop's limit date is retrieved. + (-getNextEvent): Method no longer returns a value. + Sat Nov 1 11:30:40 1997 Ovidiu Predescu * Source/GNUmakefile: Don't compile NSPasteboard.m if using diff --git a/Headers/gnustep/gui/NSApplication.h b/Headers/gnustep/gui/NSApplication.h index cf2ead605..dbb63cd50 100644 --- a/Headers/gnustep/gui/NSApplication.h +++ b/Headers/gnustep/gui/NSApplication.h @@ -271,7 +271,7 @@ extern NSString *NSEventTrackingRunLoopMode; + (NSEvent *)getNullEvent; // Get next event -- (NSEvent *)getNextEvent; +- (void)getNextEvent; - (NSEvent *)peekNextEvent; // handle a non-translated event diff --git a/Headers/gnustep/gui/NSWindowView.h b/Headers/gnustep/gui/NSWindowView.h new file mode 100644 index 000000000..f47959e21 --- /dev/null +++ b/Headers/gnustep/gui/NSWindowView.h @@ -0,0 +1,41 @@ +/* + NSWindowView.h + + View which handles drawing the window decorations and filling + the window with the background color. + + Copyright (C) 1997 Free Software Foundation, Inc. + + Author: Scott Christley + Date: November 1997 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _GNUstep_H_NSWindowView +#define _GNUstep_H_NSWindowView + +#include + +@interface NSWindowView : NSView +{ +} + +@end + +#endif /* _GNUstep_H_NSWindowView */ diff --git a/Source/GNUmakefile b/Source/GNUmakefile index acc9f92fc..6b574282d 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -97,6 +97,7 @@ NSTextField.m \ NSTextFieldCell.m \ NSView.m \ NSWindow.m \ +NSWindowView.m \ NSWorkspace.m \ TrackingRectangle.m \ PSMatrix.m \ @@ -178,9 +179,9 @@ AppKit/NSTextField.h \ AppKit/NSTextFieldCell.h \ AppKit/NSView.h \ AppKit/NSWindow.h \ +AppKit/NSWindowView.h \ AppKit/NSWorkspace.h \ AppKit/TrackingRectangle.h \ -AppKit/config.h \ AppKit/nsimage-tiff.h \ AppKit/PSMatrix.h \ DPSClient/NSDPSContext.h \ diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 1f3d647a9..1fcef2796 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -217,6 +217,7 @@ static id NSApp; do { pool = [NSAutoreleasePool new]; + e = [self nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]; @@ -392,6 +393,8 @@ static id NSApp; NSEvent* event; int i, count; + [self getNextEvent]; + /* Get an event from the events queue */ if ((count = [event_queue count])) { for (i = 0; i < count; i++) { @@ -426,11 +429,17 @@ static id NSApp; // Not in queue so wait for next event while (!done) { + NSDate *limitDate, *originalLimitDate; + + // flush any windows that need it + [NSWindow _flushWindows]; + [self _flushCommunicationChannels]; + /* Retain the limitDate so it doesn't get release accidentally by runMode:beforeDate: if a timer which has this date as fire date gets released. */ - NSDate* limitDate = [[currentLoop limitDateForMode:mode] retain]; - NSDate* originalLimitDate = limitDate; + limitDate = [[currentLoop limitDateForMode:mode] retain]; + originalLimitDate = limitDate; event = [self _eventMatchingMask:mask]; if (event) { @@ -443,11 +452,9 @@ static id NSApp; else limitDate = expiration; - [NSWindow _flushWindows]; - [self _flushCommunicationChannels]; [currentLoop runMode:mode beforeDate:limitDate]; - [originalLimitDate release]; + event = [self _eventMatchingMask:mask]; if (event) break; @@ -1088,10 +1095,9 @@ static id NSApp; } // Get next event -- (NSEvent *)getNextEvent +- (void)getNextEvent { [event_queue addObject:gnustep_gui_null_event]; - return gnustep_gui_null_event; } - (NSEvent *)peekNextEvent diff --git a/Source/NSView.m b/Source/NSView.m index e330a5e21..5bf8e3524 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -798,8 +798,6 @@ static NSRecursiveLock *gnustep_gui_nsview_lock = nil; NSLog (@"warning: %@ %p has not have the PS matrices setup!", NSStringFromClass(isa), self); -// NSLog (@"NSView displayRect:"); - needs_display = NO; [self lockFocus]; diff --git a/Source/NSWindow.m b/Source/NSWindow.m index e0bbe922a..5a5383090 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -45,6 +45,7 @@ #include #include #include +#include #define ASSIGN(variable, value) \ [value retain]; \ @@ -128,6 +129,9 @@ static BOOL _needsFlushWindows = YES; - (void)dealloc { + // Release the window view + if (content_view) [[content_view superview] release]; + // Release the content view if (content_view) [content_view release]; @@ -212,11 +216,33 @@ static BOOL _needsFlushWindows = YES; - (void)setContentView:(NSView *)aView { + NSView *wv; + + // Cannot have a nil content view + if (!aView) + aView = [[[NSView alloc] initWithFrame: frame] autorelease]; + + // If the window view hasn't been created yet + // then create it + if ((!content_view) || ([content_view superview] == nil)) + { + wv = [[NSWindowView alloc] initWithFrame: frame]; + [wv viewWillMoveToWindow: self]; + } + else + wv = [content_view superview]; + if (content_view) - [content_view viewWillMoveToWindow:nil]; + { + [content_view removeFromSuperview]; + [content_view viewWillMoveToWindow:nil]; + } ASSIGN(content_view, aView); + // Add to our window view + [wv addSubview: content_view]; + // Tell the view its changing windows [content_view viewWillMoveToWindow:self]; @@ -622,8 +648,8 @@ static BOOL _needsFlushWindows = YES; /* Temporary disable displaying */ [self disableFlushWindow]; - // Draw the content view - [content_view display]; + // Draw the window view + [[content_view superview] display]; /* Reenable displaying and flush the window */ [self enableFlushWindow]; @@ -632,7 +658,7 @@ static BOOL _needsFlushWindows = YES; - (void)displayIfNeeded { if (needs_display) { - [content_view _displayNeededViews]; + [[content_view superview] _displayNeededViews]; needs_display = NO; } } @@ -646,7 +672,7 @@ static BOOL _needsFlushWindows = YES; { needs_flush = NO; [_flushRectangles removeAllObjects]; - [content_view _recursivelyResetNeedsDisplayInAllViews]; + [[content_view superview] _recursivelyResetNeedsDisplayInAllViews]; } - (void)flushWindowIfNeeded @@ -671,9 +697,10 @@ static BOOL _needsFlushWindows = YES; originMatrix = [PSMatrix new]; sizeMatrix = [PSMatrix new]; - [content_view _collectInvalidatedRectanglesInArray:_flushRectangles - originMatrix:originMatrix - sizeMatrix:sizeMatrix]; + [[content_view superview] + _collectInvalidatedRectanglesInArray:_flushRectangles + originMatrix:originMatrix + sizeMatrix:sizeMatrix]; [originMatrix release]; [sizeMatrix release]; @@ -787,7 +814,7 @@ static BOOL _needsFlushWindows = YES; - (void)discardCursorRects { - [self discardCursorRectsForView: content_view]; + [self discardCursorRectsForView: [content_view superview]]; } - (void)enableCursorRects @@ -819,7 +846,7 @@ static BOOL _needsFlushWindows = YES; - (void)resetCursorRects { // Tell all the views to reset their cursor rects - [self resetCursorRectsForView: content_view]; + [self resetCursorRectsForView: [content_view superview]]; // Cursor rects are now valid cursor_rects_valid = YES; diff --git a/Source/NSWindowView.m b/Source/NSWindowView.m new file mode 100644 index 000000000..87237a37f --- /dev/null +++ b/Source/NSWindowView.m @@ -0,0 +1,39 @@ +/* + NSWindowView.m + + View which handles drawing the window decorations and filling + the window with the background color. + + Copyright (C) 1997 Free Software Foundation, Inc. + + Author: Scott Christley + Date: November 1997 + + This file is part of the GNUstep GUI Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include + +@implementation NSWindowView + +// +// The backend will have to fill in the implementation +// + +@end +