XWorkstation.st
changeset 2156 0cb3b353630f
parent 2146 1c13fdc62a9f
child 2176 80290576c9db
equal deleted inserted replaced
2155:27862eea4474 2156:0cb3b353630f
  4092 	    aView pasteFromClipBoard:s
  4092 	    aView pasteFromClipBoard:s
  4093 	]
  4093 	]
  4094     ]
  4094     ]
  4095 !
  4095 !
  4096 
  4096 
  4097 selectionRequest:propertyID target:targetID selection:selectionID from:windowID view:aView
  4097 selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView
  4098     "sent by some other X-client to ask for the selection.
  4098     "sent by some other X-client to ask for the selection.
  4099      This is a very X-specific mechanism."
  4099      This is a very X-specific mechanism."
  4100 
  4100 
  4101     |o s stream|
  4101     |o s stream|
  4102 
  4102 
  4103     targetID == (self atomIDOfLENGTH) ifTrue:[
  4103     targetID == (self atomIDOfLENGTH) ifTrue:[
  4104 	"/
  4104         "/
  4105 	"/ the other one wants to know the size of our selection ...
  4105         "/ the other one wants to know the size of our selection ...
  4106 	"/
  4106         "/
  4107 
  4107         s := self selectionAsString.
  4108 	s := self selectionAsString.
  4108         self
  4109 	self
  4109             setLengthProperty:propertyID 
  4110 	    setLengthProperty:propertyID 
  4110             value:s size 
  4111 	    value:s size 
  4111             for:windowID.
  4112 	    for:windowID.
  4112         self
  4113 	self
  4113             sendSelectionNotifySelection:selectionID
  4114 	    sendSelectionNotifySelection:selectionID
  4114             property:propertyID
  4115 	    property:propertyID
  4115             target:targetID
  4116 	    target:targetID
  4116             time:t
  4117 	    from:aView id
  4117             from:aView id
  4118 	    to:windowID.
  4118             to:windowID.
  4119 	^ self
  4119         ^ self
  4120     ].
  4120     ].
  4121 
  4121 
  4122     (targetID == self atomIDOfSTRING or:[
  4122     (targetID == self atomIDOfSTRING or:[
  4123      targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[
  4123      targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[
  4124 	"/
  4124         "/
  4125 	"/ the other view wants the selection as string
  4125         "/ the other view wants the selection as string
  4126 	"/
  4126         "/
  4127 
  4127         s := self selectionAsString.
  4128 	s := self selectionAsString.
  4128         self
  4129 	self
  4129             sendSelection:s 
  4130 	    sendSelection:s 
  4130             selection:primaryAtom
  4131 	    property:propertyID 
  4131             property:propertyID 
  4132 	    target:targetID
  4132             target:self atomIDOfSTRING "/ targetID
  4133 	    from:aView id 
  4133             time:t
  4134 	    to:windowID.
  4134             from:windowID
  4135 	^ self
  4135             to:windowID.
       
  4136         ^ self
  4136     ].
  4137     ].
  4137 
  4138 
  4138     "/
  4139 "/    (targetID == (self atomIDOf:'TARGETS')) ifTrue:[
  4139     "/ send the seletion in binaryStore format
  4140 "/"/ TODO: implement this to avoid netscape paste-delay.
  4140     "/ (assuming, that the other view knows how to handle it)
  4141 "/"/
  4141     "/
  4142 "/        ^ self
  4142     o := self getCopyBuffer.
  4143 "/    ].
  4143     stream := WriteStream on:(ByteArray new:200).
  4144 
  4144     o storeBinaryOn:stream.
  4145     (targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[
  4145 
  4146         "/
  4146     self
  4147         "/ send the selection in binaryStore format
  4147 	sendSelection:(stream contents) 
  4148         "/ (assuming, that the other view knows how to handle it)
  4148 	property:propertyID 
  4149         "/
  4149 	target:(self atomIDOf:'ST_OBJECT' create:true) 
  4150         o := self getCopyBuffer.
  4150 	from:aView id 
  4151         stream := WriteStream on:(ByteArray new:200).
  4151 	to:windowID
  4152         o storeBinaryOn:stream.
       
  4153 
       
  4154         ^ self
       
  4155             sendSelection:(stream contents) 
       
  4156             selection:primaryAtom
       
  4157             property:propertyID 
       
  4158             target:targetID 
       
  4159             time:t
       
  4160             from:windowID 
       
  4161             to:windowID
       
  4162     ].
       
  4163 
       
  4164     "Created: / 17.6.1998 / 19:33:10 / cg"
       
  4165     "Modified: / 17.6.1998 / 20:24:40 / cg"
  4152 ! !
  4166 ! !
  4153 
  4167 
  4154 !XWorkstation methodsFor:'event handling'!
  4168 !XWorkstation methodsFor:'event handling'!
  4155 
  4169 
  4156 dispatchEventFor:aViewIdOrNil withMask:eventMask
  4170 dispatchEventFor:aViewIdOrNil withMask:eventMask
  4185 
  4199 
  4186     "Modified: 19.8.1997 / 17:10:26 / cg"
  4200     "Modified: 19.8.1997 / 17:10:26 / cg"
  4187 !
  4201 !
  4188 
  4202 
  4189 dispatchLastEvent
  4203 dispatchLastEvent
  4190     |theView symS arg butt sibling windowID siblingID propertyID selectionID targetID requestorID
  4204     |theView symS arg butt sibling 
       
  4205      windowID siblingID propertyID selectionID targetID requestorID
       
  4206      evTime
  4191      eventType|
  4207      eventType|
  4192 
  4208 
  4193 %{  /* STACK: 8000 */
  4209 %{  /* STACK: 8000 */
  4194 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
  4210 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
  4195 
  4211 
  4251     static struct inlineCache circReq = _ILC1;
  4267     static struct inlineCache circReq = _ILC1;
  4252     static struct inlineCache circNotify = _ILC1;
  4268     static struct inlineCache circNotify = _ILC1;
  4253     static struct inlineCache gravNotify = _ILC1;
  4269     static struct inlineCache gravNotify = _ILC1;
  4254     static struct inlineCache prop = _ILC1;
  4270     static struct inlineCache prop = _ILC1;
  4255     static struct inlineCache selClear = _ILC2;
  4271     static struct inlineCache selClear = _ILC2;
  4256     static struct inlineCache selReq = _ILC5;
  4272     static struct inlineCache selReq = _ILC6;
  4257     static struct inlineCache selNotify = _ILC5;
  4273     static struct inlineCache selNotify = _ILC5;
  4258     static struct inlineCache colormap = _ILC1;
  4274     static struct inlineCache colormap = _ILC1;
  4259     static struct inlineCache mapping = _ILC2;
  4275     static struct inlineCache mapping = _ILC2;
  4260     static struct inlineCache vis = _ILC1;
  4276     static struct inlineCache vis = _ILC1;
  4261 
  4277 
  4262     static struct inlineCache skpS = _ILC4;
  4278     static struct inlineCache skpS = _ILC4;
  4263     static struct inlineCache skrS = _ILC4;
  4279     static struct inlineCache skrS = _ILC4;
  4264 
  4280 
  4265     if (! ISCONNECTED) {
  4281     if (! ISCONNECTED) {
  4266 	RETURN (false);
  4282         RETURN (false);
  4267     }
  4283     }
  4268 
  4284 
  4269     dpy = myDpy;
  4285     dpy = myDpy;
  4270 
  4286 
  4271     eB = __INST(eventBuffer);
  4287     eB = __INST(eventBuffer);
  4272 
  4288 
  4273     if (__isByteArray(eB)) {
  4289     if (__isByteArray(eB)) {
  4274 	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4290         ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4275     } else {
  4291     } else {
  4276 	printf("DISPLAY: no eventBuffer\n");
  4292         printf("DISPLAY: no eventBuffer\n");
  4277 	RETURN (false);
  4293         RETURN (false);
  4278     }
  4294     }
  4279 
  4295 
  4280     /*
  4296     /*
  4281      * very often, its another event for the same view ...
  4297      * very often, its another event for the same view ...
  4282      * avoid creation & lookup then.
  4298      * avoid creation & lookup then.
  4283      */
  4299      */
  4284     if ((t = __INST(lastId)) != nil) {
  4300     if ((t = __INST(lastId)) != nil) {
  4285 	if (__isExternalAddress(t)) {
  4301         if (__isExternalAddress(t)) {
  4286 	    if (_WindowVal(t) == ae->window) {
  4302             if (_WindowVal(t) == ae->window) {
  4287 		theView = __INST(lastView);
  4303                 theView = __INST(lastView);
  4288 		if (__isNonNilObject(theView)) {
  4304                 if (__isNonNilObject(theView)) {
  4289 		    if (__qClass(theView) == nil) {
  4305                     if (__qClass(theView) == nil) {
  4290 			theView = nil;
  4306                         theView = nil;
  4291 		    }
  4307                     }
  4292 		}
  4308                 }
  4293 	    }
  4309             }
  4294 	}
  4310         }
  4295     }
  4311     }
  4296 
  4312 
  4297     if (theView == nil) {
  4313     if (theView == nil) {
  4298 	windowID = __MKEXTERNALADDRESS(ae->window);
  4314         windowID = __MKEXTERNALADDRESS(ae->window);
  4299 	theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID);
  4315         theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID);
  4300 	/*
  4316         /*
  4301 	 * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr
  4317          * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr
  4302 	 */
  4318          */
  4303 	eB = __INST(eventBuffer);
  4319         eB = __INST(eventBuffer);
  4304 	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4320         ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4305     }
  4321     }
  4306 
  4322 
  4307     if ((theView == nil) && (ev->type != MappingNotify)) {
  4323     if ((theView == nil) && (ev->type != MappingNotify)) {
  4308 	RETURN (nil);
  4324         RETURN (nil);
  4309     }
  4325     }
  4310 
  4326 
  4311     /*
  4327     /*
  4312      * key, button and pointer events are sent to the sensor,
  4328      * key, button and pointer events are sent to the sensor,
  4313      * or (if there is none) to the delegate.
  4329      * or (if there is none) to the delegate.
  4323 
  4339 
  4324 #ifdef DEBUG
  4340 #ifdef DEBUG
  4325     eventType = __MKSMALLINT(ev->type);
  4341     eventType = __MKSMALLINT(ev->type);
  4326 #endif
  4342 #endif
  4327     switch (ev->type) {
  4343     switch (ev->type) {
  4328 	case KeyRelease:
  4344         case KeyRelease:
  4329 	    symS = @symbol(keyRelease:x:y:view:);
  4345             symS = @symbol(keyRelease:x:y:view:);
  4330 	    ipS = &skrS;
  4346             ipS = &skrS;
  4331 	    upDown = false;
  4347             upDown = false;
  4332 	    goto keyPressAndRelease;
  4348             goto keyPressAndRelease;
  4333 
  4349 
  4334 	case KeyPress:
  4350         case KeyPress:
  4335 	    symS = @symbol(keyPress:x:y:view:);
  4351             symS = @symbol(keyPress:x:y:view:);
  4336 	    ipS = &skpS;
  4352             ipS = &skpS;
  4337 	    upDown = true;
  4353             upDown = true;
  4338 	    /* FALL INTO */
  4354             /* FALL INTO */
  4339 
  4355 
  4340 	keyPressAndRelease:
  4356         keyPressAndRelease:
  4341 	    __INST(eventRootX) = __MKSMALLINT(ke->x_root);
  4357             __INST(eventRootX) = __MKSMALLINT(ke->x_root);
  4342 	    __INST(eventRootY) = __MKSMALLINT(ke->y_root);
  4358             __INST(eventRootY) = __MKSMALLINT(ke->y_root);
  4343 #ifdef OLD
  4359 #ifdef OLD
  4344 	    __INST(altDown) = (ke->state & Mod2Mask) ? true : false;
  4360             __INST(altDown) = (ke->state & Mod2Mask) ? true : false;
  4345 	    __INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
  4361             __INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
  4346 #else
  4362 #else
  4347 	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4363             __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4348 	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4364             __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4349 #endif
  4365 #endif
  4350 	    __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
  4366             __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
  4351 	    __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
  4367             __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
  4352 
  4368 
  4353 	    ev_x = ke->x;
  4369             ev_x = ke->x;
  4354 	    ev_y = ke->y;
  4370             ev_y = ke->y;
  4355 
  4371 
  4356 	    arg = nil;
  4372             arg = nil;
  4357 	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
  4373             nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
  4358 	    if (nchars 
  4374             if (nchars 
  4359 	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
  4375              && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
  4360 		 || (buffer[0] >= 0x80))) {
  4376                  || (buffer[0] >= 0x80))) {
  4361 		arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
  4377                 arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
  4362 		keySymString = NULL;
  4378                 keySymString = NULL;
  4363 	    } else {
  4379             } else {
  4364 #ifdef OLD
  4380 #ifdef OLD
  4365 		switch (keySym) {
  4381                 switch (keySym) {
  4366 		    case XK_Control_L:
  4382                     case XK_Control_L:
  4367 		    case XK_Control_R:
  4383                     case XK_Control_R:
  4368 			__INST(ctrlDown) = upDown;
  4384                         __INST(ctrlDown) = upDown;
  4369 			break;
  4385                         break;
  4370 		    case XK_Shift_L:
  4386                     case XK_Shift_L:
  4371 		    case XK_Shift_R:
  4387                     case XK_Shift_R:
  4372 			__INST(shiftDown) = upDown;
  4388                         __INST(shiftDown) = upDown;
  4373 			break;
  4389                         break;
  4374 		    case XK_Meta_L:
  4390                     case XK_Meta_L:
  4375 		    case XK_Meta_R:
  4391                     case XK_Meta_R:
  4376 			__INST(metaDown) = upDown;
  4392                         __INST(metaDown) = upDown;
  4377 			break;
  4393                         break;
  4378 		    case XK_Alt_L:
  4394                     case XK_Alt_L:
  4379 		    case XK_Alt_R:
  4395                     case XK_Alt_R:
  4380 			__INST(altDown) = upDown;
  4396                         __INST(altDown) = upDown;
  4381 			break;
  4397                         break;
  4382 		}
  4398                 }
  4383 #endif
  4399 #endif
  4384 
  4400 
  4385 		keySymString = XKeysymToString(keySym);
  4401                 keySymString = XKeysymToString(keySym);
  4386 		if (keySymString) {
  4402                 if (keySymString) {
  4387 #ifdef OLD
  4403 #ifdef OLD
  4388 		    if (keySymString[0] == 'D') {
  4404                     if (keySymString[0] == 'D') {
  4389 			/*
  4405                         /*
  4390 			 * remove underscore, dont want it in symbols
  4406                          * remove underscore, dont want it in symbols
  4391 			 */
  4407                          */
  4392 			if (strcmp(keySymString, "Delete_line") == 0) {
  4408                         if (strcmp(keySymString, "Delete_line") == 0) {
  4393 			    keySymString = "DeleteLine";
  4409                             keySymString = "DeleteLine";
  4394 			} else if (strcmp(keySymString, "Delete_word") == 0) {
  4410                         } else if (strcmp(keySymString, "Delete_word") == 0) {
  4395 			    keySymString = "DeleteWord";
  4411                             keySymString = "DeleteWord";
  4396 			}
  4412                         }
  4397 		    }
  4413                     }
  4398 		    /*
  4414                     /*
  4399 		     * make names compatible
  4415                      * make names compatible
  4400 		     */
  4416                      */
  4401 		    if (strcmp(keySymString, "Down") == 0) {
  4417                     if (strcmp(keySymString, "Down") == 0) {
  4402 			keySymString = "CursorDown";
  4418                         keySymString = "CursorDown";
  4403 		    } else if (strcmp(keySymString, "Up") == 0) {
  4419                     } else if (strcmp(keySymString, "Up") == 0) {
  4404 			keySymString = "CursorUp";
  4420                         keySymString = "CursorUp";
  4405 		    } else if (strcmp(keySymString, "Left") == 0) {
  4421                     } else if (strcmp(keySymString, "Left") == 0) {
  4406 			keySymString = "CursorLeft";
  4422                         keySymString = "CursorLeft";
  4407 		    } else if (strcmp(keySymString, "Right") == 0) {
  4423                     } else if (strcmp(keySymString, "Right") == 0) {
  4408 			keySymString = "CursorRight";
  4424                         keySymString = "CursorRight";
  4409 		    }
  4425                     }
  4410 		    arg = __MKSYMBOL(keySymString, (OBJ *)0);
  4426                     arg = __MKSYMBOL(keySymString, (OBJ *)0);
  4411 #else
  4427 #else
  4412 		    arg = __MKSTRING(keySymString);
  4428                     arg = __MKSTRING(keySymString);
  4413 #endif
  4429 #endif
  4414 		}
  4430                 }
  4415 	    }
  4431             }
  4416 
  4432 
  4417 	    if (arg == nil) {
  4433             if (arg == nil) {
  4418 		/* happens sometimes (alt-graph on sun has no keysym) */
  4434                 /* happens sometimes (alt-graph on sun has no keysym) */
  4419 		break;
  4435                 break;
  4420 	    }
  4436             }
  4421 
  4437 
  4422 	    (*(*ipS).ilc_func)(self, symS, nil, ipS,
  4438             (*(*ipS).ilc_func)(self, symS, nil, ipS,
  4423 			       arg, 
  4439                                arg, 
  4424 			       __MKSMALLINT(ev_x), 
  4440                                __MKSMALLINT(ev_x), 
  4425 			       __MKSMALLINT(ev_y),
  4441                                __MKSMALLINT(ev_y),
  4426 			       theView);
  4442                                theView);
  4427 	    break;
  4443             break;
  4428 
  4444 
  4429 	case ButtonPress:
  4445         case ButtonPress:
  4430 	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button));
  4446             __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button));
  4431 	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
  4447             __INST(eventRootX) = __MKSMALLINT(be->x_root);
  4432 	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
  4448             __INST(eventRootY) = __MKSMALLINT(be->y_root);
  4433 
  4449 
  4434 	    if (__isSmallInteger(__INST(multiClickTimeDelta)))
  4450             if (__isSmallInteger(__INST(multiClickTimeDelta)))
  4435 		nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta));
  4451                 nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta));
  4436 	    else
  4452             else
  4437 		nextMultiClickTime = 0;
  4453                 nextMultiClickTime = 0;
  4438 
  4454 
  4439 
  4455 
  4440 	    if ((t = __INST(multiClickTime)) != nil) {
  4456             if ((t = __INST(multiClickTime)) != nil) {
  4441 		INT _multiClickTime;
  4457                 INT _multiClickTime;
  4442 
  4458 
  4443 		_multiClickTime = __longIntVal(t);
  4459                 _multiClickTime = __longIntVal(t);
  4444 		if (be->time < _multiClickTime) {
  4460                 if (be->time < _multiClickTime) {
  4445 		    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
  4461                     __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
  4446 		    /*
  4462                     /*
  4447 		     * MKUINT could lead to a GC - refetch event ptr
  4463                      * MKUINT could lead to a GC - refetch event ptr
  4448 		     */
  4464                      */
  4449 		    eB = __INST(eventBuffer);
  4465                     eB = __INST(eventBuffer);
  4450 		    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4466                     ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4451 
  4467 
  4452 		    ipS = &bmpS;
  4468                     ipS = &bmpS;
  4453 		    symS = @symbol(buttonMultiPress:x:y:view:);
  4469                     symS = @symbol(buttonMultiPress:x:y:view:);
  4454 		    goto sendButtonEvent;
  4470                     goto sendButtonEvent;
  4455 		    break;
  4471                     break;
  4456 		}
  4472                 }
  4457 	    }
  4473             }
  4458 	    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
  4474             __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
  4459 	    /*
  4475             /*
  4460 	     * MKUINT could lead to a GC - refetch event ptr
  4476              * MKUINT could lead to a GC - refetch event ptr
  4461 	     */
  4477              */
  4462 	    eB = __INST(eventBuffer);
  4478             eB = __INST(eventBuffer);
  4463 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4479             ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4464 
  4480 
  4465 #ifdef NO_LONGER
  4481 #ifdef NO_LONGER
  4466 	    if (be->state & ShiftMask) {
  4482             if (be->state & ShiftMask) {
  4467 		ipS = &bspS;
  4483                 ipS = &bspS;
  4468 		symS = @symbol(buttonShiftPress:x:y:view:);
  4484                 symS = @symbol(buttonShiftPress:x:y:view:);
  4469 		goto sendButtonEvent;
  4485                 goto sendButtonEvent;
  4470 	    }
  4486             }
  4471 #endif
  4487 #endif
  4472 	    ipS = &bpS;
  4488             ipS = &bpS;
  4473 	    symS = @symbol(buttonPress:x:y:view:);
  4489             symS = @symbol(buttonPress:x:y:view:);
  4474 	    goto sendButtonEvent;
  4490             goto sendButtonEvent;
  4475 
  4491 
  4476 	    /* NOT REACHED */
  4492             /* NOT REACHED */
  4477 
  4493 
  4478 	case ButtonRelease:
  4494         case ButtonRelease:
  4479 	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button));
  4495             __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button));
  4480 	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
  4496             __INST(eventRootX) = __MKSMALLINT(be->x_root);
  4481 	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
  4497             __INST(eventRootY) = __MKSMALLINT(be->y_root);
  4482 	    ipS = &brS;
  4498             ipS = &brS;
  4483 	    symS = @symbol(buttonRelease:x:y:view:);
  4499             symS = @symbol(buttonRelease:x:y:view:);
  4484 	    /* fall into */
  4500             /* fall into */
  4485 
  4501 
  4486 	sendButtonEvent:
  4502         sendButtonEvent:
  4487 	    butt = __MKSMALLINT(be->button);
  4503             butt = __MKSMALLINT(be->button);
  4488 #ifdef NOTDEF
  4504 #ifdef NOTDEF
  4489 	    /*
  4505             /*
  4490 	     * this allows operation with single button mouses: meta-click is always Button 2
  4506              * this allows operation with single button mouses: meta-click is always Button 2
  4491 	     */
  4507              */
  4492 	    if (__INST(metaDown) == true)
  4508             if (__INST(metaDown) == true)
  4493 		butt = __MKSMALLINT(2);
  4509                 butt = __MKSMALLINT(2);
  4494 	    else 
  4510             else 
  4495 #endif
  4511 #endif
  4496 		butt = __AT_(__INST(buttonTranslation), butt);
  4512                 butt = __AT_(__INST(buttonTranslation), butt);
  4497 	    /*
  4513             /*
  4498 	     * #at: could lead to a GC - refetch event ptr
  4514              * #at: could lead to a GC - refetch event ptr
  4499 	     */
  4515              */
  4500 	    eB = __INST(eventBuffer);
  4516             eB = __INST(eventBuffer);
  4501 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4517             ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4502 
  4518 
  4503 
  4519 
  4504 	    (*(*ipS).ilc_func)(self, 
  4520             (*(*ipS).ilc_func)(self, 
  4505 			       symS, nil, ipS,
  4521                                symS, nil, ipS,
  4506 			       butt, 
  4522                                butt, 
  4507 			       __MKSMALLINT(ke->x), 
  4523                                __MKSMALLINT(ke->x), 
  4508 			       __MKSMALLINT(ke->y),
  4524                                __MKSMALLINT(ke->y),
  4509 			       theView);
  4525                                theView);
  4510 	    break;
  4526             break;
  4511 
  4527 
  4512 	case MotionNotify:
  4528         case MotionNotify:
  4513 	    if (__INST(motionEventCompression) != false) {
  4529             if (__INST(motionEventCompression) != false) {
  4514 		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
  4530                 while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
  4515 	    }
  4531             }
  4516 
  4532 
  4517 	    __INST(eventRootX) = __MKSMALLINT(me->x_root);
  4533             __INST(eventRootX) = __MKSMALLINT(me->x_root);
  4518 	    __INST(eventRootY) = __MKSMALLINT(me->y_root);
  4534             __INST(eventRootY) = __MKSMALLINT(me->y_root);
  4519 
  4535 
  4520 #ifdef OLD
  4536 #ifdef OLD
  4521 	    __INST(altDown) = (me->state & Mod2Mask) ? true : false;
  4537             __INST(altDown) = (me->state & Mod2Mask) ? true : false;
  4522 	    __INST(metaDown) = (me->state & Mod1Mask) ? true : false;
  4538             __INST(metaDown) = (me->state & Mod1Mask) ? true : false;
  4523 #else
  4539 #else
  4524 	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4540             __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4525 	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4541             __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4526 #endif
  4542 #endif
  4527 	    __INST(shiftDown) = (me->state & ShiftMask) ? true : false;
  4543             __INST(shiftDown) = (me->state & ShiftMask) ? true : false;
  4528 	    __INST(ctrlDown) = (me->state & ControlMask) ? true : false;
  4544             __INST(ctrlDown) = (me->state & ControlMask) ? true : false;
  4529 
  4545 
  4530 	    (*motS.ilc_func)(self, 
  4546             (*motS.ilc_func)(self, 
  4531 			     @symbol(buttonMotion:x:y:view:), nil, &motS,
  4547                              @symbol(buttonMotion:x:y:view:), nil, &motS,
  4532 			     __MKSMALLINT(me->state),
  4548                              __MKSMALLINT(me->state),
  4533 			     __MKSMALLINT(me->x),
  4549                              __MKSMALLINT(me->x),
  4534 			     __MKSMALLINT(me->y),
  4550                              __MKSMALLINT(me->y),
  4535 			     theView);
  4551                              theView);
  4536 	    break;
  4552             break;
  4537 
  4553 
  4538 	case FocusIn:
  4554         case FocusIn:
  4539 	    (*focInS.ilc_func)(self, 
  4555             (*focInS.ilc_func)(self, 
  4540 			       @symbol(focusInView:), nil, &focInS, 
  4556                                @symbol(focusInView:), nil, &focInS, 
  4541 			       theView);
  4557                                theView);
  4542 	    break;
  4558             break;
  4543 
  4559 
  4544 	case FocusOut:
  4560         case FocusOut:
  4545 	    (*focOutS.ilc_func)(self, 
  4561             (*focOutS.ilc_func)(self, 
  4546 				@symbol(focusOutView:), nil, &focOutS, 
  4562                                 @symbol(focusOutView:), nil, &focOutS, 
  4547 				theView);
  4563                                 theView);
  4548 	    break;
  4564             break;
  4549 
  4565 
  4550 	case EnterNotify:
  4566         case EnterNotify:
  4551 #ifdef OLD
  4567 #ifdef OLD
  4552 	    __INST(altDown) = (ewe->state & Mod2Mask) ? true : false;
  4568             __INST(altDown) = (ewe->state & Mod2Mask) ? true : false;
  4553 	    __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false;
  4569             __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false;
  4554 #else
  4570 #else
  4555 	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4571             __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
  4556 	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4572             __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
  4557 #endif
  4573 #endif
  4558 	    __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false;
  4574             __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false;
  4559 	    __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false;
  4575             __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false;
  4560 
  4576 
  4561 	    (*peS.ilc_func)(self, 
  4577             (*peS.ilc_func)(self, 
  4562 			    @symbol(pointerEnter:x:y:view:), nil, &peS,
  4578                             @symbol(pointerEnter:x:y:view:), nil, &peS,
  4563 			    __MKSMALLINT(ewe->state),
  4579                             __MKSMALLINT(ewe->state),
  4564 			    __MKSMALLINT(ewe->x), 
  4580                             __MKSMALLINT(ewe->x), 
  4565 			    __MKSMALLINT(ewe->y),
  4581                             __MKSMALLINT(ewe->y),
  4566 			    theView);
  4582                             theView);
  4567 	    break;
  4583             break;
  4568 
  4584 
  4569 	case LeaveNotify:
  4585         case LeaveNotify:
  4570 	    (*plS.ilc_func)(self, 
  4586             (*plS.ilc_func)(self, 
  4571 			    @symbol(pointerLeave:view:), nil, &plS,
  4587                             @symbol(pointerLeave:view:), nil, &plS,
  4572 			    __MKSMALLINT(lwe->state), 
  4588                             __MKSMALLINT(lwe->state), 
  4573 			    theView);
  4589                             theView);
  4574 	    break;
  4590             break;
  4575 
  4591 
  4576 	case GraphicsExpose:
  4592         case GraphicsExpose:
  4577 	    (*gexpS.ilc_func)(self, 
  4593             (*gexpS.ilc_func)(self, 
  4578 			      @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS,
  4594                               @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS,
  4579 			      __MKSMALLINT(ee->x),
  4595                               __MKSMALLINT(ee->x),
  4580 			      __MKSMALLINT(ee->y),
  4596                               __MKSMALLINT(ee->y),
  4581 			      __MKSMALLINT(ee->width),
  4597                               __MKSMALLINT(ee->width),
  4582 			      __MKSMALLINT(ee->height),
  4598                               __MKSMALLINT(ee->height),
  4583 			      ee->count == 0 ? true : false,
  4599                               ee->count == 0 ? true : false,
  4584 			      theView);
  4600                               theView);
  4585 
  4601 
  4586 	    if (ee->count != 0) {
  4602             if (ee->count != 0) {
  4587 		break;
  4603                 break;
  4588 	    }
  4604             }
  4589 	    /* fall into */
  4605             /* fall into */
  4590 
  4606 
  4591 	case NoExpose:
  4607         case NoExpose:
  4592 	    (*nexpS.ilc_func)(self, 
  4608             (*nexpS.ilc_func)(self, 
  4593 			      @symbol(noExposeView:), nil, &nexpS, 
  4609                               @symbol(noExposeView:), nil, &nexpS, 
  4594 			      theView);
  4610                               theView);
  4595 	    break;
  4611             break;
  4596 
  4612 
  4597 	case Expose:
  4613         case Expose:
  4598 	    (*expS.ilc_func)(self, 
  4614             (*expS.ilc_func)(self, 
  4599 			     @symbol(exposeX:y:width:height:view:), nil, &expS,
  4615                              @symbol(exposeX:y:width:height:view:), nil, &expS,
  4600 			     __MKSMALLINT(ee->x),
  4616                              __MKSMALLINT(ee->x),
  4601 			     __MKSMALLINT(ee->y),
  4617                              __MKSMALLINT(ee->y),
  4602 			     __MKSMALLINT(ee->width),
  4618                              __MKSMALLINT(ee->width),
  4603 			     __MKSMALLINT(ee->height),
  4619                              __MKSMALLINT(ee->height),
  4604 			     theView);
  4620                              theView);
  4605 	    break;
  4621             break;
  4606 
  4622 
  4607 	case ConfigureNotify:
  4623         case ConfigureNotify:
  4608 	    if (ce->above != None) {
  4624             if (ce->above != None) {
  4609 		siblingID = __MKEXTERNALADDRESS(ce->above);
  4625                 siblingID = __MKEXTERNALADDRESS(ce->above);
  4610 		sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID);
  4626                 sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID);
  4611 		/*
  4627                 /*
  4612 		 * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr
  4628                  * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr
  4613 		 */
  4629                  */
  4614 		eB = __INST(eventBuffer);
  4630                 eB = __INST(eventBuffer);
  4615 		ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4631                 ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4616 	    }
  4632             }
  4617 
  4633 
  4618 	    (*confS.ilc_func)(self, 
  4634             (*confS.ilc_func)(self, 
  4619 			     @symbol(configureX:y:width:height:view:), nil, &confS,
  4635                              @symbol(configureX:y:width:height:view:), nil, &confS,
  4620 			     __MKSMALLINT(ce->x),
  4636                              __MKSMALLINT(ce->x),
  4621 			     __MKSMALLINT(ce->y),
  4637                              __MKSMALLINT(ce->y),
  4622 			     __MKSMALLINT(ce->width),
  4638                              __MKSMALLINT(ce->width),
  4623 			     __MKSMALLINT(ce->height),
  4639                              __MKSMALLINT(ce->height),
  4624 			     theView);
  4640                              theView);
  4625 	    if (sibling != nil) {
  4641             if (sibling != nil) {
  4626 		(*coveredS.ilc_func)(self,
  4642                 (*coveredS.ilc_func)(self,
  4627 				    @symbol(coveredBy:view:), nil, &coveredS,
  4643                                     @symbol(coveredBy:view:), nil, &coveredS,
  4628 				    theView,
  4644                                     theView,
  4629 				    sibling);
  4645                                     sibling);
  4630 	    }
  4646             }
  4631 	    break;
  4647             break;
  4632 
  4648 
  4633 	case ClientMessage:
  4649         case ClientMessage:
  4634 	    if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) {
  4650             if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) {
  4635 		if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom)))
  4651                 if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom)))
  4636 		 || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) {
  4652                  || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) {
  4637 		    (*termS.ilc_func)(self, 
  4653                     (*termS.ilc_func)(self, 
  4638 				      @symbol(terminateView:), nil, &termS, theView);
  4654                                       @symbol(terminateView:), nil, &termS, theView);
  4639 		    break;
  4655                     break;
  4640 		}
  4656                 }
  4641 		if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) {
  4657                 if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) {
  4642 		    (*savtermS.ilc_func)(self, 
  4658                     (*savtermS.ilc_func)(self, 
  4643 					 @symbol(saveAndTerminateView:)
  4659                                          @symbol(saveAndTerminateView:)
  4644 					 , nil, &savtermS, theView);
  4660                                          , nil, &savtermS, theView);
  4645 		    break;
  4661                     break;
  4646 		}
  4662                 }
  4647 	    }
  4663             }
  4648 	    /*
  4664             /*
  4649 	     * any other client message
  4665              * any other client message
  4650 	     */
  4666              */
  4651 	    i = (char *)(&(ev->xclient.data)) - (char *)ev;
  4667             i = (char *)(&(ev->xclient.data)) - (char *)ev;
  4652 	    (*clientMsg.ilc_func)(self, 
  4668             (*clientMsg.ilc_func)(self, 
  4653 				 @symbol(clientMessage:type:format:dataOffset:view:)
  4669                                  @symbol(clientMessage:type:format:dataOffset:view:)
  4654 				 , nil, &clientMsg 
  4670                                  , nil, &clientMsg 
  4655 				 , __INST(eventBuffer)
  4671                                  , __INST(eventBuffer)
  4656 				 ,__MKSMALLINT(ev->xclient.message_type)
  4672                                  ,__MKSMALLINT(ev->xclient.message_type)
  4657 				 ,__MKSMALLINT(ev->xclient.format)
  4673                                  ,__MKSMALLINT(ev->xclient.format)
  4658 				 ,__MKSMALLINT(i), 
  4674                                  ,__MKSMALLINT(i), 
  4659 				 theView);
  4675                                  theView);
  4660 	    break;
  4676             break;
  4661 
  4677 
  4662 	case DestroyNotify:
  4678         case DestroyNotify:
  4663 	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
  4679             (*destrS.ilc_func)(self, @symbol(destroyedView:)
  4664 			       , nil, &destrS, theView);
  4680                                , nil, &destrS, theView);
  4665 	    break;
  4681             break;
  4666 
  4682 
  4667 	case UnmapNotify:
  4683         case UnmapNotify:
  4668 	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
  4684             (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
  4669 			       , nil, &unmapS, theView);
  4685                                , nil, &unmapS, theView);
  4670 	    break;
  4686             break;
  4671 
  4687 
  4672 	case MapNotify:
  4688         case MapNotify:
  4673 	    (*mapS.ilc_func)(self, 
  4689             (*mapS.ilc_func)(self, 
  4674 			     @symbol(mappedView:) 
  4690                              @symbol(mappedView:) 
  4675 			     , nil, &mapS, theView);
  4691                              , nil, &mapS, theView);
  4676 	    break;
  4692             break;
  4677 
  4693 
  4678 	case KeymapNotify:
  4694         case KeymapNotify:
  4679 	    (*keymap.ilc_func)(theView, 
  4695             (*keymap.ilc_func)(theView, 
  4680 			       @symbol(keyMapChange) 
  4696                                @symbol(keyMapChange) 
  4681 			       , nil, &keymap);
  4697                                , nil, &keymap);
  4682 	    break;
  4698             break;
  4683 
  4699 
  4684 	case VisibilityNotify:
  4700         case VisibilityNotify:
  4685 	    switch (ve->state) {
  4701             switch (ve->state) {
  4686 		case VisibilityUnobscured:
  4702                 case VisibilityUnobscured:
  4687 		    arg = @symbol(unobscured);
  4703                     arg = @symbol(unobscured);
  4688 		    break;
  4704                     break;
  4689 		case VisibilityPartiallyObscured:
  4705                 case VisibilityPartiallyObscured:
  4690 		    arg = @symbol(partiallyObscured);
  4706                     arg = @symbol(partiallyObscured);
  4691 		    break;
  4707                     break;
  4692 		case VisibilityFullyObscured:
  4708                 case VisibilityFullyObscured:
  4693 		    arg = @symbol(fullyObscured);
  4709                     arg = @symbol(fullyObscured);
  4694 		    break;
  4710                     break;
  4695 	    }
  4711             }
  4696 	    (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg);
  4712             (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg);
  4697 	    break;
  4713             break;
  4698 
  4714 
  4699 	case CreateNotify:
  4715         case CreateNotify:
  4700 	    (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView);
  4716             (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView);
  4701 	    break;
  4717             break;
  4702 
  4718 
  4703 	case MapRequest:
  4719         case MapRequest:
  4704 	    (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView);
  4720             (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView);
  4705 	    break;
  4721             break;
  4706 
  4722 
  4707 	case ReparentNotify:
  4723         case ReparentNotify:
  4708 	    (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView);
  4724             (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView);
  4709 	    break;
  4725             break;
  4710 
  4726 
  4711 	case ConfigureRequest:
  4727         case ConfigureRequest:
  4712 	    (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView);
  4728             (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView);
  4713 	    break;
  4729             break;
  4714 
  4730 
  4715 	case GravityNotify:
  4731         case GravityNotify:
  4716 	    (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView);
  4732             (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView);
  4717 	    break;
  4733             break;
  4718 
  4734 
  4719 	case ResizeRequest:
  4735         case ResizeRequest:
  4720 	    (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView);
  4736             (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView);
  4721 	    break;
  4737             break;
  4722 
  4738 
  4723 	case CirculateNotify:
  4739         case CirculateNotify:
  4724 	    (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView);
  4740             (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView);
  4725 	    break;
  4741             break;
  4726 
  4742 
  4727 	case CirculateRequest:
  4743         case CirculateRequest:
  4728 	    (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView);
  4744             (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView);
  4729 	    break;
  4745             break;
  4730 
  4746 
  4731 	case PropertyNotify:
  4747         case PropertyNotify:
  4732 	    (*prop.ilc_func)(self, 
  4748             (*prop.ilc_func)(self, 
  4733 			     @symbol(propertyChangeView) 
  4749                              @symbol(propertyChangeView) 
  4734 			     , nil, &prop,
  4750                              , nil, &prop,
  4735 			     theView);
  4751                              theView);
  4736 	    break;
  4752             break;
  4737 
  4753 
  4738 	case SelectionClear:
  4754         case SelectionClear:
  4739 	    selectionID = __MKATOMOBJ(ev->xselectionclear.selection);
  4755             selectionID = __MKATOMOBJ(ev->xselectionclear.selection);
  4740 	    (*selClear.ilc_func)(self, 
  4756             (*selClear.ilc_func)(self, 
  4741 				 @symbol(selectionClear:view:) 
  4757                                  @symbol(selectionClear:view:) 
  4742 				 , nil, &selClear,
  4758                                  , nil, &selClear,
  4743 				 selectionID,
  4759                                  selectionID,
  4744 				 theView);
  4760                                  theView);
  4745 	    break;
  4761             break;
  4746 
  4762 
  4747 	case SelectionNotify:
  4763         case SelectionNotify:
  4748 	    /*
  4764             /*
  4749 	     * returned selection value (answer from SelectionRequest)
  4765              * returned selection value (answer from SelectionRequest)
  4750 	     */
  4766              */
  4751 	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
  4767             DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
  4752 			ev->xselection.property, ev->xselection.target,
  4768                         ev->xselection.property, ev->xselection.target,
  4753 			ev->xselection.selection, ev->xselection.requestor));
  4769                         ev->xselection.selection, ev->xselection.requestor));
  4754 
  4770 
  4755 	    propertyID = __MKATOMOBJ(ev->xselection.property);
  4771             {
  4756 	    /*
  4772                 INT _property = ev->xselection.property;
  4757 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4773                 INT _target = ev->xselection.target;
  4758 	     */
  4774                 INT _selection = ev->xselection.selection;
  4759 	    eB = __INST(eventBuffer);
  4775                 INT _requestor = ev->xselection.requestor;
  4760 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4776 
  4761 
  4777                 propertyID = __MKATOMOBJ(_property);
  4762 	    targetID = __MKATOMOBJ(ev->xselection.target);
  4778                 targetID = __MKATOMOBJ(_target);
  4763 	    /*
  4779                 selectionID = __MKATOMOBJ(_selection);
  4764 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4780                 requestorID = __MKEXTERNALADDRESS(_requestor);
  4765 	     */
  4781             }
  4766 	    eB = __INST(eventBuffer);
  4782             /*
  4767 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4783              * MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr
  4768 
  4784              */
  4769 	    selectionID = __MKATOMOBJ(ev->xselection.selection);
  4785             eB = __INST(eventBuffer);
  4770 	    /*
  4786             ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4771 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4787 
  4772 	     */
  4788             (*selNotify.ilc_func)(self, 
  4773 	    eB = __INST(eventBuffer);
  4789                                   @symbol(selectionNotify:target:selection:from:view:) 
  4774 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4790                                   , nil, &selNotify,
  4775 
  4791                                   propertyID, targetID, selectionID, requestorID,
  4776 	    requestorID = __MKEXTERNALADDRESS(ev->xselection.requestor);
  4792                                   theView);
  4777 	    /*
  4793             break;
  4778 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4794 
  4779 	     */
  4795         case SelectionRequest:
  4780 	    eB = __INST(eventBuffer);
  4796             /*
  4781 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4797              * someone wants the selection
  4782 
  4798              */
  4783 	    (*selNotify.ilc_func)(self, 
  4799             DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
  4784 				  @symbol(selectionNotify:target:selection:from:view:) 
  4800                         ev->xselectionrequest.property,
  4785 				  , nil, &selNotify,
  4801                         ev->xselectionrequest.target,
  4786 				  propertyID, targetID, selectionID, requestorID,
  4802                         ev->xselectionrequest.selection,
  4787 				  theView);
  4803                         ev->xselectionrequest.requestor));
  4788 	    break;
  4804             {
  4789 
  4805                 INT _property = ev->xselectionrequest.property;
  4790 	case SelectionRequest:
  4806                 INT _target = ev->xselectionrequest.target;
  4791 	    /*
  4807                 INT _selection = ev->xselectionrequest.selection;
  4792 	     * someone wants the selection
  4808                 INT _requestor = ev->xselectionrequest.requestor;
  4793 	     */
  4809                 INT _t = ev->xselectionrequest.time;
  4794 	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
  4810 
  4795 			ev->xselectionrequest.property,
  4811                 propertyID = __MKATOMOBJ(_property);
  4796 			ev->xselectionrequest.target,
  4812                 targetID = __MKATOMOBJ(_target);
  4797 			ev->xselectionrequest.selection,
  4813                 selectionID = __MKATOMOBJ(_selection);
  4798 			ev->xselectionrequest.requestor));
  4814                 requestorID = __MKEXTERNALADDRESS(_requestor);
  4799 
  4815                 evTime = __MKEXTERNALADDRESS(_t);
  4800 	    propertyID = __MKATOMOBJ(ev->xselectionrequest.property);
  4816             }
  4801 	    /*
  4817             /*
  4802 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4818              * MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr
  4803 	     */
  4819              */
  4804 	    eB = __INST(eventBuffer);
  4820             eB = __INST(eventBuffer);
  4805 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4821             ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4806 
  4822 
  4807 	    targetID = __MKATOMOBJ(ev->xselectionrequest.target);
  4823             (*selReq.ilc_func)(self, 
  4808 	    /*
  4824                                @symbol(selectionRequest:target:selection:time:from:view:) 
  4809 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4825                                , nil, &selReq,
  4810 	     */
  4826                                propertyID, targetID, selectionID, evTime, requestorID,
  4811 	    eB = __INST(eventBuffer);
  4827                                theView);
  4812 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4828             break;
  4813 
  4829 
  4814 	    selectionID = __MKATOMOBJ(ev->xselectionrequest.selection);
  4830         case ColormapNotify:
  4815 	    /*
  4831             (*colormap.ilc_func)(self, 
  4816 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4832                                  @symbol(colorMapChangeView:) 
  4817 	     */
  4833                                  , nil, &colormap,
  4818 	    eB = __INST(eventBuffer);
  4834                                  theView);
  4819 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4835             break;
  4820 
  4836 
  4821 	    requestorID = __MKEXTERNALADDRESS(ev->xselectionrequest.requestor);
  4837         case MappingNotify:
  4822 	    /*
  4838             switch(mape->request) {
  4823 	     * MKATOMOBJ could lead to a GC - refetch event ptr
  4839                 case MappingModifier:
  4824 	     */
  4840                     arg = @symbol(mappingModifier);
  4825 	    eB = __INST(eventBuffer);
  4841                     break;
  4826 	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
  4842                 case MappingKeyboard:
  4827 
  4843                     arg = @symbol(mappingKeyboard);
  4828 	    (*selReq.ilc_func)(self, 
  4844                     break;
  4829 			       @symbol(selectionRequest:target:selection:from:view:) 
  4845                 case MappingPointer:
  4830 			       , nil, &selReq,
  4846                     arg = @symbol(mappingPointer);
  4831 			       propertyID, targetID, selectionID, requestorID,
  4847                     break;
  4832 			       theView);
  4848                 default:
  4833 	    break;
  4849                     arg = nil;
  4834 
  4850                     break;
  4835 	case ColormapNotify:
  4851             }
  4836 	    (*colormap.ilc_func)(self, 
  4852             (*mapping.ilc_func)(self, 
  4837 				 @symbol(colorMapChangeView:) 
  4853                                 @symbol(mappingChanged:event:) 
  4838 				 , nil, &colormap,
  4854                                 , nil, &mapping, arg, eB);
  4839 				 theView);
  4855             break;
  4840 	    break;
       
  4841 
       
  4842 	case MappingNotify:
       
  4843 	    switch(mape->request) {
       
  4844 		case MappingModifier:
       
  4845 		    arg = @symbol(mappingModifier);
       
  4846 		    break;
       
  4847 		case MappingKeyboard:
       
  4848 		    arg = @symbol(mappingKeyboard);
       
  4849 		    break;
       
  4850 		case MappingPointer:
       
  4851 		    arg = @symbol(mappingPointer);
       
  4852 		    break;
       
  4853 		default:
       
  4854 		    arg = nil;
       
  4855 		    break;
       
  4856 	    }
       
  4857 	    (*mapping.ilc_func)(self, 
       
  4858 				@symbol(mappingChanged:event:) 
       
  4859 				, nil, &mapping, arg, eB);
       
  4860 	    break;
       
  4861     }
  4856     }
  4862 #undef ae
  4857 #undef ae
  4863 #undef ee
  4858 #undef ee
  4864 #undef ke
  4859 #undef ke
  4865 #undef be
  4860 #undef be
  8371     "Modified: 6.4.1997 / 13:27:26 / cg"
  8366     "Modified: 6.4.1997 / 13:27:26 / cg"
  8372 !
  8367 !
  8373 
  8368 
  8374 setObjectProperty:propertyID value:anObject for:aWindowID
  8369 setObjectProperty:propertyID value:anObject for:aWindowID
  8375     "set a property to a smalltalk object in the XServer.
  8370     "set a property to a smalltalk object in the XServer.
  8376      Can only be retrieved by another ST/X smalltalk"
  8371      Non-strings can only be retrieved by another ST/X smalltalk"
  8377 
  8372 
  8378     |s|
  8373     |s|
  8379 
  8374 
  8380     (anObject isMemberOf:String) ifTrue:[
  8375     (anObject isMemberOf:String) ifTrue:[
  8381 	^ self setTextProperty:propertyID value:anObject for:aWindowID
  8376         ^ self setTextProperty:propertyID value:anObject for:aWindowID
  8382     ].
  8377     ].
  8383     s := WriteStream on:(ByteArray new:200).
  8378     s := WriteStream on:(ByteArray new:200).
  8384     anObject storeBinaryOn:s.
  8379     anObject storeBinaryOn:s.
  8385     ^ self 
  8380     ^ self 
  8386 	setProperty:propertyID 
  8381         setProperty:propertyID 
  8387 	type:(self atomIDOf:'ST_OBJECT' create:true) 
  8382         type:(self atomIDOf:'ST_OBJECT' create:true) 
  8388 	value:(s contents) 
  8383         value:(s contents) 
  8389 	for:aWindowID
  8384         for:aWindowID
  8390 
  8385 
  8391     "Modified: 6.4.1997 / 13:27:57 / cg"
  8386     "Modified: / 17.6.1998 / 17:23:49 / cg"
  8392 !
  8387 !
  8393 
  8388 
  8394 setProperty:propertyID type:typeID value:anObject for:aWindowID
  8389 setProperty:propertyID type:typeID value:anObject for:aWindowID
  8395     "set a property in the XServer"
  8390     "set a property in the XServer"
  8396 
  8391 
  8397 %{  /* UNLIMITEDSTACK */
  8392 %{  /* UNLIMITEDSTACK */
  8398 
       
  8399     Atom prop, type;
       
  8400     Window window;
       
  8401     unsigned INT value;
       
  8402 
       
  8403     if (__isAtomID(propertyID)
  8393     if (__isAtomID(propertyID)
  8404      && __isAtomID(typeID) 
  8394      && __isAtomID(typeID) 
  8405      && ISCONNECTED
  8395      && ISCONNECTED
  8406      && (__isString(anObject) 
  8396      && (__isString(anObject) 
  8407 	 || __isSmallInteger(anObject) 
  8397          || __isSmallInteger(anObject) 
  8408 	 || __isSymbol(anObject) 
  8398          || __isSymbol(anObject) 
  8409 	 || __isByteArray(anObject)
  8399          || __isByteArray(anObject)
  8410 	 || __isWords(anObject))) { 
  8400          || __isWords(anObject))) { 
  8411 
  8401 
  8412 	Display *dpy = myDpy;
  8402         Display *dpy = myDpy;
  8413 
  8403         Atom prop, type;
  8414 	prop = _AtomVal(propertyID);
  8404         Window window;
  8415 	type = _AtomVal(typeID);
  8405         unsigned INT value;
  8416 
  8406 
  8417 	if (__isExternalAddress(aWindowID)) {
  8407         prop = _AtomVal(propertyID);
  8418 	    window = _WindowVal(aWindowID);
  8408         type = _AtomVal(typeID);
  8419 	} else {
  8409 
  8420 	    window = DefaultRootWindow(dpy);
  8410         if (__isExternalAddress(aWindowID)) {
  8421 	}
  8411             window = _WindowVal(aWindowID);
  8422 	if (__isSmallInteger(anObject)) {
  8412         } else {
  8423 	    value = __intVal(anObject);
  8413             window = DefaultRootWindow(dpy);
  8424 	    XChangeProperty(dpy, window, prop, type, 32,
  8414         }
  8425 			    PropModeReplace,
  8415 
  8426 			    (unsigned char *)(&value), sizeof(unsigned int));
  8416         if (__isSmallInteger(anObject)) {
  8427 	} else {
  8417             value = __intVal(anObject);
  8428 	    if (__isByteArray(anObject)) {
  8418             XChangeProperty(dpy, window, prop, type, 32,
  8429 		XChangeProperty(dpy, window, prop, type, 8,
  8419                             PropModeReplace,
  8430 				PropModeReplace,
  8420                             (unsigned char *)(&value), sizeof(unsigned int));
  8431 				__ByteArrayInstPtr(anObject)->ba_element,
  8421         } else {
  8432 				__byteArraySize(anObject));
  8422             if (__isByteArray(anObject)) {
  8433 	    } else {
  8423                 XChangeProperty(dpy, window, prop, type, 8,
  8434 		/* string or symbol or wordArray-like (16bit-string) object */
  8424                                 PropModeReplace,
  8435 		type = _AtomVal(typeID);
  8425                                 __ByteArrayInstPtr(anObject)->ba_element,
  8436 		if (__isWords(__qClass(anObject))) {
  8426                                 __byteArraySize(anObject));
  8437 		    XChangeProperty(dpy, window, prop, type, 16,
  8427             } else {
  8438 				    PropModeReplace,
  8428                 /* string or symbol or wordArray-like (16bit-string) object */
  8439 				    __stringVal(anObject),
  8429                 if (__isWords(__qClass(anObject))) {
  8440 				    __wordArraySize(anObject));
  8430                     XChangeProperty(dpy, window, prop, type, 16,
  8441 		} else {
  8431                                     PropModeReplace,
  8442 		    XChangeProperty(dpy, window, prop, type, 8,
  8432                                     __stringVal(anObject),
  8443 				    PropModeReplace,
  8433                                     __wordArraySize(anObject));
  8444 				    __stringVal(anObject),
  8434                 } else {
  8445 				    __stringSize(anObject));
  8435                     XChangeProperty(dpy, window, prop, type, 8,
  8446 		}
  8436                                     PropModeReplace,
  8447 	    }
  8437                                     __stringVal(anObject),
  8448 	}
  8438                                     __stringSize(anObject));
  8449 	RETURN (true);
  8439                 }
       
  8440             }
       
  8441         }
       
  8442         DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
       
  8443         RETURN (true);
  8450     }
  8444     }
  8451 %}.
  8445 %}.
  8452     ^ false
  8446     ^ false
  8453 !
  8447 !
  8454 
  8448 
  8817 ! !
  8811 ! !
  8818 
  8812 
  8819 !XWorkstation methodsFor:'selections'!
  8813 !XWorkstation methodsFor:'selections'!
  8820 
  8814 
  8821 getSelectionFor:drawableId
  8815 getSelectionFor:drawableId
  8822     "get the object selection -  either immediate, or asynchronous.
  8816     "get the object selection - either immediate, or asynchronous.
  8823      Returns nil, if async request is on its way"
  8817      Returns nil, if async request is on its way"
  8824 
  8818 
  8825     |selProp sel|
  8819     |selProp sel|
  8826 
  8820 
  8827     (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
  8821     (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
  8828 	"no primary selection - use cut buffer"
  8822         "no primary selection - use cut buffer"
  8829 	sel := self getObjectProperty:cutBuffer0Atom from:nil.
  8823         sel := self getObjectProperty:cutBuffer0Atom from:nil.
  8830 	^ sel
  8824         ^ sel
  8831     ].
  8825     ].
  8832     selProp := self atomIDOf:'ST_SELECTION' create:true.
  8826     selProp := self atomIDOf:'ST_SELECTION' create:true.
  8833     self requestObjectSelection:primaryAtom property:selProp for:drawableId.
  8827     self requestObjectSelection:primaryAtom property:selProp for:drawableId.
  8834     ^ nil
  8828     ^ nil
       
  8829 
       
  8830     "Modified: / 17.6.1998 / 17:11:15 / cg"
  8835 !
  8831 !
  8836 
  8832 
  8837 getSelectionOwnerOf:selectionAtomID
  8833 getSelectionOwnerOf:selectionAtomID
  8838     "get the owner of a selection"
  8834     "get the owner of a selection"
  8839 
  8835 
  8857      Returns nil, if async request is on its way"
  8853      Returns nil, if async request is on its way"
  8858 
  8854 
  8859     |selProp sel|
  8855     |selProp sel|
  8860 
  8856 
  8861     (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
  8857     (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
  8862 	"no primary selection - use cut buffer"
  8858         "no primary selection - use cut buffer"
  8863 	sel := self getTextProperty:cutBuffer0Atom from:nil.
  8859         sel := self getTextProperty:cutBuffer0Atom from:nil.
  8864 	^ sel
  8860         ^ sel
  8865     ].
  8861     ].
  8866     selProp := self atomIDOf:'VT_SELECTION' create:true.
  8862     selProp := self atomIDOf:'VT_SELECTION' create:true.
  8867     self requestTextSelection:primaryAtom property:selProp for:drawableId.
  8863     self requestTextSelection:primaryAtom property:selProp for:drawableId.
  8868     ^ nil
  8864     ^ nil
       
  8865 
       
  8866     "Modified: / 17.6.1998 / 17:12:05 / cg"
  8869 !
  8867 !
  8870 
  8868 
  8871 requestObjectSelection:selectionID property:propertyID for:aWindowId
  8869 requestObjectSelection:selectionID property:propertyID for:aWindowId
  8872     "ask the server to send us the selection - the view with ID aWindowID
  8870     "ask the server to send us the selection - the view with ID aWindowID
  8873      will later receive a SelectionNotify event for it."
  8871      will later receive a SelectionNotify event for it."
  8925 		   property:propertyID 
  8923 		   property:propertyID 
  8926 		       type:stringAtom 
  8924 		       type:stringAtom 
  8927 			for:aWindowId
  8925 			for:aWindowId
  8928 !
  8926 !
  8929 
  8927 
  8930 sendSelection:something property:propertyID target:targetID from:windowID to:requestorID
  8928 sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
  8931     "send aString back from a SelectionRequest"
  8929     "send aString back from a SelectionRequest"
  8932 
  8930 
  8933     self 
  8931     self 
  8934 	sendSelection:something 
  8932         setProperty:propertyID 
  8935 	selection:primaryAtom
  8933         type:targetID 
  8936 	property:propertyID 
  8934         value:something 
  8937 	target:targetID 
  8935         for:requestorID.
  8938 	from:windowID 
       
  8939 	to:requestorID
       
  8940 !
       
  8941 
       
  8942 sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID
       
  8943     "send aString back from a SelectionRequest"
       
  8944 
       
  8945     self 
  8936     self 
  8946 	setProperty:propertyID 
  8937         sendSelectionNotifySelection:selectionID 
  8947 	type:targetID 
  8938         property:propertyID 
  8948 	value:something 
  8939         target:targetID
  8949 	for:requestorID.
  8940         time:t 
  8950     self 
  8941         from:windowID 
  8951 	sendSelectionNotifySelection:selectionID 
  8942         to:requestorID.
  8952 	property:propertyID 
  8943 
  8953 	target:targetID 
  8944     "Modified: / 17.6.1998 / 17:03:20 / cg"
  8954 	from:requestorID 
  8945     "Created: / 17.6.1998 / 19:44:03 / cg"
  8955 	to:requestorID.
  8946 !
  8956 !
  8947 
  8957 
  8948 sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
  8958 sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID
       
  8959     "send a selectionNotify back from a SelectionRequest"
  8949     "send a selectionNotify back from a SelectionRequest"
  8960 
  8950 
  8961 %{  /* NOCONTEXT */
  8951 %{  /* NOCONTEXT */
  8962 
       
  8963     if (__isAtomID(propertyID)
  8952     if (__isAtomID(propertyID)
  8964      && __isExternalAddress(requestorID)
  8953      && __isExternalAddress(requestorID)
  8965      && ISCONNECTED
  8954      && ISCONNECTED
  8966      && __isAtomID(targetID)
  8955      && __isAtomID(targetID)
  8967      && __isAtomID(selectionID)) {
  8956      && __isAtomID(selectionID)) {
  8979         ev.xselection.target = target;
  8968         ev.xselection.target = target;
  8980         if (__isExternalAddress(windowID))
  8969         if (__isExternalAddress(windowID))
  8981             ev.xselection.requestor = _WindowVal(windowID);
  8970             ev.xselection.requestor = _WindowVal(windowID);
  8982         else
  8971         else
  8983             ev.xselection.requestor = DefaultRootWindow(dpy);
  8972             ev.xselection.requestor = DefaultRootWindow(dpy);
  8984         ev.xselection.time = CurrentTime;
  8973         if (__isExternalAddress(t)) {
       
  8974             ev.xselection.time = (INT)(__externalAddressVal(t));
       
  8975         } else {
       
  8976             ev.xselection.time = CurrentTime;
       
  8977         }
  8985         if (property == None)
  8978         if (property == None)
  8986             ev.xselection.property = target;
  8979             ev.xselection.property = target;
  8987         else
  8980         else
  8988             ev.xselection.property = property;
  8981             ev.xselection.property = property;
  8989 
  8982 
  8992                 ev.xselection.property,
  8985                 ev.xselection.property,
  8993                 ev.xselection.target,
  8986                 ev.xselection.target,
  8994                 ev.xselection.requestor,
  8987                 ev.xselection.requestor,
  8995                 requestor));
  8988                 requestor));
  8996 
  8989 
  8997 	ENTER_XLIB();
  8990         ENTER_XLIB();
  8998         result = XSendEvent(dpy, requestor, False, 0 , &ev);
  8991         result = XSendEvent(dpy, requestor, False, 0 , &ev);
  8999 	LEAVE_XLIB();
  8992         LEAVE_XLIB();
  9000 
  8993 
  9001         if ((result == BadValue) || (result == BadWindow)) {
  8994         if ((result == BadValue) || (result == BadWindow)) {
  9002             DPRINTF(("bad status\n"));
  8995             DPRINTF(("bad status\n"));
  9003             RETURN (false);
  8996             RETURN (false);
  9004         }
  8997         }
  9005 	ENTER_XLIB();
  8998         ENTER_XLIB();
  9006         XFlush(dpy);
  8999         XFlush(dpy);
  9007 	LEAVE_XLIB();
  9000         LEAVE_XLIB();
  9008         RETURN (true)
  9001         RETURN (true)
  9009     }
  9002     }
  9010 %}.
  9003 %}.
  9011     self primitiveFailed.
  9004     self primitiveFailed.
  9012     ^ false
  9005     ^ false
       
  9006 
       
  9007     "Modified: / 17.6.1998 / 20:23:20 / cg"
  9013 !
  9008 !
  9014 
  9009 
  9015 setSelection:anObject owner:aWindowId
  9010 setSelection:anObject owner:aWindowId
  9016     "set the object selection, and make aWindowId be the owner.
  9011     "set the object selection, and make aWindowId be the owner.
  9017      This can be used by other Smalltalk(X) applications only."
  9012      This can be used by other Smalltalk(X) applications only."
  9030     Window win;
  9025     Window win;
  9031 
  9026 
  9032     if (__isExternalAddress(aWindowId)
  9027     if (__isExternalAddress(aWindowId)
  9033      && __isAtomID(selectionID)
  9028      && __isAtomID(selectionID)
  9034      && ISCONNECTED) {
  9029      && ISCONNECTED) {
  9035 	Display *dpy = myDpy;
  9030         Display *dpy = myDpy;
  9036 
  9031 
  9037 	win = _WindowVal(aWindowId);
  9032         win = _WindowVal(aWindowId);
  9038 	XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime);
  9033         XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime);
  9039 	if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) {
  9034         DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win));
  9040 	    RETURN (false);
  9035         if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) {
  9041 	}
  9036             RETURN (false);
  9042 	RETURN (true);
  9037         }
  9043     }
  9038         RETURN (true);
  9044 %}
  9039     }
  9045 .
  9040 %}.
  9046     self primitiveFailed.
  9041     self primitiveFailed.
  9047     ^ nil
  9042     ^ nil
  9048 !
  9043 !
  9049 
  9044 
  9050 setTextSelection:aString owner:aWindowId
  9045 setTextSelection:aString owner:aWindowId
  9051     "set the text selection, and make aWindowId be the owner.
  9046     "set the text selection, and make aWindowId be the owner.
  9052      This can be used by any other X application."
  9047      This can be used by any other X application."
  9053 
  9048 
  9054     (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
  9049     (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
  9055 	'XWorkstation [warning]: selection ownerchange failed' errorPrintCR.
  9050         'XWorkstation [warning]: selection ownerchange failed' errorPrintCR.
  9056     ].
  9051     ].
  9057     ^ self setTextProperty:cutBuffer0Atom value:aString for:nil
  9052     ^ self setTextProperty:cutBuffer0Atom value:aString for:rootId.
  9058 
  9053 
  9059     "Modified: 10.1.1997 / 18:18:00 / cg"
  9054     "Modified: / 17.6.1998 / 19:48:54 / cg"
  9060 ! !
  9055 ! !
  9061 
  9056 
  9062 !XWorkstation methodsFor:'window stuff'!
  9057 !XWorkstation methodsFor:'window stuff'!
  9063 
  9058 
  9064 clearRectangleX:x y:y width:width height:height in:aWindowId
  9059 clearRectangleX:x y:y width:width height:height in:aWindowId
  9908 ! !
  9903 ! !
  9909 
  9904 
  9910 !XWorkstation class methodsFor:'documentation'!
  9905 !XWorkstation class methodsFor:'documentation'!
  9911 
  9906 
  9912 version
  9907 version
  9913     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.283 1998-06-13 11:55:14 cg Exp $'
  9908     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.284 1998-06-17 18:25:57 cg Exp $'
  9914 ! !
  9909 ! !
  9915 XWorkstation initialize!
  9910 XWorkstation initialize!