diff -r cbf9bb6fb83e -r 7746d6252645 XWorkstation.st --- a/XWorkstation.st Tue Sep 08 12:02:57 1998 +0200 +++ b/XWorkstation.st Tue Sep 08 12:03:46 1998 +0200 @@ -215,21 +215,21 @@ #endif #ifdef LINUX -# define DEFAULT_XLIB_TIMEOUT 600 /* in 50ms ticks (30 seconds) */ +# define DEFAULT_XLIB_TIMEOUT 600 /* in 50ms ticks (30 seconds) */ static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT; -# define ENTER_XLIB() \ +# define ENTER_XLIB() \ { \ __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ __blockingPrimitiveTimeoutArg__ = (INT)self; \ __blockingPrimitiveTimeout__ = __xlibTimeout__; \ } -# define LEAVE_XLIB() \ +# define LEAVE_XLIB() \ { \ __blockingPrimitiveTimeout__ = 0; \ } #else -# define ENTER_XLIB() /* as nothing */ -# define LEAVE_XLIB() /* as nothing */ +# define ENTER_XLIB() /* as nothing */ +# define LEAVE_XLIB() /* as nothing */ #endif %} @@ -1169,6 +1169,13 @@ " ! +supportsViewBackgroundPixmaps + "return true, if the device allows pixmaps as + viewBackground." + + ^ true +! + supportsIconViews "return true, if this device supports views as icons. Only Xservers (currently) support this." @@ -1546,12 +1553,12 @@ windowName = ""; if (iconBitmap || windowName) { - ENTER_XLIB(); + ENTER_XLIB(); XSetStandardProperties(dpy, newWindow, windowName, windowName, iconBitmap, 0, 0, &sizehints); - LEAVE_XLIB(); + LEAVE_XLIB(); } wmhints.flags = 0; @@ -1571,9 +1578,9 @@ wmhints.flags |= InputHint; wmhints.input = True; */ - ENTER_XLIB(); + ENTER_XLIB(); XSetWMHints(dpy, newWindow, &wmhints); - LEAVE_XLIB(); + LEAVE_XLIB(); /* * tell window manager to not kill us but send an event instead @@ -1582,7 +1589,7 @@ * get atoms first (if not already known) */ if (__INST(protocolsAtom) == nil) { - ENTER_XLIB(); + ENTER_XLIB(); WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); #ifdef USE_SAVEYOURSELF_ATOM @@ -1595,7 +1602,7 @@ #endif WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); - LEAVE_XLIB(); + LEAVE_XLIB(); } else { #ifdef USE_QUIT_APP_ATOM WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); @@ -1618,10 +1625,10 @@ #ifdef USE_QUIT_APP_ATOM atoms[atomCount] = WmQuitAppAtom; atomCount++; #endif - ENTER_XLIB(); + ENTER_XLIB(); XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, atomCount); - LEAVE_XLIB(); + LEAVE_XLIB(); } END_INTERRUPTSBLOCKED @@ -1645,9 +1652,9 @@ if (gc) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XFreeGC(myDpy, gc); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES __cnt_gc--; #endif @@ -1672,9 +1679,9 @@ if (pix) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XFreePixmap(myDpy, pix); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES __cnt_bitmap--; #endif @@ -1697,9 +1704,9 @@ if (win) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XDestroyWindow(myDpy, win); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES __cnt_view--; #endif @@ -1722,14 +1729,14 @@ && __isExternalAddress(aGCId) && ISCONNECTED) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), 0, height, 0, colormap, NULL, 0, XDPSDefaultTextBackstop, XDPSDefaultErrorProc, NULL); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); } @@ -1747,10 +1754,10 @@ if (__isExternalAddress(aDrawableId) && ISCONNECTED) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), 0L, (XGCValues *)0); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES if (gc) @@ -1774,10 +1781,10 @@ if (__isExternalAddress(aDrawableId) && ISCONNECTED) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), 0L, (XGCValues *)0); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES if (gc) @@ -1870,11 +1877,11 @@ } BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), (char *)b_bits, b_width, b_height); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES if (newBitmap) __cnt_bitmap++; @@ -2037,10 +2044,10 @@ Display *dpy = myDpy; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, &dummy, 0, &color.pixel, 1); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED if (ok) { #ifdef COUNT_RESOURCES @@ -2072,9 +2079,9 @@ colorname = (char *) __stringVal(aString); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); - LEAVE_XLIB(); + LEAVE_XLIB(); if (ok) { #ifdef QUICK_TRUE_COLORS if (__INST(visualType) == @symbol(TrueColor)) { @@ -2084,9 +2091,9 @@ RETURN ( __MKSMALLINT(id) ); } #endif - ENTER_XLIB(); + ENTER_XLIB(); ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); - LEAVE_XLIB(); + LEAVE_XLIB(); } END_INTERRUPTSBLOCKED if (! ok) { @@ -2140,9 +2147,9 @@ #endif dpy = myDpy; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED if (! ok) { RETURN ( nil ); @@ -2181,9 +2188,9 @@ dpy = myDpy; color = (long) __intVal(colorIndex); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES __cnt_color--; #endif @@ -2245,9 +2252,9 @@ color.pixel = __intVal(index); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XQueryColor(dpy, DefaultColormap(dpy, screen), &color); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED /* @@ -2407,9 +2414,9 @@ color.flags = DoRed | DoGreen | DoBlue; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XStoreColor(dpy, DefaultColormap(dpy, screen), &color); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( self ); } @@ -2485,9 +2492,9 @@ bgcolor.green= __intVal(bgG); bgcolor.blue = __intVal(bgB); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( self ); } @@ -2510,9 +2517,9 @@ if (ISCONNECTED && __isSmallInteger(number)) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); newCursor = XCreateFontCursor(myDpy, __intVal(number)); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES if (newCursor) __cnt_cursor++; @@ -2549,12 +2556,12 @@ bgColor.blue = 0xFFFF; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); newCursor = XCreatePixmapCursor(myDpy, _PixmapVal(sourceId), _PixmapVal(maskId), &fgColor, &bgColor, __intVal(hx), __intVal(hy)); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES if (newCursor) __cnt_cursor++; @@ -2585,9 +2592,9 @@ if (curs) { BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); XFreeCursor(myDpy, curs); - LEAVE_XLIB(); + LEAVE_XLIB(); #ifdef COUNT_RESOURCES __cnt_cursor--; #endif @@ -2846,9 +2853,9 @@ gc = _GCVal(dstGCId); source = (Drawable) _WindowVal(sourceId); dest = (Drawable) _WindowVal(destId); - ENTER_XLIB(); + ENTER_XLIB(); XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } %}. @@ -2882,14 +2889,14 @@ gc = _GCVal(dstGCId); source = (Drawable) _WindowVal(sourceId); dest = (Drawable) _WindowVal(destId); - ENTER_XLIB(); + ENTER_XLIB(); XSetGraphicsExposures(dpy, gc, 0); XCopyArea(dpy, source, dest, gc, __intVal(srcX), __intVal(srcY), __intVal(w), __intVal(h), __intVal(dstX), __intVal(dstY)); XSetGraphicsExposures(dpy, gc, 1); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } %}. @@ -2921,12 +2928,12 @@ gc = _GCVal(dstGCId); source = (Drawable) _WindowVal(sourceId); dest = (Drawable) _WindowVal(destId); - ENTER_XLIB(); + ENTER_XLIB(); XCopyPlane(myDpy, source, dest, gc, __intVal(srcX), __intVal(srcY), __intVal(w), __intVal(h), __intVal(dstX), __intVal(dstY), 1); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } %}. @@ -2961,14 +2968,14 @@ gc = _GCVal(dstGCId); source = (Drawable) _WindowVal(sourceId); dest = (Drawable) _WindowVal(destId); - ENTER_XLIB(); + ENTER_XLIB(); XSetGraphicsExposures(dpy, gc, 0); XCopyPlane(dpy, source, dest, gc, __intVal(srcX), __intVal(srcY), __intVal(w), __intVal(h), __intVal(dstX), __intVal(dstY), 1); XSetGraphicsExposures(dpy, gc, 1); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } %}. @@ -3022,10 +3029,10 @@ * need this check here: some servers simply dump core with bad args */ if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { - ENTER_XLIB(); + ENTER_XLIB(); XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), w, h, angle1, angle2); - LEAVE_XLIB(); + LEAVE_XLIB(); } RETURN ( self ); } @@ -3076,7 +3083,7 @@ |noY| (noY := yValues size) < 2 ifTrue:[ - ^ self + ^ self ]. %{ @@ -3093,99 +3100,99 @@ if (ISCONNECTED && __isExternalAddress(aGCId) && __isExternalAddress(aDrawableId) ) { - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); - - if( __isSmallInteger(scaleY) ) - sY = (float) __intVal( scaleY ); - else if (__isFloat(scaleY)) - sY = __floatVal( scaleY ); - else if (__isShortFloat(scaleY)) - sY = __shortFloatVal( scaleY ); - else { - t = __SSEND0(scaleY, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - sY = __floatVal( t ); - } - - if( __isSmallInteger(transY) ) - tY = (float) __intVal( transY ); - else if (__isFloat(transY)) - tY = __floatVal( transY ); - else if (__isShortFloat(transY)) - tY = __shortFloatVal( transY ); - else { - t = __SSEND0(transY, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - tY = __floatVal( t ); - } - - if( __isSmallInteger(startX) ) - x = (float) __intVal( startX ); - else if (__isFloat(startX)) - x = __floatVal( startX ); - else if (__isShortFloat(startX)) - x = __shortFloatVal( startX ); - else { - t = __SSEND0(startX, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - x = __floatVal( t ); - } - - if( __isSmallInteger(stepX) ) - step = (float) __intVal( stepX ); - else if (__isFloat(stepX)) - step = __floatVal( stepX ); - else if (__isShortFloat(stepX)) - step = __shortFloatVal( stepX ); - else { - t = __SSEND0(stepX, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - step = __floatVal( t ); - } - - num = __intVal( noY ); - - if( num > 200 ) { - if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) - goto fail; - mustFree = 1; - } else { - points = qPoints; - } - for( i = 0; i < num; ++i ) { - yA = __AT_(yValues, __MKSMALLINT(i+1) ); - - if( __isFloat(yA) ) - y = __floatVal( yA ); - else if( __isSmallInteger(yA) ) - y = (float) __intVal( yA ); - else if( __isShortFloat( yA) ) - y = __shortFloatVal( yA ); - else { - t = __SSEND0(yA, @symbol(asFloat), 0); - if (! __isFloat(t)) goto fail; - y = __floatVal( t ); - } - - points[i].x = (int) (x + 0.5); - points[i].y = (int) ((y * sY) + tY + 0.5); - x = x + step; - } - - ENTER_XLIB(); - XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); - LEAVE_XLIB(); - - if( mustFree ) { - free( points ); - } - RETURN ( self ); + gc = _GCVal(aGCId); + win = _WindowVal(aDrawableId); + + if( __isSmallInteger(scaleY) ) + sY = (float) __intVal( scaleY ); + else if (__isFloat(scaleY)) + sY = __floatVal( scaleY ); + else if (__isShortFloat(scaleY)) + sY = __shortFloatVal( scaleY ); + else { + t = __SSEND0(scaleY, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + sY = __floatVal( t ); + } + + if( __isSmallInteger(transY) ) + tY = (float) __intVal( transY ); + else if (__isFloat(transY)) + tY = __floatVal( transY ); + else if (__isShortFloat(transY)) + tY = __shortFloatVal( transY ); + else { + t = __SSEND0(transY, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + tY = __floatVal( t ); + } + + if( __isSmallInteger(startX) ) + x = (float) __intVal( startX ); + else if (__isFloat(startX)) + x = __floatVal( startX ); + else if (__isShortFloat(startX)) + x = __shortFloatVal( startX ); + else { + t = __SSEND0(startX, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + x = __floatVal( t ); + } + + if( __isSmallInteger(stepX) ) + step = (float) __intVal( stepX ); + else if (__isFloat(stepX)) + step = __floatVal( stepX ); + else if (__isShortFloat(stepX)) + step = __shortFloatVal( stepX ); + else { + t = __SSEND0(stepX, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + step = __floatVal( t ); + } + + num = __intVal( noY ); + + if( num > 200 ) { + if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) + goto fail; + mustFree = 1; + } else { + points = qPoints; + } + for( i = 0; i < num; ++i ) { + yA = __AT_(yValues, __MKSMALLINT(i+1) ); + + if( __isFloat(yA) ) + y = __floatVal( yA ); + else if( __isSmallInteger(yA) ) + y = (float) __intVal( yA ); + else if( __isShortFloat( yA) ) + y = __shortFloatVal( yA ); + else { + t = __SSEND0(yA, @symbol(asFloat), 0); + if (! __isFloat(t)) goto fail; + y = __floatVal( t ); + } + + points[i].x = (int) (x + 0.5); + points[i].y = (int) ((y * sY) + tY + 0.5); + x = x + step; + } + + ENTER_XLIB(); + XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); + LEAVE_XLIB(); + + if( mustFree ) { + free( points ); + } + RETURN ( self ); } fail: if( mustFree ) - free( points ); + free( points ); %}. self primitiveFailed @@ -3353,12 +3360,12 @@ if (i2 < n) { cp += i1; if (l > 1000) l = 1000; - ENTER_XLIB(); + ENTER_XLIB(); if (opaque == true) XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); else XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } } @@ -3372,12 +3379,12 @@ if (i2 < n) { cp += i1; if (l > 1000) l = 1000; - ENTER_XLIB(); + ENTER_XLIB(); if (opaque == true) XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); else XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } } @@ -3419,12 +3426,12 @@ cp = (char *) cp2; } - ENTER_XLIB(); + ENTER_XLIB(); if (opaque == true) XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); else XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); if (mustFree) { free(cp2); @@ -3611,8 +3618,8 @@ f = __floatVal(startAngle); angle1 = f * 64; } else if (__isShortFloat(startAngle)) { - f = __shortFloatVal(startAngle); - angle1 = f * 64; + f = __shortFloatVal(startAngle); + angle1 = f * 64; } else goto bad; if (__isSmallInteger(angle)) @@ -3621,8 +3628,8 @@ f = __floatVal(angle); angle2 = f * 64; } else if (__isShortFloat(angle)) { - f = __shortFloatVal(angle); - angle2 = f * 64; + f = __shortFloatVal(angle); + angle2 = f * 64; } else goto bad; if (ISCONNECTED @@ -3746,12 +3753,12 @@ ! primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding - width:imageWidth height:imageHeight - x:srcx y:srcy - into:aDrawableId - x:dstx y:dsty - width:w height:h - with:aGCId + width:imageWidth height:imageHeight + x:srcx y:srcy + into:aDrawableId + x:dstx y:dsty + width:w height:h + with:aGCId "since XPutImage may allocate huge amount of stack space (some implementations use alloca), this must run with unlimited stack." @@ -3777,61 +3784,61 @@ && __bothSmallInteger(imageDepth, bitsPerPixel) && __isSmallInteger(bitPadding) && __isByteArray(imageBits)) { - Display *dpy = myDpy; - int pad = __intVal(bitPadding); - - gc = _GCVal(aGCId); - win = _WindowVal(aDrawableId); - if (! gc || !win) - goto fail; + Display *dpy = myDpy; + int pad = __intVal(bitPadding); + + gc = _GCVal(aGCId); + win = _WindowVal(aDrawableId); + if (! gc || !win) + goto fail; #ifdef ARGDEBUG - printf("args ok\n"); + printf("args ok\n"); #endif - image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; - image.width = imgWdth = __intVal(imageWidth); - image.height = __intVal(imageHeight); - image.xoffset = 0; - image.format = ZPixmap; - image.byte_order = MSBFirst; - image.bitmap_unit = 8; - image.bitmap_bit_order = MSBFirst; - image.bitmap_pad = pad; - image.depth = __intVal(imageDepth); - image.bits_per_pixel = __intVal(bitsPerPixel); - - /* + image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; + image.width = imgWdth = __intVal(imageWidth); + image.height = __intVal(imageHeight); + image.xoffset = 0; + image.format = ZPixmap; + image.byte_order = MSBFirst; + image.bitmap_unit = 8; + image.bitmap_bit_order = MSBFirst; + image.bitmap_pad = pad; + image.depth = __intVal(imageDepth); + image.bits_per_pixel = __intVal(bitsPerPixel); + + /* image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; */ - image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; - - switch (image.bits_per_pixel) { - case 1: - case 2: - case 4: - case 8: - case 16: - case 24: - case 32: - break; - - default: + image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; + + switch (image.bits_per_pixel) { + case 1: + case 2: + case 4: + case 8: + case 16: + case 24: + case 32: + break; + + default: #ifdef ARGDEBUG - printf("bits_per_pixel=%d\n",image.bits_per_pixel); + printf("bits_per_pixel=%d\n",image.bits_per_pixel); #endif - goto fail; - } - - image.red_mask = 0xFFFF; - image.green_mask = 0xFFFF; - image.blue_mask = 0xFFFF; - - /* ENTER_XLIB(); */ - XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), - __intVal(dstx), __intVal(dsty), - __intVal(w), __intVal(h)); - /* LEAVE_XLIB(); */ - - RETURN ( true ); + goto fail; + } + + image.red_mask = 0xFFFF; + image.green_mask = 0xFFFF; + image.blue_mask = 0xFFFF; + + /* ENTER_XLIB(); */ + XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), + __intVal(dstx), __intVal(dsty), + __intVal(w), __intVal(h)); + /* LEAVE_XLIB(); */ + + RETURN ( true ); } #ifdef ARGDEBUG if (!! __isExternalAddress(aGCId)) printf("GC\n"); @@ -4124,39 +4131,39 @@ |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 + "/ + "/ 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 + "/ + "/ 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:[ @@ -4166,22 +4173,22 @@ "/ ]. (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 + "/ + "/ 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" @@ -4302,7 +4309,7 @@ static struct inlineCache skrS = _ILC4; if (! ISCONNECTED) { - RETURN (false); + RETURN (false); } dpy = myDpy; @@ -4310,10 +4317,10 @@ eB = __INST(eventBuffer); 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); } /* @@ -4321,30 +4328,30 @@ * avoid creation & lookup then. */ if ((t = __INST(lastId)) != nil) { - if (__isExternalAddress(t)) { - if (_WindowVal(t) == ae->window) { - theView = __INST(lastView); - if (__isNonNilObject(theView)) { - if (__qClass(theView) == nil) { - theView = nil; - } - } - } - } + if (__isExternalAddress(t)) { + if (_WindowVal(t) == ae->window) { + theView = __INST(lastView); + if (__isNonNilObject(theView)) { + if (__qClass(theView) == nil) { + theView = nil; + } + } + } + } } if (theView == nil) { - windowID = __MKEXTERNALADDRESS(ae->window); - theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); - /* - * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + windowID = __MKEXTERNALADDRESS(ae->window); + theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); + /* + * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); } if ((theView == nil) && (ev->type != MappingNotify)) { - RETURN (nil); + RETURN (nil); } /* @@ -4364,518 +4371,518 @@ eventType = __MKSMALLINT(ev->type); #endif switch (ev->type) { - case KeyRelease: - symS = @symbol(keyRelease:x:y:view:); - ipS = &skrS; - upDown = false; - goto keyPressAndRelease; - - case KeyPress: - symS = @symbol(keyPress:x:y:view:); - ipS = &skpS; - upDown = true; - /* FALL INTO */ - - keyPressAndRelease: - __INST(eventRootX) = __MKSMALLINT(ke->x_root); - __INST(eventRootY) = __MKSMALLINT(ke->y_root); + case KeyRelease: + symS = @symbol(keyRelease:x:y:view:); + ipS = &skrS; + upDown = false; + goto keyPressAndRelease; + + case KeyPress: + symS = @symbol(keyPress:x:y:view:); + ipS = &skpS; + upDown = true; + /* FALL INTO */ + + keyPressAndRelease: + __INST(eventRootX) = __MKSMALLINT(ke->x_root); + __INST(eventRootY) = __MKSMALLINT(ke->y_root); #ifdef OLD - __INST(altDown) = (ke->state & Mod2Mask) ? true : false; - __INST(metaDown) = (ke->state & Mod1Mask) ? true : false; + __INST(altDown) = (ke->state & Mod2Mask) ? true : false; + __INST(metaDown) = (ke->state & Mod1Mask) ? true : false; #else - __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; - __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; + __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; + __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; #endif - __INST(shiftDown) = (ke->state & ShiftMask) ? true : false; - __INST(ctrlDown) = (ke->state & ControlMask) ? true : false; - - ev_x = ke->x; - ev_y = ke->y; - - 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 { + __INST(shiftDown) = (ke->state & ShiftMask) ? true : false; + __INST(ctrlDown) = (ke->state & ControlMask) ? true : false; + + ev_x = ke->x; + ev_y = ke->y; + + 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 { #ifdef OLD - switch (keySym) { - case XK_Control_L: - case XK_Control_R: - __INST(ctrlDown) = upDown; - break; - case XK_Shift_L: - case XK_Shift_R: - __INST(shiftDown) = upDown; - break; - case XK_Meta_L: - case XK_Meta_R: - __INST(metaDown) = upDown; - break; - case XK_Alt_L: - case XK_Alt_R: - __INST(altDown) = upDown; - break; - } + switch (keySym) { + case XK_Control_L: + case XK_Control_R: + __INST(ctrlDown) = upDown; + break; + case XK_Shift_L: + case XK_Shift_R: + __INST(shiftDown) = upDown; + break; + case XK_Meta_L: + case XK_Meta_R: + __INST(metaDown) = upDown; + break; + case XK_Alt_L: + case XK_Alt_R: + __INST(altDown) = upDown; + break; + } #endif - keySymString = XKeysymToString(keySym); - if (keySymString) { + keySymString = XKeysymToString(keySym); + if (keySymString) { #ifdef OLD - if (keySymString[0] == 'D') { - /* - * remove underscore, dont want it in symbols - */ - if (strcmp(keySymString, "Delete_line") == 0) { - keySymString = "DeleteLine"; - } else if (strcmp(keySymString, "Delete_word") == 0) { - keySymString = "DeleteWord"; - } - } - /* - * make names compatible - */ - if (strcmp(keySymString, "Down") == 0) { - keySymString = "CursorDown"; - } else if (strcmp(keySymString, "Up") == 0) { - keySymString = "CursorUp"; - } else if (strcmp(keySymString, "Left") == 0) { - keySymString = "CursorLeft"; - } else if (strcmp(keySymString, "Right") == 0) { - keySymString = "CursorRight"; - } - arg = __MKSYMBOL(keySymString, (OBJ *)0); + if (keySymString[0] == 'D') { + /* + * remove underscore, dont want it in symbols + */ + if (strcmp(keySymString, "Delete_line") == 0) { + keySymString = "DeleteLine"; + } else if (strcmp(keySymString, "Delete_word") == 0) { + keySymString = "DeleteWord"; + } + } + /* + * make names compatible + */ + if (strcmp(keySymString, "Down") == 0) { + keySymString = "CursorDown"; + } else if (strcmp(keySymString, "Up") == 0) { + keySymString = "CursorUp"; + } else if (strcmp(keySymString, "Left") == 0) { + keySymString = "CursorLeft"; + } else if (strcmp(keySymString, "Right") == 0) { + keySymString = "CursorRight"; + } + arg = __MKSYMBOL(keySymString, (OBJ *)0); #else - arg = __MKSTRING(keySymString); + arg = __MKSTRING(keySymString); #endif - } - } - - if (arg == nil) { - /* happens sometimes (alt-graph on sun has no keysym) */ - break; - } - - (*(*ipS).ilc_func)(self, symS, nil, ipS, - arg, - __MKSMALLINT(ev_x), - __MKSMALLINT(ev_y), - theView); - break; - - case ButtonPress: - __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); - __INST(eventRootX) = __MKSMALLINT(be->x_root); - __INST(eventRootY) = __MKSMALLINT(be->y_root); - - if (__isSmallInteger(__INST(multiClickTimeDelta))) - nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); - else - nextMultiClickTime = 0; - - - if ((t = __INST(multiClickTime)) != nil) { - INT _multiClickTime; - - _multiClickTime = __longIntVal(t); - if (be->time < _multiClickTime) { - __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); - /* - * MKUINT could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); - - ipS = &bmpS; - symS = @symbol(buttonMultiPress:x:y:view:); - goto sendButtonEvent; - break; - } - } - __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); - /* - * MKUINT could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + } + } + + if (arg == nil) { + /* happens sometimes (alt-graph on sun has no keysym) */ + break; + } + + (*(*ipS).ilc_func)(self, symS, nil, ipS, + arg, + __MKSMALLINT(ev_x), + __MKSMALLINT(ev_y), + theView); + break; + + case ButtonPress: + __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); + __INST(eventRootX) = __MKSMALLINT(be->x_root); + __INST(eventRootY) = __MKSMALLINT(be->y_root); + + if (__isSmallInteger(__INST(multiClickTimeDelta))) + nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); + else + nextMultiClickTime = 0; + + + if ((t = __INST(multiClickTime)) != nil) { + INT _multiClickTime; + + _multiClickTime = __longIntVal(t); + if (be->time < _multiClickTime) { + __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); + /* + * MKUINT could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + + ipS = &bmpS; + symS = @symbol(buttonMultiPress:x:y:view:); + goto sendButtonEvent; + break; + } + } + __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); + /* + * MKUINT could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); #ifdef NO_LONGER - if (be->state & ShiftMask) { - ipS = &bspS; - symS = @symbol(buttonShiftPress:x:y:view:); - goto sendButtonEvent; - } + if (be->state & ShiftMask) { + ipS = &bspS; + symS = @symbol(buttonShiftPress:x:y:view:); + goto sendButtonEvent; + } #endif - ipS = &bpS; - symS = @symbol(buttonPress:x:y:view:); - goto sendButtonEvent; - - /* NOT REACHED */ - - case ButtonRelease: - __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); - __INST(eventRootX) = __MKSMALLINT(be->x_root); - __INST(eventRootY) = __MKSMALLINT(be->y_root); - ipS = &brS; - symS = @symbol(buttonRelease:x:y:view:); - /* fall into */ - - sendButtonEvent: - butt = __MKSMALLINT(be->button); + ipS = &bpS; + symS = @symbol(buttonPress:x:y:view:); + goto sendButtonEvent; + + /* NOT REACHED */ + + case ButtonRelease: + __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); + __INST(eventRootX) = __MKSMALLINT(be->x_root); + __INST(eventRootY) = __MKSMALLINT(be->y_root); + ipS = &brS; + symS = @symbol(buttonRelease:x:y:view:); + /* fall into */ + + sendButtonEvent: + butt = __MKSMALLINT(be->button); #ifdef NOTDEF - /* - * this allows operation with single button mouses: meta-click is always Button 2 - */ - if (__INST(metaDown) == true) - butt = __MKSMALLINT(2); - else + /* + * this allows operation with single button mouses: meta-click is always Button 2 + */ + if (__INST(metaDown) == true) + butt = __MKSMALLINT(2); + else #endif - butt = __AT_(__INST(buttonTranslation), butt); - /* - * #at: could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); - - - (*(*ipS).ilc_func)(self, - symS, nil, ipS, - butt, - __MKSMALLINT(ke->x), - __MKSMALLINT(ke->y), - theView); - break; - - case MotionNotify: - if (__INST(motionEventCompression) != false) { - while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; - } - - __INST(eventRootX) = __MKSMALLINT(me->x_root); - __INST(eventRootY) = __MKSMALLINT(me->y_root); + butt = __AT_(__INST(buttonTranslation), butt); + /* + * #at: could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + + + (*(*ipS).ilc_func)(self, + symS, nil, ipS, + butt, + __MKSMALLINT(ke->x), + __MKSMALLINT(ke->y), + theView); + break; + + case MotionNotify: + if (__INST(motionEventCompression) != false) { + while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; + } + + __INST(eventRootX) = __MKSMALLINT(me->x_root); + __INST(eventRootY) = __MKSMALLINT(me->y_root); #ifdef OLD - __INST(altDown) = (me->state & Mod2Mask) ? true : false; - __INST(metaDown) = (me->state & Mod1Mask) ? true : false; + __INST(altDown) = (me->state & Mod2Mask) ? true : false; + __INST(metaDown) = (me->state & Mod1Mask) ? true : false; #else - __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; - __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; + __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; + __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; #endif - __INST(shiftDown) = (me->state & ShiftMask) ? true : false; - __INST(ctrlDown) = (me->state & ControlMask) ? true : false; - - (*motS.ilc_func)(self, - @symbol(buttonMotion:x:y:view:), nil, &motS, - __MKSMALLINT(me->state), - __MKSMALLINT(me->x), - __MKSMALLINT(me->y), - theView); - break; - - case FocusIn: - (*focInS.ilc_func)(self, - @symbol(focusInView:), nil, &focInS, - theView); - break; - - case FocusOut: - (*focOutS.ilc_func)(self, - @symbol(focusOutView:), nil, &focOutS, - theView); - break; - - case EnterNotify: + __INST(shiftDown) = (me->state & ShiftMask) ? true : false; + __INST(ctrlDown) = (me->state & ControlMask) ? true : false; + + (*motS.ilc_func)(self, + @symbol(buttonMotion:x:y:view:), nil, &motS, + __MKSMALLINT(me->state), + __MKSMALLINT(me->x), + __MKSMALLINT(me->y), + theView); + break; + + case FocusIn: + (*focInS.ilc_func)(self, + @symbol(focusInView:), nil, &focInS, + theView); + break; + + case FocusOut: + (*focOutS.ilc_func)(self, + @symbol(focusOutView:), nil, &focOutS, + theView); + break; + + case EnterNotify: #ifdef OLD - __INST(altDown) = (ewe->state & Mod2Mask) ? true : false; - __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false; + __INST(altDown) = (ewe->state & Mod2Mask) ? true : false; + __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false; #else - __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; - __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; + __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; + __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; #endif - __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; - __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; - - (*peS.ilc_func)(self, - @symbol(pointerEnter:x:y:view:), nil, &peS, - __MKSMALLINT(ewe->state), - __MKSMALLINT(ewe->x), - __MKSMALLINT(ewe->y), - theView); - break; - - case LeaveNotify: - (*plS.ilc_func)(self, - @symbol(pointerLeave:view:), nil, &plS, - __MKSMALLINT(lwe->state), - theView); - break; - - case GraphicsExpose: - (*gexpS.ilc_func)(self, - @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS, - __MKSMALLINT(ee->x), - __MKSMALLINT(ee->y), - __MKSMALLINT(ee->width), - __MKSMALLINT(ee->height), - ee->count == 0 ? true : false, - theView); - - if (ee->count != 0) { - break; - } - /* fall into */ - - case NoExpose: - (*nexpS.ilc_func)(self, - @symbol(noExposeView:), nil, &nexpS, - theView); - break; - - case Expose: - (*expS.ilc_func)(self, - @symbol(exposeX:y:width:height:view:), nil, &expS, - __MKSMALLINT(ee->x), - __MKSMALLINT(ee->y), - __MKSMALLINT(ee->width), - __MKSMALLINT(ee->height), - theView); - break; - - case ConfigureNotify: - if (ce->above != None) { - siblingID = __MKEXTERNALADDRESS(ce->above); - sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); - /* - * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); - } - - (*confS.ilc_func)(self, - @symbol(configureX:y:width:height:view:), nil, &confS, - __MKSMALLINT(ce->x), - __MKSMALLINT(ce->y), - __MKSMALLINT(ce->width), - __MKSMALLINT(ce->height), - theView); - if (sibling != nil) { - (*coveredS.ilc_func)(self, - @symbol(coveredBy:view:), nil, &coveredS, - theView, - sibling); - } - 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)))) { - (*termS.ilc_func)(self, - @symbol(terminateView:), nil, &termS, theView); - break; - } - if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { - (*savtermS.ilc_func)(self, - @symbol(saveAndTerminateView:) - , nil, &savtermS, theView); - break; - } - } - /* - * any other client message - */ - i = (char *)(&(ev->xclient.data)) - (char *)ev; - (*clientMsg.ilc_func)(self, - @symbol(clientMessage:type:format:dataOffset:view:) - , nil, &clientMsg - , __INST(eventBuffer) - ,__MKSMALLINT(ev->xclient.message_type) - ,__MKSMALLINT(ev->xclient.format) - ,__MKSMALLINT(i), - theView); - break; - - case DestroyNotify: - (*destrS.ilc_func)(self, @symbol(destroyedView:) - , nil, &destrS, theView); - break; - - case UnmapNotify: - (*unmapS.ilc_func)(self, @symbol(unmappedView:) - , nil, &unmapS, theView); - break; - - case MapNotify: - (*mapS.ilc_func)(self, - @symbol(mappedView:) - , nil, &mapS, theView); - break; - - case KeymapNotify: - (*keymap.ilc_func)(theView, - @symbol(keyMapChange) - , nil, &keymap); - break; - - case VisibilityNotify: - switch (ve->state) { - case VisibilityUnobscured: - arg = @symbol(unobscured); - break; - case VisibilityPartiallyObscured: - arg = @symbol(partiallyObscured); - break; - case VisibilityFullyObscured: - arg = @symbol(fullyObscured); - break; - } - (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); - break; - - case CreateNotify: - (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView); - break; - - case MapRequest: - (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView); - break; - - case ReparentNotify: - (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView); - break; - - case ConfigureRequest: - (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView); - break; - - case GravityNotify: - (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView); - break; - - case ResizeRequest: - (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView); - break; - - case CirculateNotify: - (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView); - break; - - case CirculateRequest: - (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView); - break; - - case PropertyNotify: - (*prop.ilc_func)(self, - @symbol(propertyChangeView) - , nil, &prop, - theView); - break; - - case SelectionClear: - selectionID = __MKATOMOBJ(ev->xselectionclear.selection); - (*selClear.ilc_func)(self, - @symbol(selectionClear:view:) - , nil, &selClear, - selectionID, - theView); - break; - - case SelectionNotify: - /* - * returned selection value (answer from SelectionRequest) - */ - DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", - ev->xselection.property, ev->xselection.target, - ev->xselection.selection, ev->xselection.requestor)); - - { - INT _property = ev->xselection.property; - INT _target = ev->xselection.target; - INT _selection = ev->xselection.selection; - INT _requestor = ev->xselection.requestor; - - propertyID = __MKATOMOBJ(_property); - targetID = __MKATOMOBJ(_target); - selectionID = __MKATOMOBJ(_selection); - requestorID = __MKEXTERNALADDRESS(_requestor); - } - /* - * MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); - - (*selNotify.ilc_func)(self, - @symbol(selectionNotify:target:selection:from:view:) - , nil, &selNotify, - propertyID, targetID, selectionID, requestorID, - theView); - break; - - case SelectionRequest: - /* - * someone wants the selection - */ - DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", - ev->xselectionrequest.property, - ev->xselectionrequest.target, - ev->xselectionrequest.selection, - ev->xselectionrequest.requestor)); - { - INT _property = ev->xselectionrequest.property; - INT _target = ev->xselectionrequest.target; - INT _selection = ev->xselectionrequest.selection; - INT _requestor = ev->xselectionrequest.requestor; - INT _t = ev->xselectionrequest.time; - - propertyID = __MKATOMOBJ(_property); - targetID = __MKATOMOBJ(_target); - selectionID = __MKATOMOBJ(_selection); - requestorID = __MKEXTERNALADDRESS(_requestor); - evTime = __MKEXTERNALADDRESS(_t); - } - /* - * MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr - */ - eB = __INST(eventBuffer); - ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); - - (*selReq.ilc_func)(self, - @symbol(selectionRequest:target:selection:time:from:view:) - , nil, &selReq, - propertyID, targetID, selectionID, evTime, requestorID, - theView); - break; - - case ColormapNotify: - (*colormap.ilc_func)(self, - @symbol(colorMapChangeView:) - , nil, &colormap, - theView); - break; - - case MappingNotify: - switch(mape->request) { - case MappingModifier: - arg = @symbol(mappingModifier); - break; - case MappingKeyboard: - arg = @symbol(mappingKeyboard); - break; - case MappingPointer: - arg = @symbol(mappingPointer); - break; - default: - arg = nil; - break; - } - (*mapping.ilc_func)(self, - @symbol(mappingChanged:event:) - , nil, &mapping, arg, eB); - break; + __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; + __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; + + (*peS.ilc_func)(self, + @symbol(pointerEnter:x:y:view:), nil, &peS, + __MKSMALLINT(ewe->state), + __MKSMALLINT(ewe->x), + __MKSMALLINT(ewe->y), + theView); + break; + + case LeaveNotify: + (*plS.ilc_func)(self, + @symbol(pointerLeave:view:), nil, &plS, + __MKSMALLINT(lwe->state), + theView); + break; + + case GraphicsExpose: + (*gexpS.ilc_func)(self, + @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS, + __MKSMALLINT(ee->x), + __MKSMALLINT(ee->y), + __MKSMALLINT(ee->width), + __MKSMALLINT(ee->height), + ee->count == 0 ? true : false, + theView); + + if (ee->count != 0) { + break; + } + /* fall into */ + + case NoExpose: + (*nexpS.ilc_func)(self, + @symbol(noExposeView:), nil, &nexpS, + theView); + break; + + case Expose: + (*expS.ilc_func)(self, + @symbol(exposeX:y:width:height:view:), nil, &expS, + __MKSMALLINT(ee->x), + __MKSMALLINT(ee->y), + __MKSMALLINT(ee->width), + __MKSMALLINT(ee->height), + theView); + break; + + case ConfigureNotify: + if (ce->above != None) { + siblingID = __MKEXTERNALADDRESS(ce->above); + sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); + /* + * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + } + + (*confS.ilc_func)(self, + @symbol(configureX:y:width:height:view:), nil, &confS, + __MKSMALLINT(ce->x), + __MKSMALLINT(ce->y), + __MKSMALLINT(ce->width), + __MKSMALLINT(ce->height), + theView); + if (sibling != nil) { + (*coveredS.ilc_func)(self, + @symbol(coveredBy:view:), nil, &coveredS, + theView, + sibling); + } + 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)))) { + (*termS.ilc_func)(self, + @symbol(terminateView:), nil, &termS, theView); + break; + } + if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { + (*savtermS.ilc_func)(self, + @symbol(saveAndTerminateView:) + , nil, &savtermS, theView); + break; + } + } + /* + * any other client message + */ + i = (char *)(&(ev->xclient.data)) - (char *)ev; + (*clientMsg.ilc_func)(self, + @symbol(clientMessage:type:format:dataOffset:view:) + , nil, &clientMsg + , __INST(eventBuffer) + ,__MKSMALLINT(ev->xclient.message_type) + ,__MKSMALLINT(ev->xclient.format) + ,__MKSMALLINT(i), + theView); + break; + + case DestroyNotify: + (*destrS.ilc_func)(self, @symbol(destroyedView:) + , nil, &destrS, theView); + break; + + case UnmapNotify: + (*unmapS.ilc_func)(self, @symbol(unmappedView:) + , nil, &unmapS, theView); + break; + + case MapNotify: + (*mapS.ilc_func)(self, + @symbol(mappedView:) + , nil, &mapS, theView); + break; + + case KeymapNotify: + (*keymap.ilc_func)(theView, + @symbol(keyMapChange) + , nil, &keymap); + break; + + case VisibilityNotify: + switch (ve->state) { + case VisibilityUnobscured: + arg = @symbol(unobscured); + break; + case VisibilityPartiallyObscured: + arg = @symbol(partiallyObscured); + break; + case VisibilityFullyObscured: + arg = @symbol(fullyObscured); + break; + } + (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); + break; + + case CreateNotify: + (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView); + break; + + case MapRequest: + (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView); + break; + + case ReparentNotify: + (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView); + break; + + case ConfigureRequest: + (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView); + break; + + case GravityNotify: + (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView); + break; + + case ResizeRequest: + (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView); + break; + + case CirculateNotify: + (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView); + break; + + case CirculateRequest: + (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView); + break; + + case PropertyNotify: + (*prop.ilc_func)(self, + @symbol(propertyChangeView) + , nil, &prop, + theView); + break; + + case SelectionClear: + selectionID = __MKATOMOBJ(ev->xselectionclear.selection); + (*selClear.ilc_func)(self, + @symbol(selectionClear:view:) + , nil, &selClear, + selectionID, + theView); + break; + + case SelectionNotify: + /* + * returned selection value (answer from SelectionRequest) + */ + DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", + ev->xselection.property, ev->xselection.target, + ev->xselection.selection, ev->xselection.requestor)); + + { + INT _property = ev->xselection.property; + INT _target = ev->xselection.target; + INT _selection = ev->xselection.selection; + INT _requestor = ev->xselection.requestor; + + propertyID = __MKATOMOBJ(_property); + targetID = __MKATOMOBJ(_target); + selectionID = __MKATOMOBJ(_selection); + requestorID = __MKEXTERNALADDRESS(_requestor); + } + /* + * MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + + (*selNotify.ilc_func)(self, + @symbol(selectionNotify:target:selection:from:view:) + , nil, &selNotify, + propertyID, targetID, selectionID, requestorID, + theView); + break; + + case SelectionRequest: + /* + * someone wants the selection + */ + DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", + ev->xselectionrequest.property, + ev->xselectionrequest.target, + ev->xselectionrequest.selection, + ev->xselectionrequest.requestor)); + { + INT _property = ev->xselectionrequest.property; + INT _target = ev->xselectionrequest.target; + INT _selection = ev->xselectionrequest.selection; + INT _requestor = ev->xselectionrequest.requestor; + INT _t = ev->xselectionrequest.time; + + propertyID = __MKATOMOBJ(_property); + targetID = __MKATOMOBJ(_target); + selectionID = __MKATOMOBJ(_selection); + requestorID = __MKEXTERNALADDRESS(_requestor); + evTime = __MKEXTERNALADDRESS(_t); + } + /* + * MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr + */ + eB = __INST(eventBuffer); + ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); + + (*selReq.ilc_func)(self, + @symbol(selectionRequest:target:selection:time:from:view:) + , nil, &selReq, + propertyID, targetID, selectionID, evTime, requestorID, + theView); + break; + + case ColormapNotify: + (*colormap.ilc_func)(self, + @symbol(colorMapChangeView:) + , nil, &colormap, + theView); + break; + + case MappingNotify: + switch(mape->request) { + case MappingModifier: + arg = @symbol(mappingModifier); + break; + case MappingKeyboard: + arg = @symbol(mappingKeyboard); + break; + case MappingPointer: + arg = @symbol(mappingPointer); + break; + default: + arg = nil; + break; + } + (*mapping.ilc_func)(self, + @symbol(mappingChanged:event:) + , nil, &mapping, arg, eB); + break; } #undef ae #undef ee @@ -4936,14 +4943,14 @@ && __isSmallInteger(aMask)) { Display *dpy = myDpy; - ENTER_XLIB(); + ENTER_XLIB(); if (__isExternalAddress(aWindowIdOrNil)) { win = _WindowVal(aWindowIdOrNil); while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; } else { while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; } - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } %} @@ -5895,9 +5902,9 @@ minWidth = __MKSMALLINT(f->min_bounds.width); maxWidth = __MKSMALLINT(f->max_bounds.width); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth(f, " ", 1); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED avgWidth = __MKSMALLINT( len ); } @@ -6481,9 +6488,9 @@ if (i2 < n) { cp += i1; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth(f, cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( __MKSMALLINT(len) ); } @@ -6497,9 +6504,9 @@ if (i2 < n) { cp += i1; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth(f, cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( __MKSMALLINT(len) ); } @@ -6542,9 +6549,9 @@ cp = (char *) cp2; } BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth16(f, (XChar2b *)cp, l); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED if (mustFree) { @@ -6589,9 +6596,9 @@ if ((cls == @global(String)) || (cls == @global(Symbol))) { n = __stringSize(aString); BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth(f, cp, n); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( __MKSMALLINT(len) ); } @@ -6603,9 +6610,9 @@ n = __byteArraySize(aString) - nInstBytes; BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth(f, cp, n); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED RETURN ( __MKSMALLINT(len) ); } @@ -6646,9 +6653,9 @@ } BEGIN_INTERRUPTSBLOCKED - ENTER_XLIB(); + ENTER_XLIB(); len = XTextWidth16(f, (XChar2b *)cp, n); - LEAVE_XLIB(); + LEAVE_XLIB(); END_INTERRUPTSBLOCKED if (mustFree) { @@ -6751,9 +6758,9 @@ break; } if (! ok) { - ENTER_XLIB(); + ENTER_XLIB(); XUngrabKeyboard(myDpy, CurrentTime); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN (false); } @@ -6775,88 +6782,88 @@ int pointer_mode, keyboard_mode; if (ISCONNECTED) { - if (__isExternalAddress(aWindowId)) { - if (__isExternalAddress(confineId)) - confineWin = _WindowVal(confineId); - else - confineWin = (Window) None; - - if (__isExternalAddress(aCursorId)) - curs = _CursorVal(aCursorId); - else - curs = (Cursor) None; - - if (pMode == @symbol(sync)) - pointer_mode = GrabModeSync; - else - pointer_mode = GrabModeAsync; - - if (kMode == @symbol(sync)) - keyboard_mode = GrabModeSync; - else - keyboard_mode = GrabModeAsync; - - if (__isSmallInteger(eventMask)) - evMask = __intVal(eventMask); - else - evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; - - BEGIN_INTERRUPTSBLOCKED + if (__isExternalAddress(aWindowId)) { + if (__isExternalAddress(confineId)) + confineWin = _WindowVal(confineId); + else + confineWin = (Window) None; + + if (__isExternalAddress(aCursorId)) + curs = _CursorVal(aCursorId); + else + curs = (Cursor) None; + + if (pMode == @symbol(sync)) + pointer_mode = GrabModeSync; + else + pointer_mode = GrabModeAsync; + + if (kMode == @symbol(sync)) + keyboard_mode = GrabModeSync; + else + keyboard_mode = GrabModeAsync; + + if (__isSmallInteger(eventMask)) + evMask = __intVal(eventMask); + else + evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; + + BEGIN_INTERRUPTSBLOCKED /* - ENTER_XLIB(); + ENTER_XLIB(); */ - result = XGrabPointer(myDpy, - _WindowVal(aWindowId), - False, - evMask, - pointer_mode, keyboard_mode, - confineWin, - curs, - CurrentTime); + result = XGrabPointer(myDpy, + _WindowVal(aWindowId), + False, + evMask, + pointer_mode, keyboard_mode, + confineWin, + curs, + CurrentTime); /* - LEAVE_XLIB(); + LEAVE_XLIB(); */ - END_INTERRUPTSBLOCKED - - ok = 0; - switch (result) { - case AlreadyGrabbed: - if (@global(ErrorPrinting) == true) { - fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); - } - break; - case GrabNotViewable: - if (@global(ErrorPrinting) == true) { - fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); - } - break; - case GrabInvalidTime: - if (@global(ErrorPrinting) == true) { - fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); - } - break; - case GrabFrozen: - if (@global(ErrorPrinting) == true) { - fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); - } - break; - default: - ok = 1; - break; - } - - if (! ok) { + END_INTERRUPTSBLOCKED + + ok = 0; + switch (result) { + case AlreadyGrabbed: + if (@global(ErrorPrinting) == true) { + fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); + } + break; + case GrabNotViewable: + if (@global(ErrorPrinting) == true) { + fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); + } + break; + case GrabInvalidTime: + if (@global(ErrorPrinting) == true) { + fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); + } + break; + case GrabFrozen: + if (@global(ErrorPrinting) == true) { + fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); + } + break; + default: + ok = 1; + break; + } + + if (! ok) { /* - ENTER_XLIB(); + ENTER_XLIB(); */ - XUngrabPointer(myDpy, CurrentTime); + XUngrabPointer(myDpy, CurrentTime); /* - LEAVE_XLIB(); + LEAVE_XLIB(); */ - RETURN (false); - } - RETURN ( true ); - } + RETURN (false); + } + RETURN ( true ); + } } %}. self primitiveFailed @@ -6866,12 +6873,12 @@ "grap the pointer - return true if ok" ^ self - grabPointerIn:aWindowId - withCursor:aCursorId - eventMask:nil - pointerMode:pMode - keyboardMode:kMode - confineTo:confineId + grabPointerIn:aWindowId + withCursor:aCursorId + eventMask:nil + pointerMode:pMode + keyboardMode:kMode + confineTo:confineId "Modified: / 28.7.1998 / 02:47:51 / cg" ! @@ -6967,16 +6974,16 @@ gc = _GCVal(aGCId); if (__isExternalAddress(aBitmapId)) { bitmap = _PixmapVal(aBitmapId); - ENTER_XLIB(); + ENTER_XLIB(); XSetStipple(dpy, gc, bitmap); XSetFillStyle(dpy, gc, FillOpaqueStippled); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } if (aBitmapId == nil) { - ENTER_XLIB(); + ENTER_XLIB(); XSetFillStyle(dpy, gc, FillSolid); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } } @@ -7151,9 +7158,9 @@ else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; if (fun != -1) { - ENTER_XLIB(); + ENTER_XLIB(); XSetFunction(myDpy, gc, fun); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } } @@ -7265,16 +7272,16 @@ gc = _GCVal(aGCId); if (__isExternalAddress(aPixmapId)) { pixmap = _PixmapVal(aPixmapId); - ENTER_XLIB(); + ENTER_XLIB(); XSetTile(dpy, gc, pixmap); XSetFillStyle(dpy, gc, FillTiled); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } if (aPixmapId == nil) { - ENTER_XLIB(); + ENTER_XLIB(); XSetFillStyle(dpy, gc, FillSolid); - LEAVE_XLIB(); + LEAVE_XLIB(); RETURN ( self ); } } @@ -7910,8 +7917,8 @@ |key| (key := untranslatedKey) isString ifTrue:[ - key := RawKeysymTranslation at:key ifAbsent:key. - key := key asSymbol. + key := RawKeysymTranslation at:key ifAbsent:key. + key := key asSymbol. ]. ^ super translateKey:key forView:aView ! ! @@ -8430,15 +8437,15 @@ |s| (anObject isMemberOf:String) ifTrue:[ - ^ self setTextProperty:propertyID value:anObject for:aWindowID + ^ self setTextProperty:propertyID value:anObject for:aWindowID ]. s := WriteStream on:(ByteArray new:200). anObject storeBinaryOn:s. ^ self - setProperty:propertyID - type:(self atomIDOf:'ST_OBJECT' create:true) - value:(s contents) - for:aWindowID + setProperty:propertyID + type:(self atomIDOf:'ST_OBJECT' create:true) + value:(s contents) + for:aWindowID "Modified: / 17.6.1998 / 17:23:49 / cg" ! @@ -8451,54 +8458,54 @@ && __isAtomID(typeID) && ISCONNECTED && (__isString(anObject) - || __isSmallInteger(anObject) - || __isSymbol(anObject) - || __isByteArray(anObject) - || __isWords(anObject))) { - - Display *dpy = myDpy; - Atom prop, type; - Window window; - unsigned INT value; - - prop = _AtomVal(propertyID); - type = _AtomVal(typeID); - - if (__isExternalAddress(aWindowID)) { - window = _WindowVal(aWindowID); - } else { - window = DefaultRootWindow(dpy); - } - - if (__isSmallInteger(anObject)) { - value = __intVal(anObject); - XChangeProperty(dpy, window, prop, type, 32, - PropModeReplace, - (unsigned char *)(&value), sizeof(unsigned int)); - } else { - if (__isByteArray(anObject)) { - XChangeProperty(dpy, window, prop, type, 8, - PropModeReplace, - __ByteArrayInstPtr(anObject)->ba_element, - __byteArraySize(anObject)); - } else { - /* string or symbol or wordArray-like (16bit-string) object */ - if (__isWords(__qClass(anObject))) { - XChangeProperty(dpy, window, prop, type, 16, - PropModeReplace, - __stringVal(anObject), - __wordArraySize(anObject)); - } else { + || __isSmallInteger(anObject) + || __isSymbol(anObject) + || __isByteArray(anObject) + || __isWords(anObject))) { + + Display *dpy = myDpy; + Atom prop, type; + Window window; + unsigned INT value; + + prop = _AtomVal(propertyID); + type = _AtomVal(typeID); + + if (__isExternalAddress(aWindowID)) { + window = _WindowVal(aWindowID); + } else { + window = DefaultRootWindow(dpy); + } + + if (__isSmallInteger(anObject)) { + value = __intVal(anObject); + XChangeProperty(dpy, window, prop, type, 32, + PropModeReplace, + (unsigned char *)(&value), sizeof(unsigned int)); + } else { + if (__isByteArray(anObject)) { + XChangeProperty(dpy, window, prop, type, 8, + PropModeReplace, + __ByteArrayInstPtr(anObject)->ba_element, + __byteArraySize(anObject)); + } else { + /* string or symbol or wordArray-like (16bit-string) object */ + if (__isWords(__qClass(anObject))) { + XChangeProperty(dpy, window, prop, type, 16, + PropModeReplace, + __stringVal(anObject), + __wordArraySize(anObject)); + } else { /* must be string or symbol */ - XChangeProperty(dpy, window, prop, type, 8, - PropModeReplace, - __stringVal(anObject), - __stringSize(anObject)); - } - } - } - DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type)); - RETURN (true); + XChangeProperty(dpy, window, prop, type, 8, + PropModeReplace, + __stringVal(anObject), + __stringSize(anObject)); + } + } + } + DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type)); + RETURN (true); } %}. ^ false @@ -8877,9 +8884,9 @@ |selProp sel| (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ - "no primary selection - use cut buffer" - sel := self getObjectProperty:cutBuffer0Atom from:nil. - ^ sel + "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. @@ -8913,9 +8920,9 @@ |selProp sel| (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ - "no primary selection - use cut buffer" - sel := self getTextProperty:cutBuffer0Atom from:nil. - ^ sel + "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. @@ -8987,17 +8994,17 @@ "send aString back from a SelectionRequest" self - setProperty:propertyID - type:targetID - value:something - for:requestorID. + setProperty:propertyID + type:targetID + value:something + for:requestorID. self - sendSelectionNotifySelection:selectionID - property:propertyID - target:targetID - time:t - from:windowID - to:requestorID. + sendSelectionNotifySelection:selectionID + property:propertyID + target:targetID + time:t + from:windowID + to:requestorID. "Modified: / 17.6.1998 / 17:03:20 / cg" "Created: / 17.6.1998 / 19:44:03 / cg" @@ -9012,51 +9019,51 @@ && ISCONNECTED && __isAtomID(targetID) && __isAtomID(selectionID)) { - Display *dpy = myDpy; - XEvent ev; - Window requestor = _WindowVal(requestorID); - Atom property = _AtomVal(propertyID); - Atom target = _AtomVal(targetID); - Atom selection = _AtomVal(selectionID); - Status result; - - ev.xselection.type = SelectionNotify; - ev.xselection.display = dpy; - ev.xselection.selection = selection; - ev.xselection.target = target; - if (__isExternalAddress(windowID)) - ev.xselection.requestor = _WindowVal(windowID); - else - ev.xselection.requestor = DefaultRootWindow(dpy); - if (__isExternalAddress(t)) { - ev.xselection.time = (INT)(__externalAddressVal(t)); - } else { - ev.xselection.time = CurrentTime; - } - if (property == None) - ev.xselection.property = target; - else - ev.xselection.property = property; - - DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", - ev.xselection.selection, - ev.xselection.property, - ev.xselection.target, - ev.xselection.requestor, - requestor)); - - ENTER_XLIB(); - result = XSendEvent(dpy, requestor, False, 0 , &ev); - LEAVE_XLIB(); - - if ((result == BadValue) || (result == BadWindow)) { - DPRINTF(("bad status\n")); - RETURN (false); - } - ENTER_XLIB(); - XFlush(dpy); - LEAVE_XLIB(); - RETURN (true) + Display *dpy = myDpy; + XEvent ev; + Window requestor = _WindowVal(requestorID); + Atom property = _AtomVal(propertyID); + Atom target = _AtomVal(targetID); + Atom selection = _AtomVal(selectionID); + Status result; + + ev.xselection.type = SelectionNotify; + ev.xselection.display = dpy; + ev.xselection.selection = selection; + ev.xselection.target = target; + if (__isExternalAddress(windowID)) + ev.xselection.requestor = _WindowVal(windowID); + else + ev.xselection.requestor = DefaultRootWindow(dpy); + if (__isExternalAddress(t)) { + ev.xselection.time = (INT)(__externalAddressVal(t)); + } else { + ev.xselection.time = CurrentTime; + } + if (property == None) + ev.xselection.property = target; + else + ev.xselection.property = property; + + DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", + ev.xselection.selection, + ev.xselection.property, + ev.xselection.target, + ev.xselection.requestor, + requestor)); + + ENTER_XLIB(); + result = XSendEvent(dpy, requestor, False, 0 , &ev); + LEAVE_XLIB(); + + if ((result == BadValue) || (result == BadWindow)) { + DPRINTF(("bad status\n")); + RETURN (false); + } + ENTER_XLIB(); + XFlush(dpy); + LEAVE_XLIB(); + RETURN (true) } %}. self primitiveFailed. @@ -9085,15 +9092,15 @@ if (__isExternalAddress(aWindowId) && __isAtomID(selectionID) && ISCONNECTED) { - Display *dpy = myDpy; - - win = _WindowVal(aWindowId); - XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); - DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win)); - if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { - RETURN (false); - } - RETURN (true); + Display *dpy = myDpy; + + win = _WindowVal(aWindowId); + XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); + DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win)); + if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { + RETURN (false); + } + RETURN (true); } %}. self primitiveFailed. @@ -9105,7 +9112,7 @@ This can be used by any other X application." (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ - 'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. + 'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. ]. ^ self setTextProperty:cutBuffer0Atom value:aString for:rootId. @@ -9131,9 +9138,9 @@ * need this check here: some servers simply dump core with bad args */ if ((w >= 0) && (h >= 0)) { - ENTER_XLIB(); + ENTER_XLIB(); XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); - LEAVE_XLIB(); + LEAVE_XLIB(); } RETURN ( self ); } @@ -9265,16 +9272,16 @@ szhints.height = __intVal(h); szhints.flags |= USSize; } - if (__bothSmallInteger(minW, minH)) { - szhints.flags |= PMinSize; - szhints.min_width = __intVal(minW); - szhints.min_height = __intVal(minH); - } - if (__bothSmallInteger(maxW, maxH)) { - szhints.flags |= PMaxSize; - szhints.max_width = __intVal(maxW); - szhints.max_height = __intVal(maxH); - } + if (__bothSmallInteger(minW, minH)) { + szhints.flags |= PMinSize; + szhints.min_width = __intVal(minW); + szhints.min_height = __intVal(minH); + } + if (__bothSmallInteger(maxW, maxH)) { + szhints.flags |= PMaxSize; + szhints.max_width = __intVal(maxW); + szhints.max_height = __intVal(maxH); + } if (aBoolean == true) { char *windowName; @@ -9297,12 +9304,12 @@ windowName = ""; if (iconBitmap || windowName) { - ENTER_XLIB(); + ENTER_XLIB(); XSetStandardProperties(dpy, win, windowName, windowName, iconBitmap, 0, 0, &szhints); - LEAVE_XLIB(); + LEAVE_XLIB(); } wmhints.flags = 0; @@ -9963,6 +9970,6 @@ !XWorkstation class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.292 1998-08-27 14:38:15 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.293 1998-09-08 10:03:46 cg Exp $' ! ! XWorkstation initialize!