diff -r e3b21cba1c59 -r 20c37636e4b8 XWorkstation.st --- a/XWorkstation.st Thu Sep 28 18:24:27 2000 +0200 +++ b/XWorkstation.st Fri Sep 29 14:23:16 2000 +0200 @@ -10,14 +10,16 @@ hereby transferred. " +'From Smalltalk/X, Version:4.1.1 on 29-sep-2000 at 12:58:38' ! + "{ Package: 'stx:libview' }" DeviceWorkstation subclass:#XWorkstation instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension hasImageExtension hasInputExtension ignoreBackingStore blackpixel - whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom - quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom + whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom + quitAppAtom primaryAtom cutBuffer0Atom stringAtom lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX eventRootY displayName eventTrace dispatchingExpose rgbVisual virtualRootId rootId eventBuffer altModifierMask metaModifierMask @@ -166,19 +168,20 @@ /* * some defines - tired of typing ... */ -#define _DisplayVal(o) (Display *)(__externalAddressVal(o)) -#define _WindowVal(o) (Window)(__externalAddressVal(o)) -#define _PixmapVal(o) (Pixmap)(__externalAddressVal(o)) -#define _GCVal(o) (GC)(__externalAddressVal(o)) -#define _CursorVal(o) (Cursor)(__externalAddressVal(o)) -#define _FontVal(o) (XFontStruct *)(__externalAddressVal(o)) -#define _DPSContextVal(o) (DPSContext)(__externalAddressVal(o)) +#define __DisplayVal(o) (Display *)(__externalAddressVal(o)) +#define __DrawableVal(o) (Drawable)(__externalAddressVal(o)) +#define __WindowVal(o) (Window)(__externalAddressVal(o)) +#define __PixmapVal(o) (Pixmap)(__externalAddressVal(o)) +#define __GCVal(o) (GC)(__externalAddressVal(o)) +#define __CursorVal(o) (Cursor)(__externalAddressVal(o)) +#define __FontVal(o) (XFontStruct *)(__externalAddressVal(o)) +#define __DPSContextVal(o) (DPSContext)(__externalAddressVal(o)) #define __MKATOMOBJ(a) __MKSMALLINT(a) -#define _AtomVal(o) __intVal(o) +#define __AtomVal(o) __intVal(o) #define __isAtomID(o) __isSmallInteger(o) -#define myDpy _DisplayVal(__INST(displayId)) +#define myDpy __DisplayVal(__INST(displayId)) #define ISCONNECTED (__INST(displayId) != nil) #ifdef __VMS__ @@ -780,7 +783,7 @@ y1 := y2 := aPoint y truncated. %{ int xpos, ypos; - Window w1, w2, child_return; + Window w1, w2, child_ret; int screen = __intVal(__INST(screen)); if (ISCONNECTED @@ -790,8 +793,8 @@ Display *dpy = myDpy; Window rootWin; - w1 = _WindowVal(windowId1); - w2 = _WindowVal(windowId2); + w1 = __WindowVal(windowId1); + w2 = __WindowVal(windowId2); #ifdef VIRTUAL_ROOT rootWin = RootWindow(dpy, screen); @@ -808,7 +811,7 @@ ENTER_XLIB(); XTranslateCoordinates(dpy, w1, w2, __intVal(x1), __intVal(y1), - &xpos, &ypos, &child_return); + &xpos, &ypos, &child_ret); LEAVE_XLIB(); x2 = __MKSMALLINT(xpos); @@ -848,7 +851,7 @@ int screen = __intVal(__INST(screen)); OBJ xp, yp; int xpos, ypos; - Window child_return; + Window child_ret; if (ISCONNECTED && __isExternalAddress(windowId) @@ -862,13 +865,13 @@ ENTER_XLIB(); XTranslateCoordinates(dpy, RootWindow(dpy, screen), - _WindowVal(windowId), + __WindowVal(windowId), __intVal(xp), __intVal(yp), - &xpos, &ypos, &child_return); + &xpos, &ypos, &child_ret); LEAVE_XLIB(); - if (child_return) { - RETURN ( __MKEXTERNALADDRESS(child_return) ); + if (child_ret) { + RETURN ( __MKEXTERNALADDRESS(child_ret) ); } RETURN ( nil ); } @@ -900,7 +903,7 @@ unsigned int dummy; int ret; - vRootWin = _WindowVal(__INST(virtualRootId)); + vRootWin = __WindowVal(__INST(virtualRootId)); ENTER_XLIB(); ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, &dummy, &dummy); @@ -1122,23 +1125,6 @@ "Created: 10.6.1996 / 21:06:48 / cg" ! -queryAtom:atomName - -%{ - Display *dpy; - - if (ISCONNECTED) { - dpy = myDpy; - RETURN ( __MKATOMOBJ( XInternAtom(dpy, __stringVal(atomName), True) )); - } -%}. - ^ nil - - " - Display queryAtom:'PRIMARY' - " -! - queryBlackPixel %{ /* NOCONTEXT */ @@ -1920,7 +1906,7 @@ bd = BlackPixel(dpy, screen); if (__isExternalAddress(wsuperViewId)) { - parentWindow = _WindowVal(wsuperViewId); + parentWindow = __WindowVal(wsuperViewId); } else { parentWindow = RootWindow(dpy, screen); isTopWindow = 1; @@ -2020,17 +2006,17 @@ */ if (isTopWindow) { if (__isExternalAddress(wiconId)) - iconBitmap = _PixmapVal(wiconId); + iconBitmap = __PixmapVal(wiconId); else iconBitmap = (Pixmap)0; if (__isExternalAddress(wiconMaskId)) - iconMask = _PixmapVal(wiconMaskId); + iconMask = __PixmapVal(wiconMaskId); else iconMask = (Pixmap)0; if (__isExternalAddress(wiconViewId)) - iconWindow = _WindowVal(wiconViewId); + iconWindow = __WindowVal(wiconViewId); else iconWindow = (Window)0; @@ -2092,14 +2078,14 @@ LEAVE_XLIB(); } else { #ifdef USE_QUIT_APP_ATOM - WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); + WmQuitAppAtom = __AtomVal(__INST(quitAppAtom)); #else WmQuitAppAtom = 0; #endif - WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); - WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); + WmProtocolsAtom = __AtomVal(__INST(protocolsAtom)); + WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom)); #ifdef USE_SAVEYOURSELF_ATOM - WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); + WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom)); #else WmSaveYourselfAtom = 0; #endif @@ -2136,7 +2122,7 @@ } if (__isExternalAddress(aGCId)) { - GC gc = _GCVal(aGCId); + GC gc = __GCVal(aGCId); if (gc) { @@ -2164,7 +2150,7 @@ } if (__isExternalAddress(aDrawableId)) { - Pixmap pix = _PixmapVal(aDrawableId); + Pixmap pix = __PixmapVal(aDrawableId); if (pix) { @@ -2200,8 +2186,8 @@ && ISCONNECTED) { ENTER_XLIB(); - dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), - _GCVal(aGCId), + dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId), + __GCVal(aGCId), 0, height, 0, colormap, NULL, 0, XDPSDefaultTextBackstop, XDPSDefaultErrorProc, @@ -2226,8 +2212,7 @@ if (__isExternalAddress(aDrawableId) && ISCONNECTED) { ENTER_XLIB(); - gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), - 0L, (XGCValues *)0); + gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0); LEAVE_XLIB(); #ifdef COUNT_RESOURCES @@ -2235,7 +2220,6 @@ __cnt_gc++; #endif - RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); } %}. @@ -2371,7 +2355,7 @@ } if (__isExternalAddress(aWindowId)) { - Window win = _WindowVal(aWindowId); + Window win = __WindowVal(aWindowId); if (win) { @@ -2930,7 +2914,7 @@ bgcolor.blue = __intVal(bgB); ENTER_XLIB(); - XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); + XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor); LEAVE_XLIB(); RETURN ( self ); @@ -2972,7 +2956,7 @@ } if (__isExternalAddress(aCursorId)) { - Cursor curs = _CursorVal(aCursorId); + Cursor curs = __CursorVal(aCursorId); if (curs) { @@ -3043,8 +3027,8 @@ ENTER_XLIB(); newCursor = XCreatePixmapCursor(myDpy, - _PixmapVal(sourceId), - _PixmapVal(maskId), + __PixmapVal(sourceId), + __PixmapVal(maskId), &fgColor, &bgColor, __intVal(hx), __intVal(hy)); LEAVE_XLIB(); #ifdef COUNT_RESOURCES @@ -3107,7 +3091,7 @@ |msgType dropColl dropCollSize anyFile anyDir anyText anyOther dropType dropTypeCode strings sz idx val| - (msgType := self atomIDOf:'DndProtocol') notNil ifTrue:[ + (msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[ "/ DND can drop files, file, dir, links, dirLink and text "/ check for this. @@ -3214,8 +3198,8 @@ ]. self - setProperty:(self atomIDOf:'DndSelection') - type:(stringAtom) + setProperty:(self atomIDOf:#DndSelection) + type:(self atomIDOf:#STRING) value:val for:rootId. @@ -3225,7 +3209,7 @@ to:destinationId data1:dropTypeCode data2:0 - data3:(destinationId) + data3:destinationId data4:nil data5:nil. ]. @@ -3261,7 +3245,7 @@ "/ "/ see, if the display supports the DND protocol ... "/ - (self atomIDOf:'DndProtocol') notNil ifTrue:[ + (self atomIDOf:#DndProtocol) notNil ifTrue:[ ^ self dndDrop:aCollectionOfDropObjects inWindowID:destinationId @@ -3306,9 +3290,9 @@ _dX = __intVal(dstX); _dY = __intVal(dstY); - gc = _GCVal(dstGCId); - source = (Drawable) _WindowVal(sourceId); - dest = (Drawable) _WindowVal(destId); + gc = __GCVal(dstGCId); + source = __DrawableVal(sourceId); + dest = __DrawableVal(destId); ENTER_XLIB(); XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); LEAVE_XLIB(); @@ -3343,9 +3327,9 @@ && __bothSmallInteger(dstX, dstY)) { Display *dpy = myDpy; - gc = _GCVal(dstGCId); - source = (Drawable) _WindowVal(sourceId); - dest = (Drawable) _WindowVal(destId); + gc = __GCVal(dstGCId); + source = __DrawableVal(sourceId); + dest = __DrawableVal(destId); ENTER_XLIB(); XSetGraphicsExposures(dpy, gc, 0); XCopyArea(dpy, source, dest, gc, @@ -3383,9 +3367,9 @@ && __bothSmallInteger(w, h) && __bothSmallInteger(srcX, srcY) && __bothSmallInteger(dstX, dstY)) { - gc = _GCVal(dstGCId); - source = (Drawable) _WindowVal(sourceId); - dest = (Drawable) _WindowVal(destId); + gc = __GCVal(dstGCId); + source = __DrawableVal(sourceId); + dest = __DrawableVal(destId); ENTER_XLIB(); XCopyPlane(myDpy, source, dest, gc, __intVal(srcX), __intVal(srcY), @@ -3424,9 +3408,9 @@ && __bothSmallInteger(dstX, dstY)) { Display *dpy = myDpy; - gc = _GCVal(dstGCId); - source = (Drawable) _WindowVal(sourceId); - dest = (Drawable) _WindowVal(destId); + gc = __GCVal(dstGCId); + source = __DrawableVal(sourceId); + dest = __DrawableVal(destId); ENTER_XLIB(); XSetGraphicsExposures(dpy, gc, 0); XCopyPlane(dpy, source, dest, gc, @@ -3481,8 +3465,8 @@ && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y) && __bothSmallInteger(width, height)) { - win = _WindowVal(aDrawableId); - gc = _GCVal(aGCId); + win = __WindowVal(aDrawableId); + gc = __GCVal(aGCId); w = __intVal(width); h = __intVal(height); /* @@ -3519,8 +3503,8 @@ && __bothSmallInteger(x0, y0) && __bothSmallInteger(x1, y1)) { Display *dpy = myDpy; - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); ENTER_XLIB(); if ((x0 == x1) && (y0 == y1)) { @@ -3564,8 +3548,8 @@ if (ISCONNECTED && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) ) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); if( __isSmallInteger(scaleY) ) sY = (float) __intVal( scaleY ); @@ -3676,8 +3660,8 @@ && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); ENTER_XLIB(); XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); @@ -3713,8 +3697,8 @@ && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) && __isSmallInteger(numberOfPoints)) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); num = __intVal(numberOfPoints); /* * avoid a (slow) malloc, if the number of points is small @@ -3768,8 +3752,8 @@ && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y) && __bothSmallInteger(width, height)) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); w = __intVal(width); h = __intVal(height); /* @@ -3812,8 +3796,8 @@ && __bothSmallInteger(x, y)) { int lMax = __intVal(@global(XWorkstation:MaxStringLength)); Display *dpy = myDpy; - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); cls = __qClass(aString); i1 = __intVal(index1) - 1; @@ -3943,8 +3927,8 @@ && __bothSmallInteger(x, y)) { int lMax = __intVal(@global(XWorkstation:MaxStringLength)); Display *dpy = myDpy; - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); cls = __qClass(aString); cp = (char *) __stringVal(aString); @@ -4140,8 +4124,8 @@ && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y) && __bothSmallInteger(width, height)) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); w = __intVal(width); h = __intVal(height); /* @@ -4185,8 +4169,8 @@ && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) && __isSmallInteger(numberOfPoints)) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); num = __intVal(numberOfPoints); if (num < 3) { RETURN ( self ); @@ -4247,7 +4231,7 @@ if ((w >= 0) && (h >= 0)) { ENTER_XLIB(); XFillRectangle(myDpy, - (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), + __DrawableVal(aDrawableId), __GCVal(aGCId), __intVal(x), __intVal(y), w, h); LEAVE_XLIB(); } @@ -4295,8 +4279,8 @@ Display *dpy = myDpy; int pad = __intVal(bitPadding); - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); + gc = __GCVal(aGCId); + win = __WindowVal(aDrawableId); if (! gc || !win) goto fail; #ifdef ARGDEBUG @@ -4403,44 +4387,20 @@ buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1). multiClickTimeDelta notNil ifTrue:[ - nextMultiClickTime := time + multiClickTimeDelta. - multiClickTime notNil ifTrue:[ - time < multiClickTime ifTrue:[ - multiClickTime := nextMultiClickTime. - self buttonMultiPress:logicalButton x:x y:y view:view. - ^ self. - ] - ]. - multiClickTime := nextMultiClickTime. + nextMultiClickTime := time + multiClickTimeDelta. + multiClickTime notNil ifTrue:[ + time < multiClickTime ifTrue:[ + multiClickTime := nextMultiClickTime. + self buttonMultiPress:logicalButton x:x y:y view:view. + ^ self. + ] + ]. + multiClickTime := nextMultiClickTime. ]. self buttonPress:logicalButton x:x y:y view:view ! -buttonPress:button x:x y:y view:aView - "forward a button-press event for some view" - - aView isNil ifTrue:[ - "/ event arrived, after I destroyed it myself - ^ self - ]. - button == 1 ifTrue:[ - activateOnClick == true ifTrue:[ - "/ dont raise above an active popup view. - (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ - aView topView raise. -"/ ] ifFalse:[ -"/ activeKeyboardGrab printCR. -"/ activePointerGrab printCR. - ] - ]. - ]. - super buttonPress:button x:x y:y view:aView - - - -! - buttonRelease:view button:button state:state x:x y:y rootX:rX rootY:rY time:time "forward a buttonPress event for some view" @@ -4462,39 +4422,30 @@ self buttonRelease:logicalButton x:x y:y view:view ! -circulateNotifyView:aView +circulateNotify:aView place:aSymbol "sent, when the stacking order changes. ignored for now." ! -circulateRequestView:aView +circulateRequest:aView place:aSymbol "sent, when the stacking order is about to change. ignored for now." ! -clientMessage:event dataOffset:offs view:targetView - self halt:'debug halt: unimplemented client message'. - - "Created: 4.4.1997 / 17:23:12 / cg" - "Modified: 17.6.1997 / 18:04:24 / cg" -! - -clientMessage:event type:type format:format dataOffset:offs view:targetView - |sensor data| - - data := event copyFrom:offs + 1. +clientMessage:targetView type:typeAtom format:format data:data + |sensor| "/ DND drag&drop protocol - type == (self atomIDOf:'DndProtocol') ifTrue:[ + typeAtom == (self atomIDOf:#DndProtocol) ifTrue:[ format == 32 ifTrue:[ - self dndMessage:event data:data view:targetView. + self dndMessage:nil data:data view:targetView. ^ self ] ]. (sensor := targetView sensor) notNil ifTrue:[ - sensor clientMessage:type format:format eventData:data view:targetView + sensor clientMessage:typeAtom format:format eventData:data view:targetView ] ifFalse:[ " not posted, if there is no sensor ... @@ -4505,7 +4456,7 @@ "Modified: 4.4.1997 / 18:00:18 / cg" ! -colorMapChangeView:aView +colorMapNotify:aView state:aBoolean "sent, when another colormap is installed. This is a very X-specific mechanism." @@ -4522,16 +4473,12 @@ self configureX:x y:y width:w height:h view:view ! -configureRequestView:aView +configureRequest:view x:x y:y width:w height:h above:above detail:detail "ignored for now" - "/ aView configureRequest -! - -createdView:aView - "ignored for now" - - "/ aView created + "/ view configureRequest + + ! dndMessage:event data:data view:targetView @@ -4545,7 +4492,7 @@ dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. self - getProperty:(self atomIDOf:'DndSelection') + getProperty:(self atomIDOf:#DndSelection) from:rootId into:[:type :value | t := type. @@ -4676,7 +4623,7 @@ ! -gravityNotifyView:aView +gravityNotify:aView x:x y:y "ignored for now" "/ aView gravityNotify @@ -4724,10 +4671,30 @@ ! -mapRequestView:aView +keymapNotify:aView + "ignore for now" + +! + +mapRequest:aView "ignored for now" "/ aView mapRequest + + + +! + +mappingNotify:view request:what event:eB + "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap. + Tell xlib about the fact." + + (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ + self refreshKeyboardMapping:eB. + "Maybe some of our modifiers have been changed" + self initializeModifierMappings. + ]. + ! pointerEnter:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time @@ -4756,7 +4723,7 @@ self pointerLeave:state view:view ! -propertyChangeView:aView +propertyChange:aView atom:atom state:aSymbol time:time "sent when an X property changes. This is a very X-specific mechanism." @@ -4773,7 +4740,7 @@ "/ aView reparented ! -resizeRequestView:aView +resizeRequest:aView width:width height:height "ignored for now" "/ aView resizeRequest @@ -4797,42 +4764,6 @@ ! -selectionClear:aView selection:selectionID time:time - "sent when another X-client has created a selection. - This is a very X-specific mechanism." - - "/ - "/ workaround a bug in olvwm: it clears selections - "/ on window raise. - "/ In this case, keep my last own selection. - "/ - - self setLastCopyBuffer:(self getCopyBuffer). - self setCopyBuffer:nil - - "/ noone is interested in that ... - "/ aView selectionClear:selectionID -! - -selectionClear:selectionID view:aView - "OBSOLETE - this will vanish" - - "sent when another X-client has created a selection. - This is a very X-specific mechanism." - - "/ - "/ workaround a bug in olvwm: it clears selections - "/ on window raise. - "/ In this case, keep my last own selection. - "/ - - self setLastCopyBuffer:(self getCopyBuffer). - self setCopyBuffer:nil - - "/ noone is interested in that ... - "/ aView selectionClear:selectionID -! - selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time "sent when the server returns an answer from a request for a selection. This is a very X-specific mechanism." @@ -4843,47 +4774,7 @@ "invalid olvwm behavior" s := self getLastCopyBuffer ] ifFalse:[ - targetID == self atomIDOfSTRING ifTrue:[ - " - a returned string - " - s := self getTextProperty:propertyID from:requestorID. - s notNil ifTrue:[ - (s endsWith:Character cr) ifTrue:[ - s := s asStringCollection copyWith:'' - ] - ] - ] ifFalse:[ - " - a returned object - " - s := self getObjectProperty:propertyID from:requestorID. - ]. - ]. - - s notNil ifTrue:[ - (sensor := aView sensor) notNil ifTrue:[ - sensor pasteFromClipBoard:s view:aView - ] ifFalse:[ - " - if there is no sensor ... - " - aView pasteFromClipBoard:s - ] - ] -! - -selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView - "sent when the server returns an answer from a request for a selection. - This is a very X-specific mechanism." - - |s sensor| - - propertyID == 0 ifTrue:[ - "invalid olvwm behavior" - s := self getLastCopyBuffer - ] ifFalse:[ - targetID == self atomIDOfSTRING ifTrue:[ + targetID == (self atomIDOf:#STRING) ifTrue:[ " a returned string " @@ -4917,11 +4808,11 @@ "sent by some other X-client to ask for the selection. This is a very X-specific mechanism." - |o s stream| + |o s stream stringAtom| "/targetID printCR. - targetID == (self atomIDOfLENGTH) ifTrue:[ + targetID == (self atomIDOf:#LENGTH) ifTrue:[ "/ "/ the other one wants to know the size of our selection ... "/ @@ -4941,8 +4832,9 @@ ^ self ]. - (targetID == self atomIDOfSTRING or:[ - targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[ + stringAtom := self atomIDOf:#STRING. + (targetID == stringAtom or:[ + targetID == (self atomIDOf:#'COMPOUND_TEXT')]) ifTrue:[ "/ "/ the other view wants the selection as string "/ @@ -4952,20 +4844,20 @@ sendSelection:s selection:primaryAtom property:propertyID - target:self atomIDOfSTRING "/ targetID, once I can provide compountText as well + target:stringAtom "/ targetID, once I can provide compountText as well time:time from:requestorID to:requestorID. ^ self ]. -"/ (targetID == (self atomIDOf:'TARGETS')) ifTrue:[ +"/ (targetID == (self atomIDOf:#'TARGETS')) ifTrue:[ "/"/ TODO: implement this to avoid netscape paste-delay. "/"/ "/ ^ self "/ ]. - (targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[ + (targetID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[ "/ "/ send the selection in binaryStore format "/ (assuming, that the other view knows how to handle it) @@ -4986,77 +4878,6 @@ ! -selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView - "sent by some other X-client to ask for the selection. - This is a very X-specific mechanism." - - |o s stream| - - targetID == (self atomIDOfLENGTH) ifTrue:[ - "/ - "/ the other one wants to know the size of our selection ... - "/ - s := self selectionAsString. - self - setLengthProperty:propertyID - value:s size - for:windowID. - self - sendSelectionNotifySelection:selectionID - property:propertyID - target:targetID - time:t - from:aView id - to:windowID. - ^ self - ]. - - (targetID == self atomIDOfSTRING or:[ - targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[ - "/ - "/ the other view wants the selection as string - "/ - s := self selectionAsString. - self - sendSelection:s - selection:primaryAtom - property:propertyID - target:self atomIDOfSTRING "/ targetID - time:t - from:windowID - to:windowID. - ^ self - ]. - -"/ (targetID == (self atomIDOf:'TARGETS')) ifTrue:[ -"/"/ TODO: implement this to avoid netscape paste-delay. -"/"/ -"/ ^ self -"/ ]. - - (targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[ - "/ - "/ send the selection in binaryStore format - "/ (assuming, that the other view knows how to handle it) - "/ - o := self getCopyBuffer. - stream := WriteStream on:(ByteArray new:200). - o storeBinaryOn:stream. - - ^ self - sendSelection:(stream contents) - selection:primaryAtom - property:propertyID - target:targetID - time:t - from:windowID - to:windowID - ]. - - "Created: / 17.6.1998 / 19:33:10 / cg" - "Modified: / 17.6.1998 / 20:24:40 / cg" -! - visibilityNotify:aView state:how aView notNil ifTrue:[ aView visibilityChange:how @@ -5069,11 +4890,11 @@ decomposeEventBuffer:aByteArray into:eventArr "extracet event fields and place them into an array: the fields are: - 1: windowID - 2: eventType-ID - 3: eventTypeSymbol - - 4.. args + 1: windowID + 2: eventType-ID + 3: eventTypeSymbol + + 4.. args " %{ # define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) @@ -5103,7 +4924,7 @@ # define cme ((XColormapEvent *)ev) KeySym keySym; - unsigned char buffer[10]; + unsigned char buffer[10]; int i, nchars; char *keySymString; char keySymStringBuffer[32]; @@ -5113,382 +4934,385 @@ eB = aByteArray; if (__isByteArray(eB)) { - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); } else { - printf("DISPLAY: no eventBuffer\n"); - RETURN (false); + printf("DISPLAY: no eventBuffer\n"); + RETURN (false); } if (!__isArray(eventArr)) { - printf("DISPLAY: bad argument\n"); - RETURN (false); + printf("DISPLAY: bad argument\n"); + RETURN (false); } if (__arraySize(eventArr) < 11) { - printf("DISPLAY: bad argument\n"); - RETURN (false); + printf("DISPLAY: bad argument\n"); + RETURN (false); } if (((t = __INST(lastId)) != nil) && __isExternalAddress(t) - && (_WindowVal(t) == ae->window)) { - windowID = t; + && (__WindowVal(t) == ae->window)) { + windowID = t; } else { - windowID = __MKEXTERNALADDRESS(ae->window); + windowID = __MKEXTERNALADDRESS(ae->window); } __ArrayInstPtr(eventArr)->a_element[0] = windowID; __STORE(eventArr, windowID); __ArrayInstPtr(eventArr)->a_element[1] = __MKSMALLINT(ev->type); switch (ev->type) { - case KeyRelease: - sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:); - goto keyPressAndRelease; - - case KeyPress: - sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:); - /* FALL INTO */ - - keyPressAndRelease: - arg = nil; - nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); - if (nchars - && (((buffer[0] >= ' ') && (buffer[0] <= '~')) - || (buffer[0] >= 0x80))) { - arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; - keySymString = NULL; - } else { - keySymString = XKeysymToString(keySym); - if (keySymString) { - arg = __MKSTRING(keySymString); - } - } - - if (arg == nil) { - /* happens sometimes (alt-graph on sun has no keysym) */ - RETURN (false); - } - - __ArrayInstPtr(eventArr)->a_element[2] = sym; - - __ArrayInstPtr(eventArr)->a_element[3] = arg; __STORE(eventArr, arg); - __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(ke->keycode); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ke->state); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ke->x); - __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ke->y); - __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ke->x_root); - __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ke->y_root); - __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ke->time); __STORE(eventArr, t); - RETURN (true); - - case ButtonPress: - sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:); - goto buttonPressAndRelease; - - case ButtonRelease: - sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:); - /* fall into */ - - buttonPressAndRelease: - __ArrayInstPtr(eventArr)->a_element[2] = sym; - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(be->button); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ke->state); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(be->x); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(be->y); - __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(be->x_root); - __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(be->y_root); - __ArrayInstPtr(eventArr)->a_element[9] = t = __MKUINT(be->time); __STORE(eventArr, t); - RETURN (true); - - case MotionNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:); - - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(me->state); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(me->x); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(me->y); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(me->x_root); - __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(me->y_root); - __ArrayInstPtr(eventArr)->a_element[8] = t = __MKUINT(me->time); __STORE(eventArr, t); - RETURN (true); - - case FocusIn: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusIn:mode:detail:); - goto focusInOut; - - case FocusOut: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusOut:mode:detail:); - /* fall into */ - - focusInOut: - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(fe->mode); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(fe->detail); - RETURN (true); - - - case EnterNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:); - goto enterLeave; - - case LeaveNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:); - /* fall into */ - - enterLeave: - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ele->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ele->y); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ele->x_root); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ele->y_root); - __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ele->state); - __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ele->mode); - __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ele->detail); - __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ele->time); __STORE(eventArr, t); - RETURN (true); - - case Expose: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(expose:x:y:width:height:count:); - goto expose; - - case GraphicsExpose: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:); - /* fall into */ - - expose: - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ee->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ee->y); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ee->width); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ee->height); - __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ee->count); - RETURN (true); - - case NoExpose: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(noExposeView:); - RETURN (true); - - case VisibilityNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(visibilityNotify:state:); - switch (ve->state) { - case VisibilityUnobscured: - __ArrayInstPtr(eventArr)->a_element[3] = @symbol(unobscured); - break; - case VisibilityPartiallyObscured: - __ArrayInstPtr(eventArr)->a_element[3] = @symbol(partiallyObscured); - break; - case VisibilityFullyObscured: - __ArrayInstPtr(eventArr)->a_element[3] = @symbol(fullyObscured); - break; - } - RETURN (true); - - case CreateNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(createWindow:x:y:width:height:); - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cre->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cre->y); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cre->width); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cre->height); - RETURN (true); - - case DestroyNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(destroyedView:); - RETURN (true); - - case UnmapNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(unmappedView:); - RETURN (true); - - case MapNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappedView:); - RETURN (true); - - case ConfigureNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configure:x:y:width:height:above:); - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ce->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ce->y); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ce->width); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ce->height); - __ArrayInstPtr(eventArr)->a_element[7] = nil; - if (ce->above != None) { - __ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(ce->above); __STORE(eventArr, t); - } - RETURN (true); - - case GravityNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(gravityNotify:x:y:); - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(gre->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(gre->y); - RETURN (true); - break; - - case ResizeRequest: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(resizeRequest:width:height:); - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(rr->width); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(rr->height); - RETURN (true); - break; - - case ConfigureRequest: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:); - __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cr->x); - __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cr->y); - __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cr->width); - __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cr->height); - __ArrayInstPtr(eventArr)->a_element[7] = nil; - if (cr->above != None) { - __ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(cr->above); __STORE(eventArr, t); - } - switch (cr->detail) { - case Above: - __ArrayInstPtr(eventArr)->a_element[8] = @symbol(above); - break; - case Below: - __ArrayInstPtr(eventArr)->a_element[8] = @symbol(below); - break; - case TopIf: - __ArrayInstPtr(eventArr)->a_element[8] = @symbol(topIf); - break; - case BottomIf: - __ArrayInstPtr(eventArr)->a_element[8] = @symbol(bottomIf); - break; - case Opposite: - __ArrayInstPtr(eventArr)->a_element[8] = @symbol(opposite); - break; - default: - __ArrayInstPtr(eventArr)->a_element[8] = nil; - break; - } - RETURN (true); - break; - - case CirculateNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateNotify:place:); - goto circulate; - - case CirculateRequest: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateRequest:place:); - /* fall into */ - circulate: - switch (cie->place) { - case PlaceOnTop: - __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnTop); - break; - case PlaceOnBottom: - __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnBottom); - break; - default: - __ArrayInstPtr(eventArr)->a_element[3] = nil; - break; - } - RETURN (true); - break; - - case PropertyNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(propertyChange:atom:state:time:); - __ArrayInstPtr(eventArr)->a_element[3] = t = __MKUINT(pe->atom); __STORE(eventArr, t); - switch (pe->state) { - case PropertyNewValue: - __ArrayInstPtr(eventArr)->a_element[4] = @symbol(newValue); - break; - case PropertyDelete: - __ArrayInstPtr(eventArr)->a_element[4] = @symbol(deleted); - break; - default: - __ArrayInstPtr(eventArr)->a_element[4] = nil; - break; - } - __ArrayInstPtr(eventArr)->a_element[5] = t = __MKUINT(pe->time); __STORE(eventArr, t); - RETURN (true); - break; - - case SelectionClear: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionClear:atom:time:); - __ArrayInstPtr(eventArr)->a_element[3] = t = __MKUINT(sce->selection); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(sce->time); __STORE(eventArr, t); - RETURN (true); - break; - - case SelectionRequest: - /* - * someone wants the selection - */ - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:); - __ArrayInstPtr(eventArr)->a_element[3] = t = __MKUINT(ev->xselectionrequest.requestor); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(ev->xselectionrequest.selection); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[5] = t = __MKUINT(ev->xselectionrequest.target); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[6] = t = __MKUINT(ev->xselectionrequest.property); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselectionrequest.time); __STORE(eventArr, t); - RETURN (true); - - case SelectionNotify: - /* - * returned selection value (answer from SelectionRequest) - */ - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:); - __ArrayInstPtr(eventArr)->a_element[3] = t = __MKUINT(ev->xselection.selection); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(ev->xselection.target); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[5] = t = __MKUINT(ev->xselection.property); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[6] = t = __MKEXTERNALADDRESS(ev->xselection.requestor); __STORE(eventArr, t); - __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselection.time); __STORE(eventArr, t); - - RETURN (true); - - case ColormapNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(colormapNotify:state:); - __ArrayInstPtr(eventArr)->a_element[3] = cme->state == ColormapInstalled ? true : false; - RETURN (true); - break; - - case ClientMessage: - if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { - if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) - || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(terminateView:); - RETURN (true); - } - if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(saveAndTerminateView:); - RETURN (true); - } - } - /* - * any other client message - */ - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(clientMessage:type:format:data:); - __ArrayInstPtr(eventArr)->a_element[3] = __MKSMALLINT(ev->xclient.message_type); - __ArrayInstPtr(eventArr)->a_element[4] = __MKSMALLINT(ev->xclient.format); - __ArrayInstPtr(eventArr)->a_element[5] = t = __MKBYTEARRAY(ev->xclient.data, sizeof(ev->xclient.data)); __STORE(eventArr, t); - RETURN (true); - break; - - case MappingNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappingNotify:request:event:); - switch(mape->request) { - case MappingModifier: - arg = @symbol(mappingModifier); - break; - case MappingKeyboard: - arg = @symbol(mappingKeyboard); - break; - case MappingPointer: - arg = @symbol(mappingPointer); - break; - default: - arg = __MKSMALLINT(mape->request); - break; - } - __ArrayInstPtr(eventArr)->a_element[3] = arg; - __ArrayInstPtr(eventArr)->a_element[4] = t = __MKBYTEARRAY(ev, sizeof(*mape)); - __STORE(eventArr, t); - RETURN (true); - - case KeymapNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(keymapNotify:); - RETURN (true); - break; - - case MapRequest: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mapRequest:); - RETURN (true); - - case ReparentNotify: - __ArrayInstPtr(eventArr)->a_element[2] = @symbol(reparentedView:); - break; + case KeyRelease: + sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:); + goto keyPressAndRelease; + + case KeyPress: + sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:); + /* FALL INTO */ + + keyPressAndRelease: + arg = nil; + nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); + if (nchars + && (((buffer[0] >= ' ') && (buffer[0] <= '~')) + || (buffer[0] >= 0x80))) { + arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; + keySymString = NULL; + } else { + keySymString = XKeysymToString(keySym); + if (keySymString) { + arg = __MKSTRING(keySymString); + } + } + + if (arg == nil) { + /* happens sometimes (alt-graph on sun has no keysym) */ + RETURN (false); + } + + __ArrayInstPtr(eventArr)->a_element[2] = sym; + + __ArrayInstPtr(eventArr)->a_element[3] = arg; __STORE(eventArr, arg); + __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(ke->keycode); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ke->state); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ke->x); + __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ke->y); + __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ke->x_root); + __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ke->y_root); + __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ke->time); __STORE(eventArr, t); + RETURN (true); + + case ButtonPress: + sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:); + goto buttonPressAndRelease; + + case ButtonRelease: + sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:); + /* fall into */ + + buttonPressAndRelease: + __ArrayInstPtr(eventArr)->a_element[2] = sym; + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(be->button); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ke->state); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(be->x); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(be->y); + __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(be->x_root); + __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(be->y_root); + __ArrayInstPtr(eventArr)->a_element[9] = t = __MKUINT(be->time); __STORE(eventArr, t); + RETURN (true); + + case MotionNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:); + + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(me->state); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(me->x); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(me->y); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(me->x_root); + __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(me->y_root); + __ArrayInstPtr(eventArr)->a_element[8] = t = __MKUINT(me->time); __STORE(eventArr, t); + RETURN (true); + + case FocusIn: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusIn:mode:detail:); + goto focusInOut; + + case FocusOut: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(focusOut:mode:detail:); + /* fall into */ + + focusInOut: + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(fe->mode); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(fe->detail); + RETURN (true); + + + case EnterNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:); + goto enterLeave; + + case LeaveNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:); + /* fall into */ + + enterLeave: + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ele->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ele->y); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ele->x_root); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ele->y_root); + __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ele->state); + __ArrayInstPtr(eventArr)->a_element[8] = __mkSmallInteger(ele->mode); + __ArrayInstPtr(eventArr)->a_element[9] = __mkSmallInteger(ele->detail); + __ArrayInstPtr(eventArr)->a_element[10] = t = __MKUINT(ele->time); __STORE(eventArr, t); + RETURN (true); + + case Expose: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(expose:x:y:width:height:count:); + goto expose; + + case GraphicsExpose: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:); + /* fall into */ + + expose: + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ee->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ee->y); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ee->width); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ee->height); + __ArrayInstPtr(eventArr)->a_element[7] = __mkSmallInteger(ee->count); + RETURN (true); + + case NoExpose: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(noExposeView:); + RETURN (true); + + case VisibilityNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(visibilityNotify:state:); + switch (ve->state) { + case VisibilityUnobscured: + __ArrayInstPtr(eventArr)->a_element[3] = @symbol(unobscured); + break; + case VisibilityPartiallyObscured: + __ArrayInstPtr(eventArr)->a_element[3] = @symbol(partiallyObscured); + break; + case VisibilityFullyObscured: + __ArrayInstPtr(eventArr)->a_element[3] = @symbol(fullyObscured); + break; + default: + __ArrayInstPtr(eventArr)->a_element[3] = __MKSMALLINT(ve->state); + break; + } + RETURN (true); + + case CreateNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(createWindow:x:y:width:height:); + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cre->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cre->y); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cre->width); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cre->height); + RETURN (true); + + case DestroyNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(destroyedView:); + RETURN (true); + + case UnmapNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(unmappedView:); + RETURN (true); + + case MapNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappedView:); + RETURN (true); + + case ConfigureNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configure:x:y:width:height:above:); + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(ce->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(ce->y); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(ce->width); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(ce->height); + __ArrayInstPtr(eventArr)->a_element[7] = nil; + if (ce->above != None) { + __ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(ce->above); __STORE(eventArr, t); + } + RETURN (true); + + case GravityNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(gravityNotify:x:y:); + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(gre->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(gre->y); + RETURN (true); + break; + + case ResizeRequest: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(resizeRequest:width:height:); + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(rr->width); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(rr->height); + RETURN (true); + break; + + case ConfigureRequest: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:); + __ArrayInstPtr(eventArr)->a_element[3] = __mkSmallInteger(cr->x); + __ArrayInstPtr(eventArr)->a_element[4] = __mkSmallInteger(cr->y); + __ArrayInstPtr(eventArr)->a_element[5] = __mkSmallInteger(cr->width); + __ArrayInstPtr(eventArr)->a_element[6] = __mkSmallInteger(cr->height); + __ArrayInstPtr(eventArr)->a_element[7] = nil; + if (cr->above != None) { + __ArrayInstPtr(eventArr)->a_element[7] = t = __MKEXTERNALADDRESS(cr->above); __STORE(eventArr, t); + } + switch (cr->detail) { + case Above: + __ArrayInstPtr(eventArr)->a_element[8] = @symbol(above); + break; + case Below: + __ArrayInstPtr(eventArr)->a_element[8] = @symbol(below); + break; + case TopIf: + __ArrayInstPtr(eventArr)->a_element[8] = @symbol(topIf); + break; + case BottomIf: + __ArrayInstPtr(eventArr)->a_element[8] = @symbol(bottomIf); + break; + case Opposite: + __ArrayInstPtr(eventArr)->a_element[8] = @symbol(opposite); + break; + default: + __ArrayInstPtr(eventArr)->a_element[8] = __MKSMALLINT(cr->detail); + break; + } + RETURN (true); + break; + + case CirculateNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateNotify:place:); + goto circulate; + + case CirculateRequest: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(circulateRequest:place:); + /* fall into */ + circulate: + switch (cie->place) { + case PlaceOnTop: + __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnTop); + break; + case PlaceOnBottom: + __ArrayInstPtr(eventArr)->a_element[3] = @symbol(placeOnBottom); + break; + default: + __ArrayInstPtr(eventArr)->a_element[3] = __MKSMALLINT(cie->place); + break; + } + RETURN (true); + break; + + case PropertyNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(propertyChange:atom:state:time:); + __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(pe->atom); __STORE(eventArr, t); + switch (pe->state) { + case PropertyNewValue: + __ArrayInstPtr(eventArr)->a_element[4] = @symbol(newValue); + break; + case PropertyDelete: + __ArrayInstPtr(eventArr)->a_element[4] = @symbol(deleted); + break; + default: + __ArrayInstPtr(eventArr)->a_element[4] = __MKSMALLINT(pe->state); + break; + } + __ArrayInstPtr(eventArr)->a_element[5] = t = __MKUINT(pe->time); __STORE(eventArr, t); + RETURN (true); + break; + + case SelectionClear: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionClear:atom:time:); + __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(sce->selection); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[4] = t = __MKUINT(sce->time); __STORE(eventArr, t); + RETURN (true); + break; + + case SelectionRequest: + /* + * someone wants the selection + */ + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:); + __ArrayInstPtr(eventArr)->a_element[3] = t = __MKEXTERNALADDRESS(ev->xselectionrequest.requestor); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[4] = t = __MKATOMOBJ(ev->xselectionrequest.selection); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[5] = t = __MKATOMOBJ(ev->xselectionrequest.target); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[6] = t = __MKATOMOBJ(ev->xselectionrequest.property); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselectionrequest.time); __STORE(eventArr, t); + RETURN (true); + + case SelectionNotify: + /* + * returned selection value (answer from SelectionRequest) + */ + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:); + __ArrayInstPtr(eventArr)->a_element[3] = t = __MKATOMOBJ(ev->xselection.selection); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[4] = t = __MKATOMOBJ(ev->xselection.target); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[5] = t = __MKATOMOBJ(ev->xselection.property); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[6] = t = __MKEXTERNALADDRESS(ev->xselection.requestor); __STORE(eventArr, t); + __ArrayInstPtr(eventArr)->a_element[7] = t = __MKUINT(ev->xselection.time); __STORE(eventArr, t); + + RETURN (true); + + case ColormapNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(colormapNotify:state:); + __ArrayInstPtr(eventArr)->a_element[3] = cme->state == ColormapInstalled ? true : false; + RETURN (true); + break; + + case ClientMessage: + if (ev->xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) { + if ((ev->xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom))) + || (ev->xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) { + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(terminateView:); + RETURN (true); + } + if (ev->xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) { + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(saveAndTerminateView:); + RETURN (true); + } + } + /* + * any other client message + */ + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(clientMessage:type:format:data:); + __ArrayInstPtr(eventArr)->a_element[3] = __MKATOMOBJ(ev->xclient.message_type); + __ArrayInstPtr(eventArr)->a_element[4] = __MKSMALLINT(ev->xclient.format); + __ArrayInstPtr(eventArr)->a_element[5] = t = __MKBYTEARRAY(ev->xclient.data, sizeof(ev->xclient.data)); __STORE(eventArr, t); + RETURN (true); + break; + + case MappingNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mappingNotify:request:event:); + switch(mape->request) { + case MappingModifier: + arg = @symbol(mappingModifier); + break; + case MappingKeyboard: + arg = @symbol(mappingKeyboard); + break; + case MappingPointer: + arg = @symbol(mappingPointer); + break; + default: + arg = __MKSMALLINT(mape->request); + break; + } + __ArrayInstPtr(eventArr)->a_element[3] = arg; + __ArrayInstPtr(eventArr)->a_element[4] = t = __MKBYTEARRAY(ev, sizeof(*mape)); + __STORE(eventArr, t); + RETURN (true); + + case KeymapNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(keymapNotify:); + RETURN (true); + break; + + case MapRequest: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(mapRequest:); + RETURN (true); + + case ReparentNotify: + __ArrayInstPtr(eventArr)->a_element[2] = @symbol(reparentedView:); + break; } @@ -5563,32 +5387,32 @@ ! dispatchLastEvent:evArray - |viewId view evTypeNr evType arguments| + |viewId view evType arguments| evArray size < 3 ifTrue:[ '********** bad event:' errorPrintCR. evArray errorPrintCR. '********** see newDispatchLastEvent' errorPrintCR. - ^ self. + ^ self. ]. viewId := evArray at:1. viewId notNil ifTrue:[ - viewId = lastId ifTrue:[ - view := lastView - ] ifFalse:[ - view := self viewFromId:viewId - ]. + viewId = lastId ifTrue:[ + view := lastView + ] ifFalse:[ + view := self viewFromId:viewId + ]. ]. evType := evArray at:3. (self respondsTo:evType) ifTrue:[ - arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1). - arguments at:1 put:view. - - self perform:evType withArguments:arguments. - ^ true. + arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1). + arguments at:1 put:view. + + self perform:evType withArguments:arguments. + ^ true. ]. '********** unhandled event:' errorPrintCR. evType errorPrintCR. @@ -5644,7 +5468,7 @@ ENTER_XLIB(); if (__isExternalAddress(aWindowIdOrNil)) { - win = _WindowVal(aWindowIdOrNil); + win = __WindowVal(aWindowIdOrNil); while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; } else { while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; @@ -5726,7 +5550,7 @@ XSync(dpy, 0); /* make certain everything is flushed */ } if (__isExternalAddress(aWindowIdOrNil)) { - win = _WindowVal(aWindowIdOrNil); + win = __WindowVal(aWindowIdOrNil); thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); } else { thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); @@ -5824,7 +5648,7 @@ XSync(dpy, 0); /* make certain everything is flushed */ } if (__isExternalAddress(aWindowIdOrNil)) { - win = _WindowVal(aWindowIdOrNil); + win = __WindowVal(aWindowIdOrNil); thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); } else { thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); @@ -5892,7 +5716,7 @@ } if (__isExternalAddress(aViewIdOrNil)) { - wWanted = _WindowVal(aViewIdOrNil); + wWanted = __WindowVal(aViewIdOrNil); if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { RETURN ( true ); } @@ -5922,18 +5746,6 @@ dispatchingExpose := aView id ! -mappingNotify:view request:what event:eB - "One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap. - Tell xlib about the fact." - - (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ - self refreshKeyboardMapping:eB. - "Maybe some of our modifiers have been changed" - self initializeModifierMappings. - ]. - -! - newDispatchLastEvent |arr| @@ -5967,7 +5779,7 @@ #endif ENTER_XLIB(); - XSelectInput(myDpy, _WindowVal(aWindowId), mask); + XSelectInput(myDpy, __WindowVal(aWindowId), mask); LEAVE_XLIB(); RETURN ( self ); } @@ -5985,6 +5797,89 @@ !XWorkstation methodsFor:'event handling - old dispatch'! +buttonPress:button x:x y:y view:aView + "forward a button-press event for some view" + + aView isNil ifTrue:[ + "/ event arrived, after I destroyed it myself + ^ self + ]. + button == 1 ifTrue:[ + activateOnClick == true ifTrue:[ + "/ dont raise above an active popup view. + (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ + aView topView raise. +"/ ] ifFalse:[ +"/ activeKeyboardGrab printCR. +"/ activePointerGrab printCR. + ] + ]. + ]. + super buttonPress:button x:x y:y view:aView + + + +! + +circulateNotifyView:aView + "sent, when the stacking order changes. + ignored for now." + +! + +circulateRequestView:aView + "sent, when the stacking order is about to change. + ignored for now." +! + +clientMessage:event type:type format:format dataOffset:offs view:targetView + |sensor data| + + data := event copyFrom:offs + 1. + + "/ DND drag&drop protocol + type == (self atomIDOf:#DndProtocol) ifTrue:[ + format == 32 ifTrue:[ + self dndMessage:event data:data view:targetView. + ^ self + ] + ]. + + (sensor := targetView sensor) notNil ifTrue:[ + sensor clientMessage:type format:format eventData:data view:targetView + ] ifFalse:[ + " + not posted, if there is no sensor ... + " + ] + + "Created: 4.4.1997 / 17:49:26 / cg" + "Modified: 4.4.1997 / 18:00:18 / cg" +! + +colorMapChangeView:aView + "sent, when another colormap is installed. + This is a very X-specific mechanism." + + aView isNil ifTrue:[ + "/ event arrived, after I destroyed it myself + ^ self + ]. + aView colorMapChange +! + +configureRequestView:aView + "ignored for now" + + "/ aView configureRequest +! + +createdView:aView + "ignored for now" + + "/ aView created +! + dispatchLastEvent |theView symS arg butt sibling windowID siblingID propertyID selectionID targetID requestorID @@ -6084,7 +5979,7 @@ */ if ((t = __INST(lastId)) != nil) { if (__isExternalAddress(t)) { - if (_WindowVal(t) == ae->window) { + if (__WindowVal(t) == ae->window) { theView = __INST(lastView); if (__isNonNilObject(theView)) { if (__qClass(theView) == nil) { @@ -6432,14 +6327,14 @@ break; case ClientMessage: - if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { - if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) - || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { + if (ev->xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) { + if ((ev->xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom))) + || (ev->xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) { (*termS.ilc_func)(self, @symbol(terminateView:), nil, &termS, theView); break; } - if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { + if (ev->xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) { (*savtermS.ilc_func)(self, @symbol(saveAndTerminateView:) , nil, &savtermS, theView); @@ -6653,18 +6548,178 @@ ^ true ! +gravityNotifyView:aView + "ignored for now" + + "/ aView gravityNotify +! + +mapRequestView:aView + "ignored for now" + + "/ aView mapRequest +! + mappingChanged:what event:eB "OBSOLETE with newDispatchLastEvent!! One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap. Tell xlib about the fact." (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ - self refreshKeyboardMapping:eB. - "Maybe some of our modifiers have been changed" - self initializeModifierMappings. + self refreshKeyboardMapping:eB. + "Maybe some of our modifiers have been changed" + self initializeModifierMappings. ]. "Created: 1.12.1995 / 16:28:23 / stefan" +! + +propertyChangeView:aView + "sent when an X property changes. + This is a very X-specific mechanism." + + aView isNil ifTrue:[ + "/ event arrived, after I destroyed it myself + ^ self + ]. + aView propertyChange +! + +resizeRequestView:aView + "ignored for now" + + "/ aView resizeRequest +! + +selectionClear:selectionID view:aView + "OBSOLETE - this will vanish" + + "sent when another X-client has created a selection. + This is a very X-specific mechanism." + + "/ + "/ workaround a bug in olvwm: it clears selections + "/ on window raise. + "/ In this case, keep my last own selection. + "/ + + self setLastCopyBuffer:(self getCopyBuffer). + self setCopyBuffer:nil + + "/ noone is interested in that ... + "/ aView selectionClear:selectionID +! + +selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView + "sent when the server returns an answer from a request for a selection. + This is a very X-specific mechanism." + + |s sensor| + + propertyID == 0 ifTrue:[ + "invalid olvwm behavior" + s := self getLastCopyBuffer + ] ifFalse:[ + targetID == (self atomIDOf:#STRING) ifTrue:[ + " + a returned string + " + s := self getTextProperty:propertyID from:requestorID. + s notNil ifTrue:[ + (s endsWith:Character cr) ifTrue:[ + s := s asStringCollection copyWith:'' + ] + ] + ] ifFalse:[ + " + a returned object + " + s := self getObjectProperty:propertyID from:requestorID. + ]. + ]. + + s notNil ifTrue:[ + (sensor := aView sensor) notNil ifTrue:[ + sensor pasteFromClipBoard:s view:aView + ] ifFalse:[ + " + if there is no sensor ... + " + aView pasteFromClipBoard:s + ] + ] +! + +selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView + "sent by some other X-client to ask for the selection. + This is a very X-specific mechanism." + + |o s stream stringAtom| + + targetID == (self atomIDOf:#LENGTH) ifTrue:[ + "/ + "/ the other one wants to know the size of our selection ... + "/ + s := self selectionAsString. + self + setLengthProperty:propertyID + value:s size + for:windowID. + self + sendSelectionNotifySelection:selectionID + property:propertyID + target:targetID + time:t + from:aView id + to:windowID. + ^ self + ]. + + stringAtom := self atomIDOf:#STRING. + (targetID == stringAtom or:[ + targetID == (self atomIDOf:#'COMPOUND_TEXT')]) ifTrue:[ + "/ + "/ the other view wants the selection as string + "/ + s := self selectionAsString. + self + sendSelection:s + selection:primaryAtom + property:propertyID + target:stringAtom "/ targetID + time:t + from:windowID + to:windowID. + ^ self + ]. + +"/ (targetID == (self atomIDOf:#'TARGETS')) ifTrue:[ +"/"/ TODO: implement this to avoid netscape paste-delay. +"/"/ +"/ ^ self +"/ ]. + + (targetID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[ + "/ + "/ send the selection in binaryStore format + "/ (assuming, that the other view knows how to handle it) + "/ + o := self getCopyBuffer. + stream := WriteStream on:(ByteArray new:200). + o storeBinaryOn:stream. + + ^ self + sendSelection:(stream contents) + selection:primaryAtom + property:propertyID + target:targetID + time:t + from:windowID + to:windowID + ]. + + "Created: / 17.6.1998 / 19:33:10 / cg" + "Modified: / 17.6.1998 / 20:24:40 / cg" ! ! !XWorkstation methodsFor:'event sending'! @@ -6750,7 +6805,7 @@ } if (__isExternalAddress(targetWindowID)) { - ev.xclient.window = _WindowVal(targetWindowID); + ev.xclient.window = __WindowVal(targetWindowID); } else { ev.xclient.window = (Window)__longIntVal(targetWindowID); } @@ -6870,7 +6925,7 @@ ev.xany.type = ButtonRelease; if (__isExternalAddress(targetId)) { - target = _WindowVal(targetId); + target = __WindowVal(targetId); } else { target = (Window) __longIntVal(targetId); } @@ -7087,7 +7142,7 @@ if (__isExternalAddress(aFontId)) { - f = _FontVal(aFontId); + f = __FontVal(aFontId); if (f) { n = f->n_properties; prop = f->properties; @@ -7241,7 +7296,7 @@ if (ISCONNECTED) { if (__isExternalAddress(fontId)) { - f = _FontVal(fontId); + f = __FontVal(fontId); if (f) { #ifdef NOTDEF char *cp; @@ -7334,7 +7389,7 @@ Display *dpy = myDpy; if (__isExternalAddress(fontId)) { - f = _FontVal(fontId); + f = __FontVal(fontId); if (f) { char *cp; XFontProp *prop; @@ -7393,7 +7448,7 @@ if (__isExternalAddress(aFontId)) { - f = _FontVal(aFontId); + f = __FontVal(aFontId); if (f) { n = f->n_properties; prop = f->properties; @@ -7815,7 +7870,7 @@ } if (__isExternalAddress(aFontId)) { - f = _FontVal(aFontId); + f = __FontVal(aFontId); if (f) { ENTER_XLIB(); @@ -7873,7 +7928,7 @@ && __isExternalAddress(aFontId) && __isNonNilObject(aString)) { int lMax = __intVal(@global(XWorkstation:MaxStringLength)); - f = _FontVal(aFontId); + f = __FontVal(aFontId); if (! f) goto fail; i1 = __intVal(index1) - 1; @@ -7993,7 +8048,7 @@ if (__isExternalAddress(aFontId) && __isNonNilObject(aString)) { int lMax = __intVal(@global(XWorkstation:MaxStringLength)); - f = _FontVal(aFontId); + f = __FontVal(aFontId); if (! f) goto fail; cls = __qClass(aString); @@ -8130,7 +8185,7 @@ ENTER_XLIB(); result = XGrabKeyboard(myDpy, - _WindowVal(aWindowId), + __WindowVal(aWindowId), True /* False */, GrabModeAsync, GrabModeAsync, @@ -8192,12 +8247,12 @@ if (ISCONNECTED) { if (__isExternalAddress(aWindowId)) { if (__isExternalAddress(confineId)) - confineWin = _WindowVal(confineId); + confineWin = __WindowVal(confineId); else confineWin = (Window) None; if (__isExternalAddress(aCursorId)) - curs = _CursorVal(aCursorId); + curs = __CursorVal(aCursorId); else curs = (Cursor) None; @@ -8221,7 +8276,7 @@ ENTER_XLIB(); */ result = XGrabPointer(myDpy, - _WindowVal(aWindowId), + __WindowVal(aWindowId), False, evMask, pointer_mode, keyboard_mode, @@ -8355,7 +8410,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); gcv.clip_mask = None; ENTER_XLIB(); XChangeGC(myDpy, gc, GCClipMask, &gcv); @@ -8377,7 +8432,7 @@ if (__isExternalAddress(aGCId) && __isSmallInteger(bgColorIndex)) { ENTER_XLIB(); - XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); + XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex)); LEAVE_XLIB(); RETURN ( self ); } @@ -8399,9 +8454,9 @@ Display *dpy = myDpy; if (__isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); if (__isExternalAddress(aBitmapId)) { - bitmap = _PixmapVal(aBitmapId); + bitmap = __PixmapVal(aBitmapId); ENTER_XLIB(); XSetStipple(dpy, gc, bitmap); XSetFillStyle(dpy, gc, FillOpaqueStippled); @@ -8431,7 +8486,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); if (aBool == true) gcv.subwindow_mode = ClipByChildren; else @@ -8464,7 +8519,7 @@ r.width = __intVal(clipWidth); r.height = __intVal(clipHeight); ENTER_XLIB(); - XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); + XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted); LEAVE_XLIB(); RETURN ( self ); } @@ -8484,7 +8539,7 @@ && __isSmallInteger(offset) && __isByteArray(dashList)) { ENTER_XLIB(); - XSetDashes(myDpy, _GCVal(aGCId), + XSetDashes(myDpy, __GCVal(aGCId), __intVal(offset), __ByteArrayInstPtr(dashList)->ba_element, __byteArraySize(dashList)); @@ -8513,9 +8568,9 @@ if (ISCONNECTED) { if (__isExternalAddress(aFontId) && __isExternalAddress(aGCId)) { - f = (XFontStruct *) _FontVal(aFontId); + f = (XFontStruct *) __FontVal(aFontId); ENTER_XLIB(); - XSetFont(myDpy, _GCVal(aGCId), f->fid); + XSetFont(myDpy, __GCVal(aGCId), f->fid); LEAVE_XLIB(); RETURN ( self ); } @@ -8539,7 +8594,7 @@ Display *dpy = myDpy; if (__bothSmallInteger(fgColorIndex, bgColorIndex) && __isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); ENTER_XLIB(); XSetForeground(dpy, gc, __intVal(fgColorIndex)); @@ -8562,7 +8617,7 @@ if (__isExternalAddress(aGCId) && __isSmallInteger(fgColorIndex)) { ENTER_XLIB(); - XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); + XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex)); LEAVE_XLIB(); RETURN ( self ); } @@ -8582,7 +8637,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; @@ -8624,7 +8679,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aGCId)) { ENTER_XLIB(); - XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); + XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0); LEAVE_XLIB(); RETURN ( self ); } @@ -8693,10 +8748,10 @@ ENTER_XLIB(); if (x_dashes) { - XSetDashes(dpy, _GCVal(aGCId), 0, x_dashes, x_nDash); + XSetDashes(dpy, __GCVal(aGCId), 0, x_dashes, x_nDash); } XSetLineAttributes(dpy, - _GCVal(aGCId), __intVal(aNumber), + __GCVal(aGCId), __intVal(aNumber), x_style, x_cap, x_join); LEAVE_XLIB(); RETURN ( self ); @@ -8723,7 +8778,7 @@ if (ISCONNECTED) { if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { ENTER_XLIB(); - XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); + XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY)); LEAVE_XLIB(); RETURN ( self ); } @@ -8745,9 +8800,9 @@ Display *dpy = myDpy; if (__isExternalAddress(aGCId)) { - gc = _GCVal(aGCId); + gc = __GCVal(aGCId); if (__isExternalAddress(aPixmapId)) { - pixmap = _PixmapVal(aPixmapId); + pixmap = __PixmapVal(aPixmapId); ENTER_XLIB(); XSetTile(dpy, gc, pixmap); XSetFillStyle(dpy, gc, FillTiled); @@ -8969,12 +9024,11 @@ hasImageExtension := self queryXIEExtension. hasInputExtension := self queryXIExtension. - primaryAtom := self queryAtom:'PRIMARY'. - secondaryAtom := self queryAtom:'SECONDARY'. - cutBuffer0Atom := self queryAtom:'CUT_BUFFER0'. - stringAtom := self queryAtom:'STRING'. - lengthAtom := self queryAtom:'LENGTH'. - wmStateAtom := self queryAtom:'WM_STATE'. + primaryAtom := self atomIDOf:#PRIMARY. + stringAtom := self atomIDOf:#STRING. + lengthAtom := self atomIDOf:#LENGTH. + cutBuffer0Atom := self atomIDOf:#'CUT_BUFFER0'. + wmStateAtom := self atomIDOf:#WM_STATE. altModifierMask := self modifier2Mask. metaModifierMask := self modifier1Mask. @@ -9246,18 +9300,18 @@ ret := Array new:8. nextKey := 1. 1 to:8 do:[ :i | - (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ - |mod| - - mod := OrderedCollection new:maxKeyPerMod. - modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | - key ~= 0 ifTrue:[ - mod add:key - ]. - ]. - ret at:i put:mod. - ]. - nextKey := nextKey+maxKeyPerMod. + (modifierKeyMap at:nextKey) ~= 0 ifTrue:[ + |mod| + + mod := OrderedCollection new:maxKeyPerMod. + modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | + key ~= 0 ifTrue:[ + mod add:key + ]. + ]. + ret at:i put:mod. + ]. + nextKey := nextKey+maxKeyPerMod. ]. ^ ret @@ -9271,12 +9325,12 @@ mapping := self modifierMapping. ^ mapping collect:[:eachRow | - eachRow notNil ifTrue:[ - eachRow collect:[ :key | self stringFromKeycode:key ]. - ] ifFalse:[ - nil - ] - ]. + eachRow notNil ifTrue:[ + eachRow collect:[ :key | self stringFromKeycode:key ]. + ] ifFalse:[ + nil + ] + ]. " ! @@ -9428,19 +9482,18 @@ ENTER_XLIB(); XFlush(myDpy); LEAVE_XLIB(); - } %} ! flushDpsContext:aDPSContext - -%{ /* NOCONTEXT */ + +%{ #ifdef DPS if (ISCONNECTED - && __isExternalAddress(aDPSContext)) { + && __isExternalAddress(aDPSContext)) { ENTER_XLIB(); - DPSFlushContext(MKDPSCONTEXT(aDPSContext)); + DPSFlushContext(__DPSContextVal(aDPSContext)); LEAVE_XLIB(); RETURN ( self ); @@ -9490,7 +9543,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aWindowId)) { - focusWindow = _WindowVal(aWindowId); + focusWindow = __WindowVal(aWindowId); } else { focusWindow = None; } @@ -9729,7 +9782,7 @@ && __isExternalAddress(aWindowId) && __bothSmallInteger(xpos, ypos)) { Display *dpy = myDpy; - Window w = _WindowVal(aWindowId); + Window w = __WindowVal(aWindowId); ENTER_XLIB(); XWarpPointer(dpy, @@ -9770,12 +9823,18 @@ "Modified: 6.4.1997 / 13:27:07 / cg" ! -getProperty:propertyID from:aWindowID into:aTwoArgBlock +getProperty:propertySymbolOrID from:aWindowID into:aTwoArgBlock "get a property, evaluate aTwoArgBlock with typeID and value" - |val typeID cls| + |val typeID cls propertyID| + + propertySymbolOrID isString ifTrue:[ + propertyID := self atomIDOf:propertySymbolOrID create:false. + ] ifFalse:[ + propertyID := propertySymbolOrID. + ]. cls := ByteArray. %{ @@ -9793,9 +9852,9 @@ Display *dpy = myDpy; if (__isAtomID(propertyID)) { - property = _AtomVal(propertyID); + property = __AtomVal(propertyID); if (__isExternalAddress(aWindowID)) { - window = _WindowVal(aWindowID); + window = __WindowVal(aWindowID); } else { window = DefaultRootWindow(dpy); } @@ -9890,7 +9949,7 @@ ^ self setProperty:propertyID - type:(self atomIDOfLENGTH) + type:(self atomIDOf:#LENGTH) value:aNumber for:aWindowID @@ -9910,7 +9969,7 @@ anObject storeBinaryOn:s. ^ self setProperty:propertyID - type:(self atomIDOf:'ST_OBJECT' create:true) + type:(self atomIDOf:#'ST_OBJECT' create:true) value:(s contents) for:aWindowID @@ -9936,11 +9995,11 @@ Window window; unsigned INT value; - prop = _AtomVal(propertyID); - type = _AtomVal(typeID); + prop = __AtomVal(propertyID); + type = __AtomVal(typeID); if (__isExternalAddress(aWindowID)) { - window = _WindowVal(aWindowID); + window = __WindowVal(aWindowID); } else if (__isSmallInteger(aWindowID)) { window = (Window)__smallIntegerVal(aWindowID); } else if (aWindowID == nil) { @@ -9991,7 +10050,7 @@ ^ self setProperty:propertyID - type:(self atomIDOfSTRING) + type:(self atomIDOf:#STRING) value:aString for:aWindowID @@ -10020,75 +10079,29 @@ "return an Atoms ID; if create is true, create it if not already present. This is highly X specific and only for local use (with selections)." -%{ /* NOCONTEXT */ - Atom prop; - - if (ISCONNECTED - && __isNonNilObject(aStringOrSymbol) - && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) { - prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), - (create == true) ? False : True); - if (prop == None) { - RETURN (nil); - } - RETURN ( __MKATOMOBJ(prop) ); - } -%}. - self primitiveFailedOrClosedConnection. - ^ nil + |atomSymbol atom| + + atomSymbol := aStringOrSymbol asSymbol. + (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[ + ^ atom. + ]. + + atom := self primAtomIDOf:atomSymbol create:create. + atom notNil ifTrue:[ + atoms isNil ifTrue:[ + atoms := IdentityDictionary new. + ]. + atoms at:atomSymbol put:atom. + ]. + + ^ atom " Display atomIDOf:'VT_SELECTION' create:false Display atomIDOf:'CUT_BUFFER0' create:false Display atomIDOf:'STRING' create:false Display atomIDOf:'PRIMARY' create:false - Display atomIDOfPRIMARY - " -! - -atomIDOfCUTBUFFER0 - "return the CUTBUFFER0 AtomID. - This is highly X specific and only for local use (with selections)." - - ^ cutBuffer0Atom - - "Modified: 2.3.1996 / 15:10:36 / cg" -! - -atomIDOfLENGTH - "return the LENGTH AtomID. - This is highly X specific and only for local use (with selections)." - - ^ lengthAtom - - "Modified: 2.3.1996 / 15:10:41 / cg" -! - -atomIDOfPRIMARY - "return the PRIMARY AtomID. - This is highly X specific and only for local use (with selections)." - - ^ primaryAtom - - "Modified: 2.3.1996 / 15:10:49 / cg" -! - -atomIDOfSECONDARY - "return the SECONDARY AtomID. - This is highly X specific and only for local use (with selections)." - - ^ secondaryAtom - - "Modified: 2.3.1996 / 15:10:59 / cg" -! - -atomIDOfSTRING - "return the STRING AtomID. - This is highly X specific and only for local use (with selections)." - - ^ stringAtom - - "Modified: 2.3.1996 / 15:11:08 / cg" + " ! atomName:anAtomID @@ -10101,7 +10114,7 @@ if (ISCONNECTED && __isAtomID(anAtomID)) { - name = XGetAtomName(myDpy, _AtomVal(anAtomID)); + name = XGetAtomName(myDpy, __AtomVal(anAtomID)); if (name == 0) { RETURN (nil); } @@ -10172,6 +10185,35 @@ Display getResource:'beNiceToColormap' class:'any' Display getResource:'beNiceToColormap' class:'' " +! + +primAtomIDOf:aStringOrSymbol create:create + "return an Atoms ID; if create is true, create it if not already present. + This is highly X specific and only for local use (with selections)." + +%{ /* NOCONTEXT */ + Atom prop; + + if (ISCONNECTED + && __isNonNilObject(aStringOrSymbol) + && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) { + prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), + (create == true) ? False : True); + if (prop == None) { + RETURN (nil); + } + RETURN ( __MKATOMOBJ(prop) ); + } +%}. + self primitiveFailedOrClosedConnection. + ^ nil + + " + Display primAtomIDOf:'VT_SELECTION' create:false + Display primAtomIDOf:'CUT_BUFFER0' create:false + Display primAtomIDOf:'STRING' create:false + Display primAtomIDOf:'PRIMARY' create:false + " ! ! !XWorkstation methodsFor:'retrieving pixels'! @@ -10238,7 +10280,7 @@ if (ISCONNECTED && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { - win = _WindowVal(aDrawableId); + win = __WindowVal(aDrawableId); xpos = __intVal(x); ypos = __intVal(y); if ((xpos < 0) || (ypos < 0)) { @@ -10276,7 +10318,7 @@ && __isByteArray(imageBits)) { Display *dpy = myDpy; - win = _WindowVal(aDrawableId); + win = __WindowVal(aDrawableId); ENTER_XLIB(); image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), __intVal(w), __intVal(h), @@ -10359,24 +10401,31 @@ "get the object selection - either immediate, or asynchronous. Returns nil, if async request is on its way" - |selProp sel| - (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ "no primary selection - use cut buffer" - sel := self getObjectProperty:cutBuffer0Atom from:nil. - ^ sel - ]. - selProp := self atomIDOf:'ST_SELECTION' create:true. - self requestObjectSelection:primaryAtom property:selProp for:drawableId. + ^ self getObjectProperty:cutBuffer0Atom from:nil. + ]. + self requestSelection:primaryAtom + property:(self atomIDOf:#'ST_SELECTION' create:true) + type:(self atomIDOf:#'ST_OBJECT' create:true) + for:drawableId. ^ nil "Modified: / 17.6.1998 / 17:11:15 / cg" ! -getSelectionOwnerOf:selectionAtomID +getSelectionOwnerOf:selectionAtomSymbolOrID "get the owner of a selection" -%{ /* NOCONTEXT */ + |selectionAtomID| + + selectionAtomSymbolOrID isString ifTrue:[ + selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. + ] ifFalse:[ + selectionAtomID := selectionAtomSymbolOrID. + ]. + +%{ Atom selection; Window window; @@ -10384,7 +10433,7 @@ && ISCONNECTED) { Display *dpy = myDpy; - window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); + window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); } %}. @@ -10396,30 +10445,19 @@ "get the text selection - either immediate, or asynchronous. Returns nil, if async request is on its way" - |selProp sel| - (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ "no primary selection - use cut buffer" - sel := self getTextProperty:cutBuffer0Atom from:nil. - ^ sel - ]. - selProp := self atomIDOf:'VT_SELECTION' create:true. - self requestTextSelection:primaryAtom property:selProp for:drawableId. + ^ self getTextProperty:cutBuffer0Atom from:nil. + ]. + self requestSelection:primaryAtom + property:(self atomIDOf:#'VT_SELECTION' create:true) + type:stringAtom + for:drawableId. ^ nil "Modified: / 17.6.1998 / 17:12:05 / cg" ! -requestObjectSelection:selectionID property:propertyID for:aWindowId - "ask the server to send us the selection - the view with ID aWindowID - will later receive a SelectionNotify event for it." - - ^ self requestSelection:selectionID - property:propertyID - type:(self atomIDOf:'ST_OBJECT' create:true) - for:aWindowId -! - requestSelection:selectionID property:propertyID type:typeID for:aWindowId "ask the server to send us the selection - the view with id aWindowID will later receive a SelectionNotify event for it (once the Xserver replies @@ -10435,7 +10473,7 @@ && __isAtomID(selectionID)) { Display *dpy = myDpy; - if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { + if (XGetSelectionOwner(dpy, __AtomVal(selectionID)) == None) { /* * no owner of primary selection */ @@ -10444,8 +10482,8 @@ /* * PRIMARY selection */ - XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), - _AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); + XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), + __AtomVal(propertyID), __WindowVal(aWindowId), CurrentTime); RETURN (true); } %}. @@ -10459,16 +10497,6 @@ " ! -requestTextSelection:selectionID property:propertyID for:aWindowId - "ask the server to send us the selection - the view with ID aWindowID - will later receive a SelectionNotify event for it." - - ^ self requestSelection:selectionID - property:propertyID - type:stringAtom - for:aWindowId -! - sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID "send aString back from a SelectionRequest" @@ -10501,13 +10529,13 @@ Display *dpy = myDpy; XEvent ev; Window requestor, originator; - Atom property = _AtomVal(propertyID); - Atom target = _AtomVal(targetID); - Atom selection = _AtomVal(selectionID); + Atom property = __AtomVal(propertyID); + Atom target = __AtomVal(targetID); + Atom selection = __AtomVal(selectionID); Status result; if (__isExternalAddress(requestorID)) { - requestor = _WindowVal(requestorID); + requestor = __WindowVal(requestorID); } else if (__isSmallInteger(requestorID)) { requestor = (Window)__smallIntegerVal(requestorID); } else if (requestorID == nil) { @@ -10516,7 +10544,7 @@ requestor = (Window)__unsignedLongIntVal(requestorID); } if (__isExternalAddress(windowID)) { - originator = _WindowVal(windowID); + originator = __WindowVal(windowID); } else if (__isSmallInteger(windowID)) { originator = (Window)__smallIntegerVal(windowID); } else if (windowID == nil) { @@ -10590,24 +10618,33 @@ ^ true ! -setSelectionOwner:aWindowId of:selectionID +setSelectionOwner:aWindowId of:selectionAtomSymbolOrID "set the owner of a selection; return false if failed" + + |selectionAtomID| + + selectionAtomSymbolOrID isString ifTrue:[ + selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. + ] ifFalse:[ + selectionAtomID := selectionAtomSymbolOrID. + ]. + %{ Window win; if (__isExternalAddress(aWindowId) - && __isAtomID(selectionID) + && __isAtomID(selectionAtomID) && ISCONNECTED) { Display *dpy = myDpy; Window owner; - win = _WindowVal(aWindowId); - DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win)); + win = __WindowVal(aWindowId); + DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win)); ENTER_XLIB(); - XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); - owner = XGetSelectionOwner(dpy, _AtomVal(selectionID)); + XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime); + owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); LEAVE_XLIB(); if (owner != win) { RETURN (false); @@ -10652,7 +10689,7 @@ */ if ((w >= 0) && (h >= 0)) { ENTER_XLIB(); - XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); + XClearArea(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); LEAVE_XLIB(); } RETURN ( self ); @@ -10671,7 +10708,7 @@ if (ISCONNECTED) { if (__isExternalAddress(aWindowId)) { ENTER_XLIB(); - XClearWindow(myDpy, _WindowVal(aWindowId)); + XClearWindow(myDpy, __WindowVal(aWindowId)); LEAVE_XLIB(); RETURN ( self ); } @@ -10706,9 +10743,9 @@ mask = CWSibling; } - chg.sibling = _WindowVal(siblingId); + chg.sibling = __WindowVal(siblingId); ENTER_XLIB(); - XConfigureWindow(myDpy, _WindowVal(aWindowId), + XConfigureWindow(myDpy, __WindowVal(aWindowId), mask, &chg); LEAVE_XLIB(); RETURN ( self ); @@ -10736,7 +10773,7 @@ int nChildren; /* ENTER_XLIB(); */ - ok = XQueryTree(myDpy, _WindowVal(aWindowId), + ok = XQueryTree(myDpy, __WindowVal(aWindowId), &root, &parent, &children, &nChildren); if (children) { XFree(children); @@ -10776,7 +10813,7 @@ if (ISCONNECTED && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XLowerWindow(myDpy, _WindowVal(aWindowId)); + XLowerWindow(myDpy, __WindowVal(aWindowId)); LEAVE_XLIB(); RETURN ( self ); } @@ -10825,7 +10862,7 @@ && __isExternalAddress(aWindowId)) { Display *dpy = myDpy; - win = _WindowVal(aWindowId); + win = __WindowVal(aWindowId); szhints.flags = 0; if (__bothSmallInteger(xPos, yPos)) { @@ -10855,12 +10892,12 @@ Window iconWindow; if (__isExternalAddress(wiconId)) - iconBitmap = _PixmapVal(wiconId); + iconBitmap = __PixmapVal(wiconId); else iconBitmap = (Pixmap)0; if (__isExternalAddress(wiconViewId)) - iconWindow = _WindowVal(wiconViewId); + iconWindow = __WindowVal(wiconViewId); else iconWindow = (Window)0; @@ -10919,7 +10956,7 @@ if (ISCONNECTED && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XMapWindow(myDpy, _WindowVal(aWindowId)); + XMapWindow(myDpy, __WindowVal(aWindowId)); LEAVE_XLIB(); RETURN ( self ); } @@ -10944,7 +10981,7 @@ if (newWidth < 1) newWidth = 1; if (newHeight < 1) newHeight = 1; ENTER_XLIB(); - XMoveResizeWindow(myDpy, _WindowVal(aWindowId), + XMoveResizeWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y), newWidth, newHeight); LEAVE_XLIB(); @@ -10963,7 +11000,7 @@ if (ISCONNECTED && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { ENTER_XLIB(); - XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); + XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y)); LEAVE_XLIB(); RETURN ( self ); } @@ -10980,7 +11017,7 @@ if (ISCONNECTED && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XRaiseWindow(myDpy, _WindowVal(aWindowId)); + XRaiseWindow(myDpy, __WindowVal(aWindowId)); LEAVE_XLIB(); RETURN ( self ); } @@ -11000,8 +11037,8 @@ Window _child, _newParent; int i; - _child = _WindowVal(windowId); - _newParent = _WindowVal(newParentWindowId); + _child = __WindowVal(windowId); + _newParent = __WindowVal(newParentWindowId); ENTER_XLIB(); #if 0 @@ -11042,7 +11079,7 @@ if (newWidth < 1) newWidth = 1; if (newHeight < 1) newHeight = 1; ENTER_XLIB(); - XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); + XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight); LEAVE_XLIB(); RETURN ( self ); } @@ -11067,7 +11104,7 @@ else wa.backing_store = 0; ENTER_XLIB(); - XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); + XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa); LEAVE_XLIB(); } @@ -11111,7 +11148,7 @@ ENTER_XLIB(); - XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); + XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa); LEAVE_XLIB(); RETURN ( self ); @@ -11130,8 +11167,8 @@ && __isExternalAddress(aWindowId) && __isExternalAddress(aCursorId)) { Display *dpy = myDpy; - Window w = _WindowVal(aWindowId); - Cursor c = _CursorVal(aCursorId); + Window w = __WindowVal(aWindowId); + Cursor c = __CursorVal(aCursorId); if (w && c) { ENTER_XLIB(); @@ -11155,7 +11192,7 @@ && (__qIsString(aString) || __qIsSymbol(aString)) && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XSetIconName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); + XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString)); LEAVE_XLIB(); RETURN ( self ); } @@ -11176,7 +11213,7 @@ if (__INST(hasSaveUnder) == true) { wa.save_under = (yesOrNo == true) ? 1 : 0; ENTER_XLIB(); - XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); + XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa); LEAVE_XLIB(); } RETURN ( self ); @@ -11199,13 +11236,13 @@ w = (Window) 0; } else { if (__isExternalAddress(aMainWindowId)) { - w = _WindowVal(aMainWindowId); + w = __WindowVal(aMainWindowId); } else { goto getOutOfHere; } } ENTER_XLIB(); - XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); + XSetTransientForHint(myDpy, __WindowVal(aWindowId), w); LEAVE_XLIB(); RETURN ( self ); } @@ -11226,7 +11263,7 @@ && __isExternalAddress(aWindowId) && __isSmallInteger(aColorIndex)) { ENTER_XLIB(); - XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); + XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); LEAVE_XLIB(); RETURN ( self ); } @@ -11247,7 +11284,7 @@ && __isExternalAddress(aWindowId) && __isExternalAddress(aPixmapId)) { ENTER_XLIB(); - XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); + XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); LEAVE_XLIB(); RETURN ( self ); } @@ -11265,7 +11302,7 @@ && __isExternalAddress(aWindowId) && __isSmallInteger(aColorIndex)) { ENTER_XLIB(); - XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); + XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); LEAVE_XLIB(); RETURN ( self ); } @@ -11283,7 +11320,7 @@ && __isExternalAddress(aWindowId) && __isExternalAddress(aPixmapId)) { ENTER_XLIB(); - XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); + XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); LEAVE_XLIB(); RETURN ( self ); } @@ -11304,14 +11341,14 @@ Pixmap shapeBitmap; if (__isExternalAddress(aPixmapId)) - shapeBitmap = _PixmapVal(aPixmapId); + shapeBitmap = __PixmapVal(aPixmapId); else shapeBitmap = (Pixmap)0; if (ISCONNECTED && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, + XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding, 0, 0, shapeBitmap, ShapeSet); LEAVE_XLIB(); RETURN ( self ); @@ -11331,7 +11368,7 @@ && __isExternalAddress(aWindowId) && __isSmallInteger(aNumber)) { ENTER_XLIB(); - XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); + XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber)); LEAVE_XLIB(); RETURN ( self ); } @@ -11363,7 +11400,7 @@ goto error; ENTER_XLIB(); - XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); + XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint); LEAVE_XLIB(); RETURN ( self ); error:; @@ -11406,7 +11443,7 @@ ENTER_XLIB(); - XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); + XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa); LEAVE_XLIB(); RETURN ( self ); @@ -11431,10 +11468,10 @@ && __isExternalAddress(aWindowId)) { XWMHints hints; - hints.icon_pixmap = _PixmapVal(iconId); + hints.icon_pixmap = __PixmapVal(iconId); hints.flags = IconPixmapHint; ENTER_XLIB(); - XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); + XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); LEAVE_XLIB(); RETURN ( self ); } @@ -11461,15 +11498,15 @@ && __isExternalAddress(aWindowId)) { XWMHints hints; - hints.icon_pixmap = _PixmapVal(iconId); + hints.icon_pixmap = __PixmapVal(iconId); hints.flags = IconPixmapHint; if ((maskId != nil) && __isExternalAddress(maskId)) { - hints.icon_mask = _PixmapVal(maskId); + hints.icon_mask = __PixmapVal(maskId); hints.flags |= IconMaskHint; } ENTER_XLIB(); - XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); + XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); LEAVE_XLIB(); RETURN ( self ); } @@ -11494,10 +11531,10 @@ && __isExternalAddress(aWindowId)) { XWMHints wmhints; - wmhints.icon_window = _WindowVal(iconWindowId); + wmhints.icon_window = __WindowVal(iconWindowId); wmhints.flags = IconWindowHint; ENTER_XLIB(); - XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); + XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints); LEAVE_XLIB(); RETURN ( self ); } @@ -11517,7 +11554,7 @@ XSizeHints szhints; Window win; - win = _WindowVal(aWindowId); + win = __WindowVal(aWindowId); szhints.flags = 0; if (__bothSmallInteger(minW, minH)) { @@ -11551,7 +11588,7 @@ && (__qIsString(aString) || __qIsSymbol(aString)) && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XStoreName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); + XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString)); LEAVE_XLIB(); RETURN ( self ); } @@ -11574,14 +11611,14 @@ Pixmap shapeBitmap; if (__isExternalAddress(aPixmapId)) - shapeBitmap = _PixmapVal(aPixmapId); + shapeBitmap = __PixmapVal(aPixmapId); else shapeBitmap = (Pixmap)0; if (ISCONNECTED && __isExternalAddress(aWindowId)) { ENTER_XLIB(); - XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, + XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip, 0, 0, shapeBitmap, ShapeSet); LEAVE_XLIB(); @@ -11604,7 +11641,7 @@ if (__isExternalAddress(aWindowId)) { ENTER_XLIB(); - XUnmapWindow(myDpy, _WindowVal(aWindowId)); + XUnmapWindow(myDpy, __WindowVal(aWindowId)); LEAVE_XLIB(); RETURN ( self ); } @@ -11628,10 +11665,10 @@ Atom WM_STATE_Atom; if (__INST(wmStateAtom) != nil) { - WM_STATE_Atom = _AtomVal(__INST(wmStateAtom)); + WM_STATE_Atom = __AtomVal(__INST(wmStateAtom)); ENTER_XLIB(); - XGetWindowProperty(myDpy, _WindowVal(aWindowId), + XGetWindowProperty(myDpy, __WindowVal(aWindowId), WM_STATE_Atom, 0L, 2L, False, AnyPropertyType, &JunkAtom,&JunkInt,&WinState,&JunkLong, @@ -11652,6 +11689,6 @@ !XWorkstation class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.374 2000-09-28 16:24:27 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.375 2000-09-29 12:23:16 stefan Exp $' ! ! XWorkstation initialize!