#if 0 /* sqNeXTSTEP.c -- support for the NeXTSTEP GUI. * * Author: Pascal Bourguignon * * Last edited: Thu Jun 11 06:57:17 MET 1998 * * BUGS: this file is too long; it should be split into two. * * $Log: sqNeXTSTEP.c,v $ */ static char *rcsid= "$Id:$"; #include "sq.h" #include #include #include #include #include #include #include /*** Variables -- image and path names ***/ #define IMAGE_NAME_SIZE MAXPATHLEN char imageName[MAXPATHLEN+1]; /* full path to image */ char shortImageName[MAXPATHLEN+1]; /* just the base name */ char vmPath[MAXPATHLEN+1]; /* full path to interpreter's directory */ int initialHeapSize; /* 5 megabytes by default */ int initialArgc; char **initialArgv; #ifndef HEADLESS /*** Variables -- X11 Related ***/ /* name of Squeak windows in Xrm and the WM */ #define xClassName "Squeak" char *displayName= 0; /* name of display,or 0 for $DISPLAY */ Display *stDisplay= null; /* Squeak display */ int stXfd= 0; /* X connection file descriptor */ Window stWindow= null; /* Squeak window */ Visual *stVisual; /* the default visual */ GC stGC; /* graphics context used for rendering */ Colormap stColormap= null; /* Squeak color map */ int stDisplayBitsIndex= 0; /* last known oop of the VM's Display */ XImage *stImage= 0; /* ...and it's client-side pixmap */ char *stPrimarySelection; /* buffer holding selection */ char *stEmptySelection= ""; /* immutable "empty string" value */ int stPrimarySelectionSize;/* size of buffer holding selection */ int stOwnsSelection= 0; /* true if we own the X selection */ XColor stColorBlack; /* black pixel value in stColormap */ XColor stColorWhite; /* white pixel value in stColormap */ int savedWindowSize= 0; /* initial size of window */ int savedWindowOrigin= -1; /* initial origin of window */ XPoint mousePosition; /* position at last PointerMotion event */ Time stButtonTime; /* time of last ButtonRelease (for SetSeln) */ # ifdef USE_XSHM XShmSegmentInfo stShmInfo; /* shared memory descriptor */ int completions= 0; /* outstanding completion events */ int completionType; /* the type of XShmCompletionEvent */ int useXshm= 0; /* 1 if shared memory is in use */ int asyncUpdate= 0; /* 1 for asynchronous screen updates */ # endif int stDepth; int stBitsPerPixel= 0; unsigned int stColors[256]; unsigned int stDownGradingColors[256]; int stHasSameRGBMask16; int stHasSameRGBMask32; int stRNMask,stGNMask,stBNMask; int stRShift,stGShift,stBShift; char *stDisplayBitmap= 0; #endif int sleepWhenUnmapped= 0; int noTitle= 0; int fullScreen= 0; struct timeval startUpTime; /* maximum input polling frequency */ #define MAXPOLLSPERSEC 33 #ifndef HEADLESS /* we are interested in these events */ #define EVENTMASK ButtonPressMask | ButtonReleaseMask | \ KeyPressMask | PointerMotionMask | \ ExposureMask | StructureNotifyMask /* largest X selection that we will attempt to handle (bytes) */ #define MAX_SELECTION_SIZE 100*1024 /* longest we're prepared to wait for the selection owner to convert it (seconds) */ #define SELECTION_TIMEOUT 3 /*** Variables -- Event Recording ***/ #define KEYBUF_SIZE 64 int keyBuf[KEYBUF_SIZE]; /* circular buffer */ int keyBufGet= 0; /* index of next item of keyBuf to read */ int keyBufPut= 0; /* index of next item of keyBuf to write */ int keyBufOverflows= 0; /* number of characters dropped */ int buttonState= 0; /* mouse button and modifier state when mouse button went down or 0 if not pressed */ /* This table maps the X modifier key bits to 4 Squeak modifier bits. (The X caps lock key is mapped as shift,meta is mapped to command,and ctrl+meta is mapped to option. X bits: Squeak bits: