--- a/XWorkstation.st Sat Dec 11 02:34:56 1993 +0100
+++ b/XWorkstation.st Sat Dec 11 02:36:44 1993 +0100
@@ -13,12 +13,13 @@
DeviceWorkstation subclass:#XWorkstation
instanceVariableNames:'screen
hasShapeExtension hasFaxExtension hasShmExtension
- hasDPSExtension
+ hasDPSExtension hasSaveUnder ignoreBackingStore
blackpixel whitepixel redMask greenMask blueMask
ProtocolsAtom DeleteWindowAtom SaveYourselfAtom
QuitAppAtom
listOfXFonts eventRootX eventRootY buttonsPressed
- displayName eventTrace'
+ displayName eventTrace
+ dispatchingExpose'
classVariableNames: 'keyPressMask pointerMotionMask
buttonPressMask buttonReleaseMask buttonMotionMask
exposureMask focusChangeMask structureNotifyMask
@@ -35,7 +36,7 @@
this class provides the interface to X11
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.5 1993-10-29 23:57:05 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.6 1993-12-11 01:35:51 claus Exp $
written spring/summer 89 by claus
'!
@@ -88,13 +89,7 @@
# endif
#endif
-extern int _immediateInterrupt;
-
-#ifdef THIS_CONTEXT
-# define CONARG /* */
-#else
-# define CONARG __context,
-#endif
+static XEvent ev;
/*
* a private error handler
@@ -104,8 +99,7 @@
static unsigned lastMinorCode = 0;
static unsigned lastResource = 0;
-static
-ErrorHandler(dpy, event)
+__XErrorHandler__(dpy, event)
Display *dpy;
XErrorEvent *event;
{
@@ -117,9 +111,9 @@
lastMinorCode = event->minor_code;
lastResource = event->resourceid;
- printf("x-error (%s) cought maj=%x min=%x resource=%x\n",
- lastErrorMsg, event->request_code, event->minor_code,
- event->resourceid);
+ printf("x-error (%s) cought maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
+ lastErrorMsg, event->request_code, event->request_code,
+ event->minor_code, event->minor_code, event->resourceid);
errorInterrupt();
return 0;
}
@@ -148,6 +142,12 @@
#endif
#define myDpy _DisplayVal(_INST(displayId))
+
+#ifndef THISCONTEXT_IN_REGISTER
+# define BLOCKINTERRUPTS() /* */
+# define UNBLOCKINTERRUPTS() /* */
+#endif
+
%}
!XWorkstation class methodsFor:'initialization'!
@@ -236,6 +236,7 @@
RETURN ( self );
}
+ BLOCKINTERRUPTS();
if (aDisplayName != nil)
dpy = XOpenDisplay((char *)_stringVal(aDisplayName));
else
@@ -283,6 +284,15 @@
#else
_INST(hasDPSExtension) = false;
#endif
+ /*
+ * this is a kludge around a bug in the X11/NeWS server,
+ * which does not correctly handle saveUnder
+ */
+ if (strncmp(XServerVendor(dpy), "X11/NeWS", 8) == 0) {
+ _INST(hasSaveUnder) = false;
+ } else
+ _INST(hasSaveUnder) = true;
+
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
switch (visual->class) {
case StaticGray:
@@ -333,8 +343,9 @@
_INST(blueMask) = _MKSMALLINT(visual->blue_mask);
_INST(visualType) = _MKSYMBOL(type, (OBJ *)0, __context);
- XSetErrorHandler(ErrorHandler);
+ XSetErrorHandler(__XErrorHandler__);
}
+ UNBLOCKINTERRUPTS();
%}
.
displayId isNil ifTrue:[
@@ -346,6 +357,8 @@
^ nil
].
dispatching := false.
+ dispatchingExpose := false.
+ isSlow := false.
shiftDown := false.
controlDown := false.
metaDown := false.
@@ -353,6 +366,7 @@
motionEventCompression := true.
buttonsPressed := 0.
displayName := aDisplayName.
+
ProtocolsAtom := nil.
DeleteWindowAtom := nil.
SaveYourselfAtom := nil.
@@ -370,10 +384,17 @@
Display *dpy;
if (_INST(displayId) != nil) {
+ BLOCKINTERRUPTS();
XCloseDisplay(myDpy);
+ UNBLOCKINTERRUPTS();
_INST(displayId) = nil;
}
%}
+!
+
+reinitialize
+ super reinitialize.
+ dispatchingExpose := nil
! !
!XWorkstation methodsFor:'misc'!
@@ -383,7 +404,9 @@
%{ /* NOCONTEXT */
if (_isSmallInteger(aWindowId)) {
+ BLOCKINTERRUPTS();
XSetInputFocus(myDpy, _WindowVal(aWindowId), RevertToParent, CurrentTime);
+ UNBLOCKINTERRUPTS();
RETURN ( self );
}
%}
@@ -396,7 +419,9 @@
%{ /* NOCONTEXT */
+ BLOCKINTERRUPTS();
XSynchronize(myDpy, 1);
+ UNBLOCKINTERRUPTS();
%}
"Display unbuffered"
!
@@ -406,7 +431,9 @@
%{ /* NOCONTEXT */
+ BLOCKINTERRUPTS();
XSynchronize(myDpy, 0);
+ UNBLOCKINTERRUPTS();
%}
"Display buffered"
!
@@ -416,7 +443,9 @@
%{ /* NOCONTEXT */
+ BLOCKINTERRUPTS();
XSync(myDpy, 0);
+ UNBLOCKINTERRUPTS();
%}
!
@@ -425,7 +454,9 @@
%{ /* NOCONTEXT */
#ifdef DPS
if (_isSmallInteger(aDPSContext)) {
+ BLOCKINTERRUPTS();
DPSFlushContext(MKDPSCONTEXT(aDPSContext));
+ UNBLOCKINTERRUPTS();
RETURN ( self );
}
#endif
@@ -444,7 +475,9 @@
volume = _intVal(volumeInPercent) * 2 - 100;
if (volume < -100) volume = -100;
else if (volume > 100) volume = 100;
+ BLOCKINTERRUPTS();
XBell(myDpy, volume);
+ UNBLOCKINTERRUPTS();
}
%}
!
@@ -453,6 +486,14 @@
"output an audible beep or bell"
self beep:50
+!
+
+ignoreBackingStore:aBoolean
+ "if the argument is true, the views backingStore setting will be ignored, and
+ no backing store used - this can be used on servers where backing store is
+ very slow or is broken (can be put into display-rc-file)"
+
+ ignoreBackingStore := aBoolean
! !
!XWorkstation methodsFor:'accessing & queries'!
@@ -557,11 +598,13 @@
xp = _point_X(aPoint);
yp = _point_Y(aPoint);
if (_isSmallInteger(xp) && _isSmallInteger(yp)) {
+ BLOCKINTERRUPTS();
XTranslateCoordinates(myDpy,
RootWindow(dpy, screen),
_WindowVal(windowId),
_intVal(xp), _intVal(yp),
&xpos, &ypos, &child_return);
+ UNBLOCKINTERRUPTS();
if (child_return) {
RETURN ( MKOBJ(child_return) );
}
@@ -705,9 +748,12 @@
if (_isString(aString) || _isSymbol(aString)) {
filename = (char *)_stringVal(aString);
+
+ BLOCKINTERRUPTS();
status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
filename, &b_width, &b_height, &newBitmap,
&b_x_hot, &b_y_hot);
+ UNBLOCKINTERRUPTS();
if (status == BitmapSuccess) {
w = _MKSMALLINT(b_width);
@@ -784,27 +830,15 @@
*cp++ = reverseBitTable[*pBits++];
}
} else {
- index = 1;
- for (row = b_height; row; row--) {
- for (col = bytesPerRow; col; col--) {
-#ifdef PASS_ARG_REF
- idx = _MKSMALLINT(index);
- num = _AT_(anArray, CONARG &idx);
-#else
- num = _AT_(anArray, CONARG _MKSMALLINT(index));
-#endif
- if (! _isSmallInteger(num)) goto fail;
- bits = _intVal(num);
- index++;
- *cp++ = reverseBitTable[bits];
- }
- }
+ goto fail;
}
}
+ BLOCKINTERRUPTS();
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
(char *)b_bits,
b_width, b_height);
+ UNBLOCKINTERRUPTS();
free(b_bits);
RETURN ( newBitmap ? MKOBJ(newBitmap) : nil );
@@ -853,7 +887,7 @@
root = RootWindow(myDpy, screen);
#else
/*
- * on IRS, this creates a badwindow error - why ?
+ * on IRIS, this creates a badwindow error - why ?
* children contains a funny window (000034)
*/
/*
@@ -1140,11 +1174,13 @@
}
visual.visualid = CopyFromParent;
+ BLOCKINTERRUPTS();
newWindow = XCreateWindow(dpy, parentWindow,
sizehints.x, sizehints.y,
sizehints.width, sizehints.height,
bw, depth, ioClass, &visual,
flags, &xswa);
+ UNBLOCKINTERRUPTS();
if (! newWindow) {
RETURN ( nil );
@@ -1342,9 +1378,7 @@
; evaluate aBlock with these"
|origin family face style moreStyle skip height size
- resX resY x1 x2 coding
- start
- end |
+ resX resY x1 x2 coding start end |
aString isNil ifTrue:[^ false].
(aString startsWith:'-') ifFalse:[^ false].
@@ -1429,7 +1463,9 @@
!
listOfAvailableFonts
- "return a list with all available font names on this display"
+ "return a list with all available font names on this display.
+ Since this takes a long time, keep the result of the query for the
+ next time."
|stream aName arr|
@@ -2247,8 +2283,10 @@
XSetWindowAttributes wa;
if (_isSmallInteger(aWindowId)) {
- wa.save_under = (yesOrNo == true) ? 1 : 0;
- XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa);
+ if (_INST(hasSaveUnder) == true) {
+ wa.save_under = (yesOrNo == true) ? 1 : 0;
+ XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa);
+ }
RETURN ( self );
}
%}
@@ -2299,6 +2337,7 @@
!
setWindowBorderPixmap:aPixmapId in:aWindowId
+ "set the windows border pattern"
%{ /* NOCONTEXT */
@@ -2312,6 +2351,7 @@
!
setWindowBorderWidth:aNumber in:aWindowId
+ "set the windows border width"
%{ /* NOCONTEXT */
@@ -2325,6 +2365,8 @@
!
setWindowBorderShape:aPixmapId in:aWindowId
+ "set the windows border shape"
+
hasShapeExtension ifFalse:[^ self].
%{ /* NOCONTEXT */
@@ -2342,6 +2384,8 @@
!
setWindowShape:aPixmapId in:aWindowId
+ "set the windows shape"
+
hasShapeExtension ifFalse:[^ self].
%{ /* NOCONTEXT */
@@ -2360,6 +2404,7 @@
!
setCursor:aCursorId in:aWindowId
+ "define a windows cursor"
%{ /* NOCONTEXT */
@@ -2375,6 +2420,7 @@
!
setWindowName:aString in:aWindowId
+ "define a windows name"
%{ /* NOCONTEXT */
@@ -2389,6 +2435,7 @@
!
setIconName:aString in:aWindowId
+ "define a windows iconname"
%{ /* NOCONTEXT */
@@ -2403,6 +2450,8 @@
!
setWindowIcon:aForm in:aWindowId
+ "define a bitmap to be used as icon"
+
|iconId|
aForm notNil ifTrue:[
@@ -2423,6 +2472,8 @@
!
setWindowIconWindow:aView in:aWindowId
+ "define a window to be used as icon"
+
|iconWindowId|
aView notNil ifTrue:[
@@ -2443,6 +2494,7 @@
!
clearWindow:aWindowId
+ "clear a window to viewbackground"
%{ /* NOCONTEXT */
@@ -2456,6 +2508,7 @@
!
clearRectangleX:x y:y width:width height:height in:aWindowId
+ "clear a rectangular area to viewbackground"
%{ /* NOCONTEXT */
@@ -2477,6 +2530,8 @@
!
mapWindow:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h
+ "make a window visible - either as icon or as a real view
+ - needed for restart"
%{ /* NOCONTEXT */
@@ -2515,6 +2570,7 @@
!
mapWindow:aWindowId
+ "make a window visible"
%{ /* NOCONTEXT */
@@ -2528,6 +2584,7 @@
!
unmapWindow:aWindowId
+ "make a window invisible"
%{ /* NOCONTEXT */
@@ -2541,6 +2598,7 @@
!
raiseWindow:aWindowId
+ "bring a window to front"
%{ /* NOCONTEXT */
@@ -2554,6 +2612,7 @@
!
lowerWindow:aWindowId
+ "bring a window to back"
%{ /* NOCONTEXT */
@@ -2567,6 +2626,7 @@
!
moveWindow:aWindowId x:x y:y
+ "move a window"
%{ /* NOCONTEXT */
@@ -2581,6 +2641,7 @@
!
resizeWindow:aWindowId width:w height:h
+ "resize a window"
%{ /* NOCONTEXT */
@@ -2601,6 +2662,7 @@
!
moveResizeWindow:aWindowId x:x y:y width:w height:h
+ "move and resize a window"
%{ /* NOCONTEXT */
@@ -2999,7 +3061,7 @@
if ((xpos < 0) || (ypos < 0)) {
RETURN ( _MKSMALLINT(0) );
}
- img = XGetImage(myDpy, win, xpos, ypos, 1, 1, ~0, ZPixmap);
+ img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
retVal = _MKSMALLINT(XGetPixel(img, 0, 0));
XDestroyImage(img);
RETURN ( retVal );
@@ -3037,10 +3099,12 @@
&& (_Class(imageBits) == ByteArray)) {
image = XGetImage(dpy, win, _intVal(srcx), _intVal(srcy),
_intVal(w), _intVal(h),
- AllPlanes, ZPixmap);
+ (unsigned)AllPlanes, ZPixmap);
pad = image->bitmap_pad;
-printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
+#ifdef SUPERDEBUG
+ printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
+#endif
switch (image->depth) {
case 1:
case 2:
@@ -3056,8 +3120,10 @@
goto fail;
}
-printf("bytes need:%d bytes given:%d\n", bytes,
+#ifdef SUPERDEBUG
+ printf("bytes need:%d bytes given:%d\n", bytes,
(_qSize(imageBits) - OHDR_SIZE));
+#endif
if (bytes > (_qSize(imageBits) - OHDR_SIZE)) {
/* imageBits too small */
@@ -3521,9 +3587,12 @@
&& _isSmallInteger(width) && _isSmallInteger(height)) {
w = _intVal(width);
h = _intVal(height);
- if (w < 0) w = 0;
- if (h < 0) h = 0;
- XDrawRectangle(myDpy, win, gc, _intVal(x), _intVal(y), w, h);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0)) {
+ XDrawRectangle(myDpy, win, gc, _intVal(x), _intVal(y), w, h);
+ }
RETURN ( self );
}
%}
@@ -3545,9 +3614,12 @@
&& _isSmallInteger(width) && _isSmallInteger(height)) {
w = _intVal(width);
h = _intVal(height);
- if (w < 0) w = 0;
- if (h < 0) h = 0;
- XDrawRectangle(myDpy, win, gc, _intVal(x), _intVal(y), w, h);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0)) {
+ XDrawRectangle(myDpy, win, gc, _intVal(x), _intVal(y), w, h);
+ }
RETURN ( self );
}
%}
@@ -3556,7 +3628,7 @@
!
drawPolygon:aPolygon in:aDrawableId with:aGCId
- "draw a polygon"
+ "draw a polygon"
|numberOfPoints index|
@@ -3569,24 +3641,19 @@
OBJ point, x, y;
int i, num;
XPoint *points;
- XPoint qPoints[128];
+ XPoint qPoints[64];
static struct inlineCache ix = _ILC0;
static struct inlineCache iy = _ILC0;
if (_isSmallInteger(aGCId) && _isSmallInteger(aDrawableId)
&& _isSmallInteger(numberOfPoints)) {
num = _intVal(numberOfPoints);
- if (num > 128)
+ if (num > 64)
points = (XPoint *)malloc(sizeof(XPoint) * num);
else
points = qPoints;
for (i=0; i<num; i++) {
-#ifdef PASS_ARG_REF
- index = _MKSMALLINT(i+1);
- point = _AT_(aPolygon, CONARG &index);
-#else
- point = _AT_(aPolygon, CONARG _MKSMALLINT(i+1));
-#endif
+ point = _AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
if (! _isPoint(point)) goto fail;
x = _point_X(point);
y = _point_Y(point);
@@ -3596,7 +3663,7 @@
points[i].y = _intVal(y);
}
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
- if (num > 128)
+ if (num > 64)
free(points);
RETURN ( self );
}
@@ -3609,7 +3676,9 @@
copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY
width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY
- "do a bit-blt"
+
+ "do a bit-blt of a compressed FAX image
+ - this needs my private FAX extension"
%{
#ifdef FAX
GC gc = _GCVal(aGCId);
@@ -3691,8 +3760,8 @@
self primitiveFailed
!
-drawArcX:x y:y w:width h:height from:startAngle angle:angle
- in:aDrawableId with:aGCId
+displayArcX:x y:y w:width h:height from:startAngle angle:angle
+ in:aDrawableId with:aGCId
"draw an arc"
%{ /* NOCONTEXT */
@@ -3719,10 +3788,13 @@
&& _isSmallInteger(width) && _isSmallInteger(height)) {
w = _intVal(width);
h = _intVal(height);
- if (w < 0) w = 0;
- if (h < 0) h = 0;
- XDrawArc(myDpy, win, gc, _intVal(x), _intVal(y),
- w, h, angle1, angle2);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
+ XDrawArc(myDpy, win, gc, _intVal(x), _intVal(y),
+ w, h, angle1, angle2);
+ }
RETURN ( self );
}
%}
@@ -3758,10 +3830,13 @@
&& _isSmallInteger(width) && _isSmallInteger(height)) {
w = _intVal(width);
h = _intVal(height);
- if (w < 0) w = 0;
- if (h < 0) h = 0;
- XFillArc(myDpy, win, gc, _intVal(x), _intVal(y),
- w, h, angle1, angle2);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
+ XFillArc(myDpy, win, gc, _intVal(x), _intVal(y),
+ w, h, angle1, angle2);
+ }
RETURN ( self );
}
%}
@@ -3781,11 +3856,14 @@
&& _isSmallInteger(width) && _isSmallInteger(height)) {
w = _intVal(width);
h = _intVal(height);
- if (w < 0) w = 0;
- if (h < 0) h = 0;
- XFillRectangle(myDpy,
- (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId),
- _intVal(x), _intVal(y), w, h);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0)) {
+ XFillRectangle(myDpy,
+ (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId),
+ _intVal(x), _intVal(y), w, h);
+ }
RETURN ( self );
}
%}
@@ -3794,7 +3872,7 @@
!
fillPolygon:aPolygon in:aDrawableId with:aGCId
- "fill a polygon"
+ "fill a polygon given by its points"
|numberOfPoints index|
@@ -3807,6 +3885,7 @@
extern OBJ Point;
int i, num;
XPoint *points;
+ XPoint qPoints[64];
static struct inlineCache ix = _ILC0;
static struct inlineCache iy = _ILC0;
@@ -3816,14 +3895,12 @@
if (num < 3) {
RETURN ( self );
}
- points = (XPoint *)malloc(sizeof(XPoint) * num);
+ if (num > 64)
+ points = (XPoint *)malloc(sizeof(XPoint) * num);
+ else
+ points = qPoints;
for (i=0; i<num; i++) {
-#ifdef PASS_ARG_REF
- index = _MKSMALLINT(i+1);
- point = _AT_(aPolygon, CONARG &index);
-#else
- point = _AT_(aPolygon, CONARG _MKSMALLINT(i+1));
-#endif
+ point = _AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
if (! _isPoint(point)) goto fail;
x = _point_X(point);
y = _point_Y(point);
@@ -3833,7 +3910,8 @@
points[i].y = _intVal(y);
}
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
- free(points);
+ if (num > 64)
+ free(points);
RETURN ( self );
}
fail: ;
@@ -3846,12 +3924,25 @@
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight
x:srcx y:srcy
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId
+
+ (self primDrawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId)
+ ifFalse:[
+ self primitiveFailed
+ ].
+!
+
+primDrawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight
+ x:srcx y:srcy
+ into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId
+
"draw a bitimage which has depth id, width iw and height ih into
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
It has to be checked elsewhere, that server can do it with the given
depth; also it is assumed, that the colormap is setup correctly"
-%{ /* NOCONTEXT */
+%{ /* UNLIMITEDSTACK */
{
Display *dpy = myDpy;
@@ -3906,18 +3997,20 @@
XPutImage(dpy, win, gc, &image, _intVal(srcx), _intVal(srcy),
_intVal(dstx), _intVal(dsty),
_intVal(w), _intVal(h));
- RETURN ( self );
+ RETURN ( true );
}
fail: ;
}
%}
.
- self primitiveFailed
+ ^ false
! !
!XWorkstation methodsFor:'events'!
eventMaskFor:anEventSymbol
+ "return the eventMask bit-constant corresponding to an event symbol"
+
(anEventSymbol == #keyPress) ifTrue:[^ keyPressMask].
(anEventSymbol == #keyRelease) ifTrue:[^ keyPressMask].
(anEventSymbol == #buttonPress) ifTrue:[^ buttonPressMask].
@@ -3932,6 +4025,8 @@
!
setEventMask:aMask in:aWindowId
+ "tell X that we are only interrested in events from aMask, which
+ is the bitwise or of the eventMask bits (see 'eventMaskFor:')"
%{ /* NOCONTEXT */
@@ -3951,20 +4046,114 @@
self primitiveFailed
!
+startDispatch
+ "redefined to clear dispatchingExpose, which is a special X feature"
+
+ dispatching ifTrue:[^ self].
+ dispatchingExpose := nil.
+ super startDispatch
+!
+
+checkForEndOfDispatch
+ "return true, if there are still any views of interrest - if not,
+ stop dispatch"
+
+ knownViews isEmpty ifTrue:[
+ dispatching := false.
+ ^ self
+ ].
+ ((knownViews size == 1) and:[(knownViews at:1) == RootView]) ifTrue:[
+ dispatching := false.
+ ]
+!
+
+dispatchPendingEvents
+ "central event handling method:
+ this code is somewhat special, since X has a concept of graphic
+ expose events (which are sent after a bitblt). After such a bitblt,
+ we only handle exposes until the graphicsExpose arrives.
+ Other systems may not need such a kludge"
+
+ "interrested in exposes only ?"
+ dispatchingExpose notNil ifTrue:[
+ [self exposeEventPendingFor:dispatchingExpose] whileTrue:[
+ self dispatchExposeEventFor:dispatchingExpose
+ ].
+ ^ self
+ ].
+
+ "no general dispatch"
+ [self eventPendingWithoutSync] whileTrue:[
+ self dispatchEventFor:nil withMask:nil
+ ]
+!
+
+handleExposeOnlyFor:aView
+ "from now on, handle expose events only"
+
+ dispatchingExpose := aView id
+!
+
+handleAllEvents
+ "from now on, handle any kind of event"
+
+ dispatchingExpose := nil
+!
+
+dispatchExposeEventFor:aViewIdOrNil
+ "get next expose event and send appropriate message to the view or the controller
+ (if the view has one).
+ If the argument aViewIdOrNil is nil, events for any view are processed,
+ otherwise only events for the view with given id are processed."
+
+ self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
+!
+
dispatchEventFor:aViewIdOrNil withMask:eventMask
"central event handling method:
- get next event and send appropriate message to the view or the controller,
- if the view has one.;
+ get next event and send appropriate message to the view or the controller
+ (if the view has one).
If the argument aViewIdOrNil is nil, events for any view are processed,
- otherwise only events for the view with given id are processed
- (in this case, nothing is done if no events are pending);
- if the argument aMask is nonNil, only events for this eventMask are
- handled;"
-
+ otherwise only events for the view with given id are processed.
+ If the argument aMask is nonNil, only events for this eventMask are
+ handled."
+
+ self getEventFor:aViewIdOrNil withMask:eventMask.
+ self dispatchLastEvent
+!
+
+getEventFor:aViewIdOrNil withMask:eventMask
+ "read next event - put into local buffer - sorry had to split
+ dispatch into this get and a handle to allow unlimitedstack here
+ (some Xlibs do a big alloca there ...)"
+
+%{ /* UNLIMITEDSTACK */
+
+ Display *dpy = myDpy;
+ Window win, wWanted;
+
+ if (_isSmallInteger(aViewIdOrNil)) {
+ wWanted = _WindowVal(aViewIdOrNil);
+ if (_isSmallInteger(eventMask))
+ XWindowEvent(dpy, wWanted, _intVal(eventMask), &ev);
+ else
+ XWindowEvent(dpy, wWanted, ~0, &ev);
+ } else {
+ if (_isSmallInteger(eventMask))
+ XMaskEvent(dpy, _intVal(eventMask), &ev);
+ else
+ XNextEvent(dpy, &ev);
+ }
+%}
+!
+
+dispatchLastEvent
"{ Symbol: graphicExposeX:y:width:height: } "
- "{ Symbol: exposeX:y:width:height: } "
- "{ Symbol: noExpose } "
+ "{ Symbol: exposeX:y:width:height: } "
+ "{ Symbol: noExpose } "
"{ Symbol: configureX:y:width:height: } "
+ "{ Symbol: keyPress:x:y: } "
+ "{ Symbol: keyRelease:x:y: } "
"{ Symbol: buttonPress:x:y: } "
"{ Symbol: buttonShiftPress:x:y: } "
"{ Symbol: buttonMultiPress:x:y: } "
@@ -3974,8 +4163,6 @@
"{ Symbol: focusOut } "
"{ Symbol: pointerEnter:x:y: } "
"{ Symbol: pointerLeave: } "
- "{ Symbol: keyPress:x:y: } "
- "{ Symbol: keyRelease:x:y: } "
"{ Symbol: unmapped } "
"{ Symbol: mapped } "
"{ Symbol: destroyed } "
@@ -3983,39 +4170,57 @@
"{ Symbol: terminate } "
"{ Symbol: saveAndTerminate } "
+ "{ Symbol: graphicExposeX:y:width:height:view: } "
+ "{ Symbol: exposeX:y:width:height:view: } "
+ "{ Symbol: noExposeView: } "
+ "{ Symbol: keyPress:x:y:view: } "
+ "{ Symbol: keyRelease:x:y:view: } "
+ "{ Symbol: buttonPress:x:y:view: } "
+ "{ Symbol: buttonShiftPress:x:y:view: } "
+ "{ Symbol: buttonMultiPress:x:y:view: } "
+ "{ Symbol: buttonRelease:x:y:view: } "
+ "{ Symbol: buttonMotion:x:y:view: } "
+ "{ Symbol: focusInView: } "
+ "{ Symbol: focusOutView: } "
+ "{ Symbol: pointerEnter:x:y:view: } "
+ "{ Symbol: pointerLeave:view: } "
+
+ "{ Symbol: unmapped } "
+ "{ Symbol: keyMapChange } "
+ "{ Symbol: visibilityChange } "
+ "{ Symbol: created } "
+ "{ Symbol: mapRequest } "
+ "{ Symbol: reparented } "
+ "{ Symbol: configRequest } "
+ "{ Symbol: resizeRequest } "
+ "{ Symbol: propertyChange } "
+ "{ Symbol: selectionClear } "
+ "{ Symbol: selectionRequest } "
+ "{ Symbol: selectionChange } "
+ "{ Symbol: colorMapChange } "
+
+ "{ Symbol: sendKeyPress:x:y:to: } "
+ "{ Symbol: viewFromId: } "
"{ Symbol: controller } "
- "{ Symbol: buttonPress:x:y:in: } "
- "{ Symbol: buttonShiftPress:x:y:in: } "
- "{ Symbol: buttonMultiPress:x:y:in: } "
- "{ Symbol: buttonRelease:x:y:in: } "
- "{ Symbol: buttonMotion:x:y:in: } "
- "{ Symbol: focusIn: } "
- "{ Symbol: focusOut: } "
- "{ Symbol: pointerEnter:x:y:in: } "
- "{ Symbol: pointerLeave:in: } "
- "{ Symbol: keyPress:x:y:in: } "
- "{ Symbol: keyRelease:x:y:in: } "
-
- "{ Symbol: sendKeyPress:x:y:view:controller: }"
- "{ Symbol: viewFromId: } "
-
- |theView controller a1 a2 a3 a4 a5|
-
-%{
-#define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask)
+ "{ Symbol: sensor } "
+ "{ Symbol: delegate } "
+
+ |theView controller sensor delegate|
+
+%{ /* STACK: 8000 */
+# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask)
Display *dpy = myDpy;
Window win, wWanted;
- XEvent ev;
XAnyEvent *ae = (XAnyEvent *)&ev;
-#define ee ((XExposeEvent *)&ev)
-#define ke ((XKeyPressedEvent *)&ev)
-#define be ((XButtonPressedEvent *)&ev)
-#define ce ((XConfigureEvent *)&ev)
-#define me ((XMotionEvent *)&ev)
-#define ewe ((XEnterWindowEvent *)&ev)
-#define lwe ((XLeaveWindowEvent *)&ev)
-#define de ((XDestroyWindowEvent *)&ev)
+# define ee ((XExposeEvent *)&ev)
+# define ke ((XKeyPressedEvent *)&ev)
+# define be ((XButtonPressedEvent *)&ev)
+# define ce ((XConfigureEvent *)&ev)
+# define me ((XMotionEvent *)&ev)
+# define ewe ((XEnterWindowEvent *)&ev)
+# define lwe ((XLeaveWindowEvent *)&ev)
+# define de ((XDestroyWindowEvent *)&ev)
KeySym keySym;
unsigned char buffer[10];
int i, nchars;
@@ -4023,17 +4228,18 @@
char keySymStringBuffer[32];
static unsigned multiClickTime = 0;
unsigned nextMultiClickTime;
- OBJ sym, arg, button;
- struct inlineCache *ip;
+ OBJ sym, symS, arg, button;
+ OBJ keyButtonReceiver, exposeReceiver;
+ struct inlineCache *ip, *ipS;
static struct inlineCache vid = _ILC1;
static struct inlineCache exp = _ILC4;
static struct inlineCache gexp = _ILC4;
- static struct inlineCache mot = _ILC3;
- static struct inlineCache kp = _ILC3;
static struct inlineCache nexp = _ILC0;
static struct inlineCache conf = _ILC4;
static struct inlineCache unmap = _ILC0;
static struct inlineCache map = _ILC0;
+ static struct inlineCache mot = _ILC3;
+ static struct inlineCache kp = _ILC3;
static struct inlineCache bp = _ILC3;
static struct inlineCache bmp = _ILC3;
static struct inlineCache bsp = _ILC3;
@@ -4045,90 +4251,71 @@
static struct inlineCache term = _ILC0;
static struct inlineCache savterm = _ILC0;
static struct inlineCache destr = _ILC0;
+
+ static struct inlineCache expS = _ILC5;
+ static struct inlineCache gexpS = _ILC5;
+ static struct inlineCache nexpS = _ILC1;
+ static struct inlineCache motS = _ILC4;
+ static struct inlineCache kpS = _ILC4;
+ static struct inlineCache bpS = _ILC4;
+ static struct inlineCache bmpS = _ILC4;
+ static struct inlineCache bspS = _ILC4;
+ static struct inlineCache brS = _ILC4;
+ static struct inlineCache focInS = _ILC1;
+ static struct inlineCache focOutS = _ILC1;
+ static struct inlineCache peS = _ILC4;
+ static struct inlineCache plS = _ILC2;
+
+ static struct inlineCache keymap = _ILC0;
+ static struct inlineCache created = _ILC0;
+ static struct inlineCache mapReq = _ILC0;
+ static struct inlineCache repar = _ILC0;
+ static struct inlineCache confReq = _ILC0;
+ static struct inlineCache resReq = _ILC0;
+ static struct inlineCache prop = _ILC0;
+ static struct inlineCache selClear = _ILC0;
+ static struct inlineCache selReq = _ILC0;
+ static struct inlineCache selNotify = _ILC0;
+ static struct inlineCache colormap = _ILC0;
+ static struct inlineCache vis = _ILC0;
+
static struct inlineCache contr = _ILC0;
- static struct inlineCache kpC = _ILC4;
- static struct inlineCache bpC = _ILC4;
- static struct inlineCache bmpC = _ILC4;
- static struct inlineCache bspC = _ILC4;
- static struct inlineCache brC = _ILC4;
- static struct inlineCache motC = _ILC4;
- static struct inlineCache focInC = _ILC1;
- static struct inlineCache focOutC = _ILC1;
- static struct inlineCache peC = _ILC4;
- static struct inlineCache plC = _ILC2;
- static struct inlineCache skp = _ILC5;
- int savInt;
-
- do {
- /*
- * if an interrupt occurs during XNextEvent, handle it right now -
- * dont schedule in context
- */
- savInt = _immediateInterrupt;
- _immediateInterrupt = 1;
- if (_isSmallInteger(aViewIdOrNil)) {
- wWanted = _WindowVal(aViewIdOrNil);
- if (_isSmallInteger(eventMask))
- XWindowEvent(dpy, wWanted, _intVal(eventMask), &ev);
- else
- XWindowEvent(dpy, wWanted, ~0, &ev);
- } else {
- if (_isSmallInteger(eventMask))
- XMaskEvent(dpy, _intVal(eventMask), &ev);
- else
- XNextEvent(dpy, &ev);
+ static struct inlineCache sens = _ILC0;
+ static struct inlineCache deleg = _ILC0;
+ static struct inlineCache skp = _ILC4;
+ static struct inlineCache skpS = _ILC4;
+
+ theView = (*vid.ilc_func)(self, _viewFromId_ COMMA_CON, nil, &vid,
+ MKOBJ(ae->window));
+
+ if (theView == nil) {
+ RETURN (nil);
+ }
+
+ /*
+ * key, button and pointer events are sent to the sensor,
+ * or (if there is none) to the delegate.
+ * or (if there is none) to the view.
+ * sensor and delegate get view as additional argument
+ */
+ keyButtonReceiver = nil;
+ exposeReceiver = nil;
+ sensor = (*sens.ilc_func)(theView, _sensor COMMA_CON, nil, &sens);
+ if (sensor != nil) {
+ keyButtonReceiver = sensor;
+ exposeReceiver = sensor;
+ } else {
+ delegate = (*deleg.ilc_func)(theView, _delegate COMMA_CON, nil, &deleg);
+ if (delegate != nil) {
+ keyButtonReceiver = delegate;
}
- _immediateInterrupt = savInt;
-
-#ifdef PASS_ARG_REF
- a1 = MKOBJ(ae->window);
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid, &a1);
-#else
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid, MKOBJ(ae->window));
-#endif
- if (InterruptPending != nil)
- interrupt();
-
- } while (theView == nil);
-
- /* get the controller */
- controller = (*contr.ilc_func)(theView, _controller, CONARG nil, &contr);
-
+ }
+
+ /*
+ * now, receiver is in variables keyButtonReceiver, exposeReceiver (to send with view)
+ * or theView if not.
+ */
switch (ev.type) {
- case GraphicsExpose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_, CONARG nil, &gexp, &a1);
-#else
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_,
- CONARG nil, &gexp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- break;
-
- case Expose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*exp.ilc_func)(theView, _exposeX_y_width_height_, CONARG nil, &exp, &a1);
-#else
- (*exp.ilc_func)(theView, _exposeX_y_width_height_,
- CONARG nil, &exp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- break;
-
/*
* I do not support key-release
* to press everyone NOT to use stuff which might not be
@@ -4144,7 +4331,6 @@
case KeyPress:
_INST(eventRootX) = _MKSMALLINT(ke->x_root);
_INST(eventRootY) = _MKSMALLINT(ke->y_root);
-
_INST(altDown) = (ke->state & Mod2Mask) ? true : false;
_INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
_INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
@@ -4152,7 +4338,9 @@
arg = nil;
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
- if (nchars && (buffer[0] >= ' ') && (buffer[0] <= '~')) {
+ if (nchars
+ && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
+ || (buffer[0] >= 0x80))) {
arg = *_CharacterTable[buffer[0]];
keySymString = NULL;
} else {
@@ -4160,7 +4348,7 @@
if (keySymString) {
if (keySymString[0] == 'D') {
/*
- * remove underscor, dont want it in symbols
+ * remove underscore, dont want it in symbols
*/
if (strcmp(keySymString, "Delete_line") == 0) {
keySymString = "DeleteLine";
@@ -4189,142 +4377,94 @@
break;
}
-#ifdef PASS_ARG_REF
- a1 = arg;
- a2 = _MKSMALLINT(ke->x);
- a3 = _MKSMALLINT(ke->y);
- a4 = theView;
- a5 = controller;
- (*skp.ilc_func)(self, _sendKeyPress_x_y_view_controller_, CONARG nil, &skp, &a1);
-#else
- (*skp.ilc_func)(self, _sendKeyPress_x_y_view_controller_,
- CONARG nil, &skp,
+ if (keyButtonReceiver != nil) {
+ (*skpS.ilc_func)(keyButtonReceiver, _keyPress_x_y_view_
+ COMMA_CON, nil, &skpS,
+ arg,
+ _MKSMALLINT(ke->x), _MKSMALLINT(ke->y),
+ theView);
+ break;
+ }
+
+ (*skp.ilc_func)(self, _sendKeyPress_x_y_to_
+ COMMA_CON, nil, &skp,
arg,
_MKSMALLINT(ke->x), _MKSMALLINT(ke->y),
- theView, controller);
-#endif
+ theView);
break;
case ButtonPress:
_INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) | (1 << be->button));
-
_INST(eventRootX) = _MKSMALLINT(be->x_root);
_INST(eventRootY) = _MKSMALLINT(be->y_root);
if (_isSmallInteger(DeviceWorkstation_MultiClickTimeDelta))
- nextMultiClickTime = be->time +
- _intVal(DeviceWorkstation_MultiClickTimeDelta);
+ nextMultiClickTime = be->time + _intVal(DeviceWorkstation_MultiClickTimeDelta);
else
nextMultiClickTime = 0;
if (multiClickTime) {
if (be->time < multiClickTime) {
multiClickTime = nextMultiClickTime;
- if (controller != nil) {
- /* send it to the controller */
- ip = &bmpC;
- sym = _buttonMultiPress_x_y_in_;
- goto sendButtonEventToController;
- } else {
- /* send it to the view */
- ip = &bmp;
- sym = _buttonMultiPress_x_y_;
- goto sendButtonEventToView;
- }
+ ip = &bmp;
+ ipS = &bmpS;
+ sym = _buttonMultiPress_x_y_;
+ symS = _buttonMultiPress_x_y_view_;
+ goto sendButtonEvent;
break;
}
}
multiClickTime = nextMultiClickTime;
if (be->state & ShiftMask) {
- if (controller != nil) {
- sym = _buttonShiftPress_x_y_in_;
- ip = &bspC;
- goto sendButtonEventToController;
- } else {
- sym = _buttonShiftPress_x_y_;
- ip = &bsp;
- goto sendButtonEventToView;
- }
+ ip = &bsp;
+ ipS = &bspS;
+ sym = _buttonShiftPress_x_y_;
+ symS = _buttonShiftPress_x_y_view_;
+ goto sendButtonEvent;
}
- if (controller != nil) {
- sym = _buttonPress_x_y_in_;
- ip = &bpC;
- goto sendButtonEventToController;
- } else {
- sym = _buttonPress_x_y_;
- ip = &bp;
- goto sendButtonEventToView;
- }
+ ip = &bp;
+ ipS = &bpS;
+ sym = _buttonPress_x_y_;
+ symS = _buttonPress_x_y_view_;
+ goto sendButtonEvent;
+
/* NOT REACHED */
case ButtonRelease:
_INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) & ~(1 << be->button));
-
_INST(eventRootX) = _MKSMALLINT(be->x_root);
_INST(eventRootY) = _MKSMALLINT(be->y_root);
-
- if (controller != nil) {
- sym = _buttonRelease_x_y_in_;
- ip = &brC;
-
- sendButtonEventToController:
- button = _MKSMALLINT(be->button);
-#ifdef PASS_ARG_REF
- button = _AT_(DeviceWorkstation_ButtonTranslation, &button);
-#else
- button = _AT_(DeviceWorkstation_ButtonTranslation, button);
+ ip = &br;
+ ipS = &brS;
+ sym = _buttonRelease_x_y_;
+ symS = _buttonRelease_x_y_view_;
+ /* fall into */
+
+ sendButtonEvent:
+ button = _MKSMALLINT(be->button);
+#ifdef NOTDEF
+ /*
+ * this allows operation with single button mouses: meta-click is always Button 2
+ */
+ if (_INST(metaDown) == true)
+ button = _MKSMALLINT(2);
+ else
#endif
-#ifdef PASS_ARG_REF
- a1 = button;
- a2 = _MKSMALLINT(be->x);
- a3 = _MKSMALLINT(be->y);
- a4 = theView;
- (*(*ip).ilc_func)(controller, sym, CONARG nil, ip, &a1);
-#else
- (*(*ip).ilc_func)(controller, sym, CONARG nil, ip,
- button,
- _MKSMALLINT(be->x), _MKSMALLINT(be->y),
- theView);
-#endif
+ button = _AT_(DeviceWorkstation_ButtonTranslation, button);
+
+
+ if (keyButtonReceiver != nil) {
+ (*(*ipS).ilc_func)(keyButtonReceiver, symS
+ COMMA_CON, nil, ipS,
+ button,
+ _MKSMALLINT(ke->x), _MKSMALLINT(ke->y),
+ theView);
break;
}
- sym = _buttonRelease_x_y_;
- ip = &br;
-
- sendButtonEventToView:
- button = _MKSMALLINT(be->button);
-#ifdef PASS_ARG_REF
- button = _AT_(DeviceWorkstation_ButtonTranslation, &button);
-#else
- button = _AT_(DeviceWorkstation_ButtonTranslation, button);
-#endif
-#ifdef PASS_ARG_REF
- a1 = button;
- a2 = _MKSMALLINT(be->x);
- a3 = _MKSMALLINT(be->y);
- (*(*ip).ilc_func)(theView, sym, CONARG nil, ip, &a1);
-#else
- (*(*ip).ilc_func)(theView, sym, CONARG nil, ip,
+
+ (*(*ip).ilc_func)(theView, sym COMMA_CON, nil, ip,
button,
_MKSMALLINT(be->x), _MKSMALLINT(be->y));
-#endif
- break;
-
- case ConfigureNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ce->x);
- a2 = _MKSMALLINT(ce->y);
- a3 = _MKSMALLINT(ce->width);
- a4 = _MKSMALLINT(ce->height);
- (*conf.ilc_func)(theView, _configureX_y_width_height_, CONARG nil, &conf, &a1);
-#else
- (*conf.ilc_func)(theView, _configureX_y_width_height_,
- CONARG nil, &conf,
- _MKSMALLINT(ce->x),
- _MKSMALLINT(ce->y),
- _MKSMALLINT(ce->width),
- _MKSMALLINT(ce->height));
-#endif
break;
case MotionNotify:
@@ -4335,157 +4475,206 @@
_INST(eventRootX) = _MKSMALLINT(me->x_root);
_INST(eventRootY) = _MKSMALLINT(me->y_root);
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(me->state);
- a2 = _MKSMALLINT(me->x);
- a3 = _MKSMALLINT(me->y);
-#endif
- if (controller != nil) {
-#ifdef PASS_ARG_REF
- a4 = theView;
- (*motC.ilc_func)(controller, _buttonMotion_x_y_in_, CONARG nil, &motC, &a1);
-#else
- (*motC.ilc_func)(controller, _buttonMotion_x_y_in_,
- CONARG nil, &motC,
- _MKSMALLINT(me->state),
- _MKSMALLINT(me->x),
- _MKSMALLINT(me->y),
- theView);
-#endif
- } else {
-#ifdef PASS_ARG_REF
- (*mot.ilc_func)(theView, _buttonMotion_x_y_, CONARG nil, &mot, &a1);
-#else
- (*mot.ilc_func)(theView, _buttonMotion_x_y_,
- CONARG nil, &mot,
+ if (keyButtonReceiver != nil) {
+ (*motS.ilc_func)(keyButtonReceiver, _buttonMotion_x_y_view_
+ COMMA_CON, nil, &motS,
_MKSMALLINT(me->state),
_MKSMALLINT(me->x),
- _MKSMALLINT(me->y));
-#endif
+ _MKSMALLINT(me->y),
+ theView);
+ break;
}
+ (*mot.ilc_func)(theView, _buttonMotion_x_y_
+ COMMA_CON, nil, &mot,
+ _MKSMALLINT(me->state),
+ _MKSMALLINT(me->x),
+ _MKSMALLINT(me->y));
break;
case FocusIn:
- if (controller != nil) {
-#ifdef PASS_ARG_REF
- (*focInC.ilc_func)(controller, _focusIn_, CONARG nil, &focInC, &theView);
-#else
- (*focInC.ilc_func)(controller, _focusIn_, CONARG nil, &focInC, theView);
-#endif
- } else
- (*focIn.ilc_func)(theView, _focusIn, CONARG nil, &focIn);
+ if (keyButtonReceiver != nil) {
+ (*focInS.ilc_func)(keyButtonReceiver, _focusInView_ COMMA_CON, nil, &focInS, theView);
+ break;
+ }
+ (*focIn.ilc_func)(theView, _focusIn COMMA_CON, nil, &focIn);
break;
case FocusOut:
- if (controller != nil)
-#ifdef PASS_ARG_REF
- (*focOutC.ilc_func)(controller, _focusOut_, CONARG nil, &focOutC, &theView);
-#else
- (*focOutC.ilc_func)(controller, _focusOut_, CONARG nil, &focOutC, theView);
-#endif
- else
- (*focOut.ilc_func)(theView, _focusOut, CONARG nil, &focOut);
+ if (keyButtonReceiver != nil) {
+ (*focOutS.ilc_func)(keyButtonReceiver, _focusOutView_ COMMA_CON, nil, &focOutS, theView);
+ break;
+ }
+ (*focOut.ilc_func)(theView, _focusOut COMMA_CON, nil, &focOut);
break;
case EnterNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ewe->state);
- a2 = _MKSMALLINT(ewe->x);
- a3 = _MKSMALLINT(ewe->y);
-#endif
- if (controller != nil) {
-#ifdef PASS_ARG_REF
- a4 = theView;
- (*peC.ilc_func)(controller, _pointerEnter_x_y_in_, CONARG nil, &peC, &a1);
-#else
- (*peC.ilc_func)(controller, _pointerEnter_x_y_in_,
- CONARG nil, &peC,
- _MKSMALLINT(ewe->state),
- _MKSMALLINT(ewe->x), _MKSMALLINT(ewe->y),
- theView);
-#endif
- } else {
-#ifdef PASS_ARG_REF
- (*pe.ilc_func)(theView, _pointerEnter_x_y_, CONARG nil, &pe, &a1);
-#else
- (*pe.ilc_func)(theView, _pointerEnter_x_y_,
- CONARG nil, &pe,
- _MKSMALLINT(ewe->state),
- _MKSMALLINT(ewe->x), _MKSMALLINT(ewe->y));
-#endif
+ if (keyButtonReceiver != nil) {
+ (*peS.ilc_func)(keyButtonReceiver, _pointerEnter_x_y_view_
+ COMMA_CON, nil, &peS,
+ _MKSMALLINT(ewe->state),
+ _MKSMALLINT(ewe->x), _MKSMALLINT(ewe->y),
+ theView);
+ break;
}
+ (*pe.ilc_func)(theView, _pointerEnter_x_y_
+ COMMA_CON, nil, &pe,
+ _MKSMALLINT(ewe->state),
+ _MKSMALLINT(ewe->x), _MKSMALLINT(ewe->y));
break;
case LeaveNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(lwe->state);
-#endif
- if (controller != nil) {
-#ifdef PASS_ARG_REF
- a2 = theView;
- (*plC.ilc_func)(controller, _pointerLeave_in_, CONARG nil, &plC, &a1);
-#else
- (*plC.ilc_func)(controller, _pointerLeave_in_,
- CONARG nil, &plC,
- _MKSMALLINT(lwe->state), theView);
-#endif
- } else
-#ifdef PASS_ARG_REF
- (*pl.ilc_func)(theView, _pointerLeave_, CONARG nil, &pl,&a1);
-#else
- (*pl.ilc_func)(theView, _pointerLeave_, CONARG nil, &pl,
- _MKSMALLINT(lwe->state));
-#endif
+ if (keyButtonReceiver != nil) {
+ (*plS.ilc_func)(keyButtonReceiver, _pointerLeave_view_ COMMA_CON, nil, &plS,
+ _MKSMALLINT(lwe->state), theView);
+ break;
+ }
+ (*pl.ilc_func)(theView, _pointerLeave_ COMMA_CON, nil, &pl,
+ _MKSMALLINT(lwe->state));
+ break;
+
+ case GraphicsExpose:
+ if (exposeReceiver != nil) {
+ (*gexpS.ilc_func)(exposeReceiver, _graphicExposeX_y_width_height_view_
+ COMMA_CON, nil, &gexpS,
+ _MKSMALLINT(ee->x),
+ _MKSMALLINT(ee->y),
+ _MKSMALLINT(ee->width),
+ _MKSMALLINT(ee->height),
+ theView);
+ if (ee->count == 0) {
+ (*nexpS.ilc_func)(exposeReceiver, _noExposeView_ COMMA_CON, nil, &nexpS, theView);
+ }
+ break;
+ }
+ (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_
+ COMMA_CON, nil, &gexp,
+ _MKSMALLINT(ee->x),
+ _MKSMALLINT(ee->y),
+ _MKSMALLINT(ee->width),
+ _MKSMALLINT(ee->height));
+ if (ee->count == 0) {
+ (*nexp.ilc_func)(theView, _noExpose COMMA_CON, nil, &nexp);
+ }
+ break;
+
+ case Expose:
+ if (exposeReceiver != nil) {
+ (*expS.ilc_func)(exposeReceiver, _exposeX_y_width_height_view_
+ COMMA_CON, nil, &expS,
+ _MKSMALLINT(ee->x),
+ _MKSMALLINT(ee->y),
+ _MKSMALLINT(ee->width),
+ _MKSMALLINT(ee->height),
+ theView);
+ break;
+ }
+ (*exp.ilc_func)(theView, _exposeX_y_width_height_
+ COMMA_CON, nil, &exp,
+ _MKSMALLINT(ee->x),
+ _MKSMALLINT(ee->y),
+ _MKSMALLINT(ee->width),
+ _MKSMALLINT(ee->height));
+ break;
+
+ case NoExpose:
+ if (exposeReceiver != nil) {
+ (*nexpS.ilc_func)(exposeReceiver, _noExposeView_ COMMA_CON, nil, &nexpS, theView);
+ break;
+ }
+ (*nexp.ilc_func)(theView, _noExpose COMMA_CON, nil, &nexp);
+ break;
+
+ case ConfigureNotify:
+ (*conf.ilc_func)(theView, _configureX_y_width_height_
+ COMMA_CON, nil, &conf,
+ _MKSMALLINT(ce->x),
+ _MKSMALLINT(ce->y),
+ _MKSMALLINT(ce->width),
+ _MKSMALLINT(ce->height));
break;
case ClientMessage:
if (ev.xclient.message_type == (int) _AtomVal(_INST(ProtocolsAtom))) {
if (ev.xclient.data.l[0] == (int) _AtomVal(_INST(QuitAppAtom))) {
- (*term.ilc_func)(theView, _terminate, CONARG nil, &term);
+ (*term.ilc_func)(theView, _terminate COMMA_CON, nil, &term);
break;
}
if (ev.xclient.data.l[0] == (int) _AtomVal(_INST(DeleteWindowAtom))) {
- (*term.ilc_func)(theView, _terminate, CONARG nil, &term);
+ (*term.ilc_func)(theView, _terminate COMMA_CON, nil, &term);
break;
}
if (ev.xclient.data.l[0] == (int) _AtomVal(_INST(SaveYourselfAtom))) {
- (*savterm.ilc_func)(theView, _saveAndTerminate, CONARG nil, &savterm);
+ (*savterm.ilc_func)(theView, _saveAndTerminate COMMA_CON, nil, &savterm);
break;
}
}
break;
case DestroyNotify:
- (*destr.ilc_func)(theView, _destroyed, CONARG nil, &destr);
- break;
-
- case NoExpose:
- (*nexp.ilc_func)(theView, _noExpose, CONARG nil, &nexp);
+ (*destr.ilc_func)(theView, _destroyed COMMA_CON, nil, &destr);
break;
case UnmapNotify:
- (*unmap.ilc_func)(theView, _unmapped, CONARG nil, &unmap);
+ (*unmap.ilc_func)(theView, _unmapped COMMA_CON, nil, &unmap);
break;
case MapNotify:
- (*map.ilc_func)(theView, _mapped, CONARG nil, &map);
+ (*map.ilc_func)(theView, _mapped COMMA_CON, nil, &map);
break;
case KeymapNotify:
+ (*keymap.ilc_func)(theView, _keyMapChange COMMA_CON, nil, &keymap);
+ break;
+
case VisibilityNotify:
+ (*vis.ilc_func)(theView, _visibilityChange COMMA_CON, nil, &vis);
+ break;
+
case CreateNotify:
+ (*created.ilc_func)(theView, _created COMMA_CON, nil, &created);
+ break;
+
case MapRequest:
+ (*mapReq.ilc_func)(theView, _mapRequest COMMA_CON, nil, &mapReq);
+ break;
+
case ReparentNotify:
+ (*repar.ilc_func)(theView, _reparented COMMA_CON, nil, &repar);
+ break;
+
case ConfigureRequest:
+ (*confReq.ilc_func)(theView, _configRequest COMMA_CON, nil, &confReq);
+ break;
+
case GravityNotify:
case ResizeRequest:
+ (*resReq.ilc_func)(theView, _resizeRequest COMMA_CON, nil, &resReq);
+ break;
+
case CirculateNotify:
case CirculateRequest:
+ break;
+
case PropertyNotify:
+ (*prop.ilc_func)(theView, _propertyChange COMMA_CON, nil, &prop);
+ break;
+
case SelectionClear:
+ (*selClear.ilc_func)(theView, _selectionClear COMMA_CON, nil, &selClear);
+ break;
+
case SelectionRequest:
+ (*selReq.ilc_func)(theView, _selectionRequest COMMA_CON, nil, &selReq);
+ break;
+
case SelectionNotify:
+ (*selNotify.ilc_func)(theView, _selectionChange COMMA_CON, nil, &selNotify);
+ break;
+
case ColormapNotify:
+ (*colormap.ilc_func)(theView, _colorMapChange COMMA_CON, nil, &colormap);
+ break;
+
case MappingNotify:
break;
}
@@ -4502,103 +4691,6 @@
^ true
!
-dispatchExposeEventsFor:aViewId
- "handle all pending exposes until a noExpose or graphicsExpose arrives;
- then exit loop"
-
- "{ Symbol: graphicExposeX:y:width:height: } "
- "{ Symbol: exposeX:y:width:height: } "
- "{ Symbol: noExpose } "
-
- |theView a1 a2 a3 a4|
-
-%{
- Display *dpy = myDpy;
- XEvent ev;
- XAnyEvent *ae = (XAnyEvent *)&ev;
-#define ee ((XExposeEvent *)&ev)
- Window wWanted;
- static struct inlineCache vid = _ILC1;
- static struct inlineCache exp = _ILC4;
- static struct inlineCache gexp = _ILC4;
- static struct inlineCache nexp = _ILC0;
- int savInt;
-
- if (! _isSmallInteger(aViewId)) {
- RETURN ( nil );
- }
- wWanted = _WindowVal(aViewId);
- for (;;) {
- /*
- * if an interrupt occurs during XNextEvent, handle it right now -
- * dont schedule in context
- */
- savInt = _immediateInterrupt;
- _immediateInterrupt = 1;
- XWindowEvent(dpy, wWanted, ExposureMask, &ev);
- _immediateInterrupt = savInt;
-
- if (InterruptPending != nil)
- interrupt();
-
-#ifdef PASS_ARG_REF
- a1 = MKOBJ(ae->window);
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid,&a1);
-#else
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid,
- MKOBJ(ae->window));
-#endif
- if (theView == nil) {
- RETURN ( nil );
- }
-
- switch (ev.type) {
- case GraphicsExpose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_, CONARG nil, &gexp, &a1);
-#else
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_,
- CONARG nil, &gexp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- if (ee->count == 0) {
- RETURN ( true );
- }
- break;
-
- case Expose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*exp.ilc_func)(theView, _exposeX_y_width_height_, CONARG nil, &exp,&a1);
-#else
- (*exp.ilc_func)(theView, _exposeX_y_width_height_,
- CONARG nil, &exp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- break;
-
- case NoExpose:
- (*nexp.ilc_func)(theView, _noExpose, CONARG nil, &nexp);
- RETURN ( true );
- }
- }
-#undef ee
-%}
-!
-
disposeEventsWithMask:aMask for:aWindowId
"dispose (throw away) specific events"
@@ -4618,83 +4710,20 @@
self primitiveFailed
!
-exposeEventsFor:aViewId do:aBlock
- "for every pending expose event for aViewId evaluate the argument
- aBlock with 4 arguments"
-
- "{ Symbol: value:value:value:value: } "
-
- |theView a1 a2 a3 a4|
-%{
- Display *dpy = myDpy;
- XEvent ev;
- XAnyEvent *ae = (XAnyEvent *)&ev;
-#define ee ((XExposeEvent *)&ev)
- Window wWanted;
- static struct inlineCache vid = _ILC1;
- static struct inlineCache val = _ILC4;
- int savInt;
-
- if (! _isSmallInteger(aViewId)) {
- RETURN ( nil );
- }
-
- wWanted = _WindowVal(aViewId);
- for (;;) {
- /*
- * if an interrupt occurs during XNextEvent, handle it right now -
- * dont schedule in context
- */
- savInt = _immediateInterrupt;
- _immediateInterrupt = 1;
- XWindowEvent(dpy, wWanted, ExposureMask, &ev);
- _immediateInterrupt = savInt;
-
- if (InterruptPending != nil)
- interrupt();
-
-#ifdef PASS_ARG_REF
- a1 = MKOBJ(ae->window);
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid,&a1);
-#else
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid, MKOBJ(ae->window));
-#endif
- if (theView == nil) {
- RETURN ( nil );
- }
-
- switch (ev.type) {
- case GraphicsExpose:
- case Expose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*val.ilc_func)(aBlock, _value_value_value_value_, CONARG nil, &val,&a1);
-#else
- (*val.ilc_func)(aBlock, _value_value_value_value_,
- CONARG nil, &val,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- break;
-
- case NoExpose:
- RETURN ( false );
- }
- }
-#undef ee
-%}
+eventPending
+ "return true, if any event is pending"
+
+ dispatchingExpose notNil ifTrue:[
+ ^ self exposeEventPendingFor:dispatchingExpose
+ ].
+ ^ self eventPendingWithSync
!
-eventPending
+eventPendingWithSync
"return true, if any event is pending.
Do a flush output buffer before."
-%{ /* NOCONTEXT */
+%{ /* UNLIMITEDSTACK */
Display *dpy = myDpy;
@@ -4704,9 +4733,9 @@
!
eventPendingWithoutSync
- "return true, if any event is pending"
-
-%{ /* NOCONTEXT */
+ "return true, if any event is pending.
+
+%{ /* UNLIMITEDSTACK */
RETURN ( (XPending(myDpy)) ? true : false );
%}
@@ -4715,7 +4744,7 @@
exposeEventPendingFor:aWindowId
"return true, if any expose event is pending"
-%{ /* NOCONTEXT */
+%{ /* UNLIMITEDSTACK */
Display *dpy = myDpy;
XEvent ev;
@@ -4727,17 +4756,15 @@
XPutBackEvent(dpy, &ev);
RETURN ( true );
}
- RETURN ( false );
}
+ RETURN ( false );
%}
-.
- self primitiveFailed
!
eventsPending:anEventMask for:aWindowId
"return true, if any of the masked events is pending"
-%{ /* NOCONTEXT */
+%{ /* UNLIMITEDSTACK */
Display *dpy = myDpy;
XEvent ev;
@@ -4750,557 +4777,13 @@
XPutBackEvent(dpy, &ev);
RETURN ( true );
}
- RETURN ( false );
}
+ RETURN ( false );
%}
-.
- self primitiveFailed
!
eventPending:anEventSymbol for:aWindowId
"return true, if a specific event is pending"
- |numericMask|
-
- numericMask := self eventMaskFor:anEventSymbol.
-%{
- Display *dpy = myDpy;
- XEvent ev;
- Window win;
-
- if (_isSmallInteger(numericMask)) {
- win = _WindowVal(aWindowId);
- XSync(dpy, 0); /* make certain everything is flushed */
- if (XCheckWindowEvent(dpy, win, _intVal(numericMask), &ev)) {
- XPutBackEvent(dpy, &ev);
- RETURN ( true );
- }
- RETURN ( false );
- }
-%}
-.
- self primitiveFailed
-!
-
-nextEventFor:aViewIdOrNil withMask:eventMask sendTo:eventDispatcher
- "get next event and send an appropriate message to eventDispatcher.
- (see below for the 2 exceptions)
- If the argument aViewIdOrNil is nil, events for any view are processed,
- otherwise only events for the view with given id are processed
- (in this case, nothing is done if no events are pending);
- if the argument aMask is nonNil, only events for this eventMask are
- handled.
- GraphicExpose events are sent to the view directly instead of the eventDispatcher.
- This must be done since queueing those events does not make sense (they are the
- responses to bitBlt operations and must be handled immediately."
-
- "{ Symbol: graphicExposeX:y:width:height: } "
- "{ Symbol: noExpose } "
-
- "{ Symbol: exposeX:y:width:height:view: } "
- "{ Symbol: configureX:y:width:height:view: } "
- "{ Symbol: buttonPress:x:y:view: } "
- "{ Symbol: buttonShiftPress:x:y:view: } "
- "{ Symbol: buttonMultiPress:x:y:view: } "
- "{ Symbol: buttonRelease:x:y:view: } "
- "{ Symbol: buttonMotion:x:y:view: } "
- "{ Symbol: focusInView: } "
- "{ Symbol: focusOutView: } "
- "{ Symbol: pointerEnter:x:y:view: } "
- "{ Symbol: pointerLeave:view: } "
- "{ Symbol: keyPress:x:y:view: } "
- "{ Symbol: keyRelease:x:y:view: } "
-
- "{ Symbol: unmapped } "
- "{ Symbol: mapped } "
- "{ Symbol: destroyed } "
- "{ Symbol: terminate } "
- "{ Symbol: saveAndTerminate } "
- "{ Symbol: keyMapChange } "
- "{ Symbol: visibilityChange } "
- "{ Symbol: created } "
- "{ Symbol: mapRequest } "
- "{ Symbol: reparented } "
- "{ Symbol: configRequest } "
- "{ Symbol: resizeRequest } "
- "{ Symbol: propertyChange } "
- "{ Symbol: selectionClear } "
- "{ Symbol: selectionRequest } "
- "{ Symbol: selectionChange } "
- "{ Symbol: colorMapChange } "
-
- "{ Symbol: viewFromId: } "
-
- |theView etype ex ey ew eh ekey estate ebutton|
-
-%{
-#define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask)
-
- Display *dpy = myDpy;
- Window win, wWanted;
- XEvent ev;
- XAnyEvent *ae = (XAnyEvent *)&ev;
-#define ee ((XExposeEvent *)&ev)
-#define ke ((XKeyPressedEvent *)&ev)
-#define be ((XButtonPressedEvent *)&ev)
-#define ce ((XConfigureEvent *)&ev)
-#define me ((XMotionEvent *)&ev)
-#define ewe ((XEnterWindowEvent *)&ev)
-#define lwe ((XLeaveWindowEvent *)&ev)
-#define de ((XDestroyWindowEvent *)&ev)
- KeySym keySym;
- unsigned char buffer[10];
- int i, nchars;
- char *keySymString;
- static unsigned multiClickTime = 0;
- unsigned nextMultiClickTime;
- struct inlineCache *ip;
- OBJ xLatedKey, xLatedButton, sym, button;
-
- static struct inlineCache vid = _ILC1;
- static struct inlineCache gexp = _ILC4;
- static struct inlineCache nexp = _ILC0;
- static struct inlineCache conf = _ILC4;
- static struct inlineCache unmap = _ILC0;
- static struct inlineCache map = _ILC0;
- static struct inlineCache keymap = _ILC0;
- static struct inlineCache created = _ILC0;
- static struct inlineCache mapReq = _ILC0;
- static struct inlineCache repar = _ILC0;
- static struct inlineCache confReq = _ILC0;
- static struct inlineCache resReq = _ILC0;
- static struct inlineCache prop = _ILC0;
- static struct inlineCache selClear = _ILC0;
- static struct inlineCache selReq = _ILC0;
- static struct inlineCache selNotify = _ILC0;
- static struct inlineCache colormap = _ILC0;
- static struct inlineCache vis = _ILC0;
- static struct inlineCache term = _ILC0;
- static struct inlineCache savterm = _ILC0;
- static struct inlineCache destr = _ILC0;
-
- static struct inlineCache exp = _ILC5;
- static struct inlineCache kp = _ILC4;
- static struct inlineCache bp = _ILC4;
- static struct inlineCache bmp = _ILC4;
- static struct inlineCache bsp = _ILC4;
- static struct inlineCache br = _ILC4;
-
- static struct inlineCache mot = _ILC4;
- static struct inlineCache focIn = _ILC1;
- static struct inlineCache focOut = _ILC1;
- static struct inlineCache pe = _ILC4;
- static struct inlineCache pl = _ILC2;
-
- int savInt;
-
- do {
- /*
- * if an interrupt occurs during XNextEvent, handle it right now -
- * dont schedule in context
- */
- savInt = _immediateInterrupt;
- _immediateInterrupt = 1;
- if (_isSmallInteger(aViewIdOrNil)) {
- wWanted = _WindowVal(aViewIdOrNil);
- if (_isSmallInteger(eventMask))
- XWindowEvent(dpy, wWanted, _intVal(eventMask), &ev);
- else
- XWindowEvent(dpy, wWanted, ~0, &ev);
- } else {
- if (_isSmallInteger(eventMask))
- XMaskEvent(dpy, _intVal(eventMask), &ev);
- else
- XNextEvent(dpy, &ev);
- }
- _immediateInterrupt = savInt;
-
-#ifdef PASS_ARG_REF
- a1 = MKOBJ(ae->window);
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid, &a1);
-#else
- theView = (*vid.ilc_func)(self, _viewFromId_, CONARG nil, &vid, MKOBJ(ae->window));
-#endif
-#ifdef DEBUG
- if (theView == nil)
- printf("event for unknown view (WId = %x)\n", ae->window);
-#endif
- if (InterruptPending != nil) {
-#ifdef THIS_CONTEXT
- interrupt();
-#else
- interrupt(__context);
-#endif
- }
- } while (theView == nil);
-
- switch (ev.type) {
- case GraphicsExpose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_, CONARG nil, &gexp, &a1);
-#else
- (*gexp.ilc_func)(theView, _graphicExposeX_y_width_height_,
- CONARG nil, &gexp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height));
-#endif
- break;
-
- case NoExpose:
- (*nexp.ilc_func)(theView, _noExpose, CONARG nil, &nexp);
- break;
-
- case ConfigureNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ce->x);
- a2 = _MKSMALLINT(ce->y);
- a3 = _MKSMALLINT(ce->width);
- a4 = _MKSMALLINT(ce->height);
- (*conf.ilc_func)(theView, _configureX_y_width_height_, CONARG nil, &conf, &a1);
-#else
- (*conf.ilc_func)(theView, _configureX_y_width_height_,
- CONARG nil, &conf,
- _MKSMALLINT(ce->x),
- _MKSMALLINT(ce->y),
- _MKSMALLINT(ce->width),
- _MKSMALLINT(ce->height));
-#endif
- break;
-
- case Expose:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ee->x);
- a2 = _MKSMALLINT(ee->y);
- a3 = _MKSMALLINT(ee->width);
- a4 = _MKSMALLINT(ee->height);
- a5 = theView;
- (*exp.ilc_func)(eventDispatcher, _exposeX_y_width_height_view_, CONARG nil, &exp, &a1);
-#else
- (*exp.ilc_func)(eventDispatcher, _exposeX_y_width_height_view_,
- CONARG nil, &exp,
- _MKSMALLINT(ee->x),
- _MKSMALLINT(ee->y),
- _MKSMALLINT(ee->width),
- _MKSMALLINT(ee->height),
- theView);
-#endif
- break;
-
- /*
- * I do not support key-release
- * to press everyone NOT to use stuff which might not be
- * available on all machines ...
- */
- case KeyRelease:
- _INST(altDown) = (ke->state & Mod2Mask) ? true : false;
- _INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
- _INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
- _INST(controlDown) = (ke->state & ControlMask) ? true : false;
- break;
-
- case KeyPress:
- _INST(eventRootX) = _MKSMALLINT(ke->x_root);
- _INST(eventRootY) = _MKSMALLINT(ke->y_root);
-
- _INST(altDown) = (ke->state & Mod2Mask) ? true : false;
- _INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
- _INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
- _INST(controlDown) = (ke->state & ControlMask) ? true : false;
-
- nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
- if (nchars && (buffer[0] >= ' ') && (buffer[0] <= '~')) {
- xLatedKey = *_CharacterTable[buffer[0]];
- keySymString = NULL;
- } else {
- keySymString = XKeysymToString(keySym);
- if (keySymString) {
- if (keySymString[0] == 'D') {
- if (strcmp(keySymString, "Delete_line") == 0) {
- keySymString = "DeleteLine";
- } else if (strcmp(keySymString, "Delete_word") == 0) {
- keySymString = "DeleteWord";
- }
- }
-#ifdef ALT_KEY_KLUDGE
- if (strcmp(keySymString, "ssharp") == 0) {
- xLatedKey = *_CharacterTable['\\'];
- keySymString = NULL;
- }
-#endif
- }
- }
- if (keySymString) {
- /* make specials be characters */
- if (strcmp(keySymString, "udiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xFC];
- else if (strcmp(keySymString, "adiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xE4];
- else if (strcmp(keySymString, "odiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xF6];
- else if (strcmp(keySymString, "Udiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xDC];
- else if (strcmp(keySymString, "Adiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xC4];
- else if (strcmp(keySymString, "Odiaeresis") == 0)
- xLatedKey = *_CharacterTable[0xD6];
- else if (strcmp(keySymString, "ssharp") == 0)
- xLatedKey = *_CharacterTable[0xDF];
- else if (strcmp(keySymString, "section") == 0)
- xLatedKey = *_CharacterTable[0xA7];
- else if (strcmp(keySymString, "degree") == 0)
- xLatedKey = *_CharacterTable[0xB0];
- else if (strcmp(keySymString, "twosuperior") == 0)
- xLatedKey = *_CharacterTable[0xB2];
- else if (strcmp(keySymString, "threesuperior") == 0)
- xLatedKey = *_CharacterTable[0xB3];
- else if (strcmp(keySymString, "mu") == 0)
- xLatedKey = *_CharacterTable[0xB5];
- else
- xLatedKey = _MKSYMBOL(keySymString, (OBJ *)0, __context);
- }
-
-#ifdef PASS_ARG_REF
- a1 = xLatedKey;
- a2 = _MKSMALLINT(ke->x);
- a3 = _MKSMALLINT(ke->y);
- a4 = theView;
- (*kp.ilc_func)(eventDispatcher, _keyPress_x_y_view_, CONARG nil, &kp, &a1);
-#else
- (*kp.ilc_func)(eventDispatcher, _keyPress_x_y_view_, CONARG
- nil, &kp,
- xLatedKey,
- _MKSMALLINT(ke->x),
- _MKSMALLINT(ke->y),
- theView);
-#endif
- break;
-
- case ButtonPress:
- _INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) | (1 << be->button));
-
- if (_isSmallInteger(DeviceWorkstation_MultiClickTimeDelta))
- nextMultiClickTime = be->time + _intVal(DeviceWorkstation_MultiClickTimeDelta);
- else
- nextMultiClickTime = 0;
-
- if (multiClickTime) {
- if (be->time < multiClickTime) {
- multiClickTime = nextMultiClickTime;
- ip = &bmp;
- sym = _buttonMultiPress_x_y_view_;
- goto sendButtonEvent;
- }
- }
-
- multiClickTime = nextMultiClickTime;
- if (be->state & ShiftMask) {
- sym = _buttonShiftPress_x_y_view_;
- ip = &bsp;
- goto sendButtonEvent;
- }
-
- sym = _buttonPress_x_y_view_;
- ip = &bp;
- goto sendButtonEvent;
- /* NOT REACHED */
-
- case ButtonRelease:
- _INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) & ~(1 << be->button));
-
- sym = _buttonRelease_x_y_view_;
- ip = &br;
-
- sendButtonEvent:
-
- _INST(eventRootX) = _MKSMALLINT(be->x_root);
- _INST(eventRootY) = _MKSMALLINT(be->y_root);
-
- button = _MKSMALLINT(be->button);
-#ifdef PASS_ARG_REF
- button = _AT_(DeviceWorkstation_ButtonTranslation, &button);
-#else
- button = _AT_(DeviceWorkstation_ButtonTranslation, button);
-#endif
-
-#ifdef PASS_ARG_REF
- a1 = button;
- a2 = _MKSMALLINT(be->x);
- a3 = _MKSMALLINT(be->y);
- a4 = theView;
- (*(*ip).ilc_func)(eventDispatcher, sym, CONARG nil, ip, &a1);
-#else
- (*(*ip).ilc_func)(eventDispatcher, sym, CONARG nil, ip,
- button,
- _MKSMALLINT(be->x),
- _MKSMALLINT(be->y),
- theView);
-#endif
- break;
-
- case MotionNotify:
- if (_INST(motionEventCompression) != false) {
- while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, &ev)) ;;
- }
-
- _INST(eventRootX) = _MKSMALLINT(me->x_root);
- _INST(eventRootY) = _MKSMALLINT(me->y_root);
-
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(me->state);
- a2 = _MKSMALLINT(me->x);
- a3 = _MKSMALLINT(me->y);
- a4 = theView;
- (*mot.ilc_func)(eventDispatcher, _buttonMotion_x_y_view_, CONARG nil, &mot, &a1);
-#else
- (*mot.ilc_func)(eventDispatcher, _buttonMotion_x_y_view_,
- CONARG nil, &mot,
- _MKSMALLINT(me->state),
- _MKSMALLINT(me->x),
- _MKSMALLINT(me->y),
- theView);
-#endif
- break;
-
- case FocusIn:
-#ifdef PASS_ARG_REF
- (*focIn.ilc_func)(eventDispatcher, _focusInView_, CONARG nil, &focIn, &theView);
-#else
- (*focIn.ilc_func)(eventDispatcher, _focusInView_, CONARG nil, &focIn, theView);
-#endif
- break;
-
- case FocusOut:
-#ifdef PASS_ARG_REF
- (*focOut.ilc_func)(eventDispatcher, _focusOutView_, CONARG nil, &focOut, &theView);
-#else
- (*focOut.ilc_func)(eventDispatcher, _focusOutView_, CONARG nil, &focOut, theView);
-#endif
- break;
-
- case EnterNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(ewe->state);
- a2 = _MKSMALLINT(ewe->x);
- a3 = _MKSMALLINT(ewe->y);
- a4 = theView;
- (*pe.ilc_func)(eventDispatcher, _pointerEnter_x_y_view_, CONARG nil, &pe, &a1);
-#else
- (*pe.ilc_func)(eventDispatcher, _pointerEnter_x_y_view_,
- CONARG nil, &pe,
- _MKSMALLINT(ewe->state),
- _MKSMALLINT(ewe->x),
- _MKSMALLINT(ewe->y),
- theView);
-#endif
- break;
-
- case LeaveNotify:
-#ifdef PASS_ARG_REF
- a1 = _MKSMALLINT(lwe->state);
- a2 = theView;
- (*pl.ilc_func)(eventDispatcher, _pointerLeave_view_, CONARG nil, &pl, &a1);
-#else
- (*pl.ilc_func)(eventDispatcher, _pointerLeave_view_,
- CONARG nil, &pl,
- _MKSMALLINT(lwe->state),
- theView);
-#endif
- break;
-
- case ClientMessage:
- if (ev.xclient.message_type == _intVal(_INST(ProtocolsAtom))) {
- if (ev.xclient.data.l[0] == _intVal(_INST(DeleteWindowAtom))) {
- (*term.ilc_func)(theView, _terminate, CONARG nil, &term);
- break;
- }
- if (ev.xclient.data.l[0] == _intVal(_INST(SaveYourselfAtom))) {
- (*savterm.ilc_func)(theView, _saveAndTerminate, CONARG nil, &term);
- break;
- }
- }
- break;
-
- case DestroyNotify:
- (*destr.ilc_func)(theView, _destroyed, CONARG nil, &destr);
- break;
-
- case UnmapNotify:
- (*unmap.ilc_func)(theView, _unmapped, CONARG nil, &unmap);
- break;
-
- case MapNotify:
- (*map.ilc_func)(theView, _mapped, CONARG nil, &map);
- break;
-
- case KeymapNotify:
- (*keymap.ilc_func)(theView, _keyMapChange, CONARG nil, &keymap);
- break;
-
- case VisibilityNotify:
- (*vis.ilc_func)(theView, _visibilityChange, CONARG nil, &vis);
- break;
-
- case CreateNotify:
- (*created.ilc_func)(theView, _created, CONARG nil, &created);
- break;
-
- case MapRequest:
- (*mapReq.ilc_func)(theView, _mapRequest, CONARG nil, &mapReq);
- break;
-
- case ReparentNotify:
- (*repar.ilc_func)(theView, _reparented, CONARG nil, &repar);
- break;
-
- case ConfigureRequest:
- (*confReq.ilc_func)(theView, _configRequest, CONARG nil, &confReq);
- break;
-
- case ResizeRequest:
- (*resReq.ilc_func)(theView, _resizeRequest, CONARG nil, &resReq);
- break;
-
- case GravityNotify:
- case CirculateNotify:
- case CirculateRequest:
- break;
-
- case PropertyNotify:
- (*prop.ilc_func)(theView, _propertyChange, CONARG nil, &prop);
- break;
-
- case SelectionClear:
- (*selClear.ilc_func)(theView, _selectionClear, CONARG nil, &selClear);
- break;
-
- case SelectionRequest:
- (*selReq.ilc_func)(theView, _selectionRequest, CONARG nil, &selReq);
- break;
-
- case SelectionNotify:
- (*selNotify.ilc_func)(theView, _selectionChange, CONARG nil, &selNotify);
- break;
-
- case ColormapNotify:
- (*colormap.ilc_func)(theView, _colorMapChange, CONARG nil, &colormap);
- break;
-
- case MappingNotify:
- break;
- }
-#undef ee
-#undef ke
-#undef be
-#undef ce
-#undef me
-#undef ewe
-#undef lwe
-#undef de
-%}
+ ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowId
! !