From 816c4db82cc23b573dfe798bf239bcb12dd9e4de Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Thu, 8 Mar 2007 12:52:01 +0000 Subject: [PATCH] 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 --- Headers/AppKit/NSResponder.h | 23 ---------------- Headers/AppKit/NSView.h | 31 ++++++++++++++++++--- Headers/AppKit/NSWindow.h | 1 + Source/NSWindow.m | 53 ++++++++++++++++++------------------ 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Headers/AppKit/NSResponder.h b/Headers/AppKit/NSResponder.h index ed46a4546..3c5d2c23a 100644 --- a/Headers/AppKit/NSResponder.h +++ b/Headers/AppKit/NSResponder.h @@ -61,29 +61,6 @@ */ @private 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; } /* diff --git a/Headers/AppKit/NSView.h b/Headers/AppKit/NSView.h index 941639789..3d36004f6 100644 --- a/Headers/AppKit/NSView.h +++ b/Headers/AppKit/NSView.h @@ -109,8 +109,33 @@ typedef enum _NSFocusRingType { NSMutableArray *_cursor_rects; NSRect _invalidRect; NSRect _visibleRect; - unsigned int _autoresizingMask; 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_or_scaled_from_base; @@ -123,10 +148,8 @@ typedef enum _NSFocusRingType { BOOL _is_hidden; BOOL _in_live_resize; + unsigned int _autoresizingMask; NSFocusRingType _focusRingType; - - void *_nextKeyView; - void *_previousKeyView; } /* diff --git a/Headers/AppKit/NSWindow.h b/Headers/AppKit/NSWindow.h index 78fb056b6..4dd8dcc33 100644 --- a/Headers/AppKit/NSWindow.h +++ b/Headers/AppKit/NSWindow.h @@ -207,6 +207,7 @@ APPKIT_EXPORT NSSize NSTokenSize; unsigned can_hide:1; unsigned has_shadow:1; unsigned is_opaque:1; + unsigned views_need_display:1; // 3 bits reserved for subclass use unsigned subclass_bool_one: 1; unsigned subclass_bool_two: 1; diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 71b0e19e6..6917575d6 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -128,7 +128,7 @@ BOOL GSViewAcceptsDrag(NSView *v, id dragInfo); /* Window autodisplay machinery. */ - (void) _handleAutodisplay { - if (_f.is_autodisplay && _rFlags.needs_display) + if (_f.is_autodisplay && _f.views_need_display) { [self disableFlushWindow]; [self displayIfNeeded]; @@ -2062,18 +2062,21 @@ many times. if (_gstate == 0 || _f.visible == NO) return; - _rFlags.needs_display = NO; - [_wv display]; [self discardCachedImage]; + _f.views_need_display = NO; } - (void) displayIfNeeded { - if (_rFlags.needs_display) + if (_gstate == 0 || _f.visible == NO) + return; + + if (_f.views_need_display) { [_wv displayIfNeeded]; - _rFlags.needs_display = NO; + [self discardCachedImage]; + _f.views_need_display = NO; } } @@ -2176,9 +2179,9 @@ many times. - (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) { /* TODO: this call most likely shouldn't be here */ @@ -2189,7 +2192,7 @@ many times. - (BOOL) viewsNeedDisplay { - return _rFlags.needs_display; + return _f.views_need_display; } - (void) cacheImageInRect: (NSRect)aRect @@ -3470,23 +3473,20 @@ resetCursorRectsForView(NSView *theView) _rectNeedingFlush = NSUnionRect(_rectNeedingFlush, region); _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 - * region gets drawn before its backing store is - * flushed ... otherwise we might actually flush - * bogus data from an out of date buffer. - * Maybe we should call - * [_wv displayIfNeededInRect: region] - * but why not do all drawing at this point so - * that if we get another expose event immediately - * (eg. something is dragged over the window and - * we get a series of expose events) we can just - * flush without having to draw again. - */ - [_wv displayIfNeeded]; - } + /* Some or all of the window has not been drawn, + * so we must at least make sure that the exposed + * region gets drawn before its backing store is + * flushed ... otherwise we might actually flush + * bogus data from an out of date buffer. + * Maybe we should call + * [_wv displayIfNeededInRect: region] + * but why not do all drawing at this point so + * that if we get another expose event immediately + * (eg. something is dragged over the window and + * we get a series of expose events) we can just + * flush without having to draw again. + */ + [self displayIfNeeded]; [self flushWindowIfNeeded]; break; @@ -4654,8 +4654,7 @@ current key view.
_f.can_hide = YES; _f.has_shadow = NO; _f.is_opaque = YES; - - _rFlags.needs_display = YES; + _f.views_need_display = YES; } @end