diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-07-06 20:29:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-07-06 20:29:21 (GMT) |
commit | 4cb90496fafa54e8aaa26a86cbceafe3fb992320 (patch) | |
tree | 318369a6546c015a03a943a2dd4174c27c1a38d6 /macosx/tkMacOSXWindowEvent.c | |
parent | 1c1ba29d82eafab3ad9a7d2fc54a06da5ca531b6 (diff) | |
download | tk-4cb90496fafa54e8aaa26a86cbceafe3fb992320.zip tk-4cb90496fafa54e8aaa26a86cbceafe3fb992320.tar.gz tk-4cb90496fafa54e8aaa26a86cbceafe3fb992320.tar.bz2 |
More marking of files as Objective-C.
Diffstat (limited to 'macosx/tkMacOSXWindowEvent.c')
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 302 |
1 files changed, 193 insertions, 109 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index d9d4429..91fed49 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.36 2009/06/29 14:35:01 das Exp $ + * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.37 2009/07/06 20:29:21 dkf Exp $ */ #include "tkMacOSXPrivate.h" @@ -47,13 +47,16 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #define NSWindowDidEndLiveResizeNotification @"NSWindowDidEndLiveResizeNotification" #endif #endif - + @implementation TKApplication(TKWindowEvent) -- (void)windowActivation:(NSNotification *)notification { + +- (void) windowActivation: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif - BOOL activate = [[notification name] isEqualToString:NSWindowDidBecomeKeyNotification]; + BOOL activate = [[notification name] + isEqualToString:NSWindowDidBecomeKeyNotification]; NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); @@ -61,14 +64,19 @@ extern NSString *NSWindowDidOrderOffScreenNotification; GenerateActivateEvents(winPtr, activate); } } -- (void)windowBoundsChanged:(NSNotification *)notification { + +- (void) windowBoundsChanged: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif - BOOL movedOnly = [[notification name] isEqualToString:NSWindowDidMoveNotification]; + BOOL movedOnly = [[notification name] + isEqualToString:NSWindowDidMoveNotification]; + if (movedOnly) { /* constraining to screen after move not needed with AppKit */ } + NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); @@ -91,13 +99,18 @@ extern NSString *NSWindowDidOrderOffScreenNotification; flags |= TK_SIZE_CHANGED; } if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) { - /* propagate geometry changes immediately */ + /* + * Propagate geometry changes immediately. + */ + flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY; } TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); } } -- (void)windowExpanded:(NSNotification *)notification { + +- (void) windowExpanded: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -109,7 +122,10 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState; Tk_MapWindow((Tk_Window) winPtr); if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) { - /* Process all Tk events generated by Tk_MapWindow() */ + /* + * Process all Tk events generated by Tk_MapWindow(). + */ + while (Tcl_ServiceEvent(0)) {} while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} @@ -124,7 +140,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } } } -- (void)windowCollapsed:(NSNotification *)notification { + +- (void) windowCollapsed: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -135,7 +153,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; Tk_UnmapWindow((Tk_Window) winPtr); } } -- (void)windowClosed:(NSNotification *)notification { + +- (void) windowClosed: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -146,15 +166,22 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkGenWMDestroyEvent((Tk_Window) winPtr); } } + #ifdef TK_MAC_DEBUG_NOTIFICATIONS -- (void)windowDragStart:(NSNotification *)notification { + +- (void) windowDragStart: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } -- (void)windowLiveResize:(NSNotification *)notification { + +- (void) windowLiveResize: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); //BOOL start = [[notification name] isEqualToString:NSWindowWillStartLiveResizeNotification]; } -- (void)windowMapped:(NSNotification *)notification { + +- (void) windowMapped: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); @@ -163,12 +190,14 @@ extern NSString *NSWindowDidOrderOffScreenNotification; //Tk_MapWindow((Tk_Window) winPtr); } } -- (void)windowBecameVisible:(NSNotification *)notification { -#ifdef TK_MAC_DEBUG_NOTIFICATIONS + +- (void) windowBecameVisible: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); -#endif } -- (void)windowUnmapped:(NSNotification *)notification { + +- (void) windowUnmapped: (NSNotification *) notification +{ TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); @@ -177,11 +206,14 @@ extern NSString *NSWindowDidOrderOffScreenNotification; //Tk_UnmapWindow((Tk_Window) winPtr); } } -#endif +#endif /* TK_MAC_DEBUG_NOTIFICATIONS */ -- (void)_setupWindowNotifications { +- (void) _setupWindowNotifications +{ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; -#define observe(n, s) [nc addObserver:self selector:@selector(s) name:(n) object:nil] + +#define observe(n, s) \ + [nc addObserver:self selector:@selector(s) name:(n) object:nil] observe(NSWindowDidBecomeKeyNotification, windowActivation:); observe(NSWindowDidResignKeyNotification, windowActivation:); observe(NSWindowDidMoveNotification, windowBoundsChanged:); @@ -200,23 +232,29 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #undef observe } @end - + #pragma mark TKApplication(TKApplicationEvent) @implementation TKApplication(TKApplicationEvent) -- (void)applicationActivate:(NSNotification *)notification { + +- (void) applicationActivate: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [NSApp tkCheckPasteboard]; } -- (void)applicationDeactivate:(NSNotification *)notification { + +- (void) applicationDeactivate: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif TkSuspendClipboard(); } -- (void)applicationShowHide:(NSNotification *)notification { + +- (void) applicationShowHide: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -227,13 +265,16 @@ extern NSString *NSWindowDidOrderOffScreenNotification; if (_eventInterp && Tcl_GetCommandInfo(_eventInterp, cmd, &dummy)) { int code = Tcl_EvalEx(_eventInterp, cmd, -1, TCL_EVAL_GLOBAL); + if (code != TCL_OK) { Tcl_BackgroundException(_eventInterp, code); } Tcl_ResetResult(_eventInterp); } } -- (void)displayChanged:(NSNotification *)notification { + +- (void) displayChanged: (NSNotification *) notification +{ #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -355,8 +396,8 @@ GenerateUpdates( * * GenerateActivateEvents -- * - * Given a Macintosh window activate event this function generates all - * the X Activate events needed by Tk. + * Given a Macintosh window activate event this function generates all the + * X Activate events needed by Tk. * * Results: * True if event(s) are generated - false otherwise. @@ -462,8 +503,8 @@ TkMacOSXGenerateFocusEvent( * * TkGenWMConfigureEvent -- * - * Generate a ConfigureNotify event for Tk. Depending on the value of - * flag the values of width/height, x/y, or both may be changed. + * Generate a ConfigureNotify event for Tk. Depending on the value of flag + * the values of width/height, x/y, or both may be changed. * * Results: * None. @@ -477,10 +518,8 @@ TkMacOSXGenerateFocusEvent( void TkGenWMConfigureEvent( Tk_Window tkwin, - int x, - int y, - int width, - int height, + int x, int y, + int width, int height, int flags) { XEvent event; @@ -542,33 +581,31 @@ TkGenWMConfigureEvent( * Don't set external width, since the user didn't change it * from what the widgets asked for. */ - } else { - if (wmPtr->gridWin != NULL) { - wmPtr->width = wmPtr->reqGridWidth - + (width - winPtr->reqWidth)/wmPtr->widthInc; - if (wmPtr->width < 0) { - wmPtr->width = 0; - } - } else { - wmPtr->width = width; + } else if (wmPtr->gridWin != NULL) { + wmPtr->width = wmPtr->reqGridWidth + + (width - winPtr->reqWidth)/wmPtr->widthInc; + if (wmPtr->width < 0) { + wmPtr->width = 0; } + } else { + wmPtr->width = width; } + if ((wmPtr->height == -1) && (height == winPtr->reqHeight)) { /* * Don't set external height, since the user didn't change it * from what the widgets asked for. */ - } else { - if (wmPtr->gridWin != NULL) { - wmPtr->height = wmPtr->reqGridHeight - + (height - winPtr->reqHeight)/wmPtr->heightInc; - if (wmPtr->height < 0) { - wmPtr->height = 0; - } - } else { - wmPtr->height = height; + } else if (wmPtr->gridWin != NULL) { + wmPtr->height = wmPtr->reqGridHeight + + (height - winPtr->reqHeight)/wmPtr->heightInc; + if (wmPtr->height < 0) { + wmPtr->height = 0; } + } else { + wmPtr->height = height; } + wmPtr->configWidth = width; wmPtr->configHeight = height; } @@ -628,10 +665,9 @@ TkGenWMDestroyEvent( * * TkWmProtocolEventProc -- * - * This procedure is called by the Tk_HandleEvent whenever a - * ClientMessage event arrives whose type is "WM_PROTOCOLS". This - * procedure handles the message from the window manager in an - * appropriate fashion. + * This procedure is called by the Tk_HandleEvent whenever a ClientMessage + * event arrives whose type is "WM_PROTOCOLS". This procedure handles the + * message from the window manager in an appropriate fashion. * * Results: * None. @@ -718,7 +754,7 @@ Tk_MacOSXIsAppInFront(void) return (isFrontProcess == true); } - + #pragma mark TKContentView #import <ApplicationServices/ApplicationServices.h> @@ -728,34 +764,39 @@ Tk_MacOSXIsAppInFront(void) * The goal is to emulate X11-style drawing in response to Expose events: * during the normal AppKit drawing cycle, we supress drawing of all subviews * (using a technique adapted from WebKit's WebHTMLView) and instead send - * Expose events about the subviews that would be redrawn. - * Tk Expose event handling and drawing handlers then draw the subviews - * manually via their -displayRectIgnoringOpacity: + * Expose events about the subviews that would be redrawn. Tk Expose event + * handling and drawing handlers then draw the subviews manually via their + * -displayRectIgnoringOpacity: */ @interface TKContentView(TKWindowEvent) -- (void)drawRect:(NSRect)rect; -- (void)generateExposeEvents:(HIMutableShapeRef)shape; -- (BOOL)isOpaque; -- (BOOL)wantsDefaultClipping; -- (BOOL)acceptsFirstResponder; -- (void)keyDown:(NSEvent *)theEvent; +- (void) drawRect: (NSRect) rect; +- (void) generateExposeEvents: (HIMutableShapeRef) shape; +- (BOOL) isOpaque; +- (BOOL) wantsDefaultClipping; +- (BOOL) acceptsFirstResponder; +- (void) keyDown: (NSEvent *) theEvent; @end @implementation TKContentView @end -static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) +static Tk_RestrictAction +ExposeRestrictProc( + ClientData arg, + XEvent *eventPtr) { - return (eventPtr->type == Expose && eventPtr->xany.serial == PTR2UINT(arg) ? - TK_PROCESS_EVENT : TK_DEFER_EVENT); + return (eventPtr->type==Expose && eventPtr->xany.serial==PTR2UINT(arg) + ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } @implementation TKContentView(TKWindowEvent) -- (void)drawRect:(NSRect)rect { +- (void) drawRect: (NSRect) rect +{ const NSRect *rectsBeingDrawn; NSInteger rectsBeingDrawnCount; + [self getRectsBeingDrawn:&rectsBeingDrawn count:&rectsBeingDrawnCount]; #ifdef TK_MAC_DEBUG_DRAWING TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, NSStringFromRect(rect)); @@ -763,17 +804,23 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) NSRectFillListUsingOperation(rectsBeingDrawn, rectsBeingDrawnCount, NSCompositeSourceOver); #endif + NSWindow *w = [self window]; + if ([self isOpaque] && [w showsResizeIndicator]) { NSRect bounds = [self convertRect:[w _growBoxRect] fromView:nil]; + if ([self needsToDrawRect:bounds]) { NSEraseRect(bounds); } } + CGFloat height = [self bounds].size.height; HIMutableShapeRef drawShape = HIShapeCreateMutable(); + while (rectsBeingDrawnCount--) { CGRect r = NSRectToCGRect(*rectsBeingDrawn++); + r.origin.y = height - (r.origin.y + r.size.height); HIShapeUnionWithRect(drawShape, &r); } @@ -789,7 +836,8 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) CFRelease(drawShape); } -- (void)generateExposeEvents:(HIMutableShapeRef)shape { +- (void) generateExposeEvents: (HIMutableShapeRef) shape +{ TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); unsigned long serial; CGRect updateBounds; @@ -803,8 +851,8 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) ![[NSRunLoop currentRunLoop] currentMode] && Tcl_GetServiceMode() != TCL_SERVICE_NONE) { /* - * Ensure there are no pending idle-time redraws that could prevent - * the just posted Expose events from generating new redraws. + * Ensure there are no pending idle-time redraws that could prevent the + * just posted Expose events from generating new redraws. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} @@ -817,13 +865,15 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) ClientData oldArg; Tk_RestrictProc *oldProc = Tk_RestrictEvents(ExposeRestrictProc, UINT2PTR(serial), &oldArg); + while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {} Tk_RestrictEvents(oldProc, oldArg, &oldArg); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} } } -- (void)tkToolbarButton:(id)sender { +- (void) tkToolbarButton: (id) sender +{ #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd); #endif @@ -850,39 +900,48 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) } #ifdef TK_MAC_DEBUG_DRAWING -- (void)setFrameSize:(NSSize)newSize { - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, NSStringFromSize(newSize)); +- (void) setFrameSize: (NSSize) newSize +{ + TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, + NSStringFromSize(newSize)); [super setFrameSize:newSize]; } -- (void)setNeedsDisplayInRect:(NSRect)invalidRect { + +- (void) setNeedsDisplayInRect: (NSRect) invalidRect +{ TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, NSStringFromRect(invalidRect)); [super setNeedsDisplayInRect:invalidRect]; } #endif -- (BOOL)isOpaque { + +- (BOOL) isOpaque +{ NSWindow *w = [self window]; return (w && (([w styleMask] & NSTexturedBackgroundWindowMask) || ![w isOpaque]) ? NO : YES); } -- (BOOL)wantsDefaultClipping { +- (BOOL) wantsDefaultClipping +{ return NO; } -- (BOOL)acceptsFirstResponder { +- (BOOL) acceptsFirstResponder +{ return YES; } -- (void)keyDown:(NSEvent *)theEvent { +- (void) keyDown: (NSEvent *) theEvent +{ #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif } @end - + #pragma mark TKContentViewPrivate /* @@ -892,25 +951,31 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) */ @interface TKContentView(TKContentViewPrivate) -- (id)initWithFrame:(NSRect)frame; -- (void)_setAsideSubviews; -- (void)_restoreSubviews; +- (id) initWithFrame: (NSRect) frame; +- (void) _setAsideSubviews; +- (void) _restoreSubviews; @end @interface NSView(TKContentViewPrivate) -- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView; -- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect; -- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView; -- (void)_lightWeightRecursiveDisplayInRect:(NSRect)visRect; -- (BOOL)_drawRectIfEmpty; -- (void)_drawRect:(NSRect)inRect clip:(BOOL)clip; -- (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants; +- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect + isVisibleRect: (BOOL) isVisibleRect + rectIsVisibleRectForView: (NSView *) visibleView + topView: (BOOL) topView; +- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus + visRect: (NSRect) visRect; +- (void) _recursive: (BOOL) recurse + displayRectIgnoringOpacity: (NSRect) displayRect + inContext: (NSGraphicsContext *) context topView: (BOOL) topView; +- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect; +- (BOOL) _drawRectIfEmpty; +- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip; +- (void) _setDrawsOwnDescendants: (BOOL) drawsOwnDescendants; @end - @implementation TKContentView(TKContentViewPrivate) -- (id)initWithFrame:(NSRect)frame { +- (id) initWithFrame: (NSRect) frame +{ self = [super initWithFrame:frame]; if (self) { _savedSubviews = nil; @@ -920,7 +985,7 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) return self; } -- (void)_setAsideSubviews +- (void) _setAsideSubviews { #ifdef TK_MAC_DEBUG if (_subviewsSetAside || _savedSubviews) { @@ -930,10 +995,10 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) _savedSubviews = _subviews; _subviews = nil; _subviewsSetAside = YES; - } +} - - (void)_restoreSubviews - { +- (void) _restoreSubviews +{ #ifdef TK_MAC_DEBUG if (!_subviewsSetAside || _subviews) { Tcl_Panic("TKContentView _restoreSubviews called incorrectly"); @@ -944,34 +1009,48 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) _subviewsSetAside = NO; } -- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView +- (void) _recursiveDisplayRectIfNeededIgnoringOpacity: (NSRect) rect + isVisibleRect: (BOOL) isVisibleRect + rectIsVisibleRectForView: (NSView *) visibleView + topView: (BOOL) topView { [self _setAsideSubviews]; - [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView topView:topView]; + [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect + isVisibleRect:isVisibleRect rectIsVisibleRectForView:visibleView + topView:topView]; [self _restoreSubviews]; } -- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect +- (void) _recursiveDisplayAllDirtyWithLockFocus: (BOOL) needsLockFocus + visRect: (NSRect) visRect { BOOL needToSetAsideSubviews = !_subviewsSetAside; + if (needToSetAsideSubviews) { [self _setAsideSubviews]; } - [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus visRect:visRect]; + [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus + visRect:visRect]; if (needToSetAsideSubviews) { [self _restoreSubviews]; } } -- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView +- (void) _recursive: (BOOL) recurse + displayRectIgnoringOpacity: (NSRect) displayRect + inContext: (NSGraphicsContext *) context topView: (BOOL) topView { [self _setAsideSubviews]; - [super _recursive:recurse displayRectIgnoringOpacity:displayRect inContext:context topView:topView]; + [super _recursive:recurse + displayRectIgnoringOpacity:displayRect inContext:context + topView:topView]; [self _restoreSubviews]; } -- (void)_lightWeightRecursiveDisplayInRect:(NSRect)visRect { +- (void) _lightWeightRecursiveDisplayInRect: (NSRect) visRect +{ BOOL needToSetAsideSubviews = !_subviewsSetAside; + if (needToSetAsideSubviews) { [self _setAsideSubviews]; } @@ -981,19 +1060,24 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) } } -- (BOOL)_drawRectIfEmpty { +- (BOOL) _drawRectIfEmpty +{ /* * Our -drawRect manages subview drawing directly, so it needs to be called * even if the area to be redrawn is completely obscured by subviews. */ + return YES; } -- (void)_drawRect:(NSRect)inRect clip:(BOOL)clip { +- (void) _drawRect: (NSRect) inRect clip: (BOOL) clip +{ #ifdef TK_MAC_DEBUG_DRAWING - TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, NSStringFromRect(inRect)); + TKLog(@"-[%@(%p) %s%@]", [self class], self, _cmd, + NSStringFromRect(inRect)); #endif BOOL subviewsWereSetAside = _subviewsSetAside; + if (subviewsWereSetAside) { [self _restoreSubviews]; } @@ -1007,7 +1091,7 @@ static Tk_RestrictAction ExposeRestrictProc(ClientData arg, XEvent *eventPtr) /* * Local Variables: - * mode: c + * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 |