diff --git a/ChangeLog b/ChangeLog index 7df00df60..fcba696fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Mar 06 20:09:00 2000 Richard Frith-Macdonald + + * Headers/gnustep/gui/GSMethodTable.h: Added method to set titlebar. + * Headers/gnustep/gui/DPSOperators.h: ditto + * Headers/gnustep/gui/NSGraphicsContext.h: ditto + * Headers/gnustep/gui/PSOperators.h: ditto + * Source/NSWindow.m: Make calls to DPSsetinputstate() to set the + titlebar for the window on change of key/main/normal state. + Mon Mar 06 10:36:00 2000 Richard Frith-Macdonald * Source/NSWindow.m: Various tidyups by Fred kiefer and myself. diff --git a/Headers/gnustep/gui/DPSOperators.h b/Headers/gnustep/gui/DPSOperators.h index bedaab647..0513e8e34 100644 --- a/Headers/gnustep/gui/DPSOperators.h +++ b/Headers/gnustep/gui/DPSOperators.h @@ -928,6 +928,33 @@ static inline void DPSdocedited(GSCTXT *ctxt, int edited, int window) __attribute__((unused)); +/* ----------------------------------------------------------------------- */ +/* GNUstep Event and other I/O extensions */ +/* ----------------------------------------------------------------------- */ +static inline NSEvent* +DPSGetEvent(GSCTXT *ctxt, unsigned mask, NSDate* limit, NSString *mode) +__attribute__((unused)); + +static inline NSEvent* +DPSPeekEvent(GSCTXT *ctxt, unsigned mask, NSDate* limit, NSString *mode) +__attribute__((unused)); + +static inline void +DPSDiscardEvents(GSCTXT *ctxt, unsigned mask, NSEvent* limit) +__attribute__((unused)); + +static inline void +DPSPostEvent(GSCTXT *ctxt, NSEvent* anEvent, BOOL atStart) +__attribute__((unused)); + +static inline void +DPSmouselocation(GSCTXT *ctxt, float *x, float *y) +__attribute__((unused)); + +static inline void +DPSsetinputstate(GSCTXT *ctxt, int window, int state) +__attribute__((unused)); + /* ----------------------------------------------------------------------- */ /* Color operations */ /* ----------------------------------------------------------------------- */ @@ -2516,4 +2543,11 @@ DPSmouselocation(GSCTXT *ctxt, float *x, float *y) (ctxt, @selector(DPSmouselocation::), x, y); } +static inline void +DPSsetinputstate(GSCTXT *ctxt, int window, int state) +{ + (ctxt->methods->DPSsetinputstate__) + (ctxt, @selector(DPSsetinputstate::), window, state); +} + #endif diff --git a/Headers/gnustep/gui/GSMethodTable.h b/Headers/gnustep/gui/GSMethodTable.h index 666866ef0..95775782e 100644 --- a/Headers/gnustep/gui/GSMethodTable.h +++ b/Headers/gnustep/gui/GSMethodTable.h @@ -514,6 +514,8 @@ typedef struct { (NSGraphicsContext*, SEL, NSEvent*, BOOL); void (*DPSmouselocation__) (NSGraphicsContext*, SEL, float*, float*); + void (*DPSsetinputstate__) + (NSGraphicsContext*, SEL, int, int); } gsMethodTable; diff --git a/Headers/gnustep/gui/NSGraphicsContext.h b/Headers/gnustep/gui/NSGraphicsContext.h index 7c62f0561..1968999ce 100644 --- a/Headers/gnustep/gui/NSGraphicsContext.h +++ b/Headers/gnustep/gui/NSGraphicsContext.h @@ -90,6 +90,16 @@ typedef enum _NSWindowOrderingMode } NSWindowOrderingMode; +/* + * Window input state + */ +typedef enum _GSWindowInputState +{ + GSTitleBarKey = 0, + GSTitleBarNormal = 1, + GSTitleBarMain = 2 + +} GSWindowInputState; @interface NSGraphicsContext : NSObject { @@ -423,6 +433,7 @@ NSGraphicsContext *GSCurrentContext(); beforeEvent: (NSEvent*)limit; - (void) DPSPostEvent: (NSEvent*)anEvent atStart: (BOOL)flag; - (void) DPSmouselocation: (float*)x : (float*)y; +- (void) DPSsetinputstate: (int)window : (int)state; @end #endif /* _NSGraphicsContext_h_INCLUDE */ diff --git a/Headers/gnustep/gui/PSOperators.h b/Headers/gnustep/gui/PSOperators.h index 8d4871301..5f253e7a4 100644 --- a/Headers/gnustep/gui/PSOperators.h +++ b/Headers/gnustep/gui/PSOperators.h @@ -742,6 +742,33 @@ static inline void PScurrentalpha(float *a) __attribute__((unused)); +/* ----------------------------------------------------------------------- */ +/* GNUstep Event and other I/O extensions */ +/* ----------------------------------------------------------------------- */ +static inline NSEvent* +PSGetEvent(unsigned mask, NSDate* limit, NSString *mode) +__attribute__((unused)); + +static inline NSEvent* +PSPeekEvent(unsigned mask, NSDate* limit, NSString *mode) +__attribute__((unused)); + +static inline void +PSDiscardEvents(unsigned mask, NSEvent* limit) +__attribute__((unused)); + +static inline void +PSPostEvent(NSEvent* anEvent, BOOL atStart) +__attribute__((unused)); + +static inline void +PSmouselocation(float *x, float *y) +__attribute__((unused)); + +static inline void +PSsetinputstate(int window, int state) +__attribute__((unused)); + /* ----------------------------------------------------------------------- */ /* Color operations */ /* ----------------------------------------------------------------------- */ @@ -1823,4 +1850,10 @@ PSmouselocation(float *x, float *y) DPSmouselocation(DEFCTXT, x, y); } +static inline void +PSsetinputstate(int window, int state) +{ + DPSsetinputstate(DEFCTXT, window, state); +} + #endif diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 59b746257..4bad6e11d 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -481,7 +481,8 @@ static NSMapTable* windowmaps = NULL; NSNonRetainedObjectMapValueCallBacks, 20); /* Initialize attributes and flags */ - [self cleanInit]; + [super init]; + [self _initDefaults]; backing_type = bufferingType; style_mask = aStyle; @@ -791,7 +792,7 @@ static NSMapTable* windowmaps = NULL; [first_responder becomeKeyWindow]; _f.is_key = YES; - DPSsetinputfocus(GSCurrentContext(), window_num); + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarKey); [self resetCursorRects]; [nc postNotificationName: NSWindowDidBecomeKeyNotification object: self]; } @@ -804,6 +805,10 @@ static NSMapTable* windowmaps = NULL; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; _f.is_main = YES; + if (_f.is_key == NO) + { + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarMain); + } [nc postNotificationName: NSWindowDidBecomeMainNotification object: self]; } } @@ -1058,6 +1063,15 @@ static NSMapTable* windowmaps = NULL; //[first_responder resignKeyWindow]; _f.is_key = NO; + + if (_f.is_main == YES) + { + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarMain); + } + else + { + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarNormal); + } [self discardCursorRects]; [nc postNotificationName: NSWindowDidResignKeyNotification object: self]; @@ -1071,7 +1085,14 @@ static NSMapTable* windowmaps = NULL; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; _f.is_main = NO; - + if (_f.is_key == YES) + { + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarKey); + } + else + { + DPSsetinputstate(GSCurrentContext(), window_num, GSTitleBarNormal); + } [nc postNotificationName: NSWindowDidResignMainNotification object: self]; } } @@ -3211,14 +3232,6 @@ resetCursorRectsForView(NSView *theView) _f.has_closed = NO; } -- (id) cleanInit -{ - [super init]; - - [self _initDefaults]; - return self; -} - @end BOOL GSViewAcceptsDrag(NSView *v, id dragInfo)