From 183c8411a5556df18814477bafb0d2237a504931 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Sat, 23 Sep 2006 19:08:18 +0000 Subject: [PATCH] Add new event subtype for exposure of region of window. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23598 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 ++++++ .../Additions/GNUstepGUI/GSDisplayServer.h | 1 + Headers/AppKit/NSEvent.h | 3 +- Source/GSDisplayServer.m | 6 ++++ Source/GSWindowDecorationView.m | 2 ++ Source/NSWindow.m | 29 +++++++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 02911621c..f01127ee5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-09-23 Richard Frith-Macdonald + + * Source/GSWindowDecorationView.m: coimment out dubious change. + * Source/GSDisplayServer.m: Add method for expose events + * Source/NSWindow.m: Handle expose events. + * Headers/AppKit/NSEvent.h: Add expose event type. + * Headers/Additions/GNUstepGUI/GSDisplayServer.h: Add method for + expose events. + 2006-09-22 Richard Frith-Macdonald * Headers/AppKit/NSColorList.h: Add documentation. diff --git a/Headers/Additions/GNUstepGUI/GSDisplayServer.h b/Headers/Additions/GNUstepGUI/GSDisplayServer.h index b6421c546..d75770c4e 100644 --- a/Headers/Additions/GNUstepGUI/GSDisplayServer.h +++ b/Headers/Additions/GNUstepGUI/GSDisplayServer.h @@ -143,6 +143,7 @@ APPKIT_EXPORT NSString * GSScreenNumber; - (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b : (unsigned int) style; - (void) docedited: (int) edited : (int) win; +- (void) exposewindow: (NSRect)frame : (int) win; - (void) setinputstate: (int)state : (int)win; - (void) setinputfocus: (int) win; - (void) setalpha: (float)alpha: (int) win; diff --git a/Headers/AppKit/NSEvent.h b/Headers/AppKit/NSEvent.h index 84c8ccb57..fb2e9945a 100644 --- a/Headers/AppKit/NSEvent.h +++ b/Headers/AppKit/NSEvent.h @@ -362,7 +362,8 @@ typedef enum { GSAppKitDraggingStatus, GSAppKitDraggingExit, GSAppKitDraggingDrop, - GSAppKitDraggingFinished + GSAppKitDraggingFinished, + GSAppKitRegionExposed } GSAppKitSubtype; #endif diff --git a/Source/GSDisplayServer.m b/Source/GSDisplayServer.m index 84a452316..986070083 100644 --- a/Source/GSDisplayServer.m +++ b/Source/GSDisplayServer.m @@ -724,6 +724,12 @@ GSCurrentServer(void) [self subclassResponsibility: _cmd]; } +/** Repaint an exposed region of a buffered window */ +- (void) exposewindow: (NSRect)frame : (int) win +{ + [self subclassResponsibility: _cmd]; +} + /** Sets the input state for the window given by the GSWindowInputState constant. Instructs the window manager that the specified window is 'key', 'main', or just a normal window. */ diff --git a/Source/GSWindowDecorationView.m b/Source/GSWindowDecorationView.m index 58316e870..65780cc51 100644 --- a/Source/GSWindowDecorationView.m +++ b/Source/GSWindowDecorationView.m @@ -124,6 +124,7 @@ struct NSWindow_struct return self; } +#if 0 - (void) removeSubview: (NSView*)aView { RETAIN(aView); @@ -137,6 +138,7 @@ struct NSWindow_struct } RELEASE(aView); } +#endif - (void) setBackgroundColor: (NSColor *)color { diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 57ef1c25e..32e407114 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -3360,6 +3360,35 @@ resetCursorRectsForView(NSView *theView) break; } + case GSAppKitRegionExposed: + { + NSRect region; + + region.size.width = [theEvent data1]; + region.size.height = [theEvent data2]; + region.origin = [theEvent locationInWindow]; + switch (_backingType) + { + case NSBackingStoreBuffered: + case NSBackingStoreRetained: + /* The window is buffered/retained, so we expect the + * backend to have a copy of the region contents and + * be able to draw it. + */ + [GSServerForWindow(self) exposewindow: region + : _windowNum]; + break; + + default: + /* non-retained ... so we need to redraw the exposed + * region here. + */ + [_wv setNeedsDisplayInRect: region]; + break; + } + } + break; + case GSAppKitWindowClose: [self performClose: NSApp]; break;