Rewrite backend for context window ops

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5049 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1999-10-21 18:08:50 +00:00
parent 36a4e1b0a2
commit 5969d44f37
9 changed files with 1010 additions and 26 deletions

View file

@ -1,3 +1,19 @@
1999-10-21 Adam Fedor <fedor@gnu.org>
* Remove backend window class and use new window ops.
* Headers/gnustep/gui/DPSOperators.h: New window ops.
* Headers/gnustep/gui/GSMethodTable.h: Likewise.
* Headers/gnustep/gui/NSGraphicsContext.h: Likewise.
* NSGraphicsContext.m: Likewise.
* Headers/gnustep/gui/NSEvent.h: Add GSAppKitWindowClose event type.
* Headers/gnustep/gui/NSWindow.h: Move some backend methods here.
* Source/NSEvent.m (-window): Use new NSWindow method.
* Source/NSWindow.m (-dealloc): Use window ops.
(-init:...): Likewise. (-flushWindow): Implement using window ops.
(-processResizeEvent): New method. (-sendEvent:) Tidy.
Thu Oct 21 1999 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSPopUpButton.m ([-selectItemAtIndex:]): Mark the button

View file

@ -729,6 +729,165 @@ static inline void
DPScurrentalpha(GSCTXT *ctxt, float *alpha)
__attribute__((unused));
/* ----------------------------------------------------------------------- */
/* Window ops extensions */
/* ----------------------------------------------------------------------- */
static inline void
DPSwindow(GSCTXT *ctxt, float x, float y, float w, float h, int type, int * num)
__attribute__((unused));
static inline void
DPStermwindow(GSCTXT *ctxt, int num)
__attribute__((unused));
static inline void
DPSstylewindow(GSCTXT *ctxt, int style, int num)
__attribute__((unused));
static inline void
DPStitlewindow(GSCTXT *ctxt, const char * window_title, int num)
__attribute__((unused));
static inline void
DPSminiwindow(GSCTXT *ctxt, int num)
__attribute__((unused));
static inline void
DPSwindowdevice(GSCTXT *ctxt, int num)
__attribute__((unused));
static inline void
DPSwindowdeviceround(GSCTXT *ctxt, int num)
__attribute__((unused));
static inline void
DPScurrentwindow(GSCTXT *ctxt, int * num)
__attribute__((unused));
static inline void
DPSorderwindow(GSCTXT *ctxt, int op, int otherWin, int winNum)
__attribute__((unused));
static inline void
DPSmovewindow(GSCTXT *ctxt, float x, float y, int num)
__attribute__((unused));
static inline void
DPSupdatewindow(GSCTXT *ctxt, int win)
__attribute__((unused));
static inline void
DPSplacewindow(GSCTXT *ctxt, float x, float y, float w, float h, int win)
__attribute__((unused));
static inline void
DPSfrontwindow(GSCTXT *ctxt, int * num)
__attribute__((unused));
static inline void
DPSfindwindow(GSCTXT *ctxt, float x, float y, int op, int otherWin, float * lx, float * ly, int * winFound, int * didFind)
__attribute__((unused));
static inline void
DPScurrentwindowbounds(GSCTXT *ctxt, int num, float * x, float * y, float * w, float * h)
__attribute__((unused));
static inline void
DPSsetexposurecolor(GSCTXT *ctxt)
__attribute__((unused));
static inline void
DPSsetsendexposed(GSCTXT *ctxt, int truth, int num)
__attribute__((unused));
static inline void
DPSsetautofill(GSCTXT *ctxt, int truth, int num)
__attribute__((unused));
static inline void
DPScurrentwindowalpha(GSCTXT *ctxt, int win, int * alpha)
__attribute__((unused));
static inline void
DPScountscreenlist(GSCTXT *ctxt, int context, int * count)
__attribute__((unused));
static inline void
DPSscreenlist(GSCTXT *ctxt, int context, int count, int * windows)
__attribute__((unused));
static inline void
DPSsetowner(GSCTXT *ctxt, int owner, int win)
__attribute__((unused));
static inline void
DPScurrentowner(GSCTXT *ctxt, int win, int * owner)
__attribute__((unused));
static inline void
DPSsetwindowtype(GSCTXT *ctxt, int type, int win)
__attribute__((unused));
static inline void
DPSsetwindowlevel(GSCTXT *ctxt, int level, int win)
__attribute__((unused));
static inline void
DPScurrentwindowlevel(GSCTXT *ctxt, int win, int * level)
__attribute__((unused));
static inline void
DPScountwindowlist(GSCTXT *ctxt, int context, int * count)
__attribute__((unused));
static inline void
DPSwindowlist(GSCTXT *ctxt, int context, int count, int * windows)
__attribute__((unused));
static inline void
DPSsetwindowdepthlimit(GSCTXT *ctxt, int limit, int win)
__attribute__((unused));
static inline void
DPScurrentwindowdepthlimit(GSCTXT *ctxt, int win, int * limit)
__attribute__((unused));
static inline void
DPScurrentwindowdepth(GSCTXT *ctxt, int win, int * depth)
__attribute__((unused));
static inline void
DPSsetdefaultdepthlimit(GSCTXT *ctxt, int limit)
__attribute__((unused));
static inline void
DPScurrentdefaultdepthlimit(GSCTXT *ctxt, int * limit)
__attribute__((unused));
static inline void
DPSsetmaxsize(GSCTXT *ctxt, float width, float height, int win)
__attribute__((unused));
static inline void
DPSsetminsize(GSCTXT *ctxt, float width, float height, int win)
__attribute__((unused));
static inline void
DPSsetresizeincrements(GSCTXT *ctxt, float width, float height, int win)
__attribute__((unused));
static inline void
DPSflushwindowrect(GSCTXT *ctxt, float x, float y, float w, float h, int win)
__attribute__((unused));
static inline void
DPScapturemouse(GSCTXT *ctxt, int win)
__attribute__((unused));
static inline void
DPSreleasemouse(GSCTXT *ctxt)
__attribute__((unused));
/* ----------------------------------------------------------------------- */
/* Color operations */
/* ----------------------------------------------------------------------- */
@ -1931,6 +2090,282 @@ DPScurrentalpha(GSCTXT *ctxt, float *a)
(ctxt, @selector(DPScurrentalpha:), a);
}
/* ----------------------------------------------------------------------- */
/* Window ops extensions */
/* ----------------------------------------------------------------------- */
static inline void
DPSwindow(GSCTXT *ctxt, float x, float y, float w, float h, int type, int * num)
{
(ctxt->methods->DPSwindow______)
(ctxt, @selector(DPSwindow::::::), x, y, w, h, type, num);
}
static inline void
DPStermwindow(GSCTXT *ctxt, int num)
{
(ctxt->methods->DPStermwindow_)
(ctxt, @selector(DPStermwindow:), num);
}
static inline void
DPSstylewindow(GSCTXT *ctxt, int style, int num)
{
(ctxt->methods->DPSstylewindow__)
(ctxt, @selector(DPSstylewindow::), style, num);
}
static inline void
DPStitlewindow(GSCTXT *ctxt, const char * window_title, int num)
{
(ctxt->methods->DPStitlewindow__)
(ctxt, @selector(DPStitlewindow::), window_title, num);
}
static inline void
DPSminiwindow(GSCTXT *ctxt, int num)
{
(ctxt->methods->DPSminiwindow_)
(ctxt, @selector(DPSminiwindow:), num);
}
static inline void
DPSwindowdevice(GSCTXT *ctxt, int num)
{
(ctxt->methods->DPSwindowdevice_)
(ctxt, @selector(DPSwindowdevice:), num);
}
static inline void
DPSwindowdeviceround(GSCTXT *ctxt, int num)
{
(ctxt->methods->DPSwindowdeviceround_)
(ctxt, @selector(DPSwindowdeviceround:), num);
}
static inline void
DPScurrentwindow(GSCTXT *ctxt, int * num)
{
(ctxt->methods->DPScurrentwindow_)
(ctxt, @selector(DPScurrentwindow:), num);
}
static inline void
DPSorderwindow(GSCTXT *ctxt, int op, int otherWin, int winNum)
{
(ctxt->methods->DPSorderwindow___)
(ctxt, @selector(DPSorderwindow:::), op, otherWin, winNum);
}
static inline void
DPSmovewindow(GSCTXT *ctxt, float x, float y, int num)
{
(ctxt->methods->DPSmovewindow___)
(ctxt, @selector(DPSmovewindow:::), x, y, num);
}
static inline void
DPSupdatewindow(GSCTXT *ctxt, int win)
{
(ctxt->methods->DPSupdatewindow_)
(ctxt, @selector(DPSupdatewindow:), win);
}
static inline void
DPSplacewindow(GSCTXT *ctxt, float x, float y, float w, float h, int win)
{
(ctxt->methods->DPSplacewindow_____)
(ctxt, @selector(DPSplacewindow:::::), x, y, w, h, win);
}
static inline void
DPSfrontwindow(GSCTXT *ctxt, int * num)
{
(ctxt->methods->DPSfrontwindow_)
(ctxt, @selector(DPSfrontwindow:), num);
}
static inline void
DPSfindwindow(GSCTXT *ctxt, float x, float y, int op, int otherWin, float * lx, float * ly, int * winFound, int * didFind)
{
(ctxt->methods->DPSfindwindow________)
(ctxt, @selector(DPSfindwindow::::::::), x, y, op, otherWin, lx, ly, winFound, didFind);
}
static inline void
DPScurrentwindowbounds(GSCTXT *ctxt, int num, float * x, float * y, float * w, float * h)
{
(ctxt->methods->DPScurrentwindowbounds_____)
(ctxt, @selector(DPScurrentwindowbounds:::::), num, x, y, w, h);
}
static inline void
DPSsetexposurecolor(GSCTXT *ctxt)
{
(ctxt->methods->DPSsetexposurecolor)
(ctxt, @selector(DPSsetexposurecolor));
}
static inline void
DPSsetsendexposed(GSCTXT *ctxt, int truth, int num)
{
(ctxt->methods->DPSsetsendexposed__)
(ctxt, @selector(DPSsetsendexposed::), truth, num);
}
static inline void
DPSsetautofill(GSCTXT *ctxt, int truth, int num)
{
(ctxt->methods->DPSsetautofill__)
(ctxt, @selector(DPSsetautofill::), truth, num);
}
static inline void
DPScurrentwindowalpha(GSCTXT *ctxt, int win, int * alpha)
{
(ctxt->methods->DPScurrentwindowalpha__)
(ctxt, @selector(DPScurrentwindowalpha::), win, alpha);
}
static inline void
DPScountscreenlist(GSCTXT *ctxt, int context, int * count)
{
(ctxt->methods->DPScountscreenlist__)
(ctxt, @selector(DPScountscreenlist::), context, count);
}
static inline void
DPSscreenlist(GSCTXT *ctxt, int context, int count, int * windows)
{
(ctxt->methods->DPSscreenlist___)
(ctxt, @selector(DPSscreenlist:::), context, count, windows);
}
static inline void
DPSsetowner(GSCTXT *ctxt, int owner, int win)
{
(ctxt->methods->DPSsetowner__)
(ctxt, @selector(DPSsetowner::), owner, win);
}
static inline void
DPScurrentowner(GSCTXT *ctxt, int win, int * owner)
{
(ctxt->methods->DPScurrentowner__)
(ctxt, @selector(DPScurrentowner::), win, owner);
}
static inline void
DPSsetwindowtype(GSCTXT *ctxt, int type, int win)
{
(ctxt->methods->DPSsetwindowtype__)
(ctxt, @selector(DPSsetwindowtype::), type, win);
}
static inline void
DPSsetwindowlevel(GSCTXT *ctxt, int level, int win)
{
(ctxt->methods->DPSsetwindowlevel__)
(ctxt, @selector(DPSsetwindowlevel::), level, win);
}
static inline void
DPScurrentwindowlevel(GSCTXT *ctxt, int win, int * level)
{
(ctxt->methods->DPScurrentwindowlevel__)
(ctxt, @selector(DPScurrentwindowlevel::), win, level);
}
static inline void
DPScountwindowlist(GSCTXT *ctxt, int context, int * count)
{
(ctxt->methods->DPScountwindowlist__)
(ctxt, @selector(DPScountwindowlist::), context, count);
}
static inline void
DPSwindowlist(GSCTXT *ctxt, int context, int count, int * windows)
{
(ctxt->methods->DPSwindowlist___)
(ctxt, @selector(DPSwindowlist:::), context, count, windows);
}
static inline void
DPSsetwindowdepthlimit(GSCTXT *ctxt, int limit, int win)
{
(ctxt->methods->DPSsetwindowdepthlimit__)
(ctxt, @selector(DPSsetwindowdepthlimit::), limit, win);
}
static inline void
DPScurrentwindowdepthlimit(GSCTXT *ctxt, int win, int * limit)
{
(ctxt->methods->DPScurrentwindowdepthlimit__)
(ctxt, @selector(DPScurrentwindowdepthlimit::), win, limit);
}
static inline void
DPScurrentwindowdepth(GSCTXT *ctxt, int win, int * depth)
{
(ctxt->methods->DPScurrentwindowdepth__)
(ctxt, @selector(DPScurrentwindowdepth::), win, depth);
}
static inline void
DPSsetdefaultdepthlimit(GSCTXT *ctxt, int limit)
{
(ctxt->methods->DPSsetdefaultdepthlimit_)
(ctxt, @selector(DPSsetdefaultdepthlimit:), limit);
}
static inline void
DPScurrentdefaultdepthlimit(GSCTXT *ctxt, int * limit)
{
(ctxt->methods->DPScurrentdefaultdepthlimit_)
(ctxt, @selector(DPScurrentdefaultdepthlimit:), limit);
}
static inline void
DPSsetmaxsize(GSCTXT *ctxt, float width, float height, int win)
{
(ctxt->methods->DPSsetmaxsize___)
(ctxt, @selector(DPSsetmaxsize:::), width, height, win);
}
static inline void
DPSsetminsize(GSCTXT *ctxt, float width, float height, int win)
{
(ctxt->methods->DPSsetminsize___)
(ctxt, @selector(DPSsetminsize:::), width, height, win);
}
static inline void
DPSsetresizeincrements(GSCTXT *ctxt, float width, float height, int win)
{
(ctxt->methods->DPSsetresizeincrements___)
(ctxt, @selector(DPSsetresizeincrements:::), width, height, win);
}
static inline void
DPSflushwindowrect(GSCTXT *ctxt, float x, float y, float w, float h, int win)
{
(ctxt->methods->DPSflushwindowrect_____)
(ctxt, @selector(DPSflushwindowrect:::::), x, y, w, h, win);
}
static inline void
DPScapturemouse(GSCTXT *ctxt, int win)
{
(ctxt->methods->DPScapturemouse_)
(ctxt, @selector(DPScapturemouse:), win);
}
static inline void
DPSreleasemouse(GSCTXT *ctxt)
{
(ctxt->methods->DPSreleasemouse)
(ctxt, @selector(DPSreleasemouse));
}
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */

View file

@ -402,6 +402,87 @@ typedef struct {
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);
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */

View file

@ -314,6 +314,7 @@ unsigned int NSEventMaskFromType(NSEventType type);
typedef enum {
GSAppKitWindowMoved = 1,
GSAppKitWindowResized,
GSAppKitWindowClose,
GSAppKitDraggingEnter,
GSAppKitDraggingUpdate,
GSAppKitDraggingStatus,

View file

@ -366,6 +366,49 @@ NSGraphicsContext *GSCurrentContext();
- (void) DPSsetalpha: (float)a;
- (void) DPScurrentalpha: (float *)a;
/*-------------------------------------------------------------------------*/
/* 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;
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */

View file

@ -466,11 +466,9 @@ extern NSSize NSTokenSize;
/*
* GNUstep backend methods
*/
@interface NSWindow (GNUstepBackend)
@interface NSWindow (GNUstepPrivate)
+ (NSWindow*) _windowWithTag: (int)windowNumber;
- (void) setWindowNumber: (int)windowNum;
+ (NSWindow*) _windowWithNumber: (int)windowNumber;
/*
* Mouse capture/release
@ -488,6 +486,8 @@ extern NSSize NSTokenSize;
- (void) performDeminiaturize: sender;
- (void) performHide: sender;
- (void) performUnhide: sender;
- (void) setContentViewSize: (NSSize)aSize;
- (void) _setVisible: (BOOL)flag;
@end
#endif

View file

@ -355,7 +355,7 @@ static Class eventClass;
- (NSWindow *) window
{
return [NSWindow _windowWithTag: window_num];
return [NSWindow _windowWithNumber: window_num];
}
- (int) windowNumber

View file

@ -363,7 +363,6 @@ NSGraphicsContext *GSCurrentContext()
#define GET_IMP(X) ((void*) [self instanceMethodForSelector: (X)])
methodTable.DPScurrentcmykcolor____ =
/* ----------------------------------------------------------------------- */
/* Color operations */
/* ----------------------------------------------------------------------- */
@ -731,6 +730,87 @@ NSGraphicsContext *GSCurrentContext()
GET_IMP(@selector(DPSsetalpha:));
methodTable.DPScurrentalpha_ =
GET_IMP(@selector(DPScurrentalpha:));
/*-------------------------------------------------------------------------*/
/* Window Extension Ops */
/*-------------------------------------------------------------------------*/
methodTable.DPSwindow______ =
GET_IMP(@selector(DPSwindow::::::));
methodTable.DPStermwindow_ =
GET_IMP(@selector(DPStermwindow:));
methodTable.DPSstylewindow__ =
GET_IMP(@selector(DPSstylewindow::));
methodTable.DPStitlewindow__ =
GET_IMP(@selector(DPStitlewindow::));
methodTable.DPSminiwindow_ =
GET_IMP(@selector(DPSminiwindow:));
methodTable.DPSwindowdevice_ =
GET_IMP(@selector(DPSwindowdevice:));
methodTable.DPSwindowdeviceround_ =
GET_IMP(@selector(DPSwindowdeviceround:));
methodTable.DPScurrentwindow_ =
GET_IMP(@selector(DPScurrentwindow:));
methodTable.DPSorderwindow___ =
GET_IMP(@selector(DPSorderwindow:::));
methodTable.DPSmovewindow___ =
GET_IMP(@selector(DPSmovewindow:::));
methodTable.DPSupdatewindow_ =
GET_IMP(@selector(DPSupdatewindow:));
methodTable.DPSplacewindow_____ =
GET_IMP(@selector(DPSplacewindow:::::));
methodTable.DPSfrontwindow_ =
GET_IMP(@selector(DPSfrontwindow:));
methodTable.DPSfindwindow________ =
GET_IMP(@selector(DPSfindwindow::::::::));
methodTable.DPScurrentwindowbounds_____ =
GET_IMP(@selector(DPScurrentwindowbounds:::::));
methodTable.DPSsetexposurecolor =
GET_IMP(@selector(DPSsetexposurecolor));
methodTable.DPSsetsendexposed__ =
GET_IMP(@selector(DPSsetsendexposed::));
methodTable.DPSsetautofill__ =
GET_IMP(@selector(DPSsetautofill::));
methodTable.DPScurrentwindowalpha__ =
GET_IMP(@selector(DPScurrentwindowalpha::));
methodTable.DPScountscreenlist__ =
GET_IMP(@selector(DPScountscreenlist::));
methodTable.DPSscreenlist___ =
GET_IMP(@selector(DPSscreenlist:::));
methodTable.DPSsetowner__ =
GET_IMP(@selector(DPSsetowner::));
methodTable.DPScurrentowner__ =
GET_IMP(@selector(DPScurrentowner::));
methodTable.DPSsetwindowtype__ =
GET_IMP(@selector(DPSsetwindowtype::));
methodTable.DPSsetwindowlevel__ =
GET_IMP(@selector(DPSsetwindowlevel::));
methodTable.DPScurrentwindowlevel__ =
GET_IMP(@selector(DPScurrentwindowlevel::));
methodTable.DPScountwindowlist__ =
GET_IMP(@selector(DPScountwindowlist::));
methodTable.DPSwindowlist___ =
GET_IMP(@selector(DPSwindowlist:::));
methodTable.DPSsetwindowdepthlimit__ =
GET_IMP(@selector(DPSsetwindowdepthlimit::));
methodTable.DPScurrentwindowdepthlimit__ =
GET_IMP(@selector(DPScurrentwindowdepthlimit::));
methodTable.DPScurrentwindowdepth__ =
GET_IMP(@selector(DPScurrentwindowdepth::));
methodTable.DPSsetdefaultdepthlimit_ =
GET_IMP(@selector(DPSsetdefaultdepthlimit:));
methodTable.DPScurrentdefaultdepthlimit_ =
GET_IMP(@selector(DPScurrentdefaultdepthlimit:));
methodTable.DPSsetmaxsize___ =
GET_IMP(@selector(DPSsetmaxsize:::));
methodTable.DPSsetminsize___ =
GET_IMP(@selector(DPSsetminsize:::));
methodTable.DPSsetresizeincrements___ =
GET_IMP(@selector(DPSsetresizeincrements:::));
methodTable.DPSflushwindowrect_____ =
GET_IMP(@selector(DPSflushwindowrect:::::));
methodTable.DPScapturemouse_ =
GET_IMP(@selector(DPScapturemouse:));
methodTable.DPSreleasemouse =
GET_IMP(@selector(DPSreleasemouse));
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */
@ -1648,6 +1728,204 @@ NSGraphicsContext *GSCurrentContext()
[self subclassResponsibility: _cmd];
}
/*-------------------------------------------------------------------------*/
/* Window Extension Ops */
/*-------------------------------------------------------------------------*/
- (void) DPSwindow: (float) x : (float) y : (float) w : (float) h : (int) type : (int *) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPStermwindow: (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSstylewindow: (int) style : (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPStitlewindow: (const char *) window_title : (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSminiwindow: (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSwindowdevice: (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSwindowdeviceround: (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindow: (int *) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSorderwindow: (int) op : (int) otherWin : (int) winNum ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSmovewindow: (float) x : (float) y : (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSupdatewindow: (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSplacewindow: (float) x : (float) y : (float) w : (float) h : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSfrontwindow: (int *) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSfindwindow: (float) x : (float) y : (int) op : (int) otherWin : (float *) lx : (float *) ly : (int *) winFound : (int *) didFind ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindowbounds: (int) num : (float *) x : (float *) y : (float *) w : (float *) h ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetexposurecolor;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetsendexposed: (int) truth : (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetautofill: (int) truth : (int) num ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindowalpha: (int) win : (int *) alpha ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScountscreenlist: (int) context : (int *) count ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSscreenlist: (int) context : (int) count : (int *) windows ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetowner: (int) owner : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentowner: (int) win : (int *) owner ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetwindowtype: (int) type : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetwindowlevel: (int) level : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindowlevel: (int) win : (int *) level ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScountwindowlist: (int) context : (int *) count ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSwindowlist: (int) context : (int) count : (int *) windows ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetwindowdepthlimit: (int) limit : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindowdepthlimit: (int) win : (int *) limit ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentwindowdepth: (int) win : (int *) depth ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetdefaultdepthlimit: (int) limit ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScurrentdefaultdepthlimit: (int *) limit ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetmaxsize: (float) width : (float) height : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetminsize: (float) width : (float) height : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSsetresizeincrements: (float) width : (float) height : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSflushwindowrect: (float) x : (float) y : (float) w : (float) h : (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPScapturemouse: (int) win ;
{
[self subclassResponsibility: _cmd];
}
- (void) DPSreleasemouse;
{
[self subclassResponsibility: _cmd];
}
/* ----------------------------------------------------------------------- */
/* GNUstep Event and other I/O extensions */
/* ----------------------------------------------------------------------- */

View file

@ -59,6 +59,8 @@
#include <AppKit/NSDragging.h>
#include <AppKit/NSPasteboard.h>
#include <AppKit/NSHelpManager.h>
#include <AppKit/NSGraphicsContext.h>
#include <AppKit/GSWraps.h>
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
@ -127,6 +129,7 @@ static Class responderClass;
static Class viewClass;
static NSMutableSet *autosaveNames;
static NSRecursiveLock *windowsLock;
static NSMapTable* windowmaps = NULL;
/*
* Class methods
@ -203,6 +206,7 @@ static NSRecursiveLock *windowsLock;
- (void) dealloc
{
NSGraphicsContext *context = GSCurrentContext();
if (content_view)
{
RELEASE([content_view superview]); /* Release the window view */
@ -222,8 +226,17 @@ static NSRecursiveLock *windowsLock;
* FIXME This should not be necessary - the views should have removed
* their drag types, so we should already have been removed.
*/
[GSCurrentContext() _removeDragTypes: nil fromWindow: [self windowNumber]];
[context _removeDragTypes: nil fromWindow: [self windowNumber]];
/* Often, when an app is terminated, an NSWindow is autoreleased after the
context, so we forget about this if there is no more context */
if (context)
{
if (gstate)
DPSundefineuserobject(context, gstate);
DPStermwindow(context, window_num);
}
NSMapRemove(windowmaps, (void*)window_num);
[super dealloc];
}
@ -250,6 +263,7 @@ static NSRecursiveLock *windowsLock;
defer: (BOOL)flag
screen: (NSScreen*)aScreen
{
NSGraphicsContext *context = GSCurrentContext();
NSRect r = [[NSScreen mainScreen] frame];
NSRect cframe;
@ -258,6 +272,9 @@ static NSRecursiveLock *windowsLock;
NSLog(@"No application!\n");
NSDebugLog(@"NSWindow start of init\n");
if (!windowmaps)
windowmaps = NSCreateMapTable(NSIntMapKeyCallBacks,
NSNonRetainedObjectMapValueCallBacks, 20);
/* Initialize attributes and flags */
[self cleanInit];
@ -280,11 +297,25 @@ static NSRecursiveLock *windowsLock;
[self setContentView: AUTORELEASE([[NSView alloc] initWithFrame: cframe])];
/* rectBeingDrawn is variable used to optimize flushing the backing store.
It is set by NSGraphicContext during a lockFocus to tell NSWindow what
It is set by NSGraphicsContext during a lockFocus to tell NSWindow what
part a view is drawing in, so NSWindow only has to flush that portion */
rectsBeingDrawn = RETAIN([NSMutableArray arrayWithCapacity: 10]);
NSDebugLog(@"NSWindow end of init\n");
DPSwindow(context, NSMinX(contentRect), NSMinY(contentRect),
NSWidth(contentRect), NSHeight(contentRect),
bufferingType, &window_num);
DPSstylewindow(context, aStyle, window_num);
DPSsetwindowlevel(context, [self level], window_num);
// Set window in new gstate
DPSgsave(context);
DPSwindowdevice(context, window_num);
DPSgstate(context);
gstate = GSWDefineAsUserObj(context);
DPSgrestore(context);
NSMapInsert (windowmaps, (void*)window_num, self);
NSDebugLog(@"NSWindow end of init\n");
return self;
}
@ -364,6 +395,7 @@ static NSRecursiveLock *windowsLock;
- (void) setTitle: (NSString*)aString
{
ASSIGN(window_title, aString);
DPStitlewindow(GSCurrentContext(), [window_title cString], window_num);
[self setMiniwindowTitle: aString];
}
@ -753,6 +785,7 @@ static NSRecursiveLock *windowsLock;
if (aSize.height < 1)
aSize.height = 1;
minimum_size = aSize;
DPSsetminsize(GSCurrentContext(), aSize.width, aSize.height, window_num);
}
- (void) setMaxSize: (NSSize)aSize
@ -765,6 +798,7 @@ static NSRecursiveLock *windowsLock;
if (aSize.height > 10000)
aSize.height = 10000;
maximum_size = aSize;
DPSsetmaxsize(GSCurrentContext(), aSize.width, aSize.height, window_num);
}
- (NSSize) resizeIncrements
@ -775,6 +809,8 @@ static NSRecursiveLock *windowsLock;
- (void) setResizeIncrements: (NSSize)aSize
{
increments = aSize;
DPSsetresizeincrements(GSCurrentContext(), aSize.width, aSize.height,
window_num);
}
/*
@ -848,6 +884,7 @@ static NSRecursiveLock *windowsLock;
[self enableFlushWindow];
[self flushWindowIfNeeded];
}
[GSCurrentContext() flush];
[nc postNotificationName: NSWindowDidUpdateNotification object: self];
}
@ -862,7 +899,49 @@ static NSRecursiveLock *windowsLock;
- (void) flushWindow
{
// implemented in back end
int i;
NSGraphicsContext* context = GSCurrentContext();
// do nothing if backing is not buffered
if (backing_type == NSBackingStoreNonretained)
{
[context flush];
return;
}
if (disable_flush_window) // if flushWindow is called
{ // while flush is disabled
needs_flush = YES; // mark self as needing a
return; // flush, then return
}
/* Check for special case of flushing while we are lock focused.
For instance, when we are highlighting a button. */
if (NSIsEmptyRect(rectNeedingFlush))
{
if ([rectsBeingDrawn count] == 0)
{
needs_flush = NO;
return;
}
}
/*
* Accumulate the rectangles from all nested focus locks.
*/
i = [rectsBeingDrawn count];
while (i-- > 0)
{
rectNeedingFlush = NSUnionRect(rectNeedingFlush,
[[rectsBeingDrawn objectAtIndex: i] rectValue]);
}
DPSflushwindowrect(context,
NSMinX(rectNeedingFlush), NSMinY(rectNeedingFlush),
NSWidth(rectNeedingFlush), NSHeight(rectNeedingFlush),
window_num);
needs_flush = NO;
rectNeedingFlush = NSZeroRect;
}
- (void) enableFlushWindow
@ -1147,6 +1226,7 @@ static NSRecursiveLock *windowsLock;
- (void) performMiniaturize: (id)sender
{
DPSminiwindow(GSCurrentContext(), window_num);
is_miniaturized = YES;
}
@ -1512,6 +1592,23 @@ static NSRecursiveLock *windowsLock;
}
}
- (void) _processResizeEvent
{
NSGraphicsContext* context = GSCurrentContext();
if (gstate)
{
DPSgsave(context);
DPSsetgstate(context, gstate);
}
DPSupdatewindow(context, window_num);
if (gstate)
DPSgrestore(context);
[self update];
}
- (void) sendEvent: (NSEvent *)theEvent
{
NSView *v;
@ -1697,9 +1794,13 @@ static NSRecursiveLock *windowsLock;
[wv setFrame: rect];
[wv setNeedsDisplay: YES];
}
[self _processResizeEvent];
[nc postNotificationName: NSWindowDidResizeNotification
object: self];
break;
case GSAppKitWindowClose:
[self performClose: NSApp];
break;
#define GSPerformDragSelector(view, sel, info, action) \
if (view == content_view && delegate) \
@ -1720,15 +1821,21 @@ static NSRecursiveLock *windowsLock;
v = content_view;
dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && _lastDragView != v && accepts_drag)
GSPerformVoidDragSelector(_lastDragView,
{
GSPerformVoidDragSelector(_lastDragView,
@selector(draggingExited:), dragInfo);
}
accepts_drag = GSViewAcceptsDrag(v, dragInfo);
if (_lastDragView != v && accepts_drag)
GSPerformDragSelector(v, @selector(draggingEntered:),
{
GSPerformDragSelector(v, @selector(draggingEntered:),
dragInfo, action);
}
else
GSPerformDragSelector(v, @selector(draggingUpdated:),
{
GSPerformDragSelector(v, @selector(draggingUpdated:),
dragInfo, action);
}
e = [NSEvent otherEventWithType: NSAppKitDefined
location: [theEvent locationInWindow]
modifierFlags: 0
@ -1749,9 +1856,11 @@ static NSRecursiveLock *windowsLock;
case GSAppKitDraggingExit:
dragInfo = [GSCurrentContext() _dragInfo];
if (_lastDragView && accepts_drag)
GSPerformDragSelector(_lastDragView,
{
GSPerformDragSelector(_lastDragView,
@selector(draggingExited:), dragInfo,
action);
}
break;
case GSAppKitDraggingDrop:
@ -1762,13 +1871,17 @@ static NSRecursiveLock *windowsLock;
@selector(prepareForDragOperation:),
dragInfo, action);
if (action)
GSPerformDragSelector(_lastDragView,
{
GSPerformDragSelector(_lastDragView,
@selector(performDragOperation:),
dragInfo, action);
}
if (action)
GSPerformVoidDragSelector(_lastDragView,
{
GSPerformVoidDragSelector(_lastDragView,
@selector(concludeDragOperation:),
dragInfo);
}
}
e = [NSEvent otherEventWithType: NSAppKitDefined
location: [theEvent locationInWindow]
@ -2305,23 +2418,40 @@ static NSRecursiveLock *windowsLock;
/*
* GNUstep backend methods
*/
@implementation NSWindow (GNUstepBackend)
@implementation NSWindow (GNUstepPrivate)
+ (NSWindow*) _windowWithTag: (int)windowNumber
+ (NSWindow*) _windowWithNumber: (int)windowNumber
{
return nil;
}
- (void) setWindowNumber: (int)windowNum
{
window_num = windowNum;
return NSMapGet(windowmaps, (void *)windowNumber);
}
/*
* Mouse capture/release
*/
- (void) _captureMouse: sender {} // Do nothing, should be
- (void) _releaseMouse: sender {} // implemented by back-end
- (void) _captureMouse: sender
{
DPScapturemouse(GSCurrentContext(), window_num);
}
- (void) _releaseMouse: sender
{
DPSreleasemouse(GSCurrentContext());
}
- (void) setContentViewSize: (NSSize)aSize
{
NSRect r;
r.origin = NSZeroPoint;
r.size = aSize;
if (content_view)
[content_view setFrame: r];
}
- (void) _setVisible: (BOOL)flag
{
visible = flag;
}
- (void) performDeminiaturize: sender {}
- (void) performHide: sender {}