Lock focus / unlock focus optimizations and fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15839 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2003-02-01 05:10:00 +00:00
parent 959e21868b
commit ba494c7cd9
22 changed files with 111 additions and 115 deletions

View file

@ -439,10 +439,15 @@ static NSCell* tileCell = nil;
- (void) setImage: (NSImage *)anImage
{
[tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self];
[dragCell setImage: anImage];
[dragCell drawWithFrame: NSMakeRect(8,8,48,48) inView: self];
[_window flushWindow];
if ([self lockFocusIfCanDraw])
{
[tileCell drawWithFrame: NSMakeRect(0,0,64,64) inView: self];
[dragCell drawWithFrame: NSMakeRect(8,8,48,48) inView: self];
[self unlockFocus];
[_window flushWindow];
}
}
@end

View file

@ -192,9 +192,7 @@ static NSTextFieldCell *titleCell;
return;
}
[controlView lockFocus];
NSDrawGrayBezel (cellFrame, NSZeroRect);
[controlView unlockFocus];
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
@end
@ -752,8 +750,10 @@ static NSTextFieldCell *titleCell;
// Update and display title of column
if (_isTitled)
{
[self lockFocus];
[self drawTitleOfColumn: column
inRect: [self titleFrameOfColumn: column]];
[self unlockFocus];
}
// Display column
@ -762,6 +762,9 @@ static NSTextFieldCell *titleCell;
if (!(sc = [bc columnScrollView]))
return;
/* FIXME: why the following ? Are we displaying now, or marking for
* later display ?? Given the name, I think we are displaying
* now. */
[sc setNeedsDisplay: YES];
}
@ -1800,7 +1803,6 @@ static NSTextFieldCell *titleCell;
if (_allowsBranchSelection == NO && [cell isLeaf] == NO)
{
[selectedCells removeObject: cell];
continue;
}
}
@ -1826,6 +1828,11 @@ static NSTextFieldCell *titleCell;
while ((cell = [enumerator nextObject]))
[sender selectCell: cell];
// FIXME: shouldn't be locking focus on another object
// probably all this loop is wrong, because deselectSelectedCell
// above may have changed array a.
[sender lockFocus];
enumerator = [a objectEnumerator];
while ((cell = [enumerator nextObject]))
{
@ -1840,6 +1847,9 @@ static NSTextFieldCell *titleCell;
[sender drawCellAtRow: row column: 0];
}
}
[sender unlockFocus];
[self displayIfNeeded];
[_window flushWindow];
}
if (selectedCellsCount > 0)

View file

@ -230,8 +230,6 @@ static NSFont *_leafFont;
if (!cvWin)
return;
[controlView lockFocus];
if (_cell.is_highlighted || _cell.state)
{
backColor = [self highlightColorInView: controlView];
@ -308,8 +306,6 @@ static NSFont *_leafFont;
NSDottedFrameRect(cellFrame);
_cell.shows_first_responder = showsFirstResponder;
[controlView unlockFocus];
}
- (BOOL) isOpaque

View file

@ -615,7 +615,6 @@
// draw the border if needed
if (_cell.is_bordered)
{
[controlView lockFocus];
// FIXME Should check the bezel and gradient style
if (_cell.is_highlighted && (_highlightsByMask & NSPushInCellMask))
{
@ -625,7 +624,6 @@
{
NSDrawButton(cellFrame, NSZeroRect);
}
[controlView unlockFocus];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];
@ -651,7 +649,6 @@
_control_view = controlView;
cellFrame = [self drawingRectForBounds: cellFrame];
[controlView lockFocus];
if (_cell.is_highlighted)
{
@ -897,8 +894,6 @@
else
NSDottedFrameRect(titleRect);
}
[controlView unlockFocus];
}
- (NSSize) cellSize

View file

@ -1135,6 +1135,8 @@ static NSColor *shadowCol;
{
NSRect cvBounds = [cv bounds];
NSWindow *cvWin = [cv window];
[cv lockFocus];
[self setNextState];
[self highlight: YES withFrame: cvBounds inView: cv];
@ -1147,6 +1149,8 @@ static NSColor *shadowCol;
[self highlight: NO withFrame: cvBounds inView: cv];
[cvWin flushWindow];
[cv unlockFocus];
if (action)
{
NS_DURING
@ -1596,8 +1600,6 @@ static NSColor *shadowCol;
cellFrame.size.height -= 2;
}
[controlView lockFocus];
switch (_cell.type)
{
case NSTextCellType:
@ -1637,7 +1639,6 @@ static NSColor *shadowCol;
// NB: We don't do any highlighting to make it easier for subclasses
// to reuse this code while doing their own custom highlighting and
// prettyfying
[controlView unlockFocus];
}
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
@ -1649,16 +1650,12 @@ static NSColor *shadowCol;
// draw the border if needed
if (_cell.is_bordered)
{
[controlView lockFocus];
[shadowCol set];
NSFrameRect(cellFrame);
[controlView unlockFocus];
}
else if (_cell.is_bezeled)
{
[controlView lockFocus];
NSDrawWhiteBezel(cellFrame, NSZeroRect);
[controlView unlockFocus];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];

View file

@ -1006,18 +1006,23 @@ buttonCellFrameFromRect(NSRect cellRect)
// We can not use performClick: on the button cell here as
// the button uses only part of the bounds of the control view.
NSWindow *cvWin = [controlView window];
[controlView lockFocus];
[_buttonCell highlight: YES
withFrame: buttonCellFrameFromRect(cellFrame)
inView: controlView];
[controlView unlockFocus];
[cvWin flushWindow];
[self _didClick: self];
[controlView lockFocus];
[_buttonCell highlight: NO
withFrame: buttonCellFrameFromRect(cellFrame)
inView: controlView];
[controlView unlockFocus];
[cvWin flushWindow];
}
- (void) _didClick: (id)sender
@ -1031,7 +1036,8 @@ buttonCellFrameFromRect(NSRect cellRect)
object: popView
userInfo: nil];
// HACK Abort the editing, otherwise the selected value is overwritten by the editor
// HACK Abort the editing, otherwise the selected value is
// overwritten by the editor
//if ([_control_view isKindOfClass: NSControl])
[(NSControl *)_control_view abortEditing];

View file

@ -512,6 +512,7 @@ static Class actionCellClass;
}
[_window _captureMouse: self];
[self lockFocus];
e = theEvent;
while (!done) // loop until mouse goes up
@ -557,6 +558,8 @@ static Class actionCellClass;
[_window flushWindow];
}
[self unlockFocus];
[_cell sendActionOn: oldActionMask];
if (mouseUp)

View file

@ -317,16 +317,12 @@ static NSColor *shadowCol;
if (_cell.is_bordered)
{
[controlView lockFocus];
[shadowCol set];
NSFrameRect(borderedFrame);
[controlView unlockFocus];
}
else if (_cell.is_bezeled)
{
[controlView lockFocus];
NSDrawWhiteBezel(borderedFrame, NSZeroRect);
[controlView unlockFocus];
}
//

View file

@ -121,24 +121,16 @@
// nada
break;
case NSImageFramePhoto:
[controlView lockFocus];
NSDrawFramePhoto(cellFrame, NSZeroRect);
[controlView unlockFocus];
break;
case NSImageFrameGrayBezel:
[controlView lockFocus];
NSDrawGrayBezel(cellFrame, NSZeroRect);
[controlView unlockFocus];
break;
case NSImageFrameGroove:
[controlView lockFocus];
NSDrawGroove(cellFrame, NSZeroRect);
[controlView unlockFocus];
break;
case NSImageFrameButton:
[controlView lockFocus];
NSDrawButton(cellFrame, NSZeroRect);
[controlView unlockFocus];
break;
}
@ -294,13 +286,10 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
position.y += imageSize.height;
// draw!
[controlView lockFocus];
[_cell_image compositeToPoint: position operation: NSCompositeSourceOver];
if (_cell.shows_first_responder)
NSDottedFrameRect(cellFrame);
[controlView unlockFocus];
}
- (NSSize) cellSize

View file

@ -940,9 +940,11 @@ static SEL getSel;
[aCell setState: NSOffState];
if (isHighlighted)
[self highlightCell: NO atRow: i column: j];
else
[self drawCellAtRow: i column: j];
{
[aCell setHighlighted: NO];
}
[self setNeedsDisplayInRect: [self cellFrameAtRow: i
column: j]];
}
}
}
@ -1066,7 +1068,8 @@ static SEL getSel;
&& (lastRow != row || lastColumn != column)
&& [self window] != nil)
{
[self drawCellAtRow: lastRow column: lastColumn];
[self setNeedsDisplayInRect: [self cellFrameAtRow: lastRow
column: lastColumn]];
}
}
@ -1234,7 +1237,8 @@ static SEL getSel;
lastDottedRow = _dottedRow;
lastDottedColumn = _dottedColumn;
[self drawCellAtRow: lastDottedRow column: lastDottedColumn];
[self setNeedsDisplayInRect: [self cellFrameAtRow: lastDottedRow
column: lastDottedColumn]];
}
_selectedRow = _dottedRow = end.y;
@ -1258,7 +1262,8 @@ static SEL getSel;
}
if (drawLast)
[self drawCellAtRow: _dottedRow column: _dottedColumn];
[self setNeedsDisplayInRect: [self cellFrameAtRow: _dottedRow
column: _dottedColumn]];
}
- (id) cellAtRow: (int)row
@ -1860,17 +1865,13 @@ static SEL getSel;
if (_drawsCellBackground)
{
[self lockFocus];
[_cellBackgroundColor set];
NSRectFill(cellFrame);
[self unlockFocus];
}
else
{
[self lockFocus];
[_backgroundColor set];
NSRectFill(cellFrame);
[self unlockFocus];
}
if (_dottedRow == row && _dottedColumn == column
@ -1897,13 +1898,12 @@ static SEL getSel;
if (aCell)
{
NSRect cellFrame = [self cellFrameAtRow: row column: column];
[self lockFocus];
if (_drawsCellBackground)
{
[self lockFocus];
[_cellBackgroundColor set];
NSRectFill(cellFrame);
[self unlockFocus];
}
if (_dottedRow != -1 && _dottedColumn != -1
@ -1922,6 +1922,8 @@ static SEL getSel;
if (_dottedRow != -1 && _dottedColumn != -1)
[_cells[_dottedRow][_dottedColumn] setShowsFirstResponder: NO];
[self unlockFocus];
}
}
@ -2059,6 +2061,8 @@ static SEL getSel;
if ([mouseCell isEnabled])
{
[self lockFocus];
if ([mouseCell acceptsFirstResponder])
{
NSCell *aCell = [self cellAtRow: _dottedRow
@ -2096,11 +2100,17 @@ static SEL getSel;
[self highlightCell: YES
atRow: highlightedRow
column: highlightedColumn];
[_window flushWindow];
}
if (_mode == NSRadioModeMatrix)
[mouseCell setState: NSOffState];
{
[mouseCell setState: NSOffState];
[self drawCell: _selectedCell];
}
[self unlockFocus];
[_window flushWindow];
mouseUpInCell = [mouseCell trackMouse: theEvent
inRect: mouseCellFrame
@ -2119,10 +2129,11 @@ static SEL getSel;
highlightedCell = nil;
[self lockFocus];
[self highlightCell: NO
atRow: highlightedRow
column: highlightedColumn];
[_window flushWindow];
[self unlockFocus];
}
if (!mouseUpInCell)
@ -2151,7 +2162,9 @@ static SEL getSel;
if ([_selectedCell state])
{
[_selectedCell setState: NSOffState];
[self lockFocus];
[self drawCell: _selectedCell];
[self unlockFocus];
}
_selectedCells[_selectedRow][_selectedColumn] = NO;
@ -2253,7 +2266,9 @@ static SEL getSel;
if ((_mode == NSRadioModeMatrix) && _selectedCell != nil)
{
[_selectedCell setState: NSOffState];
[self lockFocus];
[self drawCellAtRow: _selectedRow column: _selectedColumn];
[self unlockFocus];
[_window flushWindow];
_selectedCells[_selectedRow][_selectedColumn] = NO;
_selectedCell = nil;
@ -2369,8 +2384,6 @@ static SEL getSel;
highlight: YES];
}
[_window flushWindow];
previousCell = aCell;
previousRect = rect;
}
@ -2409,7 +2422,6 @@ static SEL getSel;
}
[self setNeedsDisplayInRect: rect];
[_window flushWindow];
[NSEvent stopPeriodicEvents];
@ -2451,10 +2463,13 @@ static SEL getSel;
int oldSelectedColumn = _selectedColumn;
_selectedCell = aCell;
[self lockFocus];
[self highlightCell: YES atRow: i column: j];
[_window flushWindow];
[aCell setNextState];
[self sendAction];
[self highlightCell: NO atRow: i column: j];
[self unlockFocus];
_selectedCell = oldSelectedCell;
_selectedRow = oldSelectedRow;
_selectedColumn = oldSelectedColumn;
@ -2986,25 +3001,14 @@ static SEL getSel;
{
if (_selectedCell)
{
if (_mode == NSRadioModeMatrix)
{
NSCell *aCell = _selectedCell;
[aCell setState: NSOffState];
_selectedCells[_selectedRow][_selectedColumn] = NO;
_selectedRow = _selectedColumn = -1;
_selectedCell = nil;
[self drawCell: aCell];
}
else
[self deselectAllCells];
[self deselectAllCells];
}
[self selectCellAtRow: _dottedRow column: _dottedColumn];
}
else
[self drawCellAtRow: _dottedRow column: _dottedColumn];
[self setNeedsDisplayInRect: [self cellFrameAtRow: _dottedRow
column: _dottedColumn]];
}
else
{
@ -3080,6 +3084,8 @@ static SEL getSel;
{
if (_mode == NSRadioModeMatrix)
{
/* FIXME */
/*
NSCell *aCell = _cells[lastDottedRow][lastDottedColumn];
BOOL isHighlighted = [aCell isHighlighted];
@ -3097,6 +3103,7 @@ static SEL getSel;
else
[self drawCell: aCell];
}
*/
}
else
[self deselectAllCells];
@ -3105,17 +3112,17 @@ static SEL getSel;
}
else
{
[self drawCell: _cells[lastDottedRow][lastDottedColumn]];
[self drawCell: _cells[_dottedRow][_dottedColumn]];
[self setNeedsDisplayInRect: [self cellFrameAtRow: lastDottedRow
column: lastDottedColumn]];
[self setNeedsDisplayInRect: [self cellFrameAtRow: _dottedRow
column: _dottedColumn]];
}
}
[_window flushWindow];
if (selectCell)
{
[self displayIfNeeded];
[self performClick: self];
[_window flushWindow];
}
}
@ -3206,8 +3213,10 @@ static SEL getSel;
}
}
[self lockFocus];
[self drawCell: _cells[lastDottedRow][_dottedColumn]];
[self drawCell: _cells[_dottedRow][_dottedColumn]];
[self unlockFocus];
[_window flushWindow];
[self performClick: self];
@ -3252,6 +3261,7 @@ static SEL getSel;
anchor: INDEX_FROM_COORDS(_selectedRow, _selectedColumn)
highlight: YES];
[self displayIfNeeded];
[self performClick: self];
}
@ -3290,7 +3300,8 @@ static SEL getSel;
cell = _cells[_dottedRow][_dottedColumn];
[cell setNextState];
[self drawCell: cell];
[self setNeedsDisplayInRect: [self cellFrameAtRow: _dottedRow
column: _dottedColumn]];
break;
case NSListModeMatrix:
@ -3302,7 +3313,7 @@ static SEL getSel;
break;
}
[_window flushWindow];
[self displayIfNeeded];
[self performClick: self];
}
return;
@ -3637,11 +3648,9 @@ static SEL getSel;
_selectedCells[i][j] = YES;
[aCell setCellAttribute: NSCellHighlighted to: highlight];
[self drawCell: aCell];
[self setNeedsDisplayInRect: [self cellFrameAtRow: i column: j]];
}
}
[_window flushWindow];
}
// Return YES on success; NO if no selectable cell found.
@ -3732,10 +3741,8 @@ static SEL getSel;
// (this method is only called by drawRect:)
if (_drawsCellBackground)
{
[self lockFocus];
[_cellBackgroundColor set];
NSRectFill(cellFrame);
[self unlockFocus];
}
if (_dottedRow == row && _dottedColumn == column

View file

@ -369,8 +369,6 @@ static NSImage *arrowImageH = nil;
if (!_cell.is_bordered)
return;
[controlView lockFocus];
if (_cell.is_highlighted && (_highlightsByMask & NSPushInCellMask))
{
NSDrawGrayBezel(cellFrame, NSZeroRect);
@ -379,8 +377,6 @@ static NSImage *arrowImageH = nil;
{
NSDrawButton(cellFrame, NSZeroRect);
}
[controlView unlockFocus];
}
- (void) drawImageWithFrame: (NSRect)cellFrame
@ -538,7 +534,6 @@ static NSImage *arrowImageH = nil;
return;
cellFrame = [self drawingRectForBounds: cellFrame];
[controlView lockFocus];
if (_cell.is_highlighted)
{
@ -618,7 +613,6 @@ static NSImage *arrowImageH = nil;
if (_keyEquivalentWidth > 0)
[self drawKeyEquivalentWithFrame: cellFrame inView: controlView];
[controlView unlockFocus];
_backgroundColor = nil;
}

View file

@ -1675,6 +1675,8 @@ static NSImage *unexpandable = nil;
// move the drawing rect over like in the drawRow routine...
drawingRect = [self frameOfCellAtColumn: columnIndex row: rowIndex];
[self lockFocus];
if(tb == [self outlineTableColumn])
{
level = [self levelForItem: item];
@ -1718,7 +1720,9 @@ static NSImage *unexpandable = nil;
delegate: self
event: theEvent];
}
return;
[self unlockFocus];
return;
}
@end /* implementation of NSOutlineView */

View file

@ -534,15 +534,11 @@ static NSImage *_pbc_image[2];
if (_buttoncell_is_transparent)
return;
[view lockFocus];
cellFrame = [self drawingRectForBounds: cellFrame];
if (_cell.shows_first_responder
&& [[view window] firstResponder] == view)
NSDottedFrameRect(cellFrame);
[view unlockFocus];
}
/* FIXME: this method needs to be rewritten to be something like

View file

@ -677,6 +677,8 @@ static NSColor *scrollBarColor = nil;
id theCell = nil;
NSRect rect;
[self lockFocus];
NSDebugLog (@"trackScrollButtons");
do
{
@ -740,6 +742,8 @@ static NSColor *scrollBarColor = nil;
}
while ([theEvent type] != NSLeftMouseUp);
[self unlockFocus];
NSDebugLog (@"return from trackScrollButtons");
}

View file

@ -369,6 +369,8 @@ static Class cellClass;
[NSEvent startPeriodicEventsAfterDelay: 0.05 withPeriod: 0.05];
[[NSRunLoop currentRunLoop] limitDateForMode: NSEventTrackingRunLoopMode];
[self lockFocus];
while (eventType != NSLeftMouseUp)
{
theEvent = [app nextEventMatchingMask: eventMask
@ -407,6 +409,7 @@ static Class cellClass;
}
}
}
[self unlockFocus];
// If the control is not continuous send the action at the end of the drag
if (!isContinuous)
{
@ -439,7 +442,9 @@ static Class cellClass;
{
[self sendAction: [_cell action] to: [_cell target]];
}
[self lockFocus];
[_cell drawWithFrame: _bounds inView: self];
[self unlockFocus];
[_window flushWindow];
}

View file

@ -173,7 +173,6 @@
cellFrame = [self drawingRectForBounds: cellFrame];
[controlView lockFocus];
if (vertical != _isVertical)
{
if (vertical == YES)
@ -205,7 +204,6 @@
}
[self drawKnob];
[controlView unlockFocus];
}
- (BOOL) isOpaque

View file

@ -203,6 +203,7 @@ id _nsstepperCellClass = nil;
return;
}
[self lockFocus];
{
BOOL overButton = YES;
int ignore = 3;
@ -298,6 +299,7 @@ id _nsstepperCellClass = nil;
[_window flushWindow];
[_window _releaseMouse: self];
}
[self unlockFocus];
}
- (void)_increment

View file

@ -253,7 +253,6 @@ inline void HighlightDownButton(NSRect aRect)
NSRect downRect;
NSRect twoButtons;
NSGraphicsContext *ctxt;
[controlView lockFocus];
ctxt = GSCurrentContext();
{
@ -283,8 +282,6 @@ inline void HighlightDownButton(NSRect aRect)
up_sides, grays, 2);
}
}
[controlView unlockFocus];
}
- (void) highlight: (BOOL) highlight
@ -295,7 +292,6 @@ inline void HighlightDownButton(NSRect aRect)
NSRect upRect;
NSRect downRect;
NSGraphicsContext *ctxt;
[controlView lockFocus];
ctxt = GSCurrentContext();
{
upRect = [self upButtonRectWithFrame: frame];
@ -317,7 +313,6 @@ inline void HighlightDownButton(NSRect aRect)
DrawDownButton(downRect);
}
}
[controlView unlockFocus];
}
- (NSRect) upButtonRectWithFrame: (NSRect) frame

View file

@ -69,7 +69,6 @@ static NSColor *clearCol = nil;
NSRect rect;
NSGraphicsContext *ctxt;
[controlView lockFocus];
ctxt = GSCurrentContext();
if (GSWViewIsFlipped(ctxt) == YES)
@ -86,7 +85,6 @@ static NSColor *clearCol = nil;
DPSsetgray(ctxt, NSLightGray);
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
NSWidth(rect), NSHeight(rect));
[controlView unlockFocus];
}
else
{
@ -99,7 +97,6 @@ static NSColor *clearCol = nil;
NSRect rect;
NSGraphicsContext *ctxt;
[controlView lockFocus];
ctxt = GSCurrentContext();
if (GSWViewIsFlipped(ctxt) == YES)
@ -116,7 +113,6 @@ static NSColor *clearCol = nil;
DPSsetgray(ctxt, NSDarkGray);
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
NSWidth(rect), NSHeight(rect));
[controlView unlockFocus];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
@ -158,7 +154,6 @@ static NSColor *clearCol = nil;
}
// Prepare to draw
cellFrame = [self drawingRectForBounds: cellFrame];
[controlView lockFocus];
// Deal with the background
if ([self isOpaque])
{
@ -192,7 +187,6 @@ static NSColor *clearCol = nil;
[_cell_image compositeToPoint: position operation: NSCompositeCopy];
}
// End the drawing
[controlView unlockFocus];
break;
case NSNullCellType:

View file

@ -239,13 +239,11 @@
{
NSGraphicsContext *ctxt = GSCurrentContext();
[self lockFocus];
DPSsetgray(ctxt, NSBlack);
DPSrectfill(ctxt,_bounds.origin.x, _bounds.origin.y,
_bounds.size.width, 1.);
DPSrectfill(ctxt, NSMaxX(_bounds)-1., NSMinY(_bounds),
1., _bounds.size.height);
[self unlockFocus];
}
}
@ -519,10 +517,12 @@
rect.size.height--;
[[currentColumn headerCell] setHighlighted: YES];
[self lockFocus];
[[currentColumn headerCell]
highlight: YES
withFrame: rect
inView: self];
[self unlockFocus];
[_window flushWindow];
}
@ -755,10 +755,12 @@
[[currentColumn headerCell]
setHighlighted: NO];
[self lockFocus];
[[currentColumn headerCell]
highlight: NO
withFrame: rect
inView: self];
[self unlockFocus];
[_window flushWindow];
}
if (i > columnIndex)
@ -810,10 +812,12 @@
[[currentColumn headerCell]
setHighlighted: NO];
[self lockFocus];
[[currentColumn headerCell]
highlight: NO
withFrame: rect
inView: self];
[self unlockFocus];
[_window flushWindow];
}

View file

@ -161,10 +161,8 @@ static NSColor *txtCol;
{
if (_textfieldcell_draws_background)
{
[controlView lockFocus];
[_background_color set];
NSRectFill ([self drawingRectForBounds: cellFrame]);
[controlView unlockFocus];
}
[super drawInteriorWithFrame: cellFrame inView: controlView];
}

View file

@ -324,9 +324,8 @@ static NSCell *tileCell = nil;
{
[imageCell setImage: anImage];
}
if (_window != nil)
if ([self lockFocusIfCanDraw])
{
[self lockFocus];
[self drawRect: [self bounds]];
[self unlockFocus];
[_window flushWindow];
@ -351,9 +350,8 @@ static NSCell *tileCell = nil;
{
[titleCell setStringValue: aString];
}
if (_window != nil)
if ([self lockFocusIfCanDraw])
{
[self lockFocus];
[self drawRect: [self bounds]];
[self unlockFocus];
[_window flushWindow];