XWorkstation.st
changeset 135 cf8e46015072
parent 133 ca8ce3916382
child 143 b237b9013f51
equal deleted inserted replaced
134:1a09a1d7d28d 135:cf8e46015072
    21 			      stringAtom lengthAtom
    21 			      stringAtom lengthAtom
    22 			      listOfXFonts buttonsPressed
    22 			      listOfXFonts buttonsPressed
    23 			      eventRootX eventRootY
    23 			      eventRootX eventRootY
    24 			      displayName eventTrace
    24 			      displayName eventTrace
    25 			      dispatchingExpose
    25 			      dispatchingExpose
    26 			      rgbVisual virtualRootId'
    26 			      rgbVisual virtualRootId
       
    27 			      eventBuffer'
    27        classVariableNames:   ''
    28        classVariableNames:   ''
    28        poolDictionaries:''
    29        poolDictionaries:''
    29        category:'Interface-Graphics'
    30        category:'Interface-Graphics'
    30 !
    31 !
    31 
    32 
    32 XWorkstation comment:'
    33 XWorkstation comment:'
    33 COPYRIGHT (c) 1989 by Claus Gittinger
    34 COPYRIGHT (c) 1989 by Claus Gittinger
    34 	      All Rights Reserved
    35 	      All Rights Reserved
    35 
    36 
    36 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.40 1995-04-11 15:55:56 claus Exp $
    37 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.41 1995-05-03 00:27:22 claus Exp $
    37 '!
    38 '!
    38 
    39 
    39 !XWorkstation class methodsFor:'documentation'!
    40 !XWorkstation class methodsFor:'documentation'!
    40 
    41 
    41 copyright
    42 copyright
    52 "
    53 "
    53 !
    54 !
    54 
    55 
    55 version
    56 version
    56 "
    57 "
    57 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.40 1995-04-11 15:55:56 claus Exp $
    58 $Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.41 1995-05-03 00:27:22 claus Exp $
    58 "
    59 "
    59 !
    60 !
    60 
    61 
    61 documentation
    62 documentation
    62 "
    63 "
   195 ! !
   196 ! !
   196 
   197 
   197 !XWorkstation primitiveVariables!
   198 !XWorkstation primitiveVariables!
   198 
   199 
   199 %{
   200 %{
   200 static XEvent __ev__;
       
   201 
       
   202 /*
   201 /*
   203  * a private error handler
   202  * a private error handler
   204  */
   203  */
   205 static char lastErrorMsg[80] = "";
   204 static char lastErrorMsg[80] = "";
   206 static unsigned lastRequestCode = 0;
   205 static unsigned lastRequestCode = 0;
   292 }
   291 }
   293 #endif
   292 #endif
   294 %}
   293 %}
   295 ! !
   294 ! !
   296 
   295 
   297 !XWorkstation class methodsFor:'initialization'!
       
   298 
       
   299 initialize
       
   300     self initializeConstants.
       
   301 ! !
       
   302 
       
   303 !XWorkstation class methodsFor:'error handling'!
   296 !XWorkstation class methodsFor:'error handling'!
   304 
   297 
   305 debug:aBoolean
   298 debug:aBoolean
   306 %{  /* NOCONTEXT */
   299 %{  /* NOCONTEXT */
   307 
   300 
   334 %{
   327 %{
   335     RETURN ( _MKSTRING(lastErrorMsg, __context) );
   328     RETURN ( _MKSTRING(lastErrorMsg, __context) );
   336 %}
   329 %}
   337 !
   330 !
   338 
   331 
   339 lastError
   332 lastErrorString
   340     "return the last X-error string - 
   333     "return the last X-error string - 
   341      when buffering is on, this may be
   334      when buffering is on, this may be
   342      an error for a long-ago operation"
   335      an error for a long-ago operation"
   343 
   336 
   344     |string requestCode s match line|
   337     |string requestCode s match line|
   372     |dpyName index|
   365     |dpyName index|
   373 
   366 
   374     dpyName := aDisplayName.
   367     dpyName := aDisplayName.
   375     dpyName isNil ifTrue:[
   368     dpyName isNil ifTrue:[
   376 	"look for a '-display xxx' argument"
   369 	"look for a '-display xxx' argument"
   377 	index := Arguments indexOf:'-display'.
   370 	Arguments notNil ifTrue:[
   378 	(index between:1 and:(Arguments size - 1)) ifTrue:[
   371 	    index := Arguments indexOf:'-display'.
   379 	    dpyName := Arguments at:index+1
   372 	    (index between:1 and:(Arguments size - 1)) ifTrue:[
       
   373 	        dpyName := Arguments at:index+1
       
   374 	    ]
   380 	]
   375 	]
   381     ].
   376     ].
   382 %{
   377 %{
   383     int scr;
   378     int scr;
   384     Display *dpy;
   379     Display *dpy;
   419 	_INST(height) = _MKSMALLINT(DisplayHeight(dpy, scr));
   414 	_INST(height) = _MKSMALLINT(DisplayHeight(dpy, scr));
   420 	_INST(widthMM) = _MKSMALLINT(DisplayWidthMM(dpy, scr));
   415 	_INST(widthMM) = _MKSMALLINT(DisplayWidthMM(dpy, scr));
   421 	_INST(heightMM) = _MKSMALLINT(DisplayHeightMM(dpy, scr));
   416 	_INST(heightMM) = _MKSMALLINT(DisplayHeightMM(dpy, scr));
   422 	_INST(blackpixel) = _MKSMALLINT(BlackPixel(dpy, scr));
   417 	_INST(blackpixel) = _MKSMALLINT(BlackPixel(dpy, scr));
   423 	_INST(whitepixel) = _MKSMALLINT(WhitePixel(dpy, scr));
   418 	_INST(whitepixel) = _MKSMALLINT(WhitePixel(dpy, scr));
       
   419 
   424 #ifdef SHAPE
   420 #ifdef SHAPE
   425 	if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase))
   421 	if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase))
   426 	    _INST(hasShapeExtension) = true;
   422 	    _INST(hasShapeExtension) = true;
   427 	else
   423 	else
   428 #else
   424 #endif
   429 	_INST(hasShapeExtension) = false;
   425 	_INST(hasShapeExtension) = false;
   430 #endif
   426 
   431 #ifdef SHM
   427 #ifdef SHM
   432 	if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase))
   428 	if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase))
   433 	    _INST(hasShmExtension) = true;
   429 	    _INST(hasShmExtension) = true;
   434 	else
   430 	else
   435 #else
   431 #endif
   436 	_INST(hasShmExtension) = false;
   432 	_INST(hasShmExtension) = false;
   437 #endif
   433 
   438 #ifdef FAX
   434 #ifdef FAX
   439 	if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase))
   435 	if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase))
   440 	    _INST(hasFaxExtension) = true;
   436 	    _INST(hasFaxExtension) = true;
   441 	else
   437 	else
   442 #else
   438 #endif
   443 	_INST(hasFaxExtension) = false;
   439 	_INST(hasFaxExtension) = false;
   444 #endif
   440 
   445 #ifdef DPS
   441 #ifdef DPS
   446 	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
   442 	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
   447 	    _INST(hasDPSExtension) = true;
   443 	    _INST(hasDPSExtension) = true;
   448 	else
   444 	else
   449 #else
   445 #endif
   450 	_INST(hasDPSExtension) = false;
   446 	_INST(hasDPSExtension) = false;
   451 #endif
       
   452 	/*
       
   453 	 * this is a kludge around a bug in the X11/NeWS server,
       
   454 	 * which does not correctly handle saveUnder
       
   455 	 */
       
   456 	if (strncmp(XServerVendor(dpy), "X11/NeWS", 8) == 0) {
       
   457 	    _INST(hasSaveUnder) = false;
       
   458 	} else
       
   459 	    _INST(hasSaveUnder) = true;
       
   460 
   447 
   461 	/*
   448 	/*
   462 	 * look for RGB visual
   449 	 * look for RGB visual
   463 	 */
   450 	 */
   464 	nvi = 0;
   451 	nvi = 0;
   585     protocolsAtom := nil.
   572     protocolsAtom := nil.
   586     deleteWindowAtom := nil.
   573     deleteWindowAtom := nil.
   587     saveYourselfAtom := nil.
   574     saveYourselfAtom := nil.
   588     quitAppAtom := nil.
   575     quitAppAtom := nil.
   589 
   576 
       
   577     self initializeEventBuffer.
       
   578     self initializeSpecialFlags.
   590     self initializeKeyboardMap.
   579     self initializeKeyboardMap.
   591 
   580 
   592     ObjectMemory errorInterruptHandler:self class.
   581     ObjectMemory errorInterruptHandler:self class.
       
   582 !
       
   583 
       
   584 initializeEventBuffer
       
   585     |sz|
       
   586 
       
   587 %{
       
   588     sz = _MKSMALLINT(sizeof(XEvent) + 100);
       
   589 %}.
       
   590     eventBuffer := ByteArray new:sz.
       
   591 !
       
   592 
       
   593 initializeSpecialFlags
       
   594     "perform additional special server implementation flags"
       
   595 
       
   596     "/
       
   597     "/ assume we have it ... (should check)
       
   598     "/
       
   599     hasSaveUnder := true.
       
   600     ignoreBackingStore := false.
       
   601 
       
   602     (self serverVendor = 'X11/NeWS') ifTrue:[
       
   603 	"/
       
   604 	"/ this is a kludge around a bug in the X11/NeWS server,
       
   605 	"/ which does not correctly handle saveUnder
       
   606 	"/
       
   607 	hasSaveUnder := false.
       
   608     ].
   593 !
   609 !
   594 
   610 
   595 close
   611 close
   596     "close down the connection to the X-server"
   612     "close down the connection to the X-server"
   597 
   613 
  1013 	y2 = _MKSMALLINT(ypos);
  1029 	y2 = _MKSMALLINT(ypos);
  1014     }
  1030     }
  1015 %}.
  1031 %}.
  1016 
  1032 
  1017     ^ (x2 @ y2)
  1033     ^ (x2 @ y2)
       
  1034 !
       
  1035 
       
  1036 rootView
       
  1037     rootView isNil ifTrue:[
       
  1038 	rootView := DisplayRootView on:self
       
  1039     ].
       
  1040     ^ rootView
       
  1041 
       
  1042     "
       
  1043      |v|
       
  1044      v := Display rootView.
       
  1045      v paint:Color red.
       
  1046      v noClipByChildren.
       
  1047      v fillRectangleX:10 y:10 width:100 height:100.  
       
  1048     "
  1018 ! !
  1049 ! !
  1019 
  1050 
  1020 !XWorkstation methodsFor:'bitmap/window creation'!
  1051 !XWorkstation methodsFor:'bitmap/window creation'!
  1021 
  1052 
  1022 createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst
  1053 createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst
  1203 	} else {
  1234 	} else {
  1204 	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
  1235 	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
  1205 	    if (! cp) goto fail;
  1236 	    if (! cp) goto fail;
  1206 	}
  1237 	}
  1207         
  1238         
  1208 	if (_qClass(anArray) == Array) {
  1239 	if (__qClass(anArray) == Array) {
  1209 	    index = 1;
  1240 	    index = 1;
  1210 	    op = &(_ArrayInstPtr(anArray)->a_element[index - 1]);
  1241 	    op = &(_ArrayInstPtr(anArray)->a_element[index - 1]);
  1211 	    for (row = b_height; row; row--) {
  1242 	    for (row = b_height; row; row--) {
  1212 		for (col = bytesPerRow; col; col--) {
  1243 		for (col = bytesPerRow; col; col--) {
  1213 		    num = *op++;
  1244 		    num = *op++;
  1215 		    bits = _intVal(num);
  1246 		    bits = _intVal(num);
  1216 		    *cp++ = reverseBitTable[bits];
  1247 		    *cp++ = reverseBitTable[bits];
  1217 		}
  1248 		}
  1218 	    }
  1249 	    }
  1219 	} else {
  1250 	} else {
  1220 	    if (_qClass(anArray) == ByteArray) {
  1251 	    if (__qClass(anArray) == ByteArray) {
  1221 		pBits = _ByteArrayInstPtr(anArray)->ba_element;
  1252 		pBits = _ByteArrayInstPtr(anArray)->ba_element;
  1222 		for (col = b_height*bytesPerRow; col; col--) {
  1253 		for (col = b_height*bytesPerRow; col; col--) {
  1223 		    *cp++ = reverseBitTable[*pBits++];
  1254 		    *cp++ = reverseBitTable[*pBits++];
  1224 		}
  1255 		}
  1225 	    } else {
  1256 	    } else {
  2728 	    len = XTextWidth(f, cp, n);
  2759 	    len = XTextWidth(f, cp, n);
  2729 	    END_INTERRUPTSBLOCKED
  2760 	    END_INTERRUPTSBLOCKED
  2730 	    RETURN ( _MKSMALLINT(len) );
  2761 	    RETURN ( _MKSMALLINT(len) );
  2731 	}
  2762 	}
  2732 #ifdef TWOBYTESTRINGS
  2763 #ifdef TWOBYTESTRINGS
  2733 	if (_Class(aString) == TwoByteString) {
  2764 	if (__Class(aString) == TwoByteString) {
  2734 	    n = _byteArraySize(aString) / 2;
  2765 	    n = _byteArraySize(aString) / 2;
  2735 	    cp = (char *) _stringVal(aString);
  2766 	    cp = (char *) _stringVal(aString);
  2736 	    BEGIN_INTERRUPTSBLOCKED
  2767 	    BEGIN_INTERRUPTSBLOCKED
  2737 	    len = XTextWidth16(f, (XChar2b *)cp, n);
  2768 	    len = XTextWidth16(f, (XChar2b *)cp, n);
  2738 	    END_INTERRUPTSBLOCKED
  2769 	    END_INTERRUPTSBLOCKED
  2772 		END_INTERRUPTSBLOCKED
  2803 		END_INTERRUPTSBLOCKED
  2773 		RETURN ( _MKSMALLINT(len) );
  2804 		RETURN ( _MKSMALLINT(len) );
  2774 	    }
  2805 	    }
  2775 	}
  2806 	}
  2776 #ifdef TWOBYTESTRINGS
  2807 #ifdef TWOBYTESTRINGS
  2777 	if (_Class(aString) == TwoByteString) {
  2808 	if (__Class(aString) == TwoByteString) {
  2778 	    cp = (char *) _stringVal(aString);
  2809 	    cp = (char *) _stringVal(aString);
  2779 	    n = _byteArraySize(aString) / 2;
  2810 	    n = _byteArraySize(aString) / 2;
  2780 	    if ((i1 >= 0) && (i2 >= i1) && (i2 < n)) {
  2811 	    if ((i1 >= 0) && (i2 >= i1) && (i2 < n)) {
  2781 		cp += (i1 * 2);
  2812 		cp += (i1 * 2);
  2782 		BEGIN_INTERRUPTSBLOCKED
  2813 		BEGIN_INTERRUPTSBLOCKED
  4629 #endif
  4660 #endif
  4630 
  4661 
  4631     if (__bothSmallInteger(aGCId, aDrawableId)
  4662     if (__bothSmallInteger(aGCId, aDrawableId)
  4632      && __isNonNilObject(aString)
  4663      && __isNonNilObject(aString)
  4633      && __bothSmallInteger(x, y)) {
  4664      && __bothSmallInteger(x, y)) {
  4634 	cls = _qClass(aString);
  4665 	cls = __qClass(aString);
  4635 	if ((cls == String) || (cls == Symbol)) {
  4666 	if ((cls == String) || (cls == Symbol)) {
  4636 	    cp = _stringVal(aString);
  4667 	    cp = _stringVal(aString);
  4637 	    n = _stringSize(aString);
  4668 	    n = _stringSize(aString);
  4638 	    if (n > 1000) n = 1000;
  4669 	    if (n > 1000) n = 1000;
  4639 	    if (opaque == true)
  4670 	    if (opaque == true)
  4678 
  4709 
  4679     if (__bothSmallInteger(aGCId, aDrawableId)
  4710     if (__bothSmallInteger(aGCId, aDrawableId)
  4680      && __isNonNilObject(aString)
  4711      && __isNonNilObject(aString)
  4681      && __bothSmallInteger(index1, index2)
  4712      && __bothSmallInteger(index1, index2)
  4682      && __bothSmallInteger(x, y)) {
  4713      && __bothSmallInteger(x, y)) {
  4683 	cls = _qClass(aString);
  4714 	cls = __qClass(aString);
  4684 	if ((cls == String) || (cls == Symbol)) {
  4715 	if ((cls == String) || (cls == Symbol)) {
  4685 	    i1 = _intVal(index1) - 1;
  4716 	    i1 = _intVal(index1) - 1;
  4686 	    i2 = _intVal(index2) - 1;
  4717 	    i2 = _intVal(index2) - 1;
  4687 	    n = _stringSize(aString);
  4718 	    n = _stringSize(aString);
  4688 	    cp = _stringVal(aString);
  4719 	    cp = _stringVal(aString);
  5339 
  5370 
  5340     knownViews isEmpty ifTrue:[
  5371     knownViews isEmpty ifTrue:[
  5341 	dispatching := false.
  5372 	dispatching := false.
  5342 	^ self
  5373 	^ self
  5343     ].
  5374     ].
  5344     ((knownViews size == 1) and:[(knownViews at:1) == RootView]) ifTrue:[
  5375     ((knownViews size == 1) and:[(knownViews at:1) == rootView]) ifTrue:[
  5345 	dispatching := false.
  5376 	dispatching := false.
  5346     ]
  5377     ]
  5347 !
  5378 !
  5348 
  5379 
  5349 dispatchPendingEvents
  5380 dispatchPendingEvents
  5401 	]
  5432 	]
  5402     ].
  5433     ].
  5403 !
  5434 !
  5404 
  5435 
  5405 getEventFor:aViewIdOrNil withMask:eventMask
  5436 getEventFor:aViewIdOrNil withMask:eventMask
  5406     "read next event - put into local buffer. If aViewIdOrNil is
  5437     "read next event - put into local eventBuffer. 
  5407      nil, events for any view are fetched; otherwise only events for that
  5438      If aViewIdOrNil is nil, events for any view are fetched; 
  5408      view will be processed.
  5439      otherwise only events for that specific view will be fetched.
       
  5440      Returns true, if there was an event, false otherwise.
       
  5441      This method may block - so you better check for pending events
       
  5442      before calling for it.
  5409 
  5443 
  5410      Sorry I had to split dispatch into this fetch method and an extra
  5444      Sorry I had to split dispatch into this fetch method and an extra
  5411      handle method to allow unlimitedstack here.
  5445      handle method to allow unlimitedstack here.
  5412      (some Xlibs do a big alloca there ...) which cannot be done in 
  5446      (some Xlibs do a big alloca there ...) which cannot be done in 
  5413      dispatchLastEvent, since it dispatches out into ST-methods.
  5447      dispatchLastEvent, since it dispatches out into ST-methods.
  5418 %{  /* UNLIMITEDSTACK */
  5452 %{  /* UNLIMITEDSTACK */
  5419 
  5453 
  5420     Display *dpy = myDpy;
  5454     Display *dpy = myDpy;
  5421     Window win, wWanted;
  5455     Window win, wWanted;
  5422     int evMask;
  5456     int evMask;
  5423 
  5457     OBJ eB;
  5424     __ev__.type = 0;
  5458     XEvent *ev;
       
  5459 
       
  5460     eB = _INST(eventBuffer);
       
  5461     if (__isByteArray(eB)) {
       
  5462 	ev = (XEvent *)(_ByteArrayInstPtr(eB)->ba_element);
       
  5463     } else {
       
  5464 	printf("DISPLAY: no eventBuffer\n");
       
  5465 	RETURN (false);
       
  5466     }
       
  5467     ev->type = 0;
  5425 
  5468 
  5426     if (__isSmallInteger(eventMask)) {
  5469     if (__isSmallInteger(eventMask)) {
  5427 	evMask = _intVal(eventMask);
  5470 	evMask = _intVal(eventMask);
  5428     } else {
  5471     } else {
  5429 	evMask = ~0;
  5472 	evMask = ~0;
  5430     }
  5473     }
  5431 
  5474 
  5432     if (__isSmallInteger(aViewIdOrNil)) {
  5475     if (__isSmallInteger(aViewIdOrNil)) {
  5433 	wWanted = _WindowVal(aViewIdOrNil);
  5476 	wWanted = _WindowVal(aViewIdOrNil);
  5434 	if (XCheckWindowEvent(dpy, wWanted, evMask, &__ev__)) {
  5477 	if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) {
  5435 	    RETURN ( true );
  5478 	    RETURN ( true );
  5436 	}
  5479 	}
  5437     } else {
  5480     } else {
  5438 	if (evMask == ~0) {
  5481 	if (evMask == ~0) {
  5439 	    XNextEvent(dpy, &__ev__);
  5482 	    XNextEvent(dpy, ev);
  5440 	    RETURN (true);
  5483 	    RETURN (true);
  5441 	}
  5484 	}
  5442 	if (XCheckMaskEvent(dpy, evMask, &__ev__)) {
  5485 	if (XCheckMaskEvent(dpy, evMask, ev)) {
  5443 	   RETURN (true);
  5486 	   RETURN (true);
  5444 	}
  5487 	}
  5445     }
  5488     }
  5446 %}.
  5489 %}.
  5447     ^ false
  5490     ^ false
  5452 
  5495 
  5453 %{  /* STACK: 8000 */
  5496 %{  /* STACK: 8000 */
  5454 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
  5497 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
  5455 
  5498 
  5456     Display *dpy = myDpy;
  5499     Display *dpy = myDpy;
  5457 
  5500     OBJ eB;
  5458     XAnyEvent *ae = (XAnyEvent *)&__ev__;
  5501     XEvent *ev;
  5459 #   define ee ((XExposeEvent *)&__ev__)
  5502 
  5460 #   define ke ((XKeyPressedEvent *)&__ev__)
  5503 #   define ae ((XAnyEvent *)ev)
  5461 #   define be ((XButtonPressedEvent *)&__ev__)
  5504 #   define ee ((XExposeEvent *)ev)
  5462 #   define ce ((XConfigureEvent *)&__ev__)
  5505 #   define ke ((XKeyPressedEvent *)ev)
  5463 #   define me ((XMotionEvent *)&__ev__)
  5506 #   define be ((XButtonPressedEvent *)ev)
  5464 #   define ewe ((XEnterWindowEvent *)&__ev__)
  5507 #   define ce ((XConfigureEvent *)ev)
  5465 #   define lwe ((XLeaveWindowEvent *)&__ev__)
  5508 #   define me ((XMotionEvent *)ev)
  5466 #   define de ((XDestroyWindowEvent *)&__ev__)
  5509 #   define ewe ((XEnterWindowEvent *)ev)
  5467 #   define ve ((XVisibilityEvent *)&__ev__)
  5510 #   define lwe ((XLeaveWindowEvent *)ev)
       
  5511 #   define de ((XDestroyWindowEvent *)ev)
       
  5512 #   define ve ((XVisibilityEvent *)ev)
       
  5513 
  5468     KeySym keySym;
  5514     KeySym keySym;
  5469     unsigned char buffer[10];
  5515     unsigned char buffer[10];
  5470     int i, nchars;
  5516     int i, nchars;
  5471     char *keySymString;
  5517     char *keySymString;
  5472     char keySymStringBuffer[32];
  5518     char keySymStringBuffer[32];
  5510     static struct inlineCache vis = _ILC1;
  5556     static struct inlineCache vis = _ILC1;
  5511 
  5557 
  5512     static struct inlineCache skpS = _ILC4;
  5558     static struct inlineCache skpS = _ILC4;
  5513     static struct inlineCache skrS = _ILC4;
  5559     static struct inlineCache skrS = _ILC4;
  5514 
  5560 
       
  5561     eB = _INST(eventBuffer);
       
  5562     if (__isByteArray(eB)) {
       
  5563 	ev = (XEvent *)(_ByteArrayInstPtr(eB)->ba_element);
       
  5564     } else {
       
  5565 	printf("DISPLAY: no eventBuffer\n");
       
  5566 	RETURN (false);
       
  5567     }
       
  5568 
  5515     theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, 
  5569     theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, 
  5516 			      MKOBJ(ae->window));
  5570 			      MKOBJ(ae->window));
  5517 
  5571 
  5518     if (theView == nil) {
  5572     if (theView == nil) {
  5519 	RETURN (nil);
  5573 	RETURN (nil);
  5530      * sensor and delegate get view as additional argument
  5584      * sensor and delegate get view as additional argument
  5531      * all of this has been taken out of here to corresponding methods
  5585      * all of this has been taken out of here to corresponding methods
  5532      * in DeviceWorkstation.
  5586      * in DeviceWorkstation.
  5533      */
  5587      */
  5534 
  5588 
  5535     switch (__ev__.type) {
  5589     switch (ev->type) {
  5536 	case KeyRelease:
  5590 	case KeyRelease:
  5537 	    symS = @symbol(keyRelease:x:y:view:);
  5591 	    symS = @symbol(keyRelease:x:y:view:);
  5538 	    ipS = &skrS;
  5592 	    ipS = &skrS;
  5539 	    goto keyPressAndRelease;
  5593 	    goto keyPressAndRelease;
  5540 	    break;
  5594 	    break;
  5660 			       theView);
  5714 			       theView);
  5661 	    break;
  5715 	    break;
  5662 
  5716 
  5663 	case MotionNotify:
  5717 	case MotionNotify:
  5664 	    if (_INST(motionEventCompression) != false) {
  5718 	    if (_INST(motionEventCompression) != false) {
  5665 		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, &__ev__)) ;;
  5719 		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
  5666 	    }
  5720 	    }
  5667 
  5721 
  5668 	    _INST(eventRootX) = _MKSMALLINT(me->x_root);
  5722 	    _INST(eventRootX) = _MKSMALLINT(me->x_root);
  5669 	    _INST(eventRootY) = _MKSMALLINT(me->y_root);
  5723 	    _INST(eventRootY) = _MKSMALLINT(me->y_root);
  5670 
  5724 
  5765 				    sibling);
  5819 				    sibling);
  5766 	    }
  5820 	    }
  5767 	    break;
  5821 	    break;
  5768 
  5822 
  5769 	case ClientMessage:
  5823 	case ClientMessage:
  5770 	    if (__ev__.xclient.message_type == (int) _AtomVal(_INST(protocolsAtom))) {
  5824 	    if (ev->xclient.message_type == (int) _AtomVal(_INST(protocolsAtom))) {
  5771 		if ((__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(quitAppAtom)))
  5825 		if ((ev->xclient.data.l[0] == (int) _AtomVal(_INST(quitAppAtom)))
  5772 		 || (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(deleteWindowAtom)))) {
  5826 		 || (ev->xclient.data.l[0] == (int) _AtomVal(_INST(deleteWindowAtom)))) {
  5773 		    (*termS.ilc_func)(self, 
  5827 		    (*termS.ilc_func)(self, 
  5774 				      @symbol(terminateView:)
  5828 				      @symbol(terminateView:)
  5775 				      COMMA_CON, nil, &termS, theView);
  5829 				      COMMA_CON, nil, &termS, theView);
  5776 		    break;
  5830 		    break;
  5777 		}
  5831 		}
  5778 		if (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(saveYourselfAtom))) {
  5832 		if (ev->xclient.data.l[0] == (int) _AtomVal(_INST(saveYourselfAtom))) {
  5779 		    (*savtermS.ilc_func)(self, 
  5833 		    (*savtermS.ilc_func)(self, 
  5780 					 @symbol(saveAndTerminateView:)
  5834 					 @symbol(saveAndTerminateView:)
  5781 					 COMMA_CON, nil, &savtermS, theView);
  5835 					 COMMA_CON, nil, &savtermS, theView);
  5782 		    break;
  5836 		    break;
  5783 		}
  5837 		}
  5854 
  5908 
  5855 	case SelectionClear:
  5909 	case SelectionClear:
  5856 	    (*selClear.ilc_func)(theView, 
  5910 	    (*selClear.ilc_func)(theView, 
  5857 				 @symbol(selectionClear:) 
  5911 				 @symbol(selectionClear:) 
  5858 				 COMMA_CON, nil, &selClear,
  5912 				 COMMA_CON, nil, &selClear,
  5859 				 MKOBJ(__ev__.xselectionclear.selection));
  5913 				 MKOBJ(ev->xselectionclear.selection));
  5860 	    break;
  5914 	    break;
  5861 
  5915 
  5862 	case SelectionNotify:
  5916 	case SelectionNotify:
  5863 	    /*
  5917 	    /*
  5864 	     * returned selection value (answer from SelectionRequest)
  5918 	     * returned selection value (answer from SelectionRequest)
  5865 	     */
  5919 	     */
  5866 	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
  5920 	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
  5867 			__ev__.xselection.property, __ev__.xselection.target,
  5921 			ev->xselection.property, ev->xselection.target,
  5868 			__ev__.xselection.selection, __ev__.xselection.requestor));
  5922 			ev->xselection.selection, ev->xselection.requestor));
  5869 
  5923 
  5870 	    (*selNotify.ilc_func)(theView, 
  5924 	    (*selNotify.ilc_func)(theView, 
  5871 				  @symbol(selectionNotify:target:selection:from:) 
  5925 				  @symbol(selectionNotify:target:selection:from:) 
  5872 				  COMMA_CON, nil, &selNotify,
  5926 				  COMMA_CON, nil, &selNotify,
  5873 				  MKOBJ(__ev__.xselection.property),
  5927 				  MKOBJ(ev->xselection.property),
  5874 				  MKOBJ(__ev__.xselection.target),
  5928 				  MKOBJ(ev->xselection.target),
  5875 				  MKOBJ(__ev__.xselection.selection),
  5929 				  MKOBJ(ev->xselection.selection),
  5876 				  MKOBJ(__ev__.xselection.requestor));
  5930 				  MKOBJ(ev->xselection.requestor));
  5877 	    break;
  5931 	    break;
  5878 
  5932 
  5879 	case SelectionRequest:
  5933 	case SelectionRequest:
  5880 	    /*
  5934 	    /*
  5881 	     * someone wants the selection
  5935 	     * someone wants the selection
  5882 	     */
  5936 	     */
  5883 	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
  5937 	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
  5884 			__ev__.xselectionrequest.property,
  5938 			ev->xselectionrequest.property,
  5885 			__ev__.xselectionrequest.target,
  5939 			ev->xselectionrequest.target,
  5886 			__ev__.xselectionrequest.selection,
  5940 			ev->xselectionrequest.selection,
  5887 			__ev__.xselectionrequest.requestor));
  5941 			ev->xselectionrequest.requestor));
  5888 
  5942 
  5889 	    (*selReq.ilc_func)(theView, 
  5943 	    (*selReq.ilc_func)(theView, 
  5890 			       @symbol(selectionRequest:target:selection:from:) 
  5944 			       @symbol(selectionRequest:target:selection:from:) 
  5891 			       COMMA_CON, nil, &selReq,
  5945 			       COMMA_CON, nil, &selReq,
  5892 			       MKOBJ(__ev__.xselectionrequest.property),
  5946 			       MKOBJ(ev->xselectionrequest.property),
  5893 			       MKOBJ(__ev__.xselectionrequest.target),
  5947 			       MKOBJ(ev->xselectionrequest.target),
  5894 			       MKOBJ(__ev__.xselectionrequest.selection),
  5948 			       MKOBJ(ev->xselectionrequest.selection),
  5895 			       MKOBJ(__ev__.xselectionrequest.requestor));
  5949 			       MKOBJ(ev->xselectionrequest.requestor));
  5896 	    break;
  5950 	    break;
  5897 
  5951 
  5898 	case ColormapNotify:
  5952 	case ColormapNotify:
  5899 	    (*colormap.ilc_func)(theView, 
  5953 	    (*colormap.ilc_func)(theView, 
  5900 				 @symbol(colorMapChange) 
  5954 				 @symbol(colorMapChange) 
  5910 				@symbol(mapping) 
  5964 				@symbol(mapping) 
  5911 				COMMA_CON, nil, &mapping);
  5965 				COMMA_CON, nil, &mapping);
  5912 */
  5966 */
  5913 	    break;
  5967 	    break;
  5914     }
  5968     }
       
  5969 #undef ae
  5915 #undef ee
  5970 #undef ee
  5916 #undef ke
  5971 #undef ke
  5917 #undef be
  5972 #undef be
  5918 #undef ce
  5973 #undef ce
  5919 #undef me
  5974 #undef me