Move view specifc flags to NSView.h and ad new flag for NSWindow. This

change requires a complete re-compile of GNUstep and all applications!!!


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24821 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2007-03-08 12:52:01 +00:00
parent 210c327204
commit 816c4db82c
4 changed files with 54 additions and 54 deletions

View file

@ -61,29 +61,6 @@
*/ */
@private @private
NSMenu *_menu; NSMenu *_menu;
/*
* Flags for internal use by NSResponder and it's subclasses.
*/
@public
struct _rFlagsType {
/*
* 'flipped_view' is set in NSViews designated initialiser (and other
* methods that create views) to be the value returned by [-isFlipped]
* This caching assumes that the value returned by [-isFlipped] will
* not change during the views lifetime - if it does, the view must
* be sure to change the flag accordingly.
*/
unsigned flipped_view:1;
unsigned has_subviews:1; /* The view has subviews. */
unsigned has_currects:1; /* The view has cursor rects. */
unsigned has_trkrects:1; /* The view has tracking rects. */
unsigned has_draginfo:1; /* View/window has drag types. */
unsigned opaque_view:1; /* For views whose opacity may */
/* change to keep track of it. */
unsigned valid_rects:1; /* Some cursor rects may be ok. */
unsigned needs_display:1; /* Window/view needs display. */
unsigned has_tooltips:1; /* The view has tooltips set. */
} _rFlags;
} }
/* /*

View file

@ -109,8 +109,33 @@ typedef enum _NSFocusRingType {
NSMutableArray *_cursor_rects; NSMutableArray *_cursor_rects;
NSRect _invalidRect; NSRect _invalidRect;
NSRect _visibleRect; NSRect _visibleRect;
unsigned int _autoresizingMask;
int _gstate; int _gstate;
void *_nextKeyView;
void *_previousKeyView;
@public
/*
* Flags for internal use by NSView and it's subclasses.
*/
struct _rFlagsType {
/*
* 'flipped_view' is set in NSViews designated initialiser (and other
* methods that create views) to be the value returned by [-isFlipped]
* This caching assumes that the value returned by [-isFlipped] will
* not change during the views lifetime - if it does, the view must
* be sure to change the flag accordingly.
*/
unsigned flipped_view:1;
unsigned has_subviews:1; /* The view has subviews. */
unsigned has_currects:1; /* The view has cursor rects. */
unsigned has_trkrects:1; /* The view has tracking rects. */
unsigned has_draginfo:1; /* View has drag types. */
unsigned opaque_view:1; /* For views whose opacity may */
/* change to keep track of it. */
unsigned valid_rects:1; /* Some cursor rects may be ok. */
unsigned needs_display:1; /* view needs display. */
unsigned has_tooltips:1; /* The view has tooltips set. */
} _rFlags;
BOOL _is_rotated_from_base; BOOL _is_rotated_from_base;
BOOL _is_rotated_or_scaled_from_base; BOOL _is_rotated_or_scaled_from_base;
@ -123,10 +148,8 @@ typedef enum _NSFocusRingType {
BOOL _is_hidden; BOOL _is_hidden;
BOOL _in_live_resize; BOOL _in_live_resize;
unsigned int _autoresizingMask;
NSFocusRingType _focusRingType; NSFocusRingType _focusRingType;
void *_nextKeyView;
void *_previousKeyView;
} }
/* /*

View file

@ -207,6 +207,7 @@ APPKIT_EXPORT NSSize NSTokenSize;
unsigned can_hide:1; unsigned can_hide:1;
unsigned has_shadow:1; unsigned has_shadow:1;
unsigned is_opaque:1; unsigned is_opaque:1;
unsigned views_need_display:1;
// 3 bits reserved for subclass use // 3 bits reserved for subclass use
unsigned subclass_bool_one: 1; unsigned subclass_bool_one: 1;
unsigned subclass_bool_two: 1; unsigned subclass_bool_two: 1;

View file

@ -128,7 +128,7 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
/* Window autodisplay machinery. */ /* Window autodisplay machinery. */
- (void) _handleAutodisplay - (void) _handleAutodisplay
{ {
if (_f.is_autodisplay && _rFlags.needs_display) if (_f.is_autodisplay && _f.views_need_display)
{ {
[self disableFlushWindow]; [self disableFlushWindow];
[self displayIfNeeded]; [self displayIfNeeded];
@ -2062,18 +2062,21 @@ many times.
if (_gstate == 0 || _f.visible == NO) if (_gstate == 0 || _f.visible == NO)
return; return;
_rFlags.needs_display = NO;
[_wv display]; [_wv display];
[self discardCachedImage]; [self discardCachedImage];
_f.views_need_display = NO;
} }
- (void) displayIfNeeded - (void) displayIfNeeded
{ {
if (_rFlags.needs_display) if (_gstate == 0 || _f.visible == NO)
return;
if (_f.views_need_display)
{ {
[_wv displayIfNeeded]; [_wv displayIfNeeded];
_rFlags.needs_display = NO; [self discardCachedImage];
_f.views_need_display = NO;
} }
} }
@ -2176,9 +2179,9 @@ many times.
- (void) setViewsNeedDisplay: (BOOL)flag - (void) setViewsNeedDisplay: (BOOL)flag
{ {
if (_rFlags.needs_display != flag) if (_f.views_need_display != flag)
{ {
_rFlags.needs_display = flag; _f.views_need_display = flag;
if (flag) if (flag)
{ {
/* TODO: this call most likely shouldn't be here */ /* TODO: this call most likely shouldn't be here */
@ -2189,7 +2192,7 @@ many times.
- (BOOL) viewsNeedDisplay - (BOOL) viewsNeedDisplay
{ {
return _rFlags.needs_display; return _f.views_need_display;
} }
- (void) cacheImageInRect: (NSRect)aRect - (void) cacheImageInRect: (NSRect)aRect
@ -3470,23 +3473,20 @@ resetCursorRectsForView(NSView *theView)
_rectNeedingFlush _rectNeedingFlush
= NSUnionRect(_rectNeedingFlush, region); = NSUnionRect(_rectNeedingFlush, region);
_f.needs_flush = YES; _f.needs_flush = YES;
if (_rFlags.needs_display) /* Some or all of the window has not been drawn,
{ * so we must at least make sure that the exposed
/* Some or all of the window has not been drawn, * region gets drawn before its backing store is
* so we must at least make sure that the exposed * flushed ... otherwise we might actually flush
* region gets drawn before its backing store is * bogus data from an out of date buffer.
* flushed ... otherwise we might actually flush * Maybe we should call
* bogus data from an out of date buffer. * [_wv displayIfNeededInRect: region]
* Maybe we should call * but why not do all drawing at this point so
* [_wv displayIfNeededInRect: region] * that if we get another expose event immediately
* but why not do all drawing at this point so * (eg. something is dragged over the window and
* that if we get another expose event immediately * we get a series of expose events) we can just
* (eg. something is dragged over the window and * flush without having to draw again.
* we get a series of expose events) we can just */
* flush without having to draw again. [self displayIfNeeded];
*/
[_wv displayIfNeeded];
}
[self flushWindowIfNeeded]; [self flushWindowIfNeeded];
break; break;
@ -4654,8 +4654,7 @@ current key view.<br />
_f.can_hide = YES; _f.can_hide = YES;
_f.has_shadow = NO; _f.has_shadow = NO;
_f.is_opaque = YES; _f.is_opaque = YES;
_f.views_need_display = YES;
_rFlags.needs_display = YES;
} }
@end @end