Split into Window server and graphic context handling

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13256 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-03-28 03:53:18 +00:00
parent dc5eeca602
commit 955aa35094
26 changed files with 3096 additions and 6288 deletions

View file

@ -1,6 +1,35 @@
2002-03-27 Adam Fedor <fedor@gnu.org>
* Splitup backend into Server and Graphics Contexts. Revise list
of graphics operators for better functionality.
* Headers/gnustep/gui/GSDisplayServer.h: New file.
* Headers/gnustep/gui/DPSOperators.h: Revised set of operators.
* Headers/gnustep/gui/PSOperators.h: Likewise.
* Headers/gnustep/gui/GSMethodTable.h: Likewise.
* Headers/gnustep/gui/NSGraphics.h: Un-inline/revise functions.
* Headers/gnustep/gui/NSGraphicsContext.h: Update for MacOSX
compatibility, move server methods to GSDisplayServer, Revise list
of operators.
* Source/GSDisplayServer.m: New file.
* Source/Functions.m: Move uninlined functions from NSGraphics.h here.
* Source/NSAffineTransform.m (-set): Update to new method.
* Source/NSApplication.m: Load gnustep-back backend by default.
Update for new server class.
* Source/NSCursor: Use new methods from server.
* Source/NSEvent.m: Likewise.
* Source/NSFont.m: Likewise.
* Source/NSImageRep.m: Likewise.
* Source/NSScreen.m: Likewise.
* Source/NSView.m: Likewise.
* Source/NSWindow.m: Likewise.
* Source/NSWorkspace.m: Likewise.
* Source/NSGraphicsContext.m: Move server methods, revised list
of operators
Thu Mar 28 03:43:49 2002 Nicola Pero <n.pero@mi.flashnet.it>
* Source/libgnustep-gui.def: Removed __objc_class_name_GSTransparentView.
* Source/libgnustep-gui.def: Removed
__objc_class_name_GSTransparentView.
2002-03-27 Gregory John Casamento <greg_casamento@yahoo.com>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,169 @@
/** <title>GSDisplayServer</title>
<abstract>Abstract display server class.</abstract>
Copyright (C) 2002 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Date: Mar 2002
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#ifndef _GSDisplayServer_h_INCLUDE
#define _GSDisplayServer_h_INCLUDE
#include <Foundation/NSObject.h>
#include <Foundation/NSGeometry.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSSet.h>
#include <AppKit/NSDragging.h>
#include <AppKit/AppKitDefines.h>
#include <AppKit/NSGraphicsContext.h>
@class NSArray;
@class NSDictionary;
@class NSEvent;
@class NSImage;
@class NSMutableArray;
@class NSMutableData;
@class GSDisplayServer;
#ifndef NO_GNUSTEP
GSDisplayServer * GSServerForWindow(NSWindow *window);
GSDisplayServer * GSCurrentServer(void);
@interface GSDisplayServer : NSObject
{
NSDictionary *server_info;
NSMutableArray *event_queue;
NSMapTable *drag_types;
}
+ (void) setDefaultServerClass: (Class)aClass;
+ (GSDisplayServer *) serverWithAttributes: (NSDictionary *)attributes;
+ (void) setCurrentServer: (GSDisplayServer *)server;
- initWithAttributes: (NSDictionary *)attributes;
- (NSDictionary *) attributes;
- (void) closeServer;
/* Drag and drop support. */
+ (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win;
+ (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win;
+ (NSCountedSet*) dragTypesForWindow: (NSWindow *)win;
- (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win;
- (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win;
- (NSCountedSet*) dragTypesForWindow: (NSWindow *)win;
- (id <NSDraggingInfo>) dragInfo;
- (BOOL) slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to;
/* Screen information */
- (NSSize) resolutionForScreen: (int)screen;
- (NSRect) boundsForScreen: (int)screen;
- (NSWindowDepth) windowDepthForScreen: (int)screen;
- (const NSWindowDepth *) availableDepthsForScreen: (int)screen;
- (NSArray *) screenList;
- (void *) serverDevice;
- (void *) windowDevice: (int)win;
@end
/* ----------------------------------------------------------------------- */
/* GNUstep Window operations */
/* ----------------------------------------------------------------------- */
@interface GSDisplayServer (WindowOps)
- (void) _setWindowOwnedByServer: (int)win;
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style;
- (void) termwindow: (int) win;
- (void) stylewindow: (int) style : (int) win;
- (void) windowbacking: (NSBackingStoreType)type;
- (void) titlewindow: (NSString *) window_title : (int) win;
- (void) miniwindow: (int) win;
- (void) windowdevice: (int) win;
- (void) orderwindow: (int) op : (int) otherWin : (int) win;
- (void) movewindow: (NSPoint)loc : (int) win;
- (void) placewindow: (NSRect)frame : (int) win;
- (BOOL) findwindow: (NSPoint)loc : (int) op : (int) otherWin : (NSPoint *)floc : (int*) winFound;
- (NSRect) windowbounds: (int) win;
- (void) setwindowlevel: (int) level : (int) win;
- (int) windowlevel: (int) win;
- (NSArray *) windowlist;
- (int) windowdepth: (int) win;
- (void) setmaxsize: (NSSize)size : (int) win;
- (void) setminsize: (NSSize)size : (int) win;
- (void) setresizeincrements: (NSSize)size : (int) win;
- (void) flushwindowrect: (NSRect)rect : (int) win;
- (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b : (int) style;
- (void) docedited: (int) edited : (int) win;
- (void) setinputstate: (int)state : (int)win;
- (void) setinputfocus: (int) win;
- (NSPoint) mouselocation;
- (BOOL) capturemouse: (int) win;
- (void) releasemouse;
- (void) hidecursor;
- (void) showcursor;
- (void) standardcursor: (int) style : (void**) cid;
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors : (const char*) image : (void**) cid;
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid;
@end
/* ----------------------------------------------------------------------- */
/* GNUstep Event Operations */
/* ----------------------------------------------------------------------- */
@interface GSDisplayServer (EventOps)
- (NSEvent*) getEventMatchingMask: (unsigned)mask
beforeDate: (NSDate*)limit
inMode: (NSString*)mode
dequeue: (BOOL)flag;
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit;
- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag;
@end
static inline NSEvent*
DPSGetEvent(GSDisplayServer *ctxt, unsigned mask, NSDate* limit, NSString *mode)
{
return [ctxt getEventMatchingMask: mask beforeDate: limit inMode: mode
dequeue: YES];
}
static inline NSEvent*
DPSPeekEvent(GSDisplayServer *ctxt, unsigned mask, NSDate* limit, NSString *mode)
{
return [ctxt getEventMatchingMask: mask beforeDate: limit inMode: mode
dequeue: NO];
}
static inline void
DPSDiscardEvents(GSDisplayServer *ctxt, unsigned mask, NSEvent* limit)
{
[ctxt discardEventsMatchingMask: mask beforeEvent: limit];
}
static inline void
DPSPostEvent(GSDisplayServer *ctxt, NSEvent* anEvent, BOOL atStart)
{
[ctxt postEvent: anEvent atStart: atStart];
}
#endif /* NO_GNUSTEP */
#endif

View file

@ -25,7 +25,11 @@
#define _GSMethodTable_h_INCLUDE
#include <Foundation/NSObject.h>
#include <Foundation/NSGeometry.h>
#include <AppKit/NSFont.h>
@class NSAffineTransform;
@class NSBezierPath;
@class NSDate;
@class NSEvent;
@class NSGraphicsContext;
@ -37,367 +41,223 @@ typedef struct {
/* ----------------------------------------------------------------------- */
/* Color operations */
/* ----------------------------------------------------------------------- */
void (*DPScurrentalpha_)
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentcmykcolor____)
(NSGraphicsContext*, SEL, float*, float*, float*, float*);
(NSGraphicsContext*, SEL, float*, float*, float*, float*);
void (*DPScurrentgray_)
(NSGraphicsContext*, SEL, float*);
void (*DPScurrenthsbcolor___)
(NSGraphicsContext*, SEL, float*, float*, float*);
void (*DPScurrentrgbcolor___)
(NSGraphicsContext*, SEL, float*, float*, float*);
void (*DPSsetalpha_)
(NSGraphicsContext*, SEL, float);
void (*DPSsetcmykcolor____)
(NSGraphicsContext*, SEL, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSsetgray_)
(NSGraphicsContext*, SEL, float);
void (*DPSsethsbcolor___)
(NSGraphicsContext*, SEL, float, float, float);
void (*DPSsetrgbcolor___)
(NSGraphicsContext*, SEL, float, float, float);
void (*GSSetFillColorspace_)
(NSGraphicsContext*, SEL, NSDictionary *);
void (*GSSetStrokeColorspace_)
(NSGraphicsContext*, SEL, NSDictionary *);
void (*GSSetFillColor_)
(NSGraphicsContext*, SEL, float *);
void (*GSSetStrokeColor_)
(NSGraphicsContext*, SEL, float *);
/* ----------------------------------------------------------------------- */
/* Data operations */
/* Text operations */
/* ----------------------------------------------------------------------- */
void (*DPSclear)
(NSGraphicsContext*, SEL);
void (*DPScleartomark)
(NSGraphicsContext*, SEL);
void (*DPScopy_)
(NSGraphicsContext*, SEL, int);
void (*DPScount_)
(NSGraphicsContext*, SEL, int*);
void (*DPScounttomark_)
(NSGraphicsContext*, SEL, int*);
void (*DPSdup)
(NSGraphicsContext*, SEL);
void (*DPSexch)
(NSGraphicsContext*, SEL);
void (*DPSexecstack)
(NSGraphicsContext*, SEL);
void (*DPSget)
(NSGraphicsContext*, SEL);
void (*DPSindex_)
(NSGraphicsContext*, SEL, int);
void (*DPSmark)
(NSGraphicsContext*, SEL);
void (*DPSmatrix)
(NSGraphicsContext*, SEL);
void (*DPSnull)
(NSGraphicsContext*, SEL);
void (*DPSpop)
(NSGraphicsContext*, SEL);
void (*DPSput)
(NSGraphicsContext*, SEL);
void (*DPSroll__)
(NSGraphicsContext*, SEL, int, int);
void (*DPSashow___)
(NSGraphicsContext*, SEL, float, float, const char*);
void (*DPSawidthshow______)
(NSGraphicsContext*, SEL, float, float, int, float, float, const char*);
void (*DPScharpath__)
(NSGraphicsContext*, SEL, const char*, int);
void (*DPSshow_)
(NSGraphicsContext*, SEL, const char*);
void (*DPSwidthshow____)
(NSGraphicsContext*, SEL, float, float, int, const char*);
void (*DPSxshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
void (*DPSxyshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
void (*DPSyshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
void (*GSSetCharacterSpacing_)
(NSGraphicsContext*, SEL, float);
void (*GSSetFont_)
(NSGraphicsContext*, SEL, NSFont*);
void (*GSSetFontSize_)
(NSGraphicsContext*, SEL, float);
NSAffineTransform * (*GSGetTextCTM)
(NSGraphicsContext*, SEL);
NSPoint (*GSGetTextPosition)
(NSGraphicsContext*, SEL);
void (*GSSetTextCTM_)
(NSGraphicsContext*, SEL, NSAffineTransform *);
void (*GSSetTextDrawingMode_)
(NSGraphicsContext*, SEL, GSTextDrawingMode);
void (*GSSetTextPosition_)
(NSGraphicsContext*, SEL, NSPoint);
void (*GSShowText__)
(NSGraphicsContext*, SEL, const char *, size_t);
void (*GSShowGlyphs__)
(NSGraphicsContext*, SEL, const NSGlyph *, size_t);
/* ----------------------------------------------------------------------- */
/* Font operations */
/* Gstate Handling */
/* ----------------------------------------------------------------------- */
void (*DPSFontDirectory)
(NSGraphicsContext*, SEL);
void (*DPSISOLatin1Encoding)
(NSGraphicsContext*, SEL);
void (*DPSSharedFontDirectory)
(NSGraphicsContext*, SEL);
void (*DPSStandardEncoding)
(NSGraphicsContext*, SEL);
void (*DPScurrentcacheparams)
(NSGraphicsContext*, SEL);
void (*DPScurrentfont)
(NSGraphicsContext*, SEL);
void (*DPSdefinefont)
(NSGraphicsContext*, SEL);
void (*DPSfindfont_)
(NSGraphicsContext*, SEL, const char*);
void (*DPSmakefont)
(NSGraphicsContext*, SEL);
void (*DPSscalefont_)
(NSGraphicsContext*, SEL, float);
void (*DPSselectfont__)
(NSGraphicsContext*, SEL, const char*, float);
void (*DPSsetfont_)
(NSGraphicsContext*, SEL, int);
void (*DPSundefinefont_)
(NSGraphicsContext*, SEL, const char*);
void (*DPScurrentgstate_)
(NSGraphicsContext*, SEL, int);
void (*DPSgrestore)
(NSGraphicsContext*, SEL);
void (*DPSgsave)
(NSGraphicsContext*, SEL);
void (*DPSgstate)
(NSGraphicsContext*, SEL);
void (*DPSinitgraphics)
(NSGraphicsContext*, SEL);
void (*DPSsetgstate_)
(NSGraphicsContext*, SEL, int);
int (*GSDefineGState)
(NSGraphicsContext*, SEL);
void (*GSUndefineGState_)
(NSGraphicsContext*, SEL, int);
void (*GSReplaceGState_)
(NSGraphicsContext*, SEL, int);
/* ----------------------------------------------------------------------- */
/* Gstate operations */
/* ----------------------------------------------------------------------- */
void (*DPSconcat_)
(NSGraphicsContext*, SEL, const float *);
void (*DPScurrentdash)
(NSGraphicsContext*, SEL);
void (*DPScurrentflat_)
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentgray_)
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentgstate_)
(NSGraphicsContext*, SEL, int);
void (*DPScurrenthalftone)
(NSGraphicsContext*, SEL);
void (*DPScurrenthalftonephase__)
(NSGraphicsContext*, SEL, float*, float*);
void (*DPScurrenthsbcolor___)
(NSGraphicsContext*, SEL, float*, float*, float*);
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentlinecap_)
(NSGraphicsContext*, SEL, int*);
(NSGraphicsContext*, SEL, int*);
void (*DPScurrentlinejoin_)
(NSGraphicsContext*, SEL, int*);
(NSGraphicsContext*, SEL, int*);
void (*DPScurrentlinewidth_)
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentmatrix)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentmiterlimit_)
(NSGraphicsContext*, SEL, float*);
(NSGraphicsContext*, SEL, float*);
void (*DPScurrentpoint__)
(NSGraphicsContext*, SEL, float*, float*);
void (*DPScurrentrgbcolor___)
(NSGraphicsContext*, SEL, float*, float*, float*);
void (*DPScurrentscreen)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float*, float*);
void (*DPScurrentstrokeadjust_)
(NSGraphicsContext*, SEL, int*);
void (*DPScurrenttransfer)
(NSGraphicsContext*, SEL);
void (*DPSdefaultmatrix)
(NSGraphicsContext*, SEL);
void (*DPSgrestore)
(NSGraphicsContext*, SEL);
void (*DPSgrestoreall)
(NSGraphicsContext*, SEL);
void (*DPSgsave)
(NSGraphicsContext*, SEL);
void (*DPSgstate)
(NSGraphicsContext*, SEL);
void (*DPSinitgraphics)
(NSGraphicsContext*, SEL);
void (*DPSinitmatrix)
(NSGraphicsContext*, SEL);
void (*DPSrotate_)
(NSGraphicsContext*, SEL, float);
void (*DPSscale__)
(NSGraphicsContext*, SEL, float, float);
(NSGraphicsContext*, SEL, int*);
void (*DPSsetdash___)
(NSGraphicsContext*, SEL, const float*, int, float);
(NSGraphicsContext*, SEL, const float*, int, float);
void (*DPSsetflat_)
(NSGraphicsContext*, SEL, float);
void (*DPSsetgray_)
(NSGraphicsContext*, SEL, float);
void (*DPSsetgstate_)
(NSGraphicsContext*, SEL, int);
void (*DPSsethalftone)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float);
void (*DPSsethalftonephase__)
(NSGraphicsContext*, SEL, float, float);
void (*DPSsethsbcolor___)
(NSGraphicsContext*, SEL, float, float, float);
(NSGraphicsContext*, SEL, float, float);
void (*DPSsetlinecap_)
(NSGraphicsContext*, SEL, int);
(NSGraphicsContext*, SEL, int);
void (*DPSsetlinejoin_)
(NSGraphicsContext*, SEL, int);
(NSGraphicsContext*, SEL, int);
void (*DPSsetlinewidth_)
(NSGraphicsContext*, SEL, float);
void (*DPSsetmatrix)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float);
void (*DPSsetmiterlimit_)
(NSGraphicsContext*, SEL, float);
void (*DPSsetrgbcolor___)
(NSGraphicsContext*, SEL, float, float, float);
void (*DPSsetscreen)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float);
void (*DPSsetstrokeadjust_)
(NSGraphicsContext*, SEL, int);
void (*DPSsettransfer)
(NSGraphicsContext*, SEL);
void (*DPStranslate__)
(NSGraphicsContext*, SEL, float, float);
/* ----------------------------------------------------------------------- */
/* I/O operations */
/* ----------------------------------------------------------------------- */
void (*DPSflush)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, int);
/* ----------------------------------------------------------------------- */
/* Matrix operations */
/* ----------------------------------------------------------------------- */
void (*DPSconcatmatrix)
(NSGraphicsContext*, SEL);
void (*DPSdtransform____)
(NSGraphicsContext*, SEL, float, float, float*, float*);
void (*DPSidentmatrix)
(NSGraphicsContext*, SEL);
void (*DPSidtransform____)
(NSGraphicsContext*, SEL, float, float, float*, float*);
void (*DPSinvertmatrix)
(NSGraphicsContext*, SEL);
void (*DPSitransform____)
(NSGraphicsContext*, SEL, float, float, float*, float*);
void (*DPStransform____)
(NSGraphicsContext*, SEL, float, float, float*, float*);
/* ----------------------------------------------------------------------- */
/* Opstack operations */
/* ----------------------------------------------------------------------- */
void (*DPSdefineuserobject)
(NSGraphicsContext*, SEL);
void (*DPSexecuserobject_)
(NSGraphicsContext*, SEL, int);
void (*DPSundefineuserobject_)
(NSGraphicsContext*, SEL, int);
void (*DPSgetboolean_)
(NSGraphicsContext*, SEL, int*);
void (*DPSgetchararray__)
(NSGraphicsContext*, SEL, int, char*);
void (*DPSgetfloat_)
(NSGraphicsContext*, SEL, float*);
void (*DPSgetfloatarray__)
(NSGraphicsContext*, SEL, int, float*);
void (*DPSgetint_)
(NSGraphicsContext*, SEL, int*);
void (*DPSgetintarray__)
(NSGraphicsContext*, SEL, int, int*);
void (*DPSgetstring_)
(NSGraphicsContext*, SEL, char*);
void (*DPSsendboolean_)
(NSGraphicsContext*, SEL, int);
void (*DPSsendchararray__)
(NSGraphicsContext*, SEL, const char*, int);
void (*DPSsendfloat_)
(NSGraphicsContext*, SEL, float);
void (*DPSsendfloatarray__)
(NSGraphicsContext*, SEL, const float*, int);
void (*DPSsendint_)
(NSGraphicsContext*, SEL, int);
void (*DPSsendintarray__)
(NSGraphicsContext*, SEL, const int*, int);
void (*DPSsendstring_)
(NSGraphicsContext*, SEL, const char*);
void (*DPSconcat_)
(NSGraphicsContext*, SEL, const float*);
void (*DPSinitmatrix)
(NSGraphicsContext*, SEL);
void (*DPSrotate_)
(NSGraphicsContext*, SEL, float);
void (*DPSscale__)
(NSGraphicsContext*, SEL, float, float);
void (*DPStranslate__)
(NSGraphicsContext*, SEL, float, float);
NSAffineTransform * (*GSCurrentCTM)
(NSGraphicsContext*, SEL);
void (*GSSetCTM_)
(NSGraphicsContext*, SEL, NSAffineTransform *);
void (*GSConcatCTM_)
(NSGraphicsContext*, SEL, NSAffineTransform *);
/* ----------------------------------------------------------------------- */
/* Paint operations */
/* ----------------------------------------------------------------------- */
void (*DPSashow___)
(NSGraphicsContext*, SEL, float, float, const char*);
void (*DPSawidthshow______)
(NSGraphicsContext*, SEL, float, float, int, float, float, const char*);
void (*DPScopypage)
(NSGraphicsContext*, SEL);
void (*DPSeofill)
(NSGraphicsContext*, SEL);
void (*DPSerasepage)
(NSGraphicsContext*, SEL);
void (*DPSfill)
(NSGraphicsContext*, SEL);
void (*DPSimage)
(NSGraphicsContext*, SEL);
void (*DPSimagemask)
(NSGraphicsContext*, SEL);
void (*DPScolorimage)
(NSGraphicsContext*, SEL);
void (*DPSalphaimage)
(NSGraphicsContext*, SEL);
void (*DPSkshow_)
(NSGraphicsContext*, SEL, const char*);
void (*DPSrectfill____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSrectstroke____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSshow_)
(NSGraphicsContext*, SEL, const char*);
void (*DPSshowpage)
(NSGraphicsContext*, SEL);
void (*DPSstroke)
(NSGraphicsContext*, SEL);
void (*DPSstrokepath)
(NSGraphicsContext*, SEL);
void (*DPSueofill____)
(NSGraphicsContext*, SEL, const char*, int, const char*, int);
void (*DPSufill____)
(NSGraphicsContext*, SEL, const char*, int, const char*, int);
void (*DPSustroke____)
(NSGraphicsContext*, SEL, const char*, int, const char*, int);
void (*DPSustrokepath____)
(NSGraphicsContext*, SEL, const char*, int, const char*, int);
void (*DPSwidthshow____)
(NSGraphicsContext*, SEL, float, float, int, const char*);
void (*DPSxshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
void (*DPSxyshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
void (*DPSyshow___)
(NSGraphicsContext*, SEL, const char*, const float*, int);
/* ----------------------------------------------------------------------- */
/* Path operations */
/* ----------------------------------------------------------------------- */
void (*DPSarc_____)
(NSGraphicsContext*, SEL, float, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float, float);
void (*DPSarcn_____)
(NSGraphicsContext*, SEL, float, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float, float);
void (*DPSarct_____)
(NSGraphicsContext*, SEL, float, float, float, float, float);
void (*DPSarcto_________)
(NSGraphicsContext*, SEL, float, float, float, float, float, float*, float*, float*, float*);
void (*DPScharpath__)
(NSGraphicsContext*, SEL, const char*, int);
(NSGraphicsContext*, SEL, float, float, float, float, float);
void (*DPSclip)
(NSGraphicsContext*, SEL);
void (*DPSclippath)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSclosepath)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPScurveto______)
(NSGraphicsContext*, SEL, float, float, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float, float, float);
void (*DPSeoclip)
(NSGraphicsContext*, SEL);
void (*DPSeoviewclip)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSeofill)
(NSGraphicsContext*, SEL);
void (*DPSfill)
(NSGraphicsContext*, SEL);
void (*DPSflattenpath)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSinitclip)
(NSGraphicsContext*, SEL);
void (*DPSinitviewclip)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSlineto__)
(NSGraphicsContext*, SEL, float, float);
(NSGraphicsContext*, SEL, float, float);
void (*DPSmoveto__)
(NSGraphicsContext*, SEL, float, float);
(NSGraphicsContext*, SEL, float, float);
void (*DPSnewpath)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSpathbbox____)
(NSGraphicsContext*, SEL, float*, float*, float*, float*);
void (*DPSpathforall)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float*, float*, float*, float*);
void (*DPSrcurveto______)
(NSGraphicsContext*, SEL, float, float, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float, float, float);
void (*DPSrectclip____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSrectviewclip____)
(NSGraphicsContext*, SEL, float, float, float, float);
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSrectfill____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSrectstroke____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSreversepath)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL);
void (*DPSrlineto__)
(NSGraphicsContext*, SEL, float, float);
(NSGraphicsContext*, SEL, float, float);
void (*DPSrmoveto__)
(NSGraphicsContext*, SEL, float, float);
void (*DPSsetbbox____)
(NSGraphicsContext*, SEL, float, float, float, float);
void (*DPSviewclip)
(NSGraphicsContext*, SEL);
void (*DPSviewclippath)
(NSGraphicsContext*, SEL);
/* ----------------------------------------------------------------------- */
/* System ops */
/* ----------------------------------------------------------------------- */
void (*DPSrestore)
(NSGraphicsContext*, SEL);
void (*DPSsave)
(NSGraphicsContext*, SEL);
(NSGraphicsContext*, SEL, float, float);
void (*DPSstroke)
(NSGraphicsContext*, SEL);
void (*GSSendBezierPath_)
(NSGraphicsContext*, SEL, NSBezierPath *);
void (*GSRectClipList__)
(NSGraphicsContext*, SEL, const NSRect *, int);
void (*GSRectFillList__)
(NSGraphicsContext*, SEL, const NSRect *, int);
/* ----------------------------------------------------------------------- */
/* Window system ops */
/* ----------------------------------------------------------------------- */
void (*DPScurrentdrawingfunction_)
(NSGraphicsContext*, SEL, int*);
void (*DPScurrentgcdrawable____)
(NSGraphicsContext*, SEL, void**, void**, int*, int*);
void (*DPScurrentgcdrawablecolor_____)
(NSGraphicsContext*, SEL, void**, void**, int*, int*, int*);
(NSGraphicsContext*, SEL, void**, void**, int*, int*);
void (*DPScurrentoffset__)
(NSGraphicsContext*, SEL, int*, int*);
void (*DPSsetdrawingfunction_)
(NSGraphicsContext*, SEL, int);
(NSGraphicsContext*, SEL, int*, int*);
void (*DPSsetgcdrawable____)
(NSGraphicsContext*, SEL, void*, void*, int, int);
void (*DPSsetgcdrawablecolor_____)
(NSGraphicsContext*, SEL, void*, void*, int, int, const int*);
(NSGraphicsContext*, SEL, void*, void*, int, int);
void (*DPSsetoffset__)
(NSGraphicsContext*, SEL, short int, short int);
void (*DPSsetrgbactual____)
(NSGraphicsContext*, SEL, double, double, double, int*);
void (*DPScapturegstate_)
(NSGraphicsContext*, SEL, int*);
(NSGraphicsContext*, SEL, short int, short int);
/*-------------------------------------------------------------------------*/
/* Graphics Extensions Ops */
@ -408,174 +268,32 @@ typedef struct {
(NSGraphicsContext*, SEL, float, float, float, float, int);
void (*DPSdissolve________)
(NSGraphicsContext*, SEL, float, float, float, float, int, float, float, float);
void (*DPSreadimage)
(NSGraphicsContext*, SEL);
void (*DPSsetalpha_)
(NSGraphicsContext*, SEL, float);
void (*DPScurrentalpha_)
(NSGraphicsContext*, SEL, float*);
/*-------------------------------------------------------------------------*/
/* Window Extensions Ops */
/*-------------------------------------------------------------------------*/
void (*DPSwindow______)
(NSGraphicsContext*, SEL, float, float, float, float, int, int *);
void (*DPStermwindow_)
(NSGraphicsContext*, SEL, int);
void (*DPSstylewindow__)
(NSGraphicsContext*, SEL, int, int);
void (*DPStitlewindow__)
(NSGraphicsContext*, SEL, const char *, int);
void (*DPSminiwindow_)
(NSGraphicsContext*, SEL, int);
void (*DPSwindowdevice_)
(NSGraphicsContext*, SEL, int);
void (*DPSwindowdeviceround_)
(NSGraphicsContext*, SEL, int);
void (*DPScurrentwindow_)
(NSGraphicsContext*, SEL, int *);
void (*DPSorderwindow___)
(NSGraphicsContext*, SEL, int, int, int);
void (*DPSmovewindow___)
(NSGraphicsContext*, SEL, float, float, int);
void (*DPSupdatewindow_)
(NSGraphicsContext*, SEL, int);
void (*DPSplacewindow_____)
(NSGraphicsContext*, SEL, float, float, float, float, int);
void (*DPSfrontwindow_)
(NSGraphicsContext*, SEL, int *);
void (*DPSfindwindow________)
(NSGraphicsContext*, SEL, float, float, int, int, float *, float *, int *, int *);
void (*DPScurrentwindowbounds_____)
(NSGraphicsContext*, SEL, int, float *, float *, float *, float *);
void (*DPSsetexposurecolor)
(NSGraphicsContext*, SEL);
void (*DPSsetsendexposed__)
(NSGraphicsContext*, SEL, int, int);
void (*DPSsetautofill__)
(NSGraphicsContext*, SEL, int, int);
void (*DPScurrentwindowalpha__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPScountscreenlist__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPSscreenlist___)
(NSGraphicsContext*, SEL, int, int, int *);
void (*DPSsetowner__)
(NSGraphicsContext*, SEL, int, int);
void (*DPScurrentowner__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPSsetwindowtype__)
(NSGraphicsContext*, SEL, int, int);
void (*DPSsetwindowlevel__)
(NSGraphicsContext*, SEL, int, int);
void (*DPScurrentwindowlevel__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPScountwindowlist__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPSwindowlist___)
(NSGraphicsContext*, SEL, int, int, int *);
void (*DPSsetwindowdepthlimit__)
(NSGraphicsContext*, SEL, int, int);
void (*DPScurrentwindowdepthlimit__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPScurrentwindowdepth__)
(NSGraphicsContext*, SEL, int, int *);
void (*DPSsetdefaultdepthlimit_)
(NSGraphicsContext*, SEL, int);
void (*DPScurrentdefaultdepthlimit_)
(NSGraphicsContext*, SEL, int *);
void (*DPSsetmaxsize___)
(NSGraphicsContext*, SEL, float, float, int);
void (*DPSsetminsize___)
(NSGraphicsContext*, SEL, float, float, int);
void (*DPSsetresizeincrements___)
(NSGraphicsContext*, SEL, float, float, int);
void (*DPSflushwindowrect_____)
(NSGraphicsContext*, SEL, float, float, float, float, int);
void (*DPScapturemouse_)
(NSGraphicsContext*, SEL, int);
void (*DPSreleasemouse)
(NSGraphicsContext*, SEL);
void (*DPSsetinputfocus_)
(NSGraphicsContext*, SEL, int);
void (*DPShidecursor)
(NSGraphicsContext*, SEL);
void (*DPSshowcursor)
(NSGraphicsContext*, SEL);
void (*DPSstandardcursor__)
(NSGraphicsContext*, SEL, int, void **);
void (*DPSimagecursor_______)
(NSGraphicsContext*, SEL, float, float, float, float, int, const char *, void **);
void (*DPSsetcursorcolor_______)
(NSGraphicsContext*, SEL, float, float, float, float, float, float, void *);
void (*DPSstyleoffsets_____)
(NSGraphicsContext*, SEL, float*, float*, float*, float*, int);
void (*DPSdocedited__)
(NSGraphicsContext*, SEL, int, int);
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */
NSEvent* (*DPSGetEventMatchingMask_beforeDate_inMode_dequeue_)
(NSGraphicsContext*, SEL, unsigned, NSDate*, NSString*, BOOL);
void (*DPSDiscardEventsMatchingMask_beforeEvent_)
(NSGraphicsContext*, SEL, unsigned, NSEvent*);
void (*DPSPostEvent_atStart_)
(NSGraphicsContext*, SEL, NSEvent*, BOOL);
void (*DPSmouselocation__)
(NSGraphicsContext*, SEL, float*, float*);
void (*DPSsetinputstate__)
(NSGraphicsContext*, SEL, int, int);
void (*DPScurrentserverdevice_)
(NSGraphicsContext*, SEL, void **);
void (*DPScurrentwindowdevice__)
(NSGraphicsContext*, SEL, int, void **);
void (*GSDrawImage__)
(NSGraphicsContext*, SEL, NSRect, void *);
/* ----------------------------------------------------------------------- */
/* Client functions */
/* Postscript Client functions */
/* ----------------------------------------------------------------------- */
void (*DPSPrintf__)
(NSGraphicsContext*, SEL, char *, va_list);
void (*DPSWriteData__)
(NSGraphicsContext*, SEL, char *, unsigned int);
/* ----------------------------------------------------------------------- */
/* NSGraphics Ops */
/* ----------------------------------------------------------------------- */
NSColor * (*NSReadPixel_)
(NSGraphicsContext*, SEL, NSPoint);
/*
* Rectangle Drawing Functions
*/
void (*NSBeep)
(NSGraphicsContext*, SEL);
void (*NSEraseRect_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSHighlightRect_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectClip_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectClipList__)(NSGraphicsContext*, SEL, const NSRect *rects, int count);
void (*NSRectFill_)(NSGraphicsContext*, SEL, NSRect aRect);
void (*NSRectFillList__)(NSGraphicsContext*, SEL, const NSRect *rects, int count);
void (*NSRectFillListWithGrays___)(NSGraphicsContext*, SEL, const NSRect *rects,
const float *grays, int count);
void (*NSRectFillUsingOperation__)(NSGraphicsContext*, SEL,
NSRect aRect, NSCompositingOperation op);
/*
* Draw a Bordered Rectangle
*/
void (*NSDottedFrameRect_)(NSGraphicsContext*, SEL, const NSRect aRect);
void (*NSFrameRect_)(NSGraphicsContext*, SEL, const NSRect aRect);
void (*NSFrameRectWithWidth__)(NSGraphicsContext*, SEL, const NSRect aRect, float frameWidth);
/*
* Read the Color at a Screen Position
*/
NSColor *(*NSReadPixel_)(NSGraphicsContext*, SEL, NSPoint location);
/*
* Copy an image
*/
void (*NSCopyBitmapFromGState___)(NSGraphicsContext*, SEL, int srcGstate, NSRect srcRect,
NSRect destRect);
void (*NSCopyBits___)(NSGraphicsContext*, SEL, int srcGstate, NSRect srcRect, NSPoint destPoint);
/* Context helper wraps */
void (*GSWSetViewIsFlipped_)
(NSGraphicsContext*, SEL, BOOL);
BOOL (*GSWViewIsFlipped)
(NSGraphicsContext*, SEL);
/*
* Render Bitmap Images
@ -592,22 +310,6 @@ typedef struct {
NSString *colorSpaceName,
const unsigned char *const data[5]);
/*
* Play the System Beep
*/
void (*NSBeep)(NSGraphicsContext*, SEL);
/* Context helper wraps */
unsigned int (*GSWDefineAsUserObj)(NSGraphicsContext*, SEL);
BOOL (*GSWViewIsFlipped)(NSGraphicsContext*, SEL);
void (*GSWSetViewIsFlipped_)(NSGraphicsContext*, SEL, BOOL flipped);
NSWindowDepth (*GSWindowDepthForScreen_)(NSGraphicsContext*, SEL, int screen);
const NSWindowDepth *(*GSAvailableDepthsForScreen_)(NSGraphicsContext*, SEL,
int screen);
NSSize (*GSResolutionForScreen_)(NSGraphicsContext*, SEL, int screen);
} gsMethodTable;
#endif

View file

@ -105,61 +105,14 @@ APPKIT_DECLARE BOOL NSPlanarFromDepth(NSWindowDepth depth);
APPKIT_DECLARE void NSCountWindows(int *count);
APPKIT_DECLARE void NSWindowList(int size, int list[]);
static inline void
NSEraseRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSEraseRect_)
(ctxt, @selector(NSEraseRect:), aRect);
}
static inline void
NSHighlightRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSHighlightRect_)
(ctxt, @selector(NSHighlightRect:), aRect);
}
static inline void
NSRectClip(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectClip_)
(ctxt, @selector(NSRectClip:), aRect);
}
static inline void
NSRectClipList(const NSRect *rects, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectClipList__)
(ctxt, @selector(NSRectClipList::), rects, count);
}
static inline void
NSRectFill(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFill_)
(ctxt, @selector(NSRectFill:), aRect);
}
static inline void
NSRectFillList(const NSRect *rects, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFillList__)
(ctxt, @selector(NSRectFillList::), rects, count);
}
static inline void
NSRectFillListWithGrays(const NSRect *rects,const float *grays,int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFillListWithGrays___)
(ctxt, @selector(NSRectFillListWithGrays:::), rects, grays, count);
}
APPKIT_EXPORT void NSEraseRect(NSRect aRect);
APPKIT_EXPORT void NSHighlightRect(NSRect aRect);
APPKIT_EXPORT void NSRectClip(NSRect aRect);
APPKIT_EXPORT void NSRectClipList(const NSRect *rects, int count);
APPKIT_EXPORT void NSRectFill(NSRect aRect);
APPKIT_EXPORT void NSRectFillList(const NSRect *rects, int count);
APPKIT_EXPORT void NSRectFillListWithGrays(const NSRect *rects,
const float *grays,int count);
APPKIT_DECLARE NSRect NSDrawTiledRects(NSRect aRect,const NSRect clipRect,
const NSRectEdge * sides,
@ -178,30 +131,9 @@ NSDrawBezel(const NSRect aRect, const NSRect clipRect)
NSDrawGrayBezel(aRect, clipRect);
}
static inline void
NSDottedFrameRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSDottedFrameRect_)
(ctxt, @selector(NSDottedFrameRect:), aRect);
}
static inline void
NSFrameRect(const NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSFrameRect_)
(ctxt, @selector(NSFrameRect:), aRect);
}
static inline void
NSFrameRectWithWidth(const NSRect aRect, float frameWidth)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSFrameRectWithWidth__)
(ctxt, @selector(NSFrameRectWithWidth::), aRect, frameWidth);
}
APPKIT_EXPORT void NSDottedFrameRect(NSRect aRect);
APPKIT_EXPORT void NSFrameRect(const NSRect aRect);
APPKIT_EXPORT void NSFrameRectWithWidth(const NSRect aRect, float frameWidth);
static inline NSColor*
NSReadPixel(NSPoint location)
@ -211,21 +143,10 @@ NSReadPixel(NSPoint location)
(ctxt, @selector(NSReadPixel:), location);
}
static inline void
NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSCopyBitmapFromGState___)
(ctxt, @selector(NSCopyBitmapFromGState:::), srcGstate, srcRect, destRect);
}
static inline void
NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSCopyBits___)
(ctxt, @selector(NSCopyBits:::), srcGstate, srcRect, destPoint);
}
APPKIT_EXPORT void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect,
NSRect destRect);
APPKIT_EXPORT void NSCopyBits(int srcGstate, NSRect srcRect,
NSPoint destPoint);
static inline void
NSDrawBitmap(NSRect rect,
@ -263,13 +184,6 @@ NSBeep(void)
(ctxt, @selector(NSBeep));
}
static inline unsigned int
GSWDefineAsUserObj(NSGraphicsContext *ctxt)
{
return (ctxt->methods->GSWDefineAsUserObj)
(ctxt, @selector(GSWDefineAsUserObj));
}
static inline void
GSWSetViewIsFlipped(NSGraphicsContext *ctxt, BOOL flipped)
{
@ -284,27 +198,6 @@ GSWViewIsFlipped(NSGraphicsContext *ctxt)
(ctxt, @selector(GSWViewIsFlipped));
}
static inline NSWindowDepth
GSWindowDepthForScreen(NSGraphicsContext *ctxt, int screen_num)
{
return (ctxt->methods->GSWindowDepthForScreen_)
(ctxt, @selector(GSWindowDepthForScreen:), screen_num);
}
static inline const NSWindowDepth*
GSAvailableDepthsForScreen(NSGraphicsContext *ctxt, int screen_num)
{
return (ctxt->methods->GSAvailableDepthsForScreen_)
(ctxt, @selector(GSAvailableDepthsForScreen:), screen_num);
}
static inline NSSize
GSResolutionForScreen(NSGraphicsContext *ctxt, int screen_num)
{
return (ctxt->methods->GSResolutionForScreen_)
(ctxt, @selector(GSResolutionForScreen:), screen_num);
}
#ifndef NO_GNUSTEP
@class NSArray;
@class NSWindow;
@ -328,17 +221,12 @@ APPKIT_DECLARE void NSDrawLightBezel(NSRect aRect, NSRect clipRect);
APPKIT_DECLARE void NSRectFillListWithColors(const NSRect *rects,
NSColor **colors, int count);
static inline void
NSRectFillUsingOperation(NSRect aRect, NSCompositingOperation op)
{
NSGraphicsContext *ctxt = GSCurrentContext();
(ctxt->methods->NSRectFillUsingOperation__)
(ctxt, @selector(NSRectFillUsingOperation::), aRect, op);
}
APPKIT_DECLARE void NSRectFillListUsingOperation(const NSRect *rects, int count,
APPKIT_DECLARE void NSRectFillUsingOperation(NSRect aRect,
NSCompositingOperation op);
APPKIT_DECLARE void NSRectFillListUsingOperation(const NSRect *rects,
int count,
NSCompositingOperation op);
APPKIT_DECLARE void NSRectFillListWithColorsUsingOperation(const NSRect *rects,
APPKIT_DECLARE void NSRectFillListWithColorsUsingOperation(const NSRect *rects,
NSColor **colors,
int num,
NSCompositingOperation op);

View file

@ -30,24 +30,20 @@
#define _NSGraphicsContext_h_INCLUDE
#include <Foundation/NSObject.h>
#include <Foundation/NSGeometry.h>
#include <Foundation/NSMapTable.h>
#include <Foundation/NSSet.h>
#include <AppKit/NSDragging.h>
#include <AppKit/AppKitDefines.h>
@class NSDate;
@class NSDictionary;
@class NSEvent;
@class NSMutableArray;
@class NSMutableData;
@class NSMutableSet;
@class NSString;
@class NSView;
@class NSWindow;
@class NSGraphicsContext;
@class NSFont;
@class NSSet;
/*
* Backing Store Types
@ -84,12 +80,27 @@ typedef enum _NSCompositingOperation
typedef int NSWindowDepth;
/* Image interpolation */
typedef enum _NSImageInterpolation
{
NSImageInterpolationDefault,
NSImageInterpolationNone,
NSImageInterpolationLow,
NSImageInterpolationHigh
} NSImageInterpolation;
#ifndef STRICT_OPENSTEP
typedef enum _GSTextDrawingMode
{
GSTextFill,
GSTextStroke,
GSTextClip
} GSTextDrawingMode;
// We have to load this after the NSCompositingOperation are defined!!!
#include <AppKit/GSMethodTable.h>
/*
* Window ordering
*/
@ -112,6 +123,18 @@ typedef enum _GSWindowInputState
} GSWindowInputState;
/* Color spaces */
typedef enum _GSColorSpace
{
GSDeviceGray,
GSDeviceRGB,
GSDeviceCMYK,
GSCalibratedGray,
GSCalibratedRGB,
GSCIELab,
GSICC
} GSColorSpace;
@interface NSGraphicsContext : NSObject
{
/* Make the one public instance variable first in the object so that, if we
@ -124,31 +147,36 @@ typedef enum _GSWindowInputState
NSDictionary *context_info;
NSMutableData *context_data;
NSMutableArray *focus_stack;
NSMutableArray *event_queue;
NSMapTable *drag_types;
NSMutableSet *usedFonts;
NSImageInterpolation _interp;
BOOL _antialias;
}
+ (NSGraphicsContext*) currentContext;
+ (void) setCurrentContext: (NSGraphicsContext*)context;
+ (BOOL) currentContextDrawingToScreen;
+ (NSGraphicsContext *) graphicsContextWithAttributes: (NSDictionary *)attributes;
+ (NSGraphicsContext *) graphicsContextWithWindow: (NSWindow *)aWindow;
+ (void) restoreGraphicsState;
+ (void) saveGraphicsState;
+ (void) setGraphicsState: (int)graphicsState;
+ (void) setCurrentContext: (NSGraphicsContext*)context;
+ (NSGraphicsContext*) currentContext;
- (NSDictionary *) attributes;
- (void)flushGraphics;
- (void *)graphicsPort;
- (void *) graphicsPort;
- (void) flush;
- (BOOL) isDrawingToScreen;
- (void) flushGraphics;
- (void) restoreGraphicsState;
- (void) saveGraphicsState;
- (void) wait;
+ (void) waitAllContexts;
- (void *) focusStack;
- (void) setFocusStack: (void *)stack;
- (void) setImageInterpolation: (NSImageInterpolation)interpolation;
- (NSImageInterpolation) imageInterpolation;
- (void) setShouldAntialias: (BOOL)antialias;
- (BOOL) shouldAntialias;
@end
@ -157,10 +185,10 @@ APPKIT_DECLARE NSGraphicsContext *GSCurrentContext();
@interface NSGraphicsContext (GNUstep)
+ (void) setDefaultContextClass: (Class)defaultContextClass;
+ (NSGraphicsContext*) defaultContextWithInfo: (NSDictionary*)info;
- (id) initWithContextInfo: (NSDictionary*)info;
- (void) destroyContext;
- (NSMutableData*) mutableData;
/*
* Focus management methods - lock and unlock should only be used by NSView
* in it's implementation of lockFocus and unlockFocus.
@ -169,381 +197,192 @@ APPKIT_DECLARE NSGraphicsContext *GSCurrentContext();
- (void) lockFocusView: (NSView*)aView inRect: (NSRect)rect;
- (void) unlockFocusView: (NSView*)aView needsFlush: (BOOL)flush;
/*
* Drag and drop support etc
*/
- (BOOL) _addDragTypes: (NSArray*)types toWindow: (NSWindow *)win;
- (BOOL) _removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win;
- (NSCountedSet*) _dragTypesForWindow: (NSWindow *)win;
- (id <NSDraggingInfo>)_dragInfo;
- (BOOL) _slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to;
/* Private methods for printing */
- (void) useFont: (NSString *)fontName;
- (void) resetUsedFonts;
- (NSSet *) usedFonts;
/* Private backend methods */
- (void) contextDevice: (int)num;
@end
#endif
/*
* GNUstep drawing engine extensions - these are the methods actually
* called when one of the inline PostScript functions (like PSlineto())
* is called.
*/
@interface NSGraphicsContext (Ops)
/* ----------------------------------------------------------------------- */
/* Color operations */
/* ----------------------------------------------------------------------- */
- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k ;
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k ;
- (void) DPScurrentalpha: (float*)a;
- (void) DPScurrentcmykcolor: (float*)c : (float*)m : (float*)y : (float*)k;
- (void) DPScurrentgray: (float*)gray;
- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b;
- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b;
- (void) DPSsetalpha: (float)a;
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k;
- (void) DPSsetgray: (float)gray;
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b;
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b;
- (void) GSSetFillColorspace: (NSDictionary *)dict;
- (void) GSSetStrokeColorspace: (NSDictionary *)dict;
- (void) GSSetFillColor: (float *)values;
- (void) GSSetStrokeColor: (float *)values;
/* ----------------------------------------------------------------------- */
/* Data operations */
/* Text operations */
/* ----------------------------------------------------------------------- */
- (void) DPSclear;
- (void) DPScleartomark;
- (void) DPScopy: (int)n ;
- (void) DPScount: (int*)n ;
- (void) DPScounttomark: (int*)n ;
- (void) DPSdup;
- (void) DPSexch;
- (void) DPSexecstack;
- (void) DPSget;
- (void) DPSindex: (int)i ;
- (void) DPSmark;
- (void) DPSmatrix;
- (void) DPSnull;
- (void) DPSpop;
- (void) DPSput;
- (void) DPSroll: (int)n : (int)j ;
- (void) DPSashow: (float)x : (float)y : (const char*)s;
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay
: (const char*)s;
- (void) DPScharpath: (const char*)s : (int)b;
- (void) DPSshow: (const char*)s;
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s;
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size;
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size;
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size;
- (void) GSSetCharacterSpacing: (float)extra;
- (void) GSSetFont: (NSFont*)font;
- (void) GSSetFontSize: (float)size;
- (NSAffineTransform *) GSGetTextCTM;
- (NSPoint) GSGetTextPosition;
- (void) GSSetTextCTM: (NSAffineTransform *)ctm;
- (void) GSSetTextDrawingMode: (GSTextDrawingMode)mode;
- (void) GSSetTextPosition: (NSPoint)loc;
- (void) GSShowText: (const char *)string : (size_t) length;
- (void) GSShowGlyphs: (const NSGlyph *)glyphs : (size_t) length;
/* ----------------------------------------------------------------------- */
/* Font operations */
/* Gstate Handling */
/* ----------------------------------------------------------------------- */
- (void) DPSFontDirectory;
- (void) DPSISOLatin1Encoding;
- (void) DPSSharedFontDirectory;
- (void) DPSStandardEncoding;
- (void) DPScurrentcacheparams;
- (void) DPScurrentfont;
- (void) DPSdefinefont;
- (void) DPSfindfont: (const char*)name ;
- (void) DPSmakefont;
- (void) DPSscalefont: (float)size ;
- (void) DPSselectfont: (const char*)name : (float)scale ;
- (void) DPSsetfont: (int)f ;
- (void) DPSundefinefont: (const char*)name ;
- (void) setFont: (NSFont*) font;
/* ----------------------------------------------------------------------- */
/* Gstate operations */
/* ----------------------------------------------------------------------- */
- (void) DPSconcat: (const float*)m ;
- (void) DPScurrentdash;
- (void) DPScurrentflat: (float*)flatness ;
- (void) DPScurrentgray: (float*)gray ;
- (void) DPScurrentgstate: (int)gst ;
- (void) DPScurrenthalftone;
- (void) DPScurrenthalftonephase: (float*)x : (float*)y ;
- (void) DPScurrenthsbcolor: (float*)h : (float*)s : (float*)b ;
- (void) DPScurrentlinecap: (int*)linecap ;
- (void) DPScurrentlinejoin: (int*)linejoin ;
- (void) DPScurrentlinewidth: (float*)width ;
- (void) DPScurrentmatrix;
- (void) DPScurrentmiterlimit: (float*)limit ;
- (void) DPScurrentpoint: (float*)x : (float*)y ;
- (void) DPScurrentrgbcolor: (float*)r : (float*)g : (float*)b ;
- (void) DPScurrentscreen;
- (void) DPScurrentstrokeadjust: (int*)b ;
- (void) DPScurrenttransfer;
- (void) DPSdefaultmatrix;
- (void) DPScurrentgstate: (int)gst;
- (void) DPSgrestore;
- (void) DPSgrestoreall;
- (void) DPSgsave;
- (void) DPSgstate;
- (void) DPSinitgraphics;
- (void) DPSinitmatrix;
- (void) DPSrotate: (float)angle ;
- (void) DPSscale: (float)x : (float)y ;
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset ;
- (void) DPSsetflat: (float)flatness ;
- (void) DPSsetgray: (float)gray ;
- (void) DPSsetgstate: (int)gst ;
- (void) DPSsethalftone;
- (void) DPSsethalftonephase: (float)x : (float)y ;
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b ;
- (void) DPSsetlinecap: (int)linecap ;
- (void) DPSsetlinejoin: (int)linejoin ;
- (void) DPSsetlinewidth: (float)width ;
- (void) DPSsetmatrix;
- (void) DPSsetmiterlimit: (float)limit ;
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b ;
- (void) DPSsetscreen;
- (void) DPSsetstrokeadjust: (int)b ;
- (void) DPSsettransfer;
- (void) DPStranslate: (float)x : (float)y ;
- (void) DPSsetgstate: (int)gst;
- (int) GSDefineGState;
- (void) GSUndefineGState: (int)gst;
- (void) GSReplaceGState: (int)gst;
/* ----------------------------------------------------------------------- */
/* I/O operations */
/* Gstate operations */
/* ----------------------------------------------------------------------- */
- (void) DPSflush;
- (void) DPScurrentflat: (float*)flatness;
- (void) DPScurrentlinecap: (int*)linecap;
- (void) DPScurrentlinejoin: (int*)linejoin;
- (void) DPScurrentlinewidth: (float*)width;
- (void) DPScurrentmiterlimit: (float*)limit;
- (void) DPScurrentpoint: (float*)x : (float*)y;
- (void) DPScurrentstrokeadjust: (int*)b;
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset;
- (void) DPSsetflat: (float)flatness;
- (void) DPSsethalftonephase: (float)x : (float)y;
- (void) DPSsetlinecap: (int)linecap;
- (void) DPSsetlinejoin: (int)linejoin;
- (void) DPSsetlinewidth: (float)width;
- (void) DPSsetmiterlimit: (float)limit;
- (void) DPSsetstrokeadjust: (int)b;
/* ----------------------------------------------------------------------- */
/* Matrix operations */
/* ----------------------------------------------------------------------- */
- (void) DPSconcatmatrix;
- (void) DPSdtransform: (float)x1 : (float)y1 : (float*)x2 : (float*)y2 ;
- (void) DPSidentmatrix;
- (void) DPSidtransform: (float)x1 : (float)y1 : (float*)x2 : (float*)y2 ;
- (void) DPSinvertmatrix;
- (void) DPSitransform: (float)x1 : (float)y1 : (float*)x2 : (float*)y2 ;
- (void) DPStransform: (float)x1 : (float)y1 : (float*)x2 : (float*)y2 ;
/* ----------------------------------------------------------------------- */
/* Opstack operations */
/* ----------------------------------------------------------------------- */
- (void) DPSdefineuserobject;
- (void) DPSexecuserobject: (int)index ;
- (void) DPSundefineuserobject: (int)index ;
- (void) DPSgetboolean: (int*)it ;
- (void) DPSgetchararray: (int)size : (char*)s ;
- (void) DPSgetfloat: (float*)it ;
- (void) DPSgetfloatarray: (int)size : (float*)a ;
- (void) DPSgetint: (int*)it ;
- (void) DPSgetintarray: (int)size : (int*)a ;
- (void) DPSgetstring: (char*)s ;
- (void) DPSsendboolean: (int)it ;
- (void) DPSsendchararray: (const char*)s : (int)size ;
- (void) DPSsendfloat: (float)it ;
- (void) DPSsendfloatarray: (const float*)a : (int)size ;
- (void) DPSsendint: (int)it ;
- (void) DPSsendintarray: (const int*)a : (int)size ;
- (void) DPSsendstring: (const char*)s ;
- (void) DPSconcat: (const float*)m;
- (void) DPSinitmatrix;
- (void) DPSrotate: (float)angle;
- (void) DPSscale: (float)x : (float)y;
- (void) DPStranslate: (float)x : (float)y;
- (NSAffineTransform *) GSCurrentCTM;
- (void) GSSetCTM: (NSAffineTransform *)ctm;
- (void) GSConcatCTM: (NSAffineTransform *)ctm;
/* ----------------------------------------------------------------------- */
/* Paint operations */
/* ----------------------------------------------------------------------- */
- (void) DPSashow: (float)x : (float)y : (const char*)s ;
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s ;
- (void) DPScopypage;
- (void) DPSeofill;
- (void) DPSerasepage;
- (void) DPSfill;
- (void) DPSimage;
- (void) DPSimagemask;
- (void) DPScolorimage;
- (void) DPSalphaimage;
- (void) DPSkshow: (const char*)s ;
- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h ;
- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h ;
- (void) DPSshow: (const char*)s ;
- (void) DPSshowpage;
- (void) DPSstroke;
- (void) DPSstrokepath;
- (void) DPSueofill: (const char*)nums : (int)n : (const char*)ops : (int)l ;
- (void) DPSufill: (const char*)nums : (int)n : (const char*)ops : (int)l ;
- (void) DPSustroke: (const char*)nums : (int)n : (const char*)ops : (int)l ;
- (void) DPSustrokepath: (const char*)nums : (int)n : (const char*)ops : (int)l ;
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s ;
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size ;
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size ;
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size ;
/* ----------------------------------------------------------------------- */
/* Path operations */
/* ----------------------------------------------------------------------- */
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2 ;
- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2 ;
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r ;
- (void) DPSarcto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r : (float*)xt1 : (float*)yt1 : (float*)xt2 : (float*)yt2 ;
- (void) DPScharpath: (const char*)s : (int)b ;
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1
: (float)angle2;
- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1
: (float)angle2;
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r;
- (void) DPSclip;
- (void) DPSclippath;
- (void) DPSclosepath;
- (void) DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3 ;
- (void) DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
: (float)x3 : (float)y3;
- (void) DPSeoclip;
- (void) DPSeoviewclip;
- (void) DPSeofill;
- (void) DPSfill;
- (void) DPSflattenpath;
- (void) DPSinitclip;
- (void) DPSinitviewclip;
- (void) DPSlineto: (float)x : (float)y ;
- (void) DPSmoveto: (float)x : (float)y ;
- (void) DPSlineto: (float)x : (float)y;
- (void) DPSmoveto: (float)x : (float)y;
- (void) DPSnewpath;
- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury ;
- (void) DPSpathforall;
- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)x3 : (float)y3 ;
- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h ;
- (void) DPSrectviewclip: (float)x : (float)y : (float)w : (float)h ;
- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury;
- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2
: (float)x3 : (float)y3;
- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h;
- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h;
- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h;
- (void) DPSreversepath;
- (void) DPSrlineto: (float)x : (float)y ;
- (void) DPSrmoveto: (float)x : (float)y ;
- (void) DPSsetbbox: (float)llx : (float)lly : (float)urx : (float)ury ;
- (void) DPSviewclip;
- (void) DPSviewclippath;
- (void) DPSrlineto: (float)x : (float)y;
- (void) DPSrmoveto: (float)x : (float)y;
- (void) DPSstroke;
/* ----------------------------------------------------------------------- */
/* System system ops */
/* ----------------------------------------------------------------------- */
- (void) DPSrestore ;
- (void) DPSsave ;
- (void) GSSendBezierPath: (NSBezierPath *)path;
- (void) GSRectClipList: (const NSRect *)rects : (int) count;
- (void) GSRectFillList: (const NSRect *)rects : (int) count;
/* ----------------------------------------------------------------------- */
/* Window system ops */
/* ----------------------------------------------------------------------- */
- (void) DPScurrentdrawingfunction: (int*)function ;
- (void) DPScurrentgcdrawable: (void**)gc : (void**)draw : (int*)x : (int*)y ;
- (void) DPScurrentgcdrawablecolor: (void**)gc : (void**)draw : (int*)x : (int*)y : (int*)colorInfo ;
- (void) DPScurrentoffset: (int*)x : (int*)y ;
- (void) DPSsetdrawingfunction: (int)function ;
- (void) DPSsetgcdrawable: (void*)gc : (void*)draw : (int)x : (int)y ;
- (void) DPSsetgcdrawablecolor: (void*)gc : (void*)draw : (int)x : (int)y : (const int*)colorInfo ;
- (void) DPSsetoffset: (short int)x : (short int)y ;
- (void) DPSsetrgbactual: (double)r : (double)g : (double)b : (int*)success ;
- (void) DPScapturegstate: (int*)gst ;
- (void) DPScurrentgcdrawable: (void**)gc : (void**)draw : (int*)x : (int*)y;
- (void) DPScurrentoffset: (int*)x : (int*)y;
- (void) DPSsetgcdrawable: (void*)gc : (void*)draw : (int)x : (int)y;
- (void) DPSsetoffset: (short int)x : (short int)y;
/*-------------------------------------------------------------------------*/
/* Graphics Extensions Ops */
/*-------------------------------------------------------------------------*/
- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h : (int)gstateNum : (float)dx : (float)dy : (int)op;
- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h
: (int)gstateNum : (float)dx : (float)dy : (int)op;
- (void) DPScompositerect: (float)x : (float)y : (float)w : (float)h : (int)op;
- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h : (int)gstateNum
: (float)dx : (float)dy : (float)delta;
- (void) DPSreadimage;
- (void) DPSsetalpha: (float)a;
- (void) DPScurrentalpha: (float*)a;
- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h
: (int)gstateNum : (float)dx : (float)dy : (float)delta;
/*-------------------------------------------------------------------------*/
/* Window Extensions Ops */
/*-------------------------------------------------------------------------*/
- (void) DPSwindow: (float) x : (float) y : (float) w : (float) h : (int) type : (int*) num ;
- (void) DPStermwindow: (int) num ;
- (void) DPSstylewindow: (int) style : (int) num ;
- (void) DPStitlewindow: (const char*) window_title : (int) num ;
- (void) DPSminiwindow: (int) num ;
- (void) DPSwindowdevice: (int) num ;
- (void) DPSwindowdeviceround: (int) num ;
- (void) DPScurrentwindow: (int*) num ;
- (void) DPSorderwindow: (int) op : (int) otherWin : (int) winNum ;
- (void) DPSmovewindow: (float) x : (float) y : (int) num ;
- (void) DPSupdatewindow: (int) win ;
- (void) DPSplacewindow: (float) x : (float) y : (float) w : (float) h : (int) win ;
- (void) DPSfrontwindow: (int*) num ;
- (void) DPSfindwindow: (float) x : (float) y : (int) op : (int) otherWin : (float*) lx : (float*) ly : (int*) winFound : (int*) didFind ;
- (void) DPScurrentwindowbounds: (int) num : (float*) x : (float*) y : (float*) w : (float*) h ;
- (void) DPSsetexposurecolor;
- (void) DPSsetsendexposed: (int) truth : (int) num ;
- (void) DPSsetautofill: (int) truth : (int) num ;
- (void) DPScurrentwindowalpha: (int) win : (int*) alpha ;
- (void) DPScountscreenlist: (int) context : (int*) count ;
- (void) DPSscreenlist: (int) context : (int) count : (int*) windows ;
- (void) DPSsetowner: (int) owner : (int) win ;
- (void) DPScurrentowner: (int) win : (int*) owner ;
- (void) DPSsetwindowtype: (int) type : (int) win ;
- (void) DPSsetwindowlevel: (int) level : (int) win ;
- (void) DPScurrentwindowlevel: (int) win : (int*) level ;
- (void) DPScountwindowlist: (int) context : (int*) count ;
- (void) DPSwindowlist: (int) context : (int) count : (int*) windows ;
- (void) DPSsetwindowdepthlimit: (int) limit : (int) win ;
- (void) DPScurrentwindowdepthlimit: (int) win : (int*) limit ;
- (void) DPScurrentwindowdepth: (int) win : (int*) depth ;
- (void) DPSsetdefaultdepthlimit: (int) limit ;
- (void) DPScurrentdefaultdepthlimit: (int*) limit ;
- (void) DPSsetmaxsize: (float) width : (float) height : (int) win ;
- (void) DPSsetminsize: (float) width : (float) height : (int) win ;
- (void) DPSsetresizeincrements: (float) width : (float) height : (int) win ;
- (void) DPSflushwindowrect: (float) x : (float) y : (float) w : (float) h : (int) win ;
- (void) DPScapturemouse: (int) win ;
- (void) DPSreleasemouse;
- (void) DPSsetinputfocus: (int) win ;
- (void) DPShidecursor;
- (void) DPSshowcursor;
- (void) DPSstandardcursor: (int) style : (void**) cid ;
- (void) DPSimagecursor: (float) hotx : (float) hoty : (float) w : (float) h : (int) colors : (const char*) image : (void**) cid ;
- (void) DPSsetcursorcolor: (float) fr : (float) fg : (float) fb : (float) br : (float) bg : (float) bb : (void*) cid ;
- (void) DPSstyleoffsets: (float*) l : (float*) r : (float*) t : (float*) b : (int) style ;
- (void) DPSdocedited: (int) edited : (int) window ;
- (void) GSDrawImage: (NSRect)rect : (void *)imageref;
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */
- (NSEvent*) DPSGetEventMatchingMask: (unsigned)mask
beforeDate: (NSDate*)limit
inMode: (NSString*)mode
dequeue: (BOOL)flag;
- (void) DPSDiscardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit;
- (void) DPSPostEvent: (NSEvent*)anEvent atStart: (BOOL)flag;
- (void) DPSmouselocation: (float*)x : (float*)y;
- (void) DPSsetinputstate: (int)window : (int)state;
- (void) DPScurrentserverdevice: (void **)serverptr;
- (void) DPScurrentwindowdevice: (int)win : (void **)windowptr;
/* ----------------------------------------------------------------------- */
/* Client functions */
/* Postscript Client functions */
/* ----------------------------------------------------------------------- */
- (void) DPSPrintf: (char *)fmt : (va_list)args;
- (void) DPSWriteData: (char *)buf : (unsigned int)count;
@end
/* Common graphics functions */
@interface NSGraphicsContext (NSGraphics)
/* ----------------------------------------------------------------------- */
/* NSGraphics Ops */
/* ----------------------------------------------------------------------- */
/* initialize the backend */
+ (void) initializeBackend;
/*
* Rectangle Drawing Functions
*/
- (void) NSEraseRect: (NSRect) aRect;
- (void) NSHighlightRect: (NSRect) aRect;
- (void) NSRectClip: (NSRect) aRect;
- (void) NSRectClipList: (const NSRect *)rects : (int) count;
- (void) NSRectFill: (NSRect) aRect;
- (void) NSRectFillList: (const NSRect *)rects : (int) count;
- (void) NSRectFillListWithGrays: (const NSRect *)rects : (const float *)grays
:(int) count;
- (void) NSRectFillUsingOperation: (NSRect) aRect : (NSCompositingOperation) op;
/*
* Draw a Bordered Rectangle
*/
- (void) NSDottedFrameRect: (const NSRect) aRect;
- (void) NSFrameRect: (const NSRect) aRect;
- (void) NSFrameRectWithWidth: (const NSRect) aRect : (float) frameWidth;
/*
* Read the Color at a Screen Position
*/
@interface NSGraphicsContext (NSGraphics)
- (NSColor *) NSReadPixel: (NSPoint) location;
/*
* Copy an image
*/
- (void) NSCopyBitmapFromGState: (int) srcGstate: (NSRect) srcRect
: (NSRect) destRect;
- (void) NSCopyBits: (int) srcGstate : (NSRect) srcRect : (NSPoint) destPoint;
/*
* Render Bitmap Images
*/
/* Soon to be obsolete */
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
: (int) bitsPerSample : (int) samplesPerPixel
: (int) bitsPerPixel : (int) bytesPerRow : (BOOL) isPlanar
: (BOOL) hasAlpha : (NSString *) colorSpaceName
: (const unsigned char *const [5]) data;
/*
* Play the System Beep
*/
- (void) NSBeep;
/* Context helper wraps */
- (unsigned int) GSWDefineAsUserObj;
- (void) GSWSetViewIsFlipped: (BOOL) flipped;
- (BOOL) GSWViewIsFlipped;
- (NSWindowDepth) GSWindowDepthForScreen: (int) screen;
- (const NSWindowDepth *) GSAvailableDepthsForScreen: (int) screen;
- (NSSize) GSResolutionForScreen: (int) screen;
@end
@ -553,12 +392,6 @@ APPKIT_EXPORT NSString *NSGraphicsContextPDFFormat;
APPKIT_EXPORT NSString *NSGraphicsContextPSFormat;
APPKIT_EXPORT NSString *NSGraphicsContextRepresentationFormatAttributeName;
APPKIT_EXPORT NSString *NSImageInterpolationDefault;
APPKIT_EXPORT NSString *NSImageInterpolationNone;
APPKIT_EXPORT NSString *NSImageInterpolationLow;
APPKIT_EXPORT NSString *NSImageInterpolationHigh;
#endif /* _NSGraphicsContext_h_INCLUDE */
#endif /* STRICT_OPENSTEP */

View file

@ -31,6 +31,7 @@
#ifndef _GNUstep_H_NSTextView
#define _GNUstep_H_NSTextView
#include <AppKit/NSDragging.h>
#include <AppKit/NSText.h>
#include <AppKit/NSTextAttachment.h>
#include <AppKit/NSRulerView.h>

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/NSColor.h>
#include <AppKit/NSView.h>
#include <AppKit/DPSOperators.h>
char **NSArgv = NULL;
@ -298,9 +299,86 @@ NSPlanarFromDepth(NSWindowDepth depth)
return planar;
}
/* Graphic Ops */
void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
{
}
void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
{
float x, y, w, h;
NSGraphicsContext *ctxt = GSCurrentContext();
x = NSMinX(srcRect);
y = NSMinY(srcRect);
w = NSWidth(srcRect);
h = NSHeight(srcRect);
DPScomposite(ctxt, x, y, w, h, srcGstate, destPoint.x, destPoint.y,
NSCompositeCopy);
}
/*
* Rectangle Drawing
*/
void NSEraseRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
DPSgsave(ctxt);
DPSsetgray(ctxt, 1.0);
NSRectFill(aRect);
DPSgrestore(ctxt);
}
void NSHighlightRect(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
DPScompositerect(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect),
NSCompositeHighlight);
[[[ctxt focusView] window] flushWindow];
}
void NSRectClip(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
DPSrectclip(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect));
DPSnewpath(ctxt);
}
void NSRectClipList(const NSRect *rects, int count)
{
int i;
NSRect union_rect;
if (count == 0)
return;
/*
The specification is not clear if the union of the rects
should produce the new clip rect or if the outline of all rects
should be used as clip path.
*/
union_rect = rects[0];
for (i = 1; i < count; i++)
union_rect = NSUnionRect(union_rect, rects[i]);
NSRectClip(union_rect);
}
void NSRectFill(NSRect aRect)
{
NSGraphicsContext *ctxt = GSCurrentContext();
DPSrectfill(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect));
}
void NSRectFillList(const NSRect *rects, int count)
{
NSGraphicsContext *ctxt = GSCurrentContext();
GSRectFillList(ctxt, rects, count);
}
void
NSRectFillListWithColors(const NSRect *rects, NSColor **colors, int count)
@ -314,6 +392,28 @@ NSRectFillListWithColors(const NSRect *rects, NSColor **colors, int count)
}
}
void NSRectFillListWithGrays(const NSRect *rects, const float *grays,
int count)
{
int i;
NSGraphicsContext *ctxt = GSCurrentContext();
for (i = 0; i < count; i++)
{
DPSsetgray(ctxt, grays[i]);
DPSrectfill(ctxt, NSMinX(rects[i]), NSMinY(rects[i]),
NSWidth(rects[i]), NSHeight(rects[i]));
}
}
void NSRectFillUsingOperation(NSRect aRect, NSCompositingOperation op)
{
NSGraphicsContext *ctxt = GSCurrentContext();
DPScompositerect(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect), op);
}
void
NSRectFillListUsingOperation(const NSRect *rects, int count,
NSCompositingOperation op)
@ -341,6 +441,37 @@ NSRectFillListWithColorsUsingOperation(const NSRect *rects,
}
}
/*
* Draw a Bordered Rectangle
*/
void NSDottedFrameRect(const NSRect aRect)
{
float dot_dash[] = {1.0, 1.0};
NSGraphicsContext *ctxt = GSCurrentContext();
DPSsetgray(ctxt, 0.0);
DPSsetlinewidth(ctxt, 1.0);
// FIXME
DPSsetdash(ctxt, dot_dash, 2, 0.0);
DPSrectstroke(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect));
}
void NSFrameRect(const NSRect aRect)
{
NSFrameRectWithWidth(aRect, 1.0);
}
void NSFrameRectWithWidth(const NSRect aRect, float frameWidth)
{
float width;
NSGraphicsContext *ctxt = GSCurrentContext();
DPScurrentlinewidth(ctxt, &width);
DPSsetlinewidth(ctxt, frameWidth);
DPSrectstroke(ctxt, NSMinX(aRect), NSMinY(aRect),
NSWidth(aRect), NSHeight(aRect));
DPSsetlinewidth(ctxt, width);
}
//*****************************************************************************
//

View file

@ -148,6 +148,7 @@ NSWindow.m \
NSWindowController.m \
NSWorkspace.m \
GSComboSupport.m \
GSDisplayServer.m \
GSHelpManagerPanel.m \
GSInfoPanel.m \
GSMemoryPanel.m \
@ -296,6 +297,7 @@ AppKitExceptions.h \
DPSOperators.h \
GMAppKit.h \
GMArchiver.h \
GSDisplayServer.h \
GSFontInfo.h \
GSMemoryPanel.h \
GSInfoPanel.h \

978
Source/GSDisplayServer.m Normal file
View file

@ -0,0 +1,978 @@
/** <title>GSDisplayServer</title>
<abstract>Abstract display server class.</abstract>
Copyright (C) 2002 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Date: Mar 2002
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#include <Foundation/NSArray.h>
#include <Foundation/NSDictionary.h>
#include <Foundation/NSData.h>
#include <Foundation/NSLock.h>
#include <Foundation/NSRunLoop.h>
#include <Foundation/NSThread.h>
#include <AppKit/NSEvent.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSWindow.h>
#include <AppKit/GSDisplayServer.h>
/* The memory zone where all server objects are allocated from (Contexts
are also allocated from this zone) */
static NSZone *_globalGSZone = NULL;
/* The current concrete class */
static Class defaultServerClass = NULL;
/* Maps windows to a server */
static NSMapTable *windowmaps = NULL;
/* Current server */
static GSDisplayServer *currentServer = nil;
/* Lock for use when creating contexts */
static NSRecursiveLock *serverLock = nil;
static NSString *NSCurrentServerThreadKey;
/** Returns the GSDisplayServer that created the interal
representation for window. If the internal representation has not
yet been created (for instance, if the window is deferred), it
returns the current server */
GSDisplayServer *
GSServerForWindow(NSWindow *window)
{
int num;
if (windowmaps == NULL)
{
NSLog(@"GSServerForWindow: No window server");
return nil;
}
num = [window windowNumber];
if (num == 0)
{
/* Backend window hasn't been initialized yet, assume current server. */
return GSCurrentServer();
}
return NSMapGet(windowmaps, (void *)num);
}
/** Returns the current GSDisplayServer */
GSDisplayServer *
GSCurrentServer(void)
{
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
return (GSDisplayServer*) [dict objectForKey: NSCurrentServerThreadKey];
}
/**
<unit>
<heading>GSDisplayServer</heading>
<p>This is an abstract class which provides a framework for a device
independant window server. A window server handles the very basic control
of the computer display and input. This includes basic window
creation and handling, event handling, cursors, and providing
miscellaneous information about the display.
</p>
<p>Typically a backend library will provide a concrete subclass
which implements the device specific methods described below.
</p>
<p>In almost all cases, you should not call these methods directly
in an application. You should use the equivalent methods available
elsewhere in the library (e.g. NSWindow, NSScreen, etc).
</p>
</unit> */
@implementation GSDisplayServer
+ (void) initialize
{
if (serverLock == nil)
{
[gnustep_global_lock lock];
if (serverLock == nil)
{
serverLock = [NSRecursiveLock new];
_globalGSZone = NSDefaultMallocZone();
defaultServerClass = [GSDisplayServer class];
NSCurrentServerThreadKey = @"NSCurrentServerThreadKey";
}
[gnustep_global_lock unlock];
}
}
/** Set the concrete subclass that will provide the device dependant
implementation.
*/
+ (void) setDefaultServerClass: (Class)aClass
{
defaultServerClass = aClass;
}
/**
<p>Create a window server with attributes, which contains key/value
pairs which describe the specifics of how the window server is to
be initialized. Typically these values are specific to the
concrete implementation. Currently there are no standard set of
attributes defined for GSDisplayServer.</p>
<p>In almost all applications one would only create a
single instance of a window server. Although it is possible, it is
unlikely that you would need more than one window server (and you
would have to be very careful how you handled window creation and
events in this case).</p>
*/
+ (GSDisplayServer *) serverWithAttributes: (NSDictionary *)attributes
{
GSDisplayServer *server;
if (windowmaps == NULL)
{
windowmaps = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 20);
}
if (self == [GSDisplayServer class])
{
server = [[defaultServerClass allocWithZone: _globalGSZone]
initWithAttributes: attributes];
}
else
server = [[self allocWithZone: _globalGSZone]
initWithAttributes: attributes];
return AUTORELEASE(server);
}
/**
Sets the current server that will be handling windows, events,
etc. This method must be called after a window server is created
in order to make it available to the rest of the GUI library
*/
+ (void) setCurrentServer: (GSDisplayServer *)server
{
NSMutableDictionary *dict = [[NSThread currentThread] threadDictionary];
if (server)
[dict setObject: server forKey: NSCurrentServerThreadKey];
else
[dict removeObjectForKey: NSCurrentServerThreadKey];
}
/** <init />
Initializes the server. This typically causes the receiver to
<em>connect</em> to the display (e.g. XOpenDisplay() on an X-Windows
server).
*/
- (id) initWithAttributes: (NSDictionary *)attributes
{
[super init];
ASSIGN(server_info, attributes);
event_queue = [[NSMutableArray allocWithZone: [self zone]]
initWithCapacity: 32];
drag_types = NSCreateMapTable(NSIntMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
return self;
}
/** Return information used to create the server */
- (NSDictionary *) attributes
{
return AUTORELEASE([server_info copy]);
}
/**
Causes the server to disconnect from the display. If the receiver
is the current server, it removes it self and sets the current
server to nil. Sending any more messages to the receiver after this
is likely to cause severe problems and probably crash the
application.
*/
- (void) closeServer
{
if (self == GSCurrentServer())
[GSDisplayServer setCurrentServer: nil];
}
- (void) dealloc
{
if (self == GSCurrentServer())
currentServer = nil;
DESTROY(server_info);
DESTROY(event_queue);
NSFreeMapTable(drag_types);
[super dealloc];
}
/* Drag and drop support. */
/** Convienience method that calls -addDragTypes:toWindow: using the
server that controls win.
*/
+ (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win
{
return [GSServerForWindow(win) addDragTypes: types toWindow: win];
}
/** Convienience method that calls -removeDragTypes:fromWindow: using the
server that controls win.
*/
+ (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win
{
return [GSServerForWindow(win) removeDragTypes: types fromWindow: win];
}
/** Convienience method that calls -dragTypesForWindow: using the
server that controls win.
*/
+ (NSCountedSet*) dragTypesForWindow: (NSWindow *)win
{
return [GSServerForWindow(win) dragTypesForWindow: win];
}
/**
* Add (increment count by 1) each drag type to those registered
* for the window. If this results in a change to the types registered
* in the counted set, return YES, otherwise return NO.
* Subclasses should override this method, call 'super' and take
* appropriate action if the method returns 'YES'.
*/
- (BOOL) addDragTypes: (NSArray*)types toWindow: (NSWindow *)win
{
NSCountedSet *old = (NSCountedSet*)NSMapGet(drag_types, (void*)win);
NSEnumerator *drag_enum = [types objectEnumerator];
id type;
unsigned originalCount;
/*
* Make sure the set exists.
*/
if (old == nil)
{
old = [NSCountedSet new];
NSMapInsert(drag_types, (void*)win, (void*)(gsaddr)old);
RELEASE(old);
}
originalCount = [old count];
while ((type = [drag_enum nextObject]))
{
[old addObject: type];
}
if ([old count] == originalCount)
return NO;
return YES;
}
/**
* Remove (decrement count by 1) each drag type from those registered
* for the window. If this results in a change to the types registered
* in the counted set, return YES, otherwise return NO.
* If given 'nil' as the array of types, remove ALL.
* Subclasses should override this method, call 'super' and take
* appropriate action if the method returns 'YES'.
*/
- (BOOL) removeDragTypes: (NSArray*)types fromWindow: (NSWindow *)win
{
NSCountedSet *old = (NSCountedSet*)NSMapGet(drag_types, (void*)win);
NSEnumerator *drag_enum = [types objectEnumerator];
if (types == nil)
{
if (old == nil)
return NO;
NSMapRemove(drag_types, (void*)win);
return YES;
}
else if (old == nil)
{
return NO;
}
else
{
unsigned originalCount = [old count];
id o;
while ((o = [drag_enum nextObject]))
{
[old removeObject: o];
}
if ([old count] == originalCount)
return NO;
return YES;
}
}
/** Returns the drag types set for the window win. */
- (NSCountedSet*) dragTypesForWindow: (NSWindow *)win
{
return (NSCountedSet*)NSMapGet(drag_types, (void *)win);
}
/** Returns an instance of a class which implements the NSDraggingInfo
protocol. */
- (id <NSDraggingInfo>) dragInfo
{
[self subclassResponsibility: _cmd];
return nil;
}
- (BOOL) slideImage: (NSImage*)image from: (NSPoint)from to: (NSPoint)to
{
[self subclassResponsibility: _cmd];
return NO;
}
/* Screen information */
/** Retuns the resolution, in points, for the indicated screen of the
display. */
- (NSSize) resolutionForScreen: (int)screen
{
/*[self subclassResponsibility: _cmd];*/
return NSMakeSize(72, 72);
}
/** Retuns the bounds, in pixels, for the indicated screen of the
display. */
- (NSRect) boundsForScreen: (int)screen
{
[self subclassResponsibility: _cmd];
return NSZeroRect;
}
/** Returns the default depth of windows that are created on screen. */
- (NSWindowDepth) windowDepthForScreen: (int)screen
{
[self subclassResponsibility: _cmd];
return 0;
}
/** Returns a null terminated list of possible window depths for
screen. */
- (const NSWindowDepth *) availableDepthsForScreen: (int)screen
{
[self subclassResponsibility: _cmd];
return NULL;
}
/**
Returns an array of NSNumbers, where each number describes a screen
that is available on this display.
*/
- (NSArray *) screenList
{
return nil;
}
/**
Returns a display dependant pointer that describes the internal
connection to the display. On X-Windows, for example, this is a
pointer to the <code>Display</code> variable. */
- (void *) serverDevice
{
[self subclassResponsibility: _cmd];
return NULL;
}
/**
Returns a display dependant pointer that describes the internal
window representation for win. On X-Windows, for example, this is a
pointer to the <code>Window</code> variable. */
- (void *) windowDevice: (int)win
{
[self subclassResponsibility: _cmd];
return NULL;
}
@end
/* ----------------------------------------------------------------------- */
/* GNUstep Window operations */
/* ----------------------------------------------------------------------- */
@implementation GSDisplayServer (WindowOps)
/** Tells the receiver that it owns the window described by
win. Concrete subclasses must call this function when creating a
window. Do not call this method in any other case, particularly
for a window that has already been created */
- (void) _setWindowOwnedByServer: (int)win
{
NSMapInsert (windowmaps, (void*)win, self);
}
/** Creates a window whose location and size is described by frame and
whose backing store is described by type. This window is not
mapped to the screen by this call */
- (int) window: (NSRect)frame : (NSBackingStoreType)type : (unsigned int)style
{
[self subclassResponsibility: _cmd];
return 0;
}
/** Destroys the representation of the window and frees and memory
associated with it. */
- (void) termwindow: (int) win
{
[self subclassResponsibility: _cmd];
}
/** Sets the style of the window. See [NSWindow -styleMask] for a
description of the available styles */
- (void) stylewindow: (int) style : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Changes window's the backing store to type */
- (void) windowbacking: (NSBackingStoreType)type
{
[self subclassResponsibility: _cmd];
}
/** Sets the window title */
- (void) titlewindow: (NSString *) window_title : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Miniaturizes the window */
- (void) miniwindow: (int) win
{
[self subclassResponsibility: _cmd];
}
/** Sets the window drawable for the current NSGraphicsContext,
typically by calling [NSGraphicsContext -DPSsetgcdrawable::::],
although depending on the concrete implmentation, more information
than this may need to be exchanged. */
- (void) windowdevice: (int) win
{
[self subclassResponsibility: _cmd];
}
/** Causes the window to be ordered onto or off the screen depending
on the value of op. The window is ordered relative to otherWin. */
- (void) orderwindow: (int) op : (int) otherWin : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Moves the bottom left cornder of the window to loc */
- (void) movewindow: (NSPoint)loc : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Moves and resizes the window on the screen as described by frame. */
- (void) placewindow: (NSRect)frame : (int) win
{
[self subclassResponsibility: _cmd];
}
- (BOOL) findwindow: (NSPoint)loc : (int) op : (int) otherWin
: (NSPoint *)floc : (int*) winFound
{
[self subclassResponsibility: _cmd];
return NO;
}
/** Retuns the frame of the window on the screen */
- (NSRect) windowbounds: (int) win
{
[self subclassResponsibility: _cmd];
return NSZeroRect;
}
/** Set the level of the window as in [NSWindow -setLevel] */
- (void) setwindowlevel: (int) level : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Returns the window level as in [NSWindow -level] */
- (int) windowlevel: (int) win
{
[self subclassResponsibility: _cmd];
return 0;
}
/** Returns the list of windows that the server controls */
- (NSArray *) windowlist
{
[self subclassResponsibility: _cmd];
return nil;
}
/** Returns the depth of the window */
- (int) windowdepth: (int) win
{
[self subclassResponsibility: _cmd];
return 0;
}
/** Set the maximum size of the window */
- (void) setmaxsize: (NSSize)size : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Set the minimum size of the window */
- (void) setminsize: (NSSize)size : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Set the resize incremenet of the window */
- (void) setresizeincrements: (NSSize)size : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Causes buffered graphics to be flushed to the screen */
- (void) flushwindowrect: (NSRect)rect : (int) win
{
[self subclassResponsibility: _cmd];
}
/** Returns the dimensions of the window that are inside the window
frame but are controlled by the window manager. For instance, t
gives the height of the title bar for the window */
- (void) styleoffsets: (float*) l : (float*) r : (float*) t : (float*) b : (int) style
{
[self subclassResponsibility: _cmd];
}
/** Sets the document edited flag for the window */
- (void) docedited: (int) edited : (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. */
- (void) setinputstate: (int)state : (int)win
{
[self subclassResponsibility: _cmd];
}
/** Forces focus to the window so that all key events are sent to this
window */
- (void) setinputfocus: (int) win
{
[self subclassResponsibility: _cmd];
}
/** Returns the current mouse location */
- (NSPoint) mouselocation
{
[self subclassResponsibility: _cmd];
return NSZeroPoint;
}
/** Grabs the pointer device so that all future mouse events will be
directed only to the window win. If successful, the return value
is YES and this message must be balanced by a -releasemouse
message. */
- (BOOL) capturemouse: (int) win
{
[self subclassResponsibility: _cmd];
return NO;
}
/** Release a previous captured mouse from -capturemouse: */
- (void) releasemouse
{
[self subclassResponsibility: _cmd];
}
/** Hides the cursor */
- (void) hidecursor
{
[self subclassResponsibility: _cmd];
}
/** Show a previously hidden cursor */
- (void) showcursor
{
[self subclassResponsibility: _cmd];
}
/** Create a standard cursor (such as an arror or IBeam). Returns a
pointer to the internal device representation that can be used
later to make this cursor the current one
*/
- (void) standardcursor: (int) style : (void**) cid
{
[self subclassResponsibility: _cmd];
}
/** Create a cursor from an image. Returns a pointer to the internal
device representation that can be used later to make this cursor
the current one */
- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors
: (const char*) image : (void**) cid
{
[self subclassResponsibility: _cmd];
}
/** Set the cursor given by the cid representation as being the
current cursor. The cursor has a foreground color fg and a
background color bg. To keep the default color for the cursor, pass
nil for fg and bg. */
- (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid
{
[self subclassResponsibility: _cmd];
}
@end
/* ----------------------------------------------------------------------- */
/* GNUstep Event Operations */
/* ----------------------------------------------------------------------- */
@implementation GSDisplayServer (EventOps)
- (NSEvent*) getEventMatchingMask: (unsigned)mask
beforeDate: (NSDate*)limit
inMode: (NSString*)mode
dequeue: (BOOL)flag
{
unsigned pos = 0; /* Position in queue scanned so far */
NSRunLoop *loop = nil;
do
{
unsigned count = [event_queue count];
NSEvent *event;
unsigned i = 0;
if (count == 0)
{
event = nil;
}
else if (mask == NSAnyEventMask)
{
/*
* Special case - if the mask matches any event, we just get the
* first event on the queue.
*/
event = [event_queue objectAtIndex: 0];
}
else
{
event = nil;
/*
* Scan the queue from the last position we have seen, up to the end.
*/
if (count > pos)
{
unsigned end = count - pos;
NSRange r = NSMakeRange(pos, end);
NSEvent *events[end];
[event_queue getObjects: events range: r];
for (i = 0; i < end; i++)
{
BOOL matched = NO;
switch ([events[i] type])
{
case NSLeftMouseDown:
if (mask & NSLeftMouseDownMask)
matched = YES;
break;
case NSLeftMouseUp:
if (mask & NSLeftMouseUpMask)
matched = YES;
break;
case NSOtherMouseDown:
if (mask & NSOtherMouseDownMask)
matched = YES;
break;
case NSOtherMouseUp:
if (mask & NSOtherMouseUpMask)
matched = YES;
break;
case NSRightMouseDown:
if (mask & NSRightMouseDownMask)
matched = YES;
break;
case NSRightMouseUp:
if (mask & NSRightMouseUpMask)
matched = YES;
break;
case NSMouseMoved:
if (mask & NSMouseMovedMask)
matched = YES;
break;
case NSMouseEntered:
if (mask & NSMouseEnteredMask)
matched = YES;
break;
case NSMouseExited:
if (mask & NSMouseExitedMask)
matched = YES;
break;
case NSLeftMouseDragged:
if (mask & NSLeftMouseDraggedMask)
matched = YES;
break;
case NSOtherMouseDragged:
if (mask & NSOtherMouseDraggedMask)
matched = YES;
break;
case NSRightMouseDragged:
if (mask & NSRightMouseDraggedMask)
matched = YES;
break;
case NSKeyDown:
if (mask & NSKeyDownMask)
matched = YES;
break;
case NSKeyUp:
if (mask & NSKeyUpMask)
matched = YES;
break;
case NSFlagsChanged:
if (mask & NSFlagsChangedMask)
matched = YES;
break;
case NSAppKitDefined:
if (mask & NSAppKitDefinedMask)
matched = YES;
break;
case NSSystemDefined:
if (mask & NSSystemDefinedMask)
matched = YES;
break;
case NSApplicationDefined:
if (mask & NSApplicationDefinedMask)
matched = YES;
break;
case NSPeriodic:
if (mask & NSPeriodicMask)
matched = YES;
break;
case NSCursorUpdate:
if (mask & NSCursorUpdateMask)
matched = YES;
break;
default:
break;
}
if (matched)
{
event = events[i];
break;
}
}
}
}
/*
* Note the positon we have read up to.
*/
pos += i;
/*
* If we found a matching event, we (depending on the flag) de-queue it.
* We return the event RETAINED - the caller must release it.
*/
if (event)
{
RETAIN(event);
if (flag)
{
[event_queue removeObjectAtIndex: pos];
}
return AUTORELEASE(event);
}
if (loop == nil)
loop = [NSRunLoop currentRunLoop];
}
while ([loop runMode: mode beforeDate: limit] == YES);
return nil; /* No events in specified time */
}
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit
{
unsigned index = [event_queue count];
/*
* If there is a range to use - remove all the matching events in it
* which were created before the specified event.
*/
if (index > 0)
{
NSTimeInterval when = [limit timestamp];
NSEvent *events[index];
[event_queue getObjects: events];
while (index-- > 0)
{
NSEvent *event = events[index];
if ([event timestamp] < when)
{
BOOL shouldRemove = NO;
if (mask == NSAnyEventMask)
{
shouldRemove = YES;
}
else
{
switch ([event type])
{
case NSLeftMouseDown:
if (mask & NSLeftMouseDownMask)
shouldRemove = YES;
break;
case NSLeftMouseUp:
if (mask & NSLeftMouseUpMask)
shouldRemove = YES;
break;
case NSOtherMouseDown:
if (mask & NSOtherMouseDownMask)
shouldRemove = YES;
break;
case NSOtherMouseUp:
if (mask & NSOtherMouseUpMask)
shouldRemove = YES;
break;
case NSRightMouseDown:
if (mask & NSRightMouseDownMask)
shouldRemove = YES;
break;
case NSRightMouseUp:
if (mask & NSRightMouseUpMask)
shouldRemove = YES;
break;
case NSMouseMoved:
if (mask & NSMouseMovedMask)
shouldRemove = YES;
break;
case NSMouseEntered:
if (mask & NSMouseEnteredMask)
shouldRemove = YES;
break;
case NSMouseExited:
if (mask & NSMouseExitedMask)
shouldRemove = YES;
break;
case NSLeftMouseDragged:
if (mask & NSLeftMouseDraggedMask)
shouldRemove = YES;
break;
case NSOtherMouseDragged:
if (mask & NSOtherMouseDraggedMask)
shouldRemove = YES;
break;
case NSRightMouseDragged:
if (mask & NSRightMouseDraggedMask)
shouldRemove = YES;
break;
case NSKeyDown:
if (mask & NSKeyDownMask)
shouldRemove = YES;
break;
case NSKeyUp:
if (mask & NSKeyUpMask)
shouldRemove = YES;
break;
case NSFlagsChanged:
if (mask & NSFlagsChangedMask)
shouldRemove = YES;
break;
case NSPeriodic:
if (mask & NSPeriodicMask)
shouldRemove = YES;
break;
case NSCursorUpdate:
if (mask & NSCursorUpdateMask)
shouldRemove = YES;
break;
default:
break;
}
}
if (shouldRemove)
[event_queue removeObjectAtIndex: index];
}
}
}
}
- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag
{
if (flag)
[event_queue insertObject: anEvent atIndex: 0];
else
[event_queue addObject: anEvent];
}
@end

View file

@ -261,7 +261,7 @@ static NSAffineTransformStruct identityTransform = {
m[3] = matrix.m22;
m[4] = matrix.tx;
m[5] = matrix.ty;
PSsetmatrix(m);
GSSetCTM(GSCurrentContext(), self);
}
- (void) setTransformStruct: (NSAffineTransformStruct)val

View file

@ -51,7 +51,7 @@
#endif
#include <AppKit/AppKitExceptions.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/GSDisplayServer.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSDocumentController.h>
#include <AppKit/NSPopUpButton.h>
@ -67,7 +67,6 @@
#include <AppKit/GSServicesManager.h>
#include <AppKit/NSNibLoading.h>
#include <AppKit/IMLoading.h>
#include <AppKit/DPSOperators.h>
#include <AppKit/NSPageLayout.h>
#include <AppKit/NSDataLinkPanel.h>
#include <AppKit/NSHelpManager.h>
@ -147,7 +146,7 @@ NSBundle *GSGuiBundle ()
return guiBundle;
}
@interface GSBackend : NSGraphicsContext
@interface GSBackend : NSObject
{}
+ (void) initializeBackend;
@end
@ -172,7 +171,7 @@ initialize_gnustep_backend(void)
/* What backend ? */
bundleName = [defs stringForKey: @"GSBackend"];
if ( bundleName == nil )
bundleName = @"libgnustep-xgps.bundle";
bundleName = @"libgnustep-back.bundle";
else
bundleName = [bundleName stringByAppendingString: @".bundle"];
NSDebugFLLog(@"BackendBundle", @"Looking for %@", bundleName);
@ -494,6 +493,8 @@ static NSCell* tileCell = nil;
*/
- (id) init
{
GSDisplayServer *srv;
if (NSApp != nil && NSApp != self)
{
RELEASE(self);
@ -519,10 +520,11 @@ static NSCell* tileCell = nil;
/* Initialize the backend here. */
initialize_gnustep_backend();
/* Create our context. This is equivalent to connecting to
our window server, so if someone wants to query information that might
require the backend, they just need to instantiate a sharedApplication
*/
/* Connect to our window server */
srv = [GSDisplayServer serverWithAttributes: nil];
[GSDisplayServer setCurrentServer: srv];
/* Create a default context. */
_default_context = [NSGraphicsContext graphicsContextWithAttributes: nil];
[NSGraphicsContext setCurrentContext: _default_context];
@ -723,6 +725,7 @@ static NSCell* tileCell = nil;
- (void) dealloc
{
GSDisplayServer *srv = GSServerForWindow(_app_icon_window);
NSDebugLog(@"Freeing NSApplication\n");
[nc removeObserver: self];
@ -754,6 +757,9 @@ static NSCell* tileCell = nil;
/* Destroy the default context, this will free it */
[_default_context destroyContext];
/* Close the server */
[srv closeServer];
[super dealloc];
}
@ -832,7 +838,8 @@ static NSCell* tileCell = nil;
{
_hidden_key = [self keyWindow];
[_hidden_key resignKeyWindow];
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
[GSServerForWindow(_app_icon_window)
setinputfocus: [_app_icon_window windowNumber]];
}
for (i = 0; i < count; i++)
{
@ -1099,7 +1106,7 @@ See Also: -runModalForWindow:
- (int) runModalSession: (NSModalSession)theSession
{
NSAutoreleasePool *pool;
NSGraphicsContext *ctxt;
GSDisplayServer *srv;
BOOL found = NO;
NSEvent *event;
NSDate *limit;
@ -1123,7 +1130,7 @@ See Also: -runModalForWindow:
}
// Use the default context for all events.
ctxt = _default_context;
srv = GSCurrentServer();
/*
* Set a limit date in the distant future so we wait until we get an
@ -1133,14 +1140,14 @@ See Also: -runModalForWindow:
limit = [NSDate distantFuture];
do
{
event = DPSGetEvent(ctxt, NSAnyEventMask, limit, NSDefaultRunLoopMode);
event = DPSGetEvent(srv, NSAnyEventMask, limit, NSDefaultRunLoopMode);
if (event != nil)
{
NSWindow *eventWindow = [event window];
if (eventWindow == theSession->window || [eventWindow worksWhenModal])
{
DPSPostEvent(ctxt, event, YES);
DPSPostEvent(srv, event, YES);
found = YES;
}
else if ([event type] == NSAppKitDefined)
@ -1161,7 +1168,7 @@ See Also: -runModalForWindow:
{
IF_NO_GC(pool = [arpClass new]);
event = DPSGetEvent(ctxt, NSAnyEventMask, limit, NSDefaultRunLoopMode);
event = DPSGetEvent(srv, NSAnyEventMask, limit, NSDefaultRunLoopMode);
if (event != nil)
{
NSWindow *eventWindow = [event window];
@ -1241,7 +1248,7 @@ See -runModalForWindow:
* add dummy event to queue to assure loop cycles
* at least one more time
*/
DPSPostEvent(_default_context, null_event, NO);
DPSPostEvent(GSCurrentServer(), null_event, NO);
}
}
@ -1377,7 +1384,7 @@ See -runModalForWindow:
- (void) discardEventsMatchingMask: (unsigned int)mask
beforeEvent: (NSEvent *)lastEvent
{
DPSDiscardEvents(_default_context, mask, lastEvent);
DPSDiscardEvents(GSCurrentServer(), mask, lastEvent);
}
- (NSEvent*) nextEventMatchingMask: (unsigned int)mask
@ -1391,9 +1398,9 @@ See -runModalForWindow:
expiration = [NSDate distantFuture];
if (flag)
event = DPSGetEvent(_default_context, mask, expiration, mode);
event = DPSGetEvent(GSCurrentServer(), mask, expiration, mode);
else
event = DPSPeekEvent(_default_context, mask, expiration, mode);
event = DPSPeekEvent(GSCurrentServer(), mask, expiration, mode);
if (event)
{
@ -1425,7 +1432,7 @@ IF_NO_GC(NSAssert([event retainCount] > 0, NSInternalInconsistencyException));
- (void) postEvent: (NSEvent *)event atStart: (BOOL)flag
{
DPSPostEvent(_default_context, event, flag);
DPSPostEvent(GSCurrentServer(), event, flag);
}
/*
@ -1597,7 +1604,8 @@ delegate.
{
_hidden_key = [self keyWindow];
[_hidden_key resignKeyWindow];
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
[GSServerForWindow(_app_icon_window)
setinputfocus: [_app_icon_window windowNumber]];
}
for (i = 0; i < count; i++)
{
@ -2383,7 +2391,8 @@ delegate.
RELEASE(iv);
[_app_icon_window orderFrontRegardless];
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
[GSServerForWindow(_app_icon_window)
setinputfocus: [_app_icon_window windowNumber]];
return self;
}
@ -2604,7 +2613,8 @@ delegate.
*/
if ([self keyWindow] == nil)
{
DPSsetinputfocus(GSCurrentContext(), [_app_icon_window windowNumber]);
[GSServerForWindow(_app_icon_window)
setinputfocus: [_app_icon_window windowNumber]];
}
}
}

View file

@ -33,6 +33,7 @@
#include <AppKit/NSColorPanel.h>
#include <AppKit/NSColorWell.h>
#include <AppKit/NSColor.h>
#include <AppKit/NSDragging.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/NSPasteboard.h>
#include <AppKit/NSWindow.h>

View file

@ -34,8 +34,7 @@
#include <AppKit/NSGraphics.h>
#include <AppKit/NSImage.h>
#include <AppKit/NSBitmapImageRep.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/DPSOperators.h>
#include <AppKit/GSDisplayServer.h>
// Class variables
static NSMutableArray *gnustep_gui_cursor_stack;
@ -100,9 +99,9 @@ static NSMutableDictionary *cursorDict = nil;
if (_hot_spot.y >= [rep pixelsHigh])
_hot_spot.y = [rep pixelsHigh]-1;
DPSimagecursor(GSCurrentContext(), _hot_spot.x, _hot_spot.y,
[rep pixelsWide], [rep pixelsHigh],
[rep samplesPerPixel], [rep bitmapData], &c);
[GSCurrentServer() imagecursor: _hot_spot
: [rep pixelsWide] : [rep pixelsHigh]
: [rep samplesPerPixel] : [rep bitmapData] : &c];
_cid = c;
}
@ -111,7 +110,7 @@ static NSMutableDictionary *cursorDict = nil;
*/
+ (void) hide
{
DPShidecursor(GSCurrentContext());
[GSCurrentServer() hidecursor];
}
+ (void) pop
@ -141,7 +140,7 @@ static NSMutableDictionary *cursorDict = nil;
+ (void) unhide
{
DPSshowcursor(GSCurrentContext());
[GSCurrentServer() showcursor];
}
/*
@ -156,7 +155,7 @@ static NSMutableDictionary *cursorDict = nil;
void *c;
cursor = [[NSCursor_class alloc] initWithImage: nil];
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
[GSCurrentServer() standardcursor: GSArrowCursor : &c];
[cursor _setCid: c];
[cursorDict setObject: cursor forKey: name];
RELEASE(cursor);
@ -178,7 +177,7 @@ static NSMutableDictionary *cursorDict = nil;
void *c;
cursor = [[NSCursor_class alloc] initWithImage: nil];
DPSstandardcursor(GSCurrentContext(), GSIBeamCursor, &c);
[GSCurrentServer() standardcursor: GSIBeamCursor : &c];
[cursor _setCid: c];
[cursorDict setObject: cursor forKey: name];
RELEASE(cursor);
@ -195,8 +194,9 @@ static NSMutableDictionary *cursorDict = nil;
void *c;
cursor = [[NSCursor_class alloc] initWithImage: nil];
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
DPSsetcursorcolor(GSCurrentContext (), 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, c);
[GSCurrentServer() standardcursor: GSArrowCursor : &c];
[GSCurrentServer() setcursorcolor: [NSColor greenColor]
: [NSColor blackColor] : c];
[cursor _setCid: c];
[cursorDict setObject: cursor forKey: name];
RELEASE(cursor);
@ -243,14 +243,7 @@ backgroundColorHint:(NSColor *)bg
bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
NSLog(@"fg color is %@", fg);
DPSsetcursorcolor(GSCurrentContext (),
[fg redComponent],
[fg greenComponent],
[fg blueComponent],
[bg redComponent],
[bg greenComponent],
[bg blueComponent],
_cid);
[GSCurrentServer() setcursorcolor: fg : bg : _cid];
}
return cursor;
}
@ -344,7 +337,7 @@ backgroundColorHint:(NSColor *)bg
gnustep_gui_current_cursor = self;
if (_cid)
{
DPSsetcursorcolor(GSCurrentContext(), -1, 0, 0, 1, 1, 1, _cid);
[GSCurrentServer() setcursorcolor: nil : nil : _cid];
}
}

View file

@ -46,6 +46,7 @@
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/PSOperators.h>
#include <AppKit/GSDisplayServer.h>
/*
* gstep-base has a faster mechanism to get the current thread.
@ -236,10 +237,7 @@ static Class eventClass;
*/
+ (NSPoint) mouseLocation
{
float x, y;
PSmouselocation(&x, &y);
return NSMakePoint(x, y);
return [GSCurrentServer() mouselocation];
}
+ (NSEvent*) otherEventWithType: (NSEventType)type

View file

@ -505,7 +505,7 @@ setNSFont(NSString* key, NSFont* font)
{
NSGraphicsContext *ctxt = GSCurrentContext();
[ctxt setFont: self];
[ctxt GSSetFont: self];
[ctxt useFont: fontName];
}

View file

@ -28,6 +28,7 @@
*/
#include <gnustep/gui/config.h>
#include <AppKit/NSDragging.h>
#include <AppKit/NSFont.h>
#include <AppKit/NSFontPanel.h>
#include <AppKit/NSFontManager.h>

File diff suppressed because it is too large Load diff

View file

@ -606,7 +606,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
- (void) recache
{
unsigned i, count;
unsigned i;
i = [_reps count];
while(i--)

View file

@ -55,8 +55,6 @@ static Class NSImageRep_class = NULL;
them can load in data from an external source. */
if (self == [NSImageRep class])
{
id obj;
NSImageRep_class = self;
imageReps = [[NSMutableArray alloc] initWithCapacity: 2];
[imageReps addObject: [NSBitmapImageRep class]];
@ -434,6 +432,7 @@ static Class NSImageRep_class = NULL;
{
BOOL ok, reset;
NSGraphicsContext *ctxt;
NSAffineTransform *ctm;
if (_size.width == 0 && _size.height == 0)
return NO;
@ -445,13 +444,13 @@ static Class NSImageRep_class = NULL;
{
if ([[ctxt focusView] isFlipped])
aPoint.y -= _size.height;
DPSmatrix(ctxt); DPScurrentmatrix(ctxt);
ctm = GSCurrentCTM(ctxt);
DPStranslate(ctxt, aPoint.x, aPoint.y);
reset = 1;
}
ok = [self draw];
if (reset)
DPSsetmatrix(ctxt);
GSSetCTM(ctxt, ctm);
return ok;
}
@ -460,6 +459,7 @@ static Class NSImageRep_class = NULL;
NSSize scale;
BOOL ok;
NSGraphicsContext *ctxt;
NSAffineTransform *ctm;
NSDebugLLog(@"NSImage", @"Drawing in rect (%f %f %f %f)\n",
NSMinX(aRect), NSMinY(aRect), NSWidth(aRect), NSHeight(aRect));
@ -471,11 +471,11 @@ static Class NSImageRep_class = NULL;
NSHeight(aRect) / _size.height);
if ([[ctxt focusView] isFlipped])
aRect.origin.y -= NSHeight(aRect);
DPSmatrix(ctxt); DPScurrentmatrix(ctxt);
ctm = GSCurrentCTM(ctxt);
DPStranslate(ctxt, NSMinX(aRect), NSMinY(aRect));
DPSscale(ctxt, scale.width, scale.height);
ok = [self draw];
DPSsetmatrix(ctxt);
GSSetCTM(ctxt, ctm);
return ok;
}

View file

@ -1101,7 +1101,7 @@ createRowsForColumn: (int)column
progressString = [@"Reading Directory " stringByAppendingString: path];
[super setTitle: progressString];
// Is the following really safe?
[GSCurrentContext() flush];
[GSCurrentContext() flushGraphics];
}
//TODO: Sort after creation of matrix so we do not sort
@ -1132,7 +1132,7 @@ createRowsForColumn: (int)column
reached_frac++;
progressString = [progressString stringByAppendingString: @"."];
[super setTitle: progressString];
[GSCurrentContext() flush];
[GSCurrentContext() flushGraphics];
}
// Now the real code
file = [files objectAtIndex: i];
@ -1183,7 +1183,7 @@ createRowsForColumn: (int)column
if (display_progress)
{
[super setTitle: @""];
[GSCurrentContext() flush];
[GSCurrentContext() flushGraphics];
}
RELEASE (pool);

View file

@ -31,8 +31,7 @@
#include <AppKit/NSScreen.h>
#include <AppKit/NSInterfaceStyle.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/DPSOperators.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/GSDisplayServer.h>
#include <AppKit/AppKitExceptions.h>
@interface NSScreen (Private)
@ -63,17 +62,15 @@ static NSMutableArray *screenArray = nil;
+ (NSArray*) screens
{
int count = 0, index = 0;
int *windows = NULL;
NSGraphicsContext *ctxt;
NSArray *screens;
GSDisplayServer *srv;
if (screenArray != nil)
return screenArray;
ctxt = [NSApp context];
// Get the number of screens.
DPScountscreenlist(ctxt, 0, &count);
// If the list is empty quit...
srv = GSCurrentServer();
screens = [srv screenList];
count = [screens count];
if (count == 0)
{
// something is wrong. This shouldn't happen.
@ -82,9 +79,6 @@ static NSMutableArray *screenArray = nil;
return nil;
}
windows = NSZoneMalloc(NSDefaultMallocZone(), (count+1)*sizeof(int));
DPSscreenlist(ctxt, 0, count, windows);
screenArray = [NSMutableArray new];
// Iterate over the list
@ -92,13 +86,11 @@ static NSMutableArray *screenArray = nil;
{
NSScreen *screen = nil;
screen = [[NSScreen alloc] _initWithScreenNumber: windows[index]];
screen = [[NSScreen alloc] _initWithScreenNumber:
[[screens objectAtIndex: index] intValue]];
[screenArray addObject: AUTORELEASE(screen)];
}
// free the list
NSZoneFree(NSDefaultMallocZone(), windows);
return [NSArray arrayWithArray: screenArray];
}
@ -149,8 +141,9 @@ static NSMutableArray *screenArray = nil;
// Get all of the infomation for a given screen.
- (id) _initWithScreenNumber: (int)screen
{
float x, y, w, h;
NSGraphicsContext *ctxt = [NSApp context];
GSDisplayServer *srv;
srv = GSCurrentServer();
self = [super init];
@ -167,25 +160,17 @@ static NSMutableArray *screenArray = nil;
return nil;
}
if (ctxt == nil)
if (srv == nil)
{
NSLog(@"Internal error: No current context\n");
RELEASE(self);
return nil;
}
if ([ctxt isDrawingToScreen] == NO)
{
NSLog(@"Internal error: trying to find screen with wrong context\n");
RELEASE(self);
return nil;
}
// Fill in all of the i-vars with appropriate values.
_screenNumber = screen;
DPScurrentwindowbounds(ctxt, _screenNumber, &x, &y, &w, &h);
_frame = NSMakeRect(x, y, w, h);
_depth = GSWindowDepthForScreen(ctxt, _screenNumber);
_frame = [srv boundsForScreen: _screenNumber];
_depth = [srv windowDepthForScreen: _screenNumber];
_supportedWindowDepths = NULL;
return self;
@ -240,8 +225,7 @@ static NSMutableArray *screenArray = nil;
forKey: NSDeviceSize];
// Add the NSDeviceResolution dictionary item
screenResolution = GSResolutionForScreen([NSApp context],
_screenNumber);
screenResolution = [GSCurrentServer() resolutionForScreen: _screenNumber];
[devDesc setObject: [NSValue valueWithSize: screenResolution]
forKey: NSDeviceResolution];
@ -265,8 +249,9 @@ static NSMutableArray *screenArray = nil;
// store it for the future.
if (_supportedWindowDepths == NULL)
{
_supportedWindowDepths = (NSWindowDepth*)GSAvailableDepthsForScreen(
[NSApp context], _screenNumber);
_supportedWindowDepths =
(NSWindowDepth*)[GSCurrentServer()
availableDepthsForScreen: _screenNumber];
// Check the results
if (_supportedWindowDepths == NULL)

View file

@ -49,6 +49,7 @@
#include <Foundation/NSPathUtilities.h>
#include <Foundation/NSSet.h>
#include <AppKit/GSDisplayServer.h>
#include <AppKit/GSTrackingRect.h>
#include <AppKit/GSVersion.h>
#include <AppKit/NSAffineTransform.h>
@ -642,16 +643,15 @@ GSSetDragTypes(NSView* obj, NSArray *types)
}
if (_rFlags.has_draginfo)
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSArray *t = GSGetDragTypes(self);
if (_window != nil)
{
[ctxt _removeDragTypes: t fromWindow: _window];
[GSDisplayServer removeDragTypes: t fromWindow: _window];
}
if (newWindow != nil)
{
[ctxt _addDragTypes: t toWindow: newWindow];
[GSDisplayServer addDragTypes: t toWindow: newWindow];
}
}
@ -1396,7 +1396,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) releaseGState
{
if (_allocate_gstate && _gstate)
PSundefineuserobject(_gstate);
GSUndefineGState(GSCurrentContext(), _gstate);
_gstate = 0;
/* Note that the next time we lock focus, we'll realloc a gstate (if
_allocate_gstate). This seems to make sense, and also allows us
@ -1506,7 +1506,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
if (_allocate_gstate)
{
DPSgstate(ctxt);
_gstate = GSWDefineAsUserObj(ctxt);
_gstate = GSDefineGState(ctxt);
/* Balance the previous gsave and install our own gstate */
DPSgrestore(ctxt);
DPSsetgstate(ctxt, _gstate);
@ -2571,12 +2571,11 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
_rFlags.has_draginfo = 1;
if (_window != nil)
{
NSGraphicsContext *ctxt = GSCurrentContext();
[ctxt _addDragTypes: t toWindow: _window];
[GSDisplayServer addDragTypes: t toWindow: _window];
if (o != nil)
{
[ctxt _removeDragTypes: o fromWindow: _window];
[GSDisplayServer removeDragTypes: o fromWindow: _window];
}
}
TEST_RELEASE(o);
@ -2588,10 +2587,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
{
if (_window != nil)
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSArray *t = GSGetDragTypes(self);
[ctxt _removeDragTypes: t fromWindow: _window];
[GSDisplayServer removeDragTypes: t fromWindow: _window];
}
GSRemoveDragTypes(self);
_rFlags.has_draginfo = 0;

View file

@ -62,8 +62,8 @@
#include <AppKit/NSDragging.h>
#include <AppKit/NSPasteboard.h>
#include <AppKit/NSHelpManager.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/NSGraphics.h>
#include <AppKit/GSDisplayServer.h>
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
@ -136,7 +136,7 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
}
if (w != nil && [w isVisible] == YES)
{
[GSCurrentContext() DPSsetinputfocus: [w windowNumber]];
[GSServerForWindow(w) setinputfocus: [w windowNumber]];
}
}
}
@ -497,10 +497,9 @@ static NSNotificationCenter *nc = nil;
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
NSGraphicsContext *context = GSCurrentContext();
float t, b, l, r;
DPSstyleoffsets(context, &l, &r, &t, &b, aStyle);
[GSCurrentServer() styleoffsets: &l : &r : &t : &b : aStyle];
aRect.size.width -= (l + r);
aRect.size.height -= (t + b);
aRect.origin.x += l;
@ -511,10 +510,9 @@ static NSNotificationCenter *nc = nil;
+ (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
{
NSGraphicsContext *context = GSCurrentContext();
float t, b, l, r;
DPSstyleoffsets(context, &l, &r, &t, &b, aStyle);
[GSCurrentServer() styleoffsets: &l : &r : &t : &b : aStyle];
aRect.size.width += (l + r);
aRect.size.height += (t + b);
aRect.origin.x -= l;
@ -525,11 +523,10 @@ static NSNotificationCenter *nc = nil;
+ (NSRect) minFrameWidthWithTitle: (NSString*)aTitle
styleMask: (unsigned int)aStyle
{
NSGraphicsContext *context = GSCurrentContext();
float t, b, l, r;
NSRect f = NSZeroRect;
DPSstyleoffsets(context, &l, &r, &t, &b, aStyle);
[GSCurrentServer() styleoffsets: &l : &r : &t : &b : aStyle];
f.size.width = l + r;
f.size.height = t + b;
/*
@ -627,16 +624,16 @@ static NSNotificationCenter *nc = nil;
* FIXME This should not be necessary - the views should have removed
* their drag types, so we should already have been removed.
*/
[context _removeDragTypes: nil fromWindow: self];
[GSServerForWindow(self) removeDragTypes: nil fromWindow: self];
if (_gstate)
{
DPSundefineuserobject(context, _gstate);
GSUndefineGState(context, _gstate);
}
if (_windowNum)
{
DPStermwindow(context, _windowNum);
[GSServerForWindow(self) termwindow: _windowNum];
NSMapRemove(windowmaps, (void*)_windowNum);
}
[super dealloc];
@ -645,33 +642,31 @@ static NSNotificationCenter *nc = nil;
- (void) _initBackendWindow: (NSRect)frame
{
id dragTypes;
NSGraphicsContext *context = GSCurrentContext();
NSGraphicsContext *context = GSCurrentContext();
GSDisplayServer *srv = GSCurrentServer();
/* If we were deferred or one shot, out drag types may not have
been registered properly in the backend. Remove them then re-add
them when we create the window */
dragTypes = [context _dragTypesForWindow: self];
dragTypes = [srv dragTypesForWindow: self];
if (dragTypes)
{
// As this is the original entry, it will change soon.
// We use a copy to reregister the same types later on.
dragTypes = [dragTypes copy];
[context _removeDragTypes: dragTypes fromWindow: self];
[srv removeDragTypes: dragTypes fromWindow: self];
}
frame = [NSWindow contentRectForFrameRect: frame styleMask: _styleMask];
DPSwindow(context, NSMinX(frame), NSMinY(frame),
NSWidth(frame), NSHeight(frame),
_backingType, &_windowNum);
DPSstylewindow(context, _styleMask, _windowNum);
DPSsetwindowlevel(context, [self level], _windowNum);
_windowNum = [srv window: frame : _backingType : _styleMask];
[srv setwindowlevel: [self level] : _windowNum];
// Set window in new _gstate
DPSgsave(context);
DPSwindowdevice(context, _windowNum);
[srv windowdevice: _windowNum];
DPSgstate(context);
_gstate = GSWDefineAsUserObj(context);
_gstate = GSDefineGState(context);
DPSgrestore(context);
NSMapInsert (windowmaps, (void*)_windowNum, self);
@ -686,14 +681,14 @@ static NSNotificationCenter *nc = nil;
if (dragTypes)
{
NSDebugLLog(@"NSWindow", @"Resetting drag types for window");
[context _addDragTypes: dragTypes toWindow: self];
[srv addDragTypes: dragTypes toWindow: self];
// Free our local copy.
RELEASE(dragTypes);
}
/* Other stuff we need to do for deferred windows */
if (_windowTitle != nil)
DPStitlewindow(GSCurrentContext(), [_windowTitle lossyCString], _windowNum);
[srv titlewindow: _windowTitle : _windowNum];
if (!NSEqualSizes(_minimumSize, NSZeroSize))
[self setMinSize: _minimumSize];
if (!NSEqualSizes(_maximumSize, NSZeroSize))
@ -890,7 +885,7 @@ static NSNotificationCenter *nc = nil;
ASSIGN(_windowTitle, aString);
[self setMiniwindowTitle: aString];
if (_windowNum > 0)
DPStitlewindow(GSCurrentContext(), [aString lossyCString], _windowNum);
[GSServerForWindow(self) titlewindow: aString : _windowNum];
if (_f.menu_exclude == NO && _f.has_opened == YES)
{
[NSApp changeWindowsItem: self
@ -911,7 +906,7 @@ static NSNotificationCenter *nc = nil;
ASSIGN(_windowTitle, aString);
[self setMiniwindowTitle: aString];
if (_windowNum > 0)
DPStitlewindow(GSCurrentContext(), [aString lossyCString], _windowNum);
[GSServerForWindow(self) titlewindow: aString : _windowNum];
if (_f.menu_exclude == NO && _f.has_opened == YES)
{
[NSApp changeWindowsItem: self
@ -1132,8 +1127,8 @@ static NSNotificationCenter *nc = nil;
[_firstResponder becomeKeyWindow];
_f.is_key = YES;
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarKey);
DPSsetinputfocus(GSCurrentContext(), _windowNum);
[GSServerForWindow(self) setinputstate: GSTitleBarKey : _windowNum];
[GSServerForWindow(self) setinputfocus: _windowNum];
[self resetCursorRects];
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
NSDebugLLog(@"NSWindow", @"%@ is now key window", [self title]);
@ -1147,7 +1142,7 @@ static NSNotificationCenter *nc = nil;
_f.is_main = YES;
if (_f.is_key == NO)
{
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarMain);
[GSServerForWindow(self) setinputstate: GSTitleBarMain : _windowNum];
}
[nc postNotificationName: NSWindowDidBecomeMainNotification object: self];
NSDebugLLog(@"NSWindow", @"%@ is now main window", [self title]);
@ -1271,7 +1266,7 @@ static NSNotificationCenter *nc = nil;
- (void) orderWindow: (NSWindowOrderingMode)place relativeTo: (int)otherWin
{
NSGraphicsContext *context = GSCurrentContext();
GSDisplayServer *srv = GSServerForWindow(self);
BOOL display = NO;
if (place == NSWindowOut)
@ -1313,7 +1308,7 @@ static NSNotificationCenter *nc = nil;
display = YES;
}
}
DPSorderwindow(context, place, otherWin, _windowNum);
[srv orderwindow: place : otherWin : _windowNum];
if (display)
[self display];
@ -1355,8 +1350,8 @@ static NSNotificationCenter *nc = nil;
}
if ([self isKeyWindow] == YES)
{
DPSsetinputstate(context, _windowNum, GSTitleBarKey);
DPSsetinputfocus(context, _windowNum);
[srv setinputstate: GSTitleBarKey : _windowNum];
[srv setinputfocus: _windowNum];
}
_f.visible = YES;
}
@ -1374,11 +1369,12 @@ static NSNotificationCenter *nc = nil;
if (_f.is_main == YES)
{
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarMain);
[GSServerForWindow(self) setinputstate: GSTitleBarMain : _windowNum];
}
else
{
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarNormal);
[GSServerForWindow(self) setinputstate: GSTitleBarNormal
: _windowNum];
}
[self discardCursorRects];
@ -1393,11 +1389,13 @@ static NSNotificationCenter *nc = nil;
_f.is_main = NO;
if (_f.is_key == YES)
{
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarKey);
[GSServerForWindow(self) setinputstate: GSTitleBarKey
: _windowNum];
}
else
{
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarNormal);
[GSServerForWindow(self) setinputstate: GSTitleBarNormal
: _windowNum];
}
[nc postNotificationName: NSWindowDidResignMainNotification object: self];
}
@ -1415,11 +1413,12 @@ static NSNotificationCenter *nc = nil;
{
if (_windowLevel != newLevel)
{
NSGraphicsContext *context = GSCurrentContext();
_windowLevel = newLevel;
if (_windowNum > 0)
DPSsetwindowlevel(context, _windowLevel, _windowNum);
{
GSDisplayServer *srv = GSServerForWindow(self);
[srv setwindowlevel: _windowLevel : _windowNum];
}
}
}
@ -1572,8 +1571,7 @@ static NSNotificationCenter *nc = nil;
* We will recieve an event to tell us when the resize is done.
*/
if(_windowNum)
DPSplacewindow(GSCurrentContext(), frameRect.origin.x, frameRect.origin.y,
frameRect.size.width, frameRect.size.height, _windowNum);
[GSServerForWindow(self) placewindow: frameRect : _windowNum];
else
{
_frame = frameRect;
@ -1612,7 +1610,7 @@ static NSNotificationCenter *nc = nil;
aSize.height = 1;
_minimumSize = aSize;
if (_windowNum > 0)
DPSsetminsize(GSCurrentContext(), aSize.width, aSize.height, _windowNum);
[GSServerForWindow(self) setminsize: aSize : _windowNum];
}
- (void) setMaxSize: (NSSize)aSize
@ -1626,7 +1624,7 @@ static NSNotificationCenter *nc = nil;
aSize.height = 10000;
_maximumSize = aSize;
if (_windowNum > 0)
DPSsetmaxsize(GSCurrentContext(), aSize.width, aSize.height, _windowNum);
[GSServerForWindow(self) setmaxsize: aSize : _windowNum];
}
- (NSSize) resizeIncrements
@ -1638,8 +1636,7 @@ static NSNotificationCenter *nc = nil;
{
_increments = aSize;
if (_windowNum > 0)
DPSsetresizeincrements(GSCurrentContext(), aSize.width, aSize.height,
_windowNum);
[GSServerForWindow(self) setresizeincrements: aSize : _windowNum];
}
- (NSSize) aspectRatio
@ -1658,11 +1655,11 @@ static NSNotificationCenter *nc = nil;
*/
- (NSPoint) convertBaseToScreen: (NSPoint)basePoint
{
NSGraphicsContext *context = GSCurrentContext();
GSDisplayServer *srv = GSCurrentServer();
NSPoint screenPoint;
float t, b, l, r;
DPSstyleoffsets(context, &l, &r, &t, &b, _styleMask);
[srv styleoffsets: &l : &r : &t : &b : _styleMask];
screenPoint.x = _frame.origin.x + basePoint.x + l;
screenPoint.y = _frame.origin.y + basePoint.y + b;
@ -1671,11 +1668,11 @@ static NSNotificationCenter *nc = nil;
- (NSPoint) convertScreenToBase: (NSPoint)screenPoint
{
NSGraphicsContext *context = GSCurrentContext();
GSDisplayServer *srv = GSCurrentServer();
NSPoint basePoint;
float t, b, l, r;
DPSstyleoffsets(context, &l, &r, &t, &b, _styleMask);
[srv styleoffsets: &l : &r : &t : &b : _styleMask];
basePoint.x = screenPoint.x - _frame.origin.x - l;
basePoint.y = screenPoint.y - _frame.origin.y - b;
@ -1737,7 +1734,7 @@ static NSNotificationCenter *nc = nil;
[self enableFlushWindow];
[self flushWindowIfNeeded];
}
[GSCurrentContext() flush];
[GSCurrentContext() flushGraphics];
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
@ -1758,7 +1755,7 @@ static NSNotificationCenter *nc = nil;
// do nothing if backing is not buffered
if (_backingType == NSBackingStoreNonretained)
{
[context flush];
[context flushGraphics];
return;
}
@ -1790,10 +1787,8 @@ static NSNotificationCenter *nc = nil;
}
if (_windowNum)
DPSflushwindowrect(context,
NSMinX(_rectNeedingFlush), NSMinY(_rectNeedingFlush),
NSWidth(_rectNeedingFlush), NSHeight(_rectNeedingFlush),
_windowNum);
[GSServerForWindow(self) flushwindowrect: _rectNeedingFlush
: _windowNum];
_f.needs_flush = NO;
_rectNeedingFlush = NSZeroRect;
}
@ -2123,7 +2118,7 @@ resetCursorRectsForView(NSView *theView)
RELEASE(v);
}
[self _lossOfKeyOrMainWindow];
DPSminiwindow(GSCurrentContext(), _windowNum);
[GSServerForWindow(self) miniwindow: _windowNum];
_f.visible = NO;
[nc postNotificationName: NSWindowDidMiniaturizeNotification
@ -2227,7 +2222,7 @@ resetCursorRectsForView(NSView *theView)
[NSApp updateWindowsItem: self];
}
if (_windowNum)
DPSdocedited(GSCurrentContext(), flag, _windowNum);
[GSServerForWindow(self) docedited: flag : _windowNum];
}
}
@ -2386,7 +2381,7 @@ resetCursorRectsForView(NSView *theView)
{
NSPoint p;
DPSmouselocation(GSCurrentContext(), &p.x, &p.y);
p = [GSCurrentServer() mouselocation];
p = [self convertScreenToBase: p];
return p;
}
@ -2625,9 +2620,8 @@ resetCursorRectsForView(NSView *theView)
NSGraphicsContext *context = GSCurrentContext();
DPSgsave(context);
DPSsetgstate(context, _gstate);
DPSupdatewindow(context, _windowNum);
DPScurrentgstate(context, _gstate);
DPSpop(context);
[GSServerForWindow(self) windowdevice: _windowNum];
GSReplaceGState(context, _gstate);
DPSgrestore(context);
}
@ -2962,7 +2956,7 @@ resetCursorRectsForView(NSView *theView)
{
v = _contentView;
}
dragInfo = [GSCurrentContext() _dragInfo];
dragInfo = [GSServerForWindow(self) dragInfo];
if (_lastDragView == v)
{
isEntry = NO;
@ -3024,7 +3018,7 @@ resetCursorRectsForView(NSView *theView)
case GSAppKitDraggingExit:
NSDebugLLog(@"NSDragging", @"GSAppKitDraggingExit");
dragInfo = [GSCurrentContext() _dragInfo];
dragInfo = [GSServerForWindow(self) dragInfo];
if (_lastDragView && _f.accepts_drag)
{
NSDebugLLog(@"NSDragging", @"Dragging exit");
@ -3037,7 +3031,7 @@ resetCursorRectsForView(NSView *theView)
case GSAppKitDraggingDrop:
NSDebugLLog(@"NSDragging", @"GSAppKitDraggingDrop");
dragInfo = [GSCurrentContext() _dragInfo];
dragInfo = [GSServerForWindow(self) dragInfo];
if (_lastDragView && _f.accepts_drag)
{
action = NO;
@ -3217,7 +3211,7 @@ resetCursorRectsForView(NSView *theView)
source: (id)sourceObject
slideBack: (BOOL)slideFlag
{
id dragView = [GSCurrentContext() _dragInfo];
id dragView = [GSServerForWindow(self) dragInfo];
[NSApp preventWindowOrdering];
[dragView dragImage: anImage
@ -3838,12 +3832,12 @@ resetCursorRectsForView(NSView *theView)
*/
- (void) _captureMouse: sender
{
DPScapturemouse(GSCurrentContext(), _windowNum);
[GSCurrentServer() capturemouse: _windowNum];
}
- (void) _releaseMouse: sender
{
DPSreleasemouse(GSCurrentContext());
[GSCurrentServer() releasemouse];
}
- (void) setContentViewSize: (NSSize)aSize

View file

@ -51,6 +51,7 @@
#include <AppKit/NSWindow.h>
#include <AppKit/NSScreen.h>
#include <AppKit/GSServicesManager.h>
#include <AppKit/GSDisplayServer.h>
#define PosixExecutePermission (0111)
@ -1002,7 +1003,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
from: (NSPoint)fromPoint
to: (NSPoint)toPoint
{
[GSCurrentContext() _slideImage: image from: fromPoint to: toPoint];
[GSCurrentServer() slideImage: image from: fromPoint to: toPoint];
}
/*