XWorkstation.st
changeset 850 42948798db7f
parent 847 f7c402bc5983
child 857 df5125310d86
equal deleted inserted replaced
849:a0d448023a54 850:42948798db7f
   168 # define END_INTERRUPTSBLOCKED /* */
   168 # define END_INTERRUPTSBLOCKED /* */
   169 #else
   169 #else
   170 extern int __interruptsBlocked;
   170 extern int __interruptsBlocked;
   171 # define BEGIN_INTERRUPTSBLOCKED        \
   171 # define BEGIN_INTERRUPTSBLOCKED        \
   172     {                                   \
   172     {                                   \
   173         int needUnblock = 0;            \
   173 	int needUnblock = 0;            \
   174         extern OBJ __thisContext__;     \
   174 	extern OBJ __thisContext__;     \
   175                                         \
   175 					\
   176         __thisContext__ = __thisContext;\
   176 	__thisContext__ = __thisContext;\
   177         if (!__interruptsBlocked) {     \
   177 	if (!__interruptsBlocked) {     \
   178             __BLOCKINTERRUPTS();        \
   178 	    __BLOCKINTERRUPTS();        \
   179             needUnblock = 1;            \
   179 	    needUnblock = 1;            \
   180         }
   180 	}
   181 
   181 
   182 # define END_INTERRUPTSBLOCKED          \
   182 # define END_INTERRUPTSBLOCKED          \
   183         __thisContext = __thisContext;  \
   183 	__thisContext = __thisContext;  \
   184         __thisContext__ = 0;            \
   184 	__thisContext__ = 0;            \
   185         if (needUnblock) {              \
   185 	if (needUnblock) {              \
   186             __UNBLOCKINTERRUPTS();      \
   186 	    __UNBLOCKINTERRUPTS();      \
   187         }                               \
   187 	}                               \
   188     }
   188     }
   189 
   189 
   190 #endif
   190 #endif
   191 %}
   191 %}
   192 ! !
   192 ! !
   319     all of this ...
   319     all of this ...
   320 
   320 
   321     See more documentation in my superclass, DeviceWorkstation.
   321     See more documentation in my superclass, DeviceWorkstation.
   322 
   322 
   323     [author:]
   323     [author:]
   324         Claus Gittinger
   324 	Claus Gittinger
   325 "
   325 "
   326 ! !
   326 ! !
   327 
   327 
   328 !XWorkstation class methodsFor:'initialization'!
   328 !XWorkstation class methodsFor:'initialization'!
   329 
   329 
   851     int screen = __intVal(__INST(screen));
   851     int screen = __intVal(__INST(screen));
   852     XIconSize *sizeList;
   852     XIconSize *sizeList;
   853     int cnt;
   853     int cnt;
   854 
   854 
   855     if (ISCONNECTED) {
   855     if (ISCONNECTED) {
   856         if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) {
   856 	if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) {
   857            xIconSizes = __MKEXTERNALBYTES(sizeList);
   857 	   xIconSizes = __MKEXTERNALBYTES(sizeList);
   858            count = __MKSMALLINT(cnt);
   858 	   count = __MKSMALLINT(cnt);
   859         }
   859 	}
   860     }
   860     }
   861 %}.
   861 %}.
   862     xIconSizes isNil ifTrue:[^ nil].
   862     xIconSizes isNil ifTrue:[^ nil].
   863 
   863 
   864     ret := OrderedCollection new:count.
   864     ret := OrderedCollection new:count.
   865     1 to:count do:[ :i |
   865     1 to:count do:[ :i |
   866         |minWidth minHeight maxWidth maxHeight widthStep heightStep d|
   866 	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
   867 
   867 
   868 %{
   868 %{
   869         XIconSize *slp;
   869 	XIconSize *slp;
   870 
   870 
   871         slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1];
   871 	slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1];
   872         minWidth = __MKSMALLINT(slp->min_width);
   872 	minWidth = __MKSMALLINT(slp->min_width);
   873         minHeight = __MKSMALLINT(slp->min_height);
   873 	minHeight = __MKSMALLINT(slp->min_height);
   874         maxWidth = __MKSMALLINT(slp->max_width);
   874 	maxWidth = __MKSMALLINT(slp->max_width);
   875         maxHeight = __MKSMALLINT(slp->max_height);
   875 	maxHeight = __MKSMALLINT(slp->max_height);
   876         widthStep = __MKSMALLINT(slp->width_inc);
   876 	widthStep = __MKSMALLINT(slp->width_inc);
   877         heightStep = __MKSMALLINT(slp->height_inc);
   877 	heightStep = __MKSMALLINT(slp->height_inc);
   878 %}.
   878 %}.
   879         d := IdentityDictionary new.
   879 	d := IdentityDictionary new.
   880         d at:#minWidth put:minWidth.
   880 	d at:#minWidth put:minWidth.
   881         d at:#maxWidth put:maxWidth.
   881 	d at:#maxWidth put:maxWidth.
   882         d at:#widthStep put:widthStep.
   882 	d at:#widthStep put:widthStep.
   883         d at:#minHeight put:minHeight.
   883 	d at:#minHeight put:minHeight.
   884         d at:#maxHeight put:maxHeight.
   884 	d at:#maxHeight put:maxHeight.
   885         d at:#heightStep put:heightStep.
   885 	d at:#heightStep put:heightStep.
   886 
   886 
   887         ret add:d
   887 	ret add:d
   888     ].
   888     ].
   889 
   889 
   890     xIconSizes free.
   890     xIconSizes free.
   891     ^ ret
   891     ^ ret
   892 
   892 
   906 preferredIconSize
   906 preferredIconSize
   907     "return the displays preferred size for icons.
   907     "return the displays preferred size for icons.
   908      Redefined to return a special value on SGI servers."
   908      Redefined to return a special value on SGI servers."
   909 
   909 
   910     self serverVendor = 'Silicon Graphics' ifTrue:[
   910     self serverVendor = 'Silicon Graphics' ifTrue:[
   911         ^ 86@68
   911 	^ 86@68
   912     ].
   912     ].
   913     ^ super preferredIconSize
   913     ^ super preferredIconSize
   914 
   914 
   915     "Created: 10.6.1996 / 21:06:48 / cg"
   915     "Created: 10.6.1996 / 21:06:48 / cg"
   916 !
   916 !
  1130 
  1130 
  1131 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
  1131 createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
  1132     "will vanish - for compatibility with previous versions"
  1132     "will vanish - for compatibility with previous versions"
  1133 
  1133 
  1134     ^ self 
  1134     ^ self 
  1135           createWindowFor:aView 
  1135 	  createWindowFor:aView 
  1136           origin:(xpos @ ypos)
  1136 	  origin:(xpos @ ypos)
  1137           extent:(wwidth @ wheight)
  1137 	  extent:(wwidth @ wheight)
  1138           minExtent:(aView minExtent)
  1138 	  minExtent:(aView minExtent)
  1139           maxExtent:(aView maxExtent)
  1139 	  maxExtent:(aView maxExtent)
  1140           borderWidth:(aView borderWidth)
  1140 	  borderWidth:(aView borderWidth)
  1141           subViewOf:(aView superView)
  1141 	  subViewOf:(aView superView)
  1142           onTop:(aView isPopUpView)
  1142 	  onTop:(aView isPopUpView)
  1143           inputOnly:(aView isInputOnly)
  1143 	  inputOnly:(aView isInputOnly)
  1144           label:(aView label)
  1144 	  label:(aView label)
  1145           cursor:(aView cursor)
  1145 	  cursor:(aView cursor)
  1146           icon:(aView icon)
  1146 	  icon:(aView icon)
  1147           iconView:(aView iconView)
  1147 	  iconView:(aView iconView)
  1148 
  1148 
  1149     "Modified: 1.6.1996 / 13:22:48 / cg"
  1149     "Modified: 1.6.1996 / 13:22:48 / cg"
  1150 !
  1150 !
  1151 
  1151 
  1152 createWindowFor:aView
  1152 createWindowFor:aView
  1811 
  1811 
  1812     char *colorname;
  1812     char *colorname;
  1813     Display *dpy = myDpy;
  1813     Display *dpy = myDpy;
  1814     XColor scolor, ecolor;
  1814     XColor scolor, ecolor;
  1815     int screen = __intVal(__INST(screen));
  1815     int screen = __intVal(__INST(screen));
       
  1816     int id;
  1816     Status ok;
  1817     Status ok;
  1817 
  1818 
  1818     if (ISCONNECTED) {
  1819     if (ISCONNECTED) {
  1819         if (__isString(aString) || __isSymbol(aString)) {
  1820 	if (__isString(aString) || __isSymbol(aString)) {
  1820             colorname = (char *)_stringVal(aString);
  1821 	    colorname = (char *)_stringVal(aString);
  1821 
  1822 
  1822             BEGIN_INTERRUPTSBLOCKED
  1823 	    BEGIN_INTERRUPTSBLOCKED
  1823             ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
  1824 	    ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
  1824             if (ok) {
  1825 	    if (ok) {
  1825 #ifdef QUICK_TRUE_COLORS
  1826 #ifdef QUICK_TRUE_COLORS
  1826                 if (__INST(visualType) == @symbol(TrueColor)) {
  1827 		if (__INST(visualType) == @symbol(TrueColor)) {
  1827                     id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
  1828 		    id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
  1828                     id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
  1829 		    id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
  1829                     id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
  1830 		    id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
  1830                     RETURN ( __MKSMALLINT(id) );
  1831 		    RETURN ( __MKSMALLINT(id) );
  1831                 }
  1832 		}
  1832 #endif
  1833 #endif
  1833                 ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
  1834 		ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
  1834             }
  1835 	    }
  1835             END_INTERRUPTSBLOCKED
  1836 	    END_INTERRUPTSBLOCKED
  1836             if (! ok) {
  1837 	    if (! ok) {
  1837                 RETURN ( nil );
  1838 		RETURN ( nil );
  1838             }
  1839 	    }
  1839             RETURN ( __MKSMALLINT(ecolor.pixel) );
  1840 	    RETURN ( __MKSMALLINT(ecolor.pixel) );
  1840         }
  1841 	}
  1841     }
  1842     }
  1842 %}.
  1843 %}.
  1843     self primitiveFailed.
  1844     self primitiveFailed.
  1844     ^ nil
  1845     ^ nil
  1845 !
  1846 !
  1866     int id;
  1867     int id;
  1867 
  1868 
  1868     if (__bothSmallInteger(r, g) 
  1869     if (__bothSmallInteger(r, g) 
  1869      && __isSmallInteger(b)
  1870      && __isSmallInteger(b)
  1870      && ISCONNECTED) {
  1871      && ISCONNECTED) {
  1871         ecolor.red = __intVal(r);
  1872 	ecolor.red = __intVal(r);
  1872         ecolor.green= __intVal(g);
  1873 	ecolor.green= __intVal(g);
  1873         ecolor.blue = __intVal(b);
  1874 	ecolor.blue = __intVal(b);
  1874 #ifdef QUICK_TRUE_COLORS
  1875 #ifdef QUICK_TRUE_COLORS
  1875         if (__INST(visualType) == @symbol(TrueColor)) {
  1876 	if (__INST(visualType) == @symbol(TrueColor)) {
  1876             id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
  1877 	    id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
  1877             id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
  1878 	    id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
  1878             id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
  1879 	    id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
  1879             RETURN ( __MKSMALLINT(id) );
  1880 	    RETURN ( __MKSMALLINT(id) );
  1880         }
  1881 	}
  1881 #endif
  1882 #endif
  1882         BEGIN_INTERRUPTSBLOCKED
  1883 	BEGIN_INTERRUPTSBLOCKED
  1883         ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
  1884 	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
  1884         END_INTERRUPTSBLOCKED
  1885 	END_INTERRUPTSBLOCKED
  1885         if (! ok) {
  1886 	if (! ok) {
  1886             RETURN ( nil );
  1887 	    RETURN ( nil );
  1887         }
  1888 	}
  1888         RETURN ( __MKSMALLINT(ecolor.pixel) );
  1889 	RETURN ( __MKSMALLINT(ecolor.pixel) );
  1889     }
  1890     }
  1890 %}.
  1891 %}.
  1891     self primitiveFailed.
  1892     self primitiveFailed.
  1892     ^ nil
  1893     ^ nil
  1893 !
  1894 !
  1901     unsigned long color;
  1902     unsigned long color;
  1902     int screen = __intVal(__INST(screen));
  1903     int screen = __intVal(__INST(screen));
  1903 
  1904 
  1904 #ifdef QUICK_TRUE_COLORS
  1905 #ifdef QUICK_TRUE_COLORS
  1905     if (__INST(visualType) == @symbol(TrueColor)) {
  1906     if (__INST(visualType) == @symbol(TrueColor)) {
  1906         /* no need to do anything on TrueColor displays ... */
  1907 	/* no need to do anything on TrueColor displays ... */
  1907         RETURN (self);
  1908 	RETURN (self);
  1908     }
  1909     }
  1909 #endif
  1910 #endif
  1910 
  1911 
  1911     if (__isSmallInteger(colorIndex) && ISCONNECTED) {
  1912     if (__isSmallInteger(colorIndex) && ISCONNECTED) {
  1912         color = (long) __intVal(colorIndex);
  1913 	color = (long) __intVal(colorIndex);
  1913         BEGIN_INTERRUPTSBLOCKED
  1914 	BEGIN_INTERRUPTSBLOCKED
  1914         XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
  1915 	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
  1915         END_INTERRUPTSBLOCKED
  1916 	END_INTERRUPTSBLOCKED
  1916         RETURN ( self );
  1917 	RETURN ( self );
  1917     }
  1918     }
  1918 %}.
  1919 %}.
  1919     self primitiveFailed
  1920     self primitiveFailed
  1920 !
  1921 !
  1921 
  1922 
  1926     |val|
  1927     |val|
  1927 
  1928 
  1928     self getScaledRGBFrom:index into:[:r :g :b |
  1929     self getScaledRGBFrom:index into:[:r :g :b |
  1929 	val := aBlock 
  1930 	val := aBlock 
  1930 		value:(r * 100.0 / 16rFFFF)
  1931 		value:(r * 100.0 / 16rFFFF)
  1931 	        value:(g * 100.0 / 16rFFFF)
  1932 		value:(g * 100.0 / 16rFFFF)
  1932 	        value:(b * 100.0 / 16rFFFF)
  1933 		value:(b * 100.0 / 16rFFFF)
  1933     ].
  1934     ].
  1934     ^ val
  1935     ^ val
  1935 !
  1936 !
  1936 
  1937 
  1937 getRGBFromName:colorName into:aBlock
  1938 getRGBFromName:colorName into:aBlock
  1938     "get rgb components (0..100) of color named colorName,
  1939     "get rgb components (0..100) of color named colorName,
  1939      and evaluate the 3-arg block, aBlock with them"
  1940      and evaluate the 3-arg block, aBlock with them"
  1940     |val|
  1941     |val|
  1941 
  1942 
  1942     self getScaledRGBFromName:colorName into:[:r :g :b |
  1943     self getScaledRGBFromName:colorName into:[:r :g :b |
  1943         val := aBlock 
  1944 	val := aBlock 
  1944                 value:(r * 100.0 / 16rFFFF)
  1945 		value:(r * 100.0 / 16rFFFF)
  1945                 value:(g * 100.0 / 16rFFFF)
  1946 		value:(g * 100.0 / 16rFFFF)
  1946                 value:(b * 100.0 / 16rFFFF)
  1947 		value:(b * 100.0 / 16rFFFF)
  1947     ].
  1948     ].
  1948     ^ val
  1949     ^ val
  1949 !
  1950 !
  1950 
  1951 
  1951 getScaledRGBFrom:index into:aBlock
  1952 getScaledRGBFrom:index into:aBlock
  2385     Window win;
  2386     Window win;
  2386     int w, h, angle1, angle2;
  2387     int w, h, angle1, angle2;
  2387     double f;
  2388     double f;
  2388 
  2389 
  2389     if (__isSmallInteger(startAngle))
  2390     if (__isSmallInteger(startAngle))
  2390         angle1 = __intVal(startAngle) * 64;
  2391 	angle1 = __intVal(startAngle) * 64;
  2391     else if (__isFloat(startAngle)) {
  2392     else if (__isFloat(startAngle)) {
  2392         f = __floatVal(startAngle);
  2393 	f = __floatVal(startAngle);
  2393         angle1 = f * 64;
  2394 	angle1 = f * 64;
  2394     }
  2395     }
  2395     if (__isSmallInteger(angle))
  2396     if (__isSmallInteger(angle))
  2396         angle2 = __intVal(angle) * 64;
  2397 	angle2 = __intVal(angle) * 64;
  2397     else if (__isFloat(angle)) {
  2398     else if (__isFloat(angle)) {
  2398         f = __floatVal(angle);
  2399 	f = __floatVal(angle);
  2399         angle2 = f * 64;
  2400 	angle2 = f * 64;
  2400     }
  2401     }
  2401     if (__isExternalAddress(aGCId)
  2402     if (__isExternalAddress(aGCId)
  2402      && __isExternalAddress(aDrawableId)
  2403      && __isExternalAddress(aDrawableId)
  2403      && __bothSmallInteger(x, y)
  2404      && __bothSmallInteger(x, y)
  2404      && __bothSmallInteger(width, height)) {
  2405      && __bothSmallInteger(width, height)) {
  2405         win = _WindowVal(aDrawableId);
  2406 	win = _WindowVal(aDrawableId);
  2406         gc = _GCVal(aGCId);
  2407 	gc = _GCVal(aGCId);
  2407         w = __intVal(width);
  2408 	w = __intVal(width);
  2408         h = __intVal(height);
  2409 	h = __intVal(height);
  2409         /*
  2410 	/*
  2410          * need this check here: some servers simply dump core with bad args
  2411 	 * need this check here: some servers simply dump core with bad args
  2411          */
  2412 	 */
  2412         if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
  2413 	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
  2413             XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
  2414 	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
  2414                                    w, h, angle1, angle2);
  2415 				   w, h, angle1, angle2);
  2415         }
  2416 	}
  2416         RETURN ( self );
  2417 	RETURN ( self );
  2417     }
  2418     }
  2418 %}.
  2419 %}.
  2419     "badGC, badDrawable or coordinates not integer"
  2420     "badGC, badDrawable or coordinates not integer"
  2420     self primitiveFailed
  2421     self primitiveFailed
  2421 !
  2422 !
  2569     if (__isExternalAddress(aGCId)
  2570     if (__isExternalAddress(aGCId)
  2570      && __isExternalAddress(aDrawableId)
  2571      && __isExternalAddress(aDrawableId)
  2571      && __isNonNilObject(aString)
  2572      && __isNonNilObject(aString)
  2572      && __bothSmallInteger(index1, index2)
  2573      && __bothSmallInteger(index1, index2)
  2573      && __bothSmallInteger(x, y)) {
  2574      && __bothSmallInteger(x, y)) {
  2574         gc = _GCVal(aGCId);
  2575 	gc = _GCVal(aGCId);
  2575         win = _WindowVal(aDrawableId);
  2576 	win = _WindowVal(aDrawableId);
  2576         cls = __qClass(aString);
  2577 	cls = __qClass(aString);
  2577 
  2578 
  2578         i1 = __intVal(index1) - 1;
  2579 	i1 = __intVal(index1) - 1;
  2579         if (i1 >= 0) {
  2580 	if (i1 >= 0) {
  2580             i2 = __intVal(index2) - 1;
  2581 	    i2 = __intVal(index2) - 1;
  2581             if (i2 < i1) {
  2582 	    if (i2 < i1) {
  2582                 RETURN (self);
  2583 		RETURN (self);
  2583             }
  2584 	    }
  2584 
  2585 
  2585             cp = _stringVal(aString);
  2586 	    cp = _stringVal(aString);
  2586             l = i2 - i1 + 1;
  2587 	    l = i2 - i1 + 1;
  2587 
  2588 
  2588             if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2589 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2589                 n = _stringSize(aString);
  2590 		n = _stringSize(aString);
  2590                 if (i2 < n) {
  2591 		if (i2 < n) {
  2591                     cp += i1;
  2592 		    cp += i1;
  2592                     if (l > 1000) l = 1000;
  2593 		    if (l > 1000) l = 1000;
  2593                     if (opaque == true)
  2594 		    if (opaque == true)
  2594                         XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2595 			XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2595                     else
  2596 		    else
  2596                         XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2597 			XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2597                     RETURN ( self );
  2598 		    RETURN ( self );
  2598                 }
  2599 		}
  2599             }
  2600 	    }
  2600 
  2601 
  2601             nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  2602 	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  2602             cp += nInstBytes;
  2603 	    cp += nInstBytes;
  2603 
  2604 
  2604             if (__isBytes(aString)) {
  2605 	    if (__isBytes(aString)) {
  2605                 n = __byteArraySize(aString) - nInstBytes - 1;
  2606 		n = __byteArraySize(aString) - nInstBytes - 1;
  2606 
  2607 
  2607                 if (i2 < n) {
  2608 		if (i2 < n) {
  2608                     cp += i1;
  2609 		    cp += i1;
  2609                     if (l > 1000) l = 1000;
  2610 		    if (l > 1000) l = 1000;
  2610                     if (opaque == true)
  2611 		    if (opaque == true)
  2611                         XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2612 			XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2612                     else
  2613 		    else
  2613                         XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2614 			XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
  2614                     RETURN ( self );
  2615 		    RETURN ( self );
  2615                 }
  2616 		}
  2616             }
  2617 	    }
  2617 
  2618 
  2618             /* TWOBYTESTRINGS */
  2619 	    /* TWOBYTESTRINGS */
  2619             if (__isWords(aString)) {
  2620 	    if (__isWords(aString)) {
  2620                 n = (__byteArraySize(aString) - nInstBytes) / 2;
  2621 		n = (__byteArraySize(aString) - nInstBytes) / 2;
  2621 
  2622 
  2622                 if (i2 < n) {
  2623 		if (i2 < n) {
  2623                     union {
  2624 		    union {
  2624                         char b[2];
  2625 			char b[2];
  2625                         unsigned short s;
  2626 			unsigned short s;
  2626                     } u;
  2627 		    } u;
  2627                     int i;
  2628 		    int i;
  2628                     XChar2b *cp2 = (XChar2b *)0;
  2629 		    XChar2b *cp2 = (XChar2b *)0;
  2629                     int mustFree = 0;
  2630 		    int mustFree = 0;
  2630 
  2631 
  2631                     cp += (i1 * 2);
  2632 		    cp += (i1 * 2);
  2632                     if (l > 1000) l = 1000;
  2633 		    if (l > 1000) l = 1000;
  2633 
  2634 
  2634                     /*
  2635 		    /*
  2635                      * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  2636 		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  2636                      * X expects them MSB first
  2637 		     * X expects them MSB first
  2637                      * convert as required
  2638 		     * convert as required
  2638                      */
  2639 		     */
  2639 
  2640 
  2640                     u.s = 0x1234;
  2641 		    u.s = 0x1234;
  2641                     if (u.b[0] != 0x12) {
  2642 		    if (u.b[0] != 0x12) {
  2642                         if (l <= NLOCALBUFFER) {
  2643 			if (l <= NLOCALBUFFER) {
  2643                             cp2 = xlatebuffer;
  2644 			    cp2 = xlatebuffer;
  2644                         } else {
  2645 			} else {
  2645                             cp2 = (XChar2b *)(malloc(l * 2));
  2646 			    cp2 = (XChar2b *)(malloc(l * 2));
  2646                             mustFree = 1;
  2647 			    mustFree = 1;
  2647                         }
  2648 			}
  2648                         for (i=0; i<l; i++) {
  2649 			for (i=0; i<l; i++) {
  2649                             cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  2650 			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  2650                             cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  2651 			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  2651                         }
  2652 			}
  2652                         cp = (char *) cp2;
  2653 			cp = (char *) cp2;
  2653                     }
  2654 		    }
  2654 
  2655 
  2655                     if (opaque == true)
  2656 		    if (opaque == true)
  2656                         XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
  2657 			XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
  2657                     else
  2658 		    else
  2658                         XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
  2659 			XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
  2659 
  2660 
  2660                     if (mustFree) {
  2661 		    if (mustFree) {
  2661                         free(cp2);
  2662 			free(cp2);
  2662                     }
  2663 		    }
  2663 
  2664 
  2664                     RETURN ( self );
  2665 		    RETURN ( self );
  2665                 }
  2666 		}
  2666             }
  2667 	    }
  2667         }
  2668 	}
  2668     }
  2669     }
  2669 #undef NLOCALBUFFER
  2670 #undef NLOCALBUFFER
  2670 %}.
  2671 %}.
  2671     "x/y not integer, badGC or drawable, or not a string"
  2672     "x/y not integer, badGC or drawable, or not a string"
  2672     self primitiveFailed
  2673     self primitiveFailed
  2690 
  2691 
  2691     if (__isExternalAddress(aGCId)
  2692     if (__isExternalAddress(aGCId)
  2692      && __isExternalAddress(aDrawableId)
  2693      && __isExternalAddress(aDrawableId)
  2693      && __isNonNilObject(aString)
  2694      && __isNonNilObject(aString)
  2694      && __bothSmallInteger(x, y)) {
  2695      && __bothSmallInteger(x, y)) {
  2695         gc = _GCVal(aGCId);
  2696 	gc = _GCVal(aGCId);
  2696         win = _WindowVal(aDrawableId);
  2697 	win = _WindowVal(aDrawableId);
  2697         cls = __qClass(aString);
  2698 	cls = __qClass(aString);
  2698 
  2699 
  2699         cp = _stringVal(aString);
  2700 	cp = _stringVal(aString);
  2700 
  2701 
  2701         if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2702 	if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2702             n = _stringSize(aString);
  2703 	    n = _stringSize(aString);
  2703             if (n > 1000) n = 1000;
  2704 	    if (n > 1000) n = 1000;
  2704             if (opaque == true)
  2705 	    if (opaque == true)
  2705                 XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2706 		XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2706             else
  2707 	    else
  2707                 XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2708 		XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2708             RETURN ( self );
  2709 	    RETURN ( self );
  2709         }
  2710 	}
  2710 
  2711 
  2711         nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  2712 	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  2712         cp += nInstBytes;
  2713 	cp += nInstBytes;
  2713 
  2714 
  2714         if (__isBytes(aString)) {
  2715 	if (__isBytes(aString)) {
  2715             n = __byteArraySize(aString) - nInstBytes - 1;
  2716 	    n = __byteArraySize(aString) - nInstBytes - 1;
  2716 
  2717 
  2717             if (n > 1000) n = 1000;
  2718 	    if (n > 1000) n = 1000;
  2718             if (opaque == true)
  2719 	    if (opaque == true)
  2719                 XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2720 		XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2720             else
  2721 	    else
  2721                 XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2722 		XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
  2722             RETURN ( self );
  2723 	    RETURN ( self );
  2723         }
  2724 	}
  2724 
  2725 
  2725         /* TWOBYTESTRINGS */
  2726 	/* TWOBYTESTRINGS */
  2726         if (__isWords(aString)) {
  2727 	if (__isWords(aString)) {
  2727             union {
  2728 	    union {
  2728                 char b[2];
  2729 		char b[2];
  2729                 unsigned short s;
  2730 		unsigned short s;
  2730             } u;
  2731 	    } u;
  2731             int i;
  2732 	    int i;
  2732             XChar2b *cp2;
  2733 	    XChar2b *cp2;
  2733             int mustFree = 0;
  2734 	    int mustFree = 0;
  2734 
  2735 
  2735             n = (__byteArraySize(aString) - nInstBytes) / 2;
  2736 	    n = (__byteArraySize(aString) - nInstBytes) / 2;
  2736             if (n > 1000) n = 1000;
  2737 	    if (n > 1000) n = 1000;
  2737 
  2738 
  2738             /*
  2739 	    /*
  2739              * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  2740 	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  2740              * X expects them MSB first
  2741 	     * X expects them MSB first
  2741              * convert as required
  2742 	     * convert as required
  2742              */
  2743 	     */
  2743 
  2744 
  2744             u.s = 0x1234;
  2745 	    u.s = 0x1234;
  2745             if (u.b[0] != 0x12) {
  2746 	    if (u.b[0] != 0x12) {
  2746                 if (n <= NLOCALBUFFER) {
  2747 		if (n <= NLOCALBUFFER) {
  2747                     cp2 = xlatebuffer;
  2748 		    cp2 = xlatebuffer;
  2748                 } else {
  2749 		} else {
  2749                     cp2 = (XChar2b *)(malloc(n * 2));
  2750 		    cp2 = (XChar2b *)(malloc(n * 2));
  2750                     mustFree = 1;
  2751 		    mustFree = 1;
  2751                 }
  2752 		}
  2752 
  2753 
  2753                 for (i=0; i<n; i++) {
  2754 		for (i=0; i<n; i++) {
  2754                     cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  2755 		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  2755                     cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  2756 		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  2756                 }
  2757 		}
  2757                 cp = (char *) cp2;
  2758 		cp = (char *) cp2;
  2758             }
  2759 	    }
  2759 
  2760 
  2760             if (opaque == true)
  2761 	    if (opaque == true)
  2761                 XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
  2762 		XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
  2762             else
  2763 	    else
  2763                 XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
  2764 		XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
  2764 
  2765 
  2765 
  2766 
  2766             if (mustFree) {
  2767 	    if (mustFree) {
  2767                 free(cp2);
  2768 		free(cp2);
  2768             }
  2769 	    }
  2769 
  2770 
  2770             RETURN ( self );
  2771 	    RETURN ( self );
  2771         }
  2772 	}
  2772     }
  2773     }
  2773 #undef NLOCALBUFFER
  2774 #undef NLOCALBUFFER
  2774 %}.
  2775 %}.
  2775     "x/y not integer, badGC or drawable, or not a string"
  2776     "x/y not integer, badGC or drawable, or not a string"
  2776     self primitiveFailed
  2777     self primitiveFailed
  2838 				      with:aGCId
  2839 				      with:aGCId
  2839 
  2840 
  2840 !
  2841 !
  2841 
  2842 
  2842 fillArcX:x y:y width:width height:height from:startAngle angle:angle
  2843 fillArcX:x y:y width:width height:height from:startAngle angle:angle
  2843                in:aDrawableId with:aGCId
  2844 	       in:aDrawableId with:aGCId
  2844     "fill an arc. If any coordinate is not integer, an error is triggered.
  2845     "fill an arc. If any coordinate is not integer, an error is triggered.
  2845      The angles may be floats or integer - they are given in degrees."
  2846      The angles may be floats or integer - they are given in degrees."
  2846 
  2847 
  2847 %{  /* NOCONTEXT */
  2848 %{  /* NOCONTEXT */
  2848 
  2849 
  2850     Window win;
  2851     Window win;
  2851     int w, h, angle1, angle2;
  2852     int w, h, angle1, angle2;
  2852     double f;
  2853     double f;
  2853 
  2854 
  2854     if (__isSmallInteger(startAngle))
  2855     if (__isSmallInteger(startAngle))
  2855         angle1 = __intVal(startAngle) * 64;
  2856 	angle1 = __intVal(startAngle) * 64;
  2856     else if (__isFloat(startAngle)) {
  2857     else if (__isFloat(startAngle)) {
  2857         f = __floatVal(startAngle);
  2858 	f = __floatVal(startAngle);
  2858         angle1 = f * 64;
  2859 	angle1 = f * 64;
  2859     }
  2860     }
  2860     if (__isSmallInteger(angle))
  2861     if (__isSmallInteger(angle))
  2861         angle2 = __intVal(angle) * 64;
  2862 	angle2 = __intVal(angle) * 64;
  2862     else if (__isFloat(angle)) {
  2863     else if (__isFloat(angle)) {
  2863         f = __floatVal(angle);
  2864 	f = __floatVal(angle);
  2864         angle2 = f * 64;
  2865 	angle2 = f * 64;
  2865     }
  2866     }
  2866     if (__isExternalAddress(aGCId)
  2867     if (__isExternalAddress(aGCId)
  2867      && __isExternalAddress(aDrawableId)
  2868      && __isExternalAddress(aDrawableId)
  2868      && __bothSmallInteger(x, y)
  2869      && __bothSmallInteger(x, y)
  2869      && __bothSmallInteger(width, height)) {
  2870      && __bothSmallInteger(width, height)) {
  2870         gc = _GCVal(aGCId);
  2871 	gc = _GCVal(aGCId);
  2871         win = _WindowVal(aDrawableId);
  2872 	win = _WindowVal(aDrawableId);
  2872         w = __intVal(width);
  2873 	w = __intVal(width);
  2873         h = __intVal(height);
  2874 	h = __intVal(height);
  2874         /*
  2875 	/*
  2875          * need this check here: some servers simply dump core with bad args
  2876 	 * need this check here: some servers simply dump core with bad args
  2876          */
  2877 	 */
  2877         if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
  2878 	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
  2878             XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
  2879 	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
  2879                                    w, h, angle1, angle2);
  2880 				   w, h, angle1, angle2);
  2880         }
  2881 	}
  2881         RETURN ( self );
  2882 	RETURN ( self );
  2882     }
  2883     }
  2883 %}.
  2884 %}.
  2884     "badGC, badDrawable or coordinates not integer"
  2885     "badGC, badDrawable or coordinates not integer"
  2885     self primitiveFailed
  2886     self primitiveFailed
  2886 !
  2887 !
  4114 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  4115 simulateKeyboardInput:aCharacterOrString inViewId:viewId
  4115     "send input to some other view, by simulating keyPress/keyRelease
  4116     "send input to some other view, by simulating keyPress/keyRelease
  4116      events. 
  4117      events. 
  4117      Only a few control characters are supported.
  4118      Only a few control characters are supported.
  4118      Notice: not all alien views allow this kind of synthetic input;
  4119      Notice: not all alien views allow this kind of synthetic input;
  4119              some simply ignore it."
  4120 	     some simply ignore it."
  4120 
  4121 
  4121     |control code state|
  4122     |control code state|
  4122 
  4123 
  4123     aCharacterOrString isString ifTrue:[
  4124     aCharacterOrString isString ifTrue:[
  4124         aCharacterOrString do:[:char |
  4125 	aCharacterOrString do:[:char |
  4125             self simulateKeyboardInput:char inViewId:viewId
  4126 	    self simulateKeyboardInput:char inViewId:viewId
  4126         ].
  4127 	].
  4127         ^ self
  4128 	^ self
  4128     ].
  4129     ].
  4129 
  4130 
  4130     control := false.
  4131     control := false.
  4131     code := aCharacterOrString asciiValue.
  4132     code := aCharacterOrString asciiValue.
  4132 
  4133 
  4133     (aCharacterOrString == Character cr) ifTrue:[
  4134     (aCharacterOrString == Character cr) ifTrue:[
  4134         code := #Return
  4135 	code := #Return
  4135     ] ifFalse:[
  4136     ] ifFalse:[
  4136         (aCharacterOrString == Character tab) ifTrue:[
  4137 	(aCharacterOrString == Character tab) ifTrue:[
  4137             code := #Tab 
  4138 	    code := #Tab 
  4138         ] ifFalse:[
  4139 	] ifFalse:[
  4139             (aCharacterOrString == Character esc) ifTrue:[
  4140 	    (aCharacterOrString == Character esc) ifTrue:[
  4140                 code := #Escape 
  4141 		code := #Escape 
  4141             ]
  4142 	    ]
  4142         ]
  4143 	]
  4143     ].
  4144     ].
  4144 
  4145 
  4145     control ifTrue:[
  4146     control ifTrue:[
  4146         state := self controlMask
  4147 	state := self controlMask
  4147     ].
  4148     ].
  4148 
  4149 
  4149 
  4150 
  4150     "/ the stuff below should not be needed 
  4151     "/ the stuff below should not be needed 
  4151     "/ (sendKeyOrButtonevent should be able to figure out things itself)
  4152     "/ (sendKeyOrButtonevent should be able to figure out things itself)
  4152     "/ however, on some linux systems it seems to not work correctly.
  4153     "/ however, on some linux systems it seems to not work correctly.
  4153     "/ Hopefully, this is correct ...
  4154     "/ Hopefully, this is correct ...
  4154 
  4155 
  4155     code isNumber ifTrue:[
  4156     code isNumber ifTrue:[
  4156         code >= $A asciiValue ifTrue:[
  4157 	code >= $A asciiValue ifTrue:[
  4157             code <= $Z asciiValue ifTrue:[
  4158 	    code <= $Z asciiValue ifTrue:[
  4158                 state := self shiftMask
  4159 		state := self shiftMask
  4159             ]
  4160 	    ]
  4160         ]
  4161 	]
  4161     ].
  4162     ].
  4162 
  4163 
  4163     self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId.
  4164     self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId.
  4164     self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId
  4165     self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId
  4165 
  4166 
  4378     encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True);
  4379     encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True);
  4379     charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True);
  4380     charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True);
  4380     fontAtom = XInternAtom(myDpy, "FONT", True);
  4381     fontAtom = XInternAtom(myDpy, "FONT", True);
  4381 
  4382 
  4382     if (ISCONNECTED) {
  4383     if (ISCONNECTED) {
  4383         if (__isExternalAddress(aFontId)) {
  4384 	if (__isExternalAddress(aFontId)) {
  4384         
  4385         
  4385             f = _FontVal(aFontId);
  4386 	    f = _FontVal(aFontId);
  4386             if (f) {
  4387 	    if (f) {
  4387                 n = f->n_properties;
  4388 		n = f->n_properties;
  4388                 prop = f->properties;
  4389 		prop = f->properties;
  4389                 if (prop) {
  4390 		if (prop) {
  4390                     while (n--) {
  4391 		    while (n--) {
  4391                         cp = XGetAtomName(myDpy, prop->name);
  4392 			cp = XGetAtomName(myDpy, prop->name);
  4392 #ifdef SUPERDEBUG
  4393 #ifdef SUPERDEBUG
  4393                         printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
  4394 			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
  4394 #endif
  4395 #endif
  4395                         if (prop->name == XA_FULL_NAME) {
  4396 			if (prop->name == XA_FULL_NAME) {
  4396                             cp = XGetAtomName(myDpy, prop->card32);
  4397 			    cp = XGetAtomName(myDpy, prop->card32);
  4397                             if (cp) {
  4398 			    if (cp) {
  4398                                 fullName = __MKSTRING(cp COMMA_CON);
  4399 				fullName = __MKSTRING(cp COMMA_CON);
  4399 #ifdef SUPERDEBUG
  4400 #ifdef SUPERDEBUG
  4400                                 printf("   FULL_NAME -> %s\n", cp);
  4401 				printf("   FULL_NAME -> %s\n", cp);
  4401 #endif
  4402 #endif
  4402                             }
  4403 			    }
  4403                         }
  4404 			}
  4404                         if (prop->name == fontAtom) {
  4405 			if (prop->name == fontAtom) {
  4405                             cp = XGetAtomName(myDpy, prop->card32);
  4406 			    cp = XGetAtomName(myDpy, prop->card32);
  4406                             if (cp) {
  4407 			    if (cp) {
  4407                                 fontName = __MKSTRING(cp COMMA_CON);
  4408 				fontName = __MKSTRING(cp COMMA_CON);
  4408 #ifdef SUPERDEBUG
  4409 #ifdef SUPERDEBUG
  4409                                 printf("   FONT -> %s\n", cp);
  4410 				printf("   FONT -> %s\n", cp);
  4410 #endif
  4411 #endif
  4411                             }
  4412 			    }
  4412                         }
  4413 			}
  4413                         if (prop->name == encodingAtom) {
  4414 			if (prop->name == encodingAtom) {
  4414                             cp = XGetAtomName(myDpy, prop->card32);
  4415 			    cp = XGetAtomName(myDpy, prop->card32);
  4415                             if (cp) {
  4416 			    if (cp) {
  4416                                 encoding = __MKSTRING(cp COMMA_CON);
  4417 				encoding = __MKSTRING(cp COMMA_CON);
  4417 #ifdef SUPERDEBUG
  4418 #ifdef SUPERDEBUG
  4418                                 printf("   ENCODING -> %s\n", cp);
  4419 				printf("   ENCODING -> %s\n", cp);
  4419 #endif
  4420 #endif
  4420                             }
  4421 			    }
  4421                         }
  4422 			}
  4422                         if (prop->name == registryAtom) {
  4423 			if (prop->name == registryAtom) {
  4423                             cp = XGetAtomName(myDpy, prop->card32);
  4424 			    cp = XGetAtomName(myDpy, prop->card32);
  4424                             if (cp) {
  4425 			    if (cp) {
  4425                                 registry = __MKSTRING(cp COMMA_CON);
  4426 				registry = __MKSTRING(cp COMMA_CON);
  4426 #ifdef SUPERDEBUG
  4427 #ifdef SUPERDEBUG
  4427                                 printf("   REGISTRY -> %s\n", cp);
  4428 				printf("   REGISTRY -> %s\n", cp);
  4428 #endif
  4429 #endif
  4429                             }
  4430 			    }
  4430                         }
  4431 			}
  4431                         if (prop->name == charSetCollAtom) {
  4432 			if (prop->name == charSetCollAtom) {
  4432                             cp = XGetAtomName(myDpy, prop->card32);
  4433 			    cp = XGetAtomName(myDpy, prop->card32);
  4433                             if (cp) {
  4434 			    if (cp) {
  4434                                 charSetCollections = __MKSTRING(cp COMMA_CON);
  4435 				charSetCollections = __MKSTRING(cp COMMA_CON);
  4435 #ifdef SUPERDEBUG
  4436 #ifdef SUPERDEBUG
  4436                                 printf("   CHARSET_COLLECTIONS -> %s\n", cp);
  4437 				printf("   CHARSET_COLLECTIONS -> %s\n", cp);
  4437 #endif
  4438 #endif
  4438                             }
  4439 			    }
  4439                         }
  4440 			}
  4440                         prop++;
  4441 			prop++;
  4441                     }
  4442 		    }
  4442                 }
  4443 		}
  4443             }
  4444 	    }
  4444         }
  4445 	}
  4445     }
  4446     }
  4446 %}.
  4447 %}.
  4447     ^ self
  4448     ^ self
  4448         extractEncodingFromRegistry:registry 
  4449 	extractEncodingFromRegistry:registry 
  4449         encoding:encoding 
  4450 	encoding:encoding 
  4450         charSetCollections:charSetCollections
  4451 	charSetCollections:charSetCollections
  4451 !
  4452 !
  4452 
  4453 
  4453 extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
  4454 extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
  4454     "this is pure magic ..."
  4455     "this is pure magic ..."
  4455 
  4456 
  4456     |enc charSets|
  4457     |enc charSets|
  4457 
  4458 
  4458     (registry notNil and:[registry notEmpty]) ifTrue:[
  4459     (registry notNil and:[registry notEmpty]) ifTrue:[
  4459         enc := registry asLowercase asSymbol.
  4460 	enc := registry asLowercase asSymbol.
  4460     ] ifFalse:[
  4461     ] ifFalse:[
  4461         (encoding notNil and:[encoding notEmpty]) ifTrue:[
  4462 	(encoding notNil and:[encoding notEmpty]) ifTrue:[
  4462             enc := encoding asLowercase asSymbol
  4463 	    enc := encoding asLowercase asSymbol
  4463         ] ifFalse:[
  4464 	] ifFalse:[
  4464             charSets := charSetCollections.    
  4465 	    charSets := charSetCollections.    
  4465             (charSets notNil and:[charSets notEmpty]) ifTrue:[
  4466 	    (charSets notNil and:[charSets notEmpty]) ifTrue:[
  4466                 charSets := charSets asUppercase asCollectionOfWords.
  4467 		charSets := charSets asUppercase asCollectionOfWords.
  4467                 (charSets includes:'ISO8859-1') ifTrue:[
  4468 		(charSets includes:'ISO8859-1') ifTrue:[
  4468                     enc := #iso8859
  4469 		    enc := #iso8859
  4469                 ] ifFalse:[
  4470 		] ifFalse:[
  4470                     (charSets includes:'ISO8859') ifTrue:[
  4471 		    (charSets includes:'ISO8859') ifTrue:[
  4471                         enc := #iso8859
  4472 			enc := #iso8859
  4472                     ] ifFalse:[
  4473 		    ] ifFalse:[
  4473                         (charSets includes:'ASCII') ifTrue:[
  4474 			(charSets includes:'ASCII') ifTrue:[
  4474                             enc := #ascii
  4475 			    enc := #ascii
  4475                         ] ifFalse:[
  4476 			] ifFalse:[
  4476                             (charSets includes:'ADOBE-STANDARD') ifTrue:[
  4477 			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
  4477                                 enc := #iso8859
  4478 				enc := #iso8859
  4478                             ]
  4479 			    ]
  4479                         ]
  4480 			]
  4480                     ]
  4481 		    ]
  4481                 ]
  4482 		]
  4482             ] 
  4483 	    ] 
  4483         ]
  4484 	]
  4484     ].
  4485     ].
  4485     ^  enc
  4486     ^  enc
  4486 
  4487 
  4487     "Created: 17.4.1996 / 14:57:06 / cg"
  4488     "Created: 17.4.1996 / 14:57:06 / cg"
  4488     "Modified: 17.4.1996 / 17:22:35 / cg"
  4489     "Modified: 17.4.1996 / 17:22:35 / cg"
  4846 "/          listOfXFonts := nil
  4847 "/          listOfXFonts := nil
  4847 "/      ] ifFalse:[
  4848 "/      ] ifFalse:[
  4848 "/          listOfXFonts sort:[:a :b | a family < b family].
  4849 "/          listOfXFonts sort:[:a :b | a family < b family].
  4849 "/      ].
  4850 "/      ].
  4850 
  4851 
  4851         "/
  4852 	"/
  4852         "/ new code:
  4853 	"/ new code:
  4853         "/ use new primitive to get font names;
  4854 	"/ use new primitive to get font names;
  4854         "/ this is much faster, and also works on systems where
  4855 	"/ this is much faster, and also works on systems where
  4855         "/      a) xlsfonts is broken (sco)
  4856 	"/      a) xlsfonts is broken (sco)
  4856         "/      b) xlsfonts is not available (aix)
  4857 	"/      b) xlsfonts is not available (aix)
  4857         "/
  4858 	"/
  4858         names := self getAvailableFontsMatching:'*'.
  4859 	names := self getAvailableFontsMatching:'*'.
  4859         names isNil ifTrue:[
  4860 	names isNil ifTrue:[
  4860             "no names returned ..."
  4861 	    "no names returned ..."
  4861             ^ nil
  4862 	    ^ nil
  4862         ].
  4863 	].
  4863         listOfXFonts := names collect:[:aName |
  4864 	listOfXFonts := names collect:[:aName |
  4864                                     |fntDescr|
  4865 				    |fntDescr|
  4865 
  4866 
  4866                                     (self decomposeXFontName:aName into:
  4867 				    (self decomposeXFontName:aName into:
  4867                                         [:family :face :style :size :coding |
  4868 					[:family :face :style :size :coding |
  4868                                            family notNil ifTrue:[
  4869 					   family notNil ifTrue:[
  4869                                                fntDescr := FontDescription
  4870 					       fntDescr := FontDescription
  4870                                                                family:family
  4871 							       family:family
  4871                                                                face:face
  4872 							       face:face
  4872                                                                style:style
  4873 							       style:style
  4873                                                                size:size
  4874 							       size:size
  4874                                                                encoding:coding.
  4875 							       encoding:coding.
  4875                                            ] ifFalse:[
  4876 					   ] ifFalse:[
  4876                                                fntDescr := FontDescription
  4877 					       fntDescr := FontDescription
  4877                                                                name:aName
  4878 							       name:aName
  4878                                            ]
  4879 					   ]
  4879                                         ]
  4880 					]
  4880                                     ) ifFalse:[
  4881 				    ) ifFalse:[
  4881                                         fntDescr := FontDescription name:aName.
  4882 					fntDescr := FontDescription name:aName.
  4882                                     ].  
  4883 				    ].  
  4883                                     fntDescr
  4884 				    fntDescr
  4884                             ].
  4885 			    ].
  4885 
  4886 
  4886     ].
  4887     ].
  4887     ^ listOfXFonts
  4888     ^ listOfXFonts
  4888 
  4889 
  4889     "
  4890     "
  5020 #   define NLOCALBUFFER 200
  5021 #   define NLOCALBUFFER 200
  5021     XChar2b xlatebuffer[NLOCALBUFFER];
  5022     XChar2b xlatebuffer[NLOCALBUFFER];
  5022     int nInstBytes;
  5023     int nInstBytes;
  5023 
  5024 
  5024     if (ISCONNECTED) {
  5025     if (ISCONNECTED) {
  5025         if (__bothSmallInteger(index1, index2)
  5026 	if (__bothSmallInteger(index1, index2)
  5026          && __isExternalAddress(aFontId)
  5027 	 && __isExternalAddress(aFontId)
  5027          && __isNonNilObject(aString)) {
  5028 	 && __isNonNilObject(aString)) {
  5028             f = _FontVal(aFontId);
  5029 	    f = _FontVal(aFontId);
  5029             i1 = __intVal(index1) - 1;
  5030 	    i1 = __intVal(index1) - 1;
  5030             cls = __qClass(aString);
  5031 	    cls = __qClass(aString);
  5031 
  5032 
  5032             if (i1 >= 0) {
  5033 	    if (i1 >= 0) {
  5033                 i2 = __intVal(index2) - 1;
  5034 		i2 = __intVal(index2) - 1;
  5034                 if (i2 < i1) {
  5035 		if (i2 < i1) {
  5035                     RETURN (self);
  5036 		    RETURN (self);
  5036                 }
  5037 		}
  5037 
  5038 
  5038                 cp = (char *) _stringVal(aString);
  5039 		cp = (char *) _stringVal(aString);
  5039                 l = i2 - i1 + 1;
  5040 		l = i2 - i1 + 1;
  5040 
  5041 
  5041                 if ((cls == @global(String)) || (cls == @global(Symbol))) {
  5042 		if ((cls == @global(String)) || (cls == @global(Symbol))) {
  5042                     n = _stringSize(aString);
  5043 		    n = _stringSize(aString);
  5043                     if (i2 < n) {
  5044 		    if (i2 < n) {
  5044                         cp += i1;
  5045 			cp += i1;
  5045                         BEGIN_INTERRUPTSBLOCKED
  5046 			BEGIN_INTERRUPTSBLOCKED
  5046                         len = XTextWidth(f, cp, l);
  5047 			len = XTextWidth(f, cp, l);
  5047                         END_INTERRUPTSBLOCKED
  5048 			END_INTERRUPTSBLOCKED
  5048                         RETURN ( __MKSMALLINT(len) );
  5049 			RETURN ( __MKSMALLINT(len) );
  5049                     }
  5050 		    }
  5050                 }
  5051 		}
  5051 
  5052 
  5052                 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  5053 		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  5053                 cp += nInstBytes;
  5054 		cp += nInstBytes;
  5054 
  5055 
  5055                 if (__isBytes(aString)) {
  5056 		if (__isBytes(aString)) {
  5056                     n = __byteArraySize(aString) - nInstBytes;
  5057 		    n = __byteArraySize(aString) - nInstBytes;
  5057                     if (i2 < n) {
  5058 		    if (i2 < n) {
  5058                         cp += i1;
  5059 			cp += i1;
  5059                         BEGIN_INTERRUPTSBLOCKED
  5060 			BEGIN_INTERRUPTSBLOCKED
  5060                         len = XTextWidth(f, cp, l);
  5061 			len = XTextWidth(f, cp, l);
  5061                         END_INTERRUPTSBLOCKED
  5062 			END_INTERRUPTSBLOCKED
  5062                         RETURN ( __MKSMALLINT(len) );
  5063 			RETURN ( __MKSMALLINT(len) );
  5063                     }
  5064 		    }
  5064                 }
  5065 		}
  5065 
  5066 
  5066                 /* TWOBYTESTRINGS */
  5067 		/* TWOBYTESTRINGS */
  5067                 if (__isWords(aString)) {
  5068 		if (__isWords(aString)) {
  5068                     n = (__byteArraySize(aString) - nInstBytes) / 2;
  5069 		    n = (__byteArraySize(aString) - nInstBytes) / 2;
  5069 
  5070 
  5070                     if (i2 < n) {
  5071 		    if (i2 < n) {
  5071                         union {
  5072 			union {
  5072                             char b[2];
  5073 			    char b[2];
  5073                             unsigned short s;
  5074 			    unsigned short s;
  5074                         } u;
  5075 			} u;
  5075                         int i;
  5076 			int i;
  5076                         XChar2b *cp2 = (XChar2b *)0;
  5077 			XChar2b *cp2 = (XChar2b *)0;
  5077                         int mustFree = 0;
  5078 			int mustFree = 0;
  5078 
  5079 
  5079                         cp += (i1 * 2);
  5080 			cp += (i1 * 2);
  5080                         if (l > 1000) l = 1000;
  5081 			if (l > 1000) l = 1000;
  5081 
  5082 
  5082                         /*
  5083 			/*
  5083                          * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  5084 			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  5084                          * X expects them MSB first
  5085 			 * X expects them MSB first
  5085                          * convert as required
  5086 			 * convert as required
  5086                          */
  5087 			 */
  5087 
  5088 
  5088                         u.s = 0x1234;
  5089 			u.s = 0x1234;
  5089                         if (u.b[0] != 0x12) {
  5090 			if (u.b[0] != 0x12) {
  5090                             if (l <= NLOCALBUFFER) {
  5091 			    if (l <= NLOCALBUFFER) {
  5091                                 cp2 = xlatebuffer;
  5092 				cp2 = xlatebuffer;
  5092                             } else {
  5093 			    } else {
  5093                                 cp2 = (XChar2b *)(malloc(l * 2));
  5094 				cp2 = (XChar2b *)(malloc(l * 2));
  5094                                 mustFree = 1;
  5095 				mustFree = 1;
  5095                             }
  5096 			    }
  5096                             for (i=0; i<l; i++) {
  5097 			    for (i=0; i<l; i++) {
  5097                                 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  5098 				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  5098                                 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  5099 				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  5099                             }
  5100 			    }
  5100                             cp = (char *) cp2;
  5101 			    cp = (char *) cp2;
  5101                         }
  5102 			}
  5102                         BEGIN_INTERRUPTSBLOCKED
  5103 			BEGIN_INTERRUPTSBLOCKED
  5103                         len = XTextWidth16(f, (XChar2b *)cp, l);
  5104 			len = XTextWidth16(f, (XChar2b *)cp, l);
  5104                         END_INTERRUPTSBLOCKED
  5105 			END_INTERRUPTSBLOCKED
  5105 
  5106 
  5106                         if (mustFree) {
  5107 			if (mustFree) {
  5107                             free(cp2);
  5108 			    free(cp2);
  5108                         }
  5109 			}
  5109 
  5110 
  5110                         RETURN ( __MKSMALLINT(len) );
  5111 			RETURN ( __MKSMALLINT(len) );
  5111                     }
  5112 		    }
  5112                 }
  5113 		}
  5113             }
  5114 	    }
  5114         }
  5115 	}
  5115     }
  5116     }
  5116 #undef NLOCALBUFFER
  5117 #undef NLOCALBUFFER
  5117 %}.
  5118 %}.
  5118     self primitiveFailed.
  5119     self primitiveFailed.
  5119     ^ nil
  5120     ^ nil
  5130 #   define NLOCALBUFFER 200
  5131 #   define NLOCALBUFFER 200
  5131     XChar2b xlatebuffer[NLOCALBUFFER];
  5132     XChar2b xlatebuffer[NLOCALBUFFER];
  5132     int nInstBytes;
  5133     int nInstBytes;
  5133 
  5134 
  5134     if (ISCONNECTED) {
  5135     if (ISCONNECTED) {
  5135         if (__isExternalAddress(aFontId)
  5136 	if (__isExternalAddress(aFontId)
  5136          && __isNonNilObject(aString)) {
  5137 	 && __isNonNilObject(aString)) {
  5137             f = _FontVal(aFontId);
  5138 	    f = _FontVal(aFontId);
  5138             cls = __qClass(aString);
  5139 	    cls = __qClass(aString);
  5139 
  5140 
  5140             cp = (char *)_stringVal(aString);
  5141 	    cp = (char *)_stringVal(aString);
  5141 
  5142 
  5142             if ((cls == @global(String)) || (cls == @global(Symbol))) {
  5143 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  5143                 n = _stringSize(aString);
  5144 		n = _stringSize(aString);
  5144                 BEGIN_INTERRUPTSBLOCKED
  5145 		BEGIN_INTERRUPTSBLOCKED
  5145                 len = XTextWidth(f, cp, n);
  5146 		len = XTextWidth(f, cp, n);
  5146                 END_INTERRUPTSBLOCKED
  5147 		END_INTERRUPTSBLOCKED
  5147                 RETURN ( __MKSMALLINT(len) );
  5148 		RETURN ( __MKSMALLINT(len) );
  5148             }
  5149 	    }
  5149 
  5150 
  5150             nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  5151 	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  5151             cp += nInstBytes;
  5152 	    cp += nInstBytes;
  5152 
  5153 
  5153             if (__isBytes(aString)) {
  5154 	    if (__isBytes(aString)) {
  5154                 n = __byteArraySize(aString) - nInstBytes;
  5155 		n = __byteArraySize(aString) - nInstBytes;
  5155 
  5156 
  5156                 BEGIN_INTERRUPTSBLOCKED
  5157 		BEGIN_INTERRUPTSBLOCKED
  5157                 len = XTextWidth(f, cp, n);
  5158 		len = XTextWidth(f, cp, n);
  5158                 END_INTERRUPTSBLOCKED
  5159 		END_INTERRUPTSBLOCKED
  5159                 RETURN ( __MKSMALLINT(len) );
  5160 		RETURN ( __MKSMALLINT(len) );
  5160             }
  5161 	    }
  5161 
  5162 
  5162             /* TWOBYTESTRINGS */
  5163 	    /* TWOBYTESTRINGS */
  5163             if (__isWords(aString)) {
  5164 	    if (__isWords(aString)) {
  5164                 union {
  5165 		union {
  5165                     char b[2];
  5166 		    char b[2];
  5166                     unsigned short s;
  5167 		    unsigned short s;
  5167                 } u;
  5168 		} u;
  5168                 int i;
  5169 		int i;
  5169                 XChar2b *cp2;
  5170 		XChar2b *cp2;
  5170                 int mustFree = 0;
  5171 		int mustFree = 0;
  5171 
  5172 
  5172                 n = (__byteArraySize(aString) - nInstBytes) / 2;
  5173 		n = (__byteArraySize(aString) - nInstBytes) / 2;
  5173                 if (n > 1000) n = 1000;
  5174 		if (n > 1000) n = 1000;
  5174 
  5175 
  5175                 /*
  5176 		/*
  5176                  * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  5177 		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  5177                  * X expects them MSB first
  5178 		 * X expects them MSB first
  5178                  * convert as required
  5179 		 * convert as required
  5179                  */
  5180 		 */
  5180 
  5181 
  5181                 u.s = 0x1234;
  5182 		u.s = 0x1234;
  5182                 if (u.b[0] != 0x12) {
  5183 		if (u.b[0] != 0x12) {
  5183                     if (n <= NLOCALBUFFER) {
  5184 		    if (n <= NLOCALBUFFER) {
  5184                         cp2 = xlatebuffer;
  5185 			cp2 = xlatebuffer;
  5185                     } else {
  5186 		    } else {
  5186                         cp2 = (XChar2b *)(malloc(n * 2));
  5187 			cp2 = (XChar2b *)(malloc(n * 2));
  5187                         mustFree = 1;
  5188 			mustFree = 1;
  5188                     }
  5189 		    }
  5189 
  5190 
  5190                     for (i=0; i<n; i++) {
  5191 		    for (i=0; i<n; i++) {
  5191                         cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  5192 			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  5192                         cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  5193 			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  5193                     }
  5194 		    }
  5194                     cp = (char *) cp2;
  5195 		    cp = (char *) cp2;
  5195                 }
  5196 		}
  5196 
  5197 
  5197                 BEGIN_INTERRUPTSBLOCKED
  5198 		BEGIN_INTERRUPTSBLOCKED
  5198                 len = XTextWidth16(f, (XChar2b *)cp, n);
  5199 		len = XTextWidth16(f, (XChar2b *)cp, n);
  5199                 END_INTERRUPTSBLOCKED
  5200 		END_INTERRUPTSBLOCKED
  5200 
  5201 
  5201                 if (mustFree) {
  5202 		if (mustFree) {
  5202                     free(cp2);
  5203 		    free(cp2);
  5203                 }
  5204 		}
  5204 
  5205 
  5205                 RETURN ( __MKSMALLINT(len) );
  5206 		RETURN ( __MKSMALLINT(len) );
  5206             }
  5207 	    }
  5207         }
  5208 	}
  5208     }
  5209     }
  5209 #undef NLOCALBUFFER
  5210 #undef NLOCALBUFFER
  5210 %}.
  5211 %}.
  5211     self primitiveFailed.
  5212     self primitiveFailed.
  5212     ^ nil
  5213     ^ nil
  5504 %{  /* NOCONTEXT */
  5505 %{  /* NOCONTEXT */
  5505 
  5506 
  5506     if (__isExternalAddress(aGCId)
  5507     if (__isExternalAddress(aGCId)
  5507      && __isSmallInteger(offset)
  5508      && __isSmallInteger(offset)
  5508      && __isByteArray(dashList)) {
  5509      && __isByteArray(dashList)) {
  5509         XSetDashes(myDpy, _GCVal(aGCId), 
  5510 	XSetDashes(myDpy, _GCVal(aGCId), 
  5510                    __intVal(offset),
  5511 		   __intVal(offset),
  5511                    __ByteArrayInstPtr(dashList)->ba_element,
  5512 		   __ByteArrayInstPtr(dashList)->ba_element,
  5512                    __byteArraySize(dashList));
  5513 		   __byteArraySize(dashList));
  5513         RETURN ( self );
  5514 	RETURN ( self );
  5514     }
  5515     }
  5515 bad: ;
  5516 bad: ;
  5516 %}.
  5517 %}.
  5517     "
  5518     "
  5518      either aGCId is invalid,
  5519      either aGCId is invalid,
  5969     char *type, *nm;
  5970     char *type, *nm;
  5970     int dummy;
  5971     int dummy;
  5971     int mask, shift, nBits;
  5972     int mask, shift, nBits;
  5972 
  5973 
  5973     if (ISCONNECTED) {
  5974     if (ISCONNECTED) {
  5974         __INST(altModifierMask) = __MKSMALLINT(Mod2Mask);
  5975 	__INST(altModifierMask) = __MKSMALLINT(Mod2Mask);
  5975         __INST(metaModifierMask) = __MKSMALLINT(Mod1Mask);
  5976 	__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask);
  5976 
  5977 
  5977         BEGIN_INTERRUPTSBLOCKED
  5978 	BEGIN_INTERRUPTSBLOCKED
  5978 
  5979 
  5979         __INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy));
  5980 	__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy));
  5980         __INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr));
  5981 	__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr));
  5981         __INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr));
  5982 	__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr));
  5982         __INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr));
  5983 	__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr));
  5983         __INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr));
  5984 	__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr));
  5984         __INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr));
  5985 	__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr));
  5985         __INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr));
  5986 	__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr));
  5986         __INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr));
  5987 	__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr));
  5987         __INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr));
  5988 	__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr));
  5988 
  5989 
  5989 #ifdef SHAPE
  5990 #ifdef SHAPE
  5990         if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase))
  5991 	if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase))
  5991             __INST(hasShapeExtension) = true;
  5992 	    __INST(hasShapeExtension) = true;
  5992         else
  5993 	else
  5993 #endif
  5994 #endif
  5994           __INST(hasShapeExtension) = false;
  5995 	  __INST(hasShapeExtension) = false;
  5995 
  5996 
  5996 #ifdef SHM
  5997 #ifdef SHM
  5997         if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase))
  5998 	if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase))
  5998             __INST(hasShmExtension) = true;
  5999 	    __INST(hasShmExtension) = true;
  5999         else
  6000 	else
  6000 #endif
  6001 #endif
  6001           __INST(hasShmExtension) = false;
  6002 	  __INST(hasShmExtension) = false;
  6002 
  6003 
  6003 #ifdef FAX
  6004 #ifdef FAX
  6004         if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase))
  6005 	if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase))
  6005             __INST(hasFaxExtension) = true;
  6006 	    __INST(hasFaxExtension) = true;
  6006         else
  6007 	else
  6007 #endif
  6008 #endif
  6008           __INST(hasFaxExtension) = false;
  6009 	  __INST(hasFaxExtension) = false;
  6009 
  6010 
  6010 #ifdef DPS
  6011 #ifdef DPS
  6011         if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
  6012 	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
  6012             __INST(hasDPSExtension) = true;
  6013 	    __INST(hasDPSExtension) = true;
  6013         else
  6014 	else
  6014 #endif
  6015 #endif
  6015           __INST(hasDPSExtension) = false;
  6016 	  __INST(hasDPSExtension) = false;
  6016 
  6017 
  6017 #ifdef XVIDEO
  6018 #ifdef XVIDEO
  6018         if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy))
  6019 	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy))
  6019             __INST(hasXVideoExtension) = true;
  6020 	    __INST(hasXVideoExtension) = true;
  6020         else
  6021 	else
  6021 #endif
  6022 #endif
  6022           __INST(hasXVideoExtension) = false;
  6023 	  __INST(hasXVideoExtension) = false;
  6023 
  6024 
  6024 #ifdef MBUF
  6025 #ifdef MBUF
  6025         if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy))
  6026 	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy))
  6026             __INST(hasMbufExtension) = true;
  6027 	    __INST(hasMbufExtension) = true;
  6027         else
  6028 	else
  6028 #endif
  6029 #endif
  6029           __INST(hasMbufExtension) = false;
  6030 	  __INST(hasMbufExtension) = false;
  6030 
  6031 
  6031 #ifdef PEX5
  6032 #ifdef PEX5
  6032         if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy))
  6033 	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy))
  6033             __INST(hasPEXExtension) = true;
  6034 	    __INST(hasPEXExtension) = true;
  6034         else
  6035 	else
  6035 #endif
  6036 #endif
  6036           __INST(hasPEXExtension) = false;
  6037 	  __INST(hasPEXExtension) = false;
  6037 
  6038 
  6038 #ifdef XIE
  6039 #ifdef XIE
  6039         if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy))
  6040 	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy))
  6040             __INST(hasImageExtension) = true;
  6041 	    __INST(hasImageExtension) = true;
  6041         else
  6042 	else
  6042 #endif
  6043 #endif
  6043           __INST(hasImageExtension) = false;
  6044 	  __INST(hasImageExtension) = false;
  6044 
  6045 
  6045 #ifdef XI
  6046 #ifdef XI
  6046         if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy))
  6047 	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy))
  6047             __INST(hasInputExtension) = true;
  6048 	    __INST(hasInputExtension) = true;
  6048         else
  6049 	else
  6049 #endif
  6050 #endif
  6050           __INST(hasInputExtension) = false;
  6051 	  __INST(hasInputExtension) = false;
  6051 
  6052 
  6052         /*
  6053 	/*
  6053          * look for RGB visual
  6054 	 * look for RGB visual
  6054          */
  6055 	 */
  6055         nvi = 0;
  6056 	nvi = 0;
  6056         viproto.screen = scr;
  6057 	viproto.screen = scr;
  6057         vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
  6058 	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
  6058         maxRGBDepth = 0;
  6059 	maxRGBDepth = 0;
  6059         for (i = 0; i < nvi; i++) {
  6060 	for (i = 0; i < nvi; i++) {
  6060             switch (vip[i].class) {
  6061 	    switch (vip[i].class) {
  6061                 case TrueColor:
  6062 		case TrueColor:
  6062                     if (vip[i].depth > maxRGBDepth) {
  6063 		    if (vip[i].depth > maxRGBDepth) {
  6063                         maxRGBDepth = vip[i].depth;
  6064 			maxRGBDepth = vip[i].depth;
  6064                         rgbRedMask = vip[i].red_mask;
  6065 			rgbRedMask = vip[i].red_mask;
  6065                         rgbGreenMask = vip[i].green_mask;
  6066 			rgbGreenMask = vip[i].green_mask;
  6066                         rgbBlueMask = vip[i].blue_mask;
  6067 			rgbBlueMask = vip[i].blue_mask;
  6067                         rgbVisualID = vip[i].visualid;
  6068 			rgbVisualID = vip[i].visualid;
  6068                     }
  6069 		    }
  6069                     break;
  6070 		    break;
  6070             }
  6071 	    }
  6071         }
  6072 	}
  6072         if (vip) XFree ((char *) vip);
  6073 	if (vip) XFree ((char *) vip);
  6073 
  6074 
  6074         if (maxRGBDepth) {
  6075 	if (maxRGBDepth) {
  6075             __INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual);
  6076 	    __INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual);
  6076         }
  6077 	}
  6077 
  6078 
  6078         visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
  6079 	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
  6079         __INST(monitorType) = @symbol(unknown);
  6080 	__INST(monitorType) = @symbol(unknown);
  6080         __INST(hasColors) = true;
  6081 	__INST(hasColors) = true;
  6081         __INST(hasGreyscales) = true;
  6082 	__INST(hasGreyscales) = true;
  6082         switch (visual->class) {
  6083 	switch (visual->class) {
  6083             case StaticGray:
  6084 	    case StaticGray:
  6084                 __INST(visualType) = @symbol(StaticGray);
  6085 		__INST(visualType) = @symbol(StaticGray);
  6085                 __INST(hasColors) = false;
  6086 		__INST(hasColors) = false;
  6086                 __INST(monitorType) = @symbol(monochrome);
  6087 		__INST(monitorType) = @symbol(monochrome);
  6087                 break;
  6088 		break;
  6088             case GrayScale:
  6089 	    case GrayScale:
  6089                 __INST(visualType) = @symbol(GrayScale);
  6090 		__INST(visualType) = @symbol(GrayScale);
  6090                 __INST(hasColors) = false;
  6091 		__INST(hasColors) = false;
  6091                 __INST(monitorType) = @symbol(monochrome);
  6092 		__INST(monitorType) = @symbol(monochrome);
  6092                 break;
  6093 		break;
  6093             case StaticColor:
  6094 	    case StaticColor:
  6094                 __INST(visualType) = @symbol(StaticColor);
  6095 		__INST(visualType) = @symbol(StaticColor);
  6095                 break;
  6096 		break;
  6096             case PseudoColor:
  6097 	    case PseudoColor:
  6097                 __INST(visualType) = @symbol(PseudoColor);
  6098 		__INST(visualType) = @symbol(PseudoColor);
  6098                 break;
  6099 		break;
  6099             case TrueColor:
  6100 	    case TrueColor:
  6100                 __INST(visualType) = @symbol(TrueColor);
  6101 		__INST(visualType) = @symbol(TrueColor);
  6101                 break;
  6102 		break;
  6102             case DirectColor:
  6103 	    case DirectColor:
  6103                 __INST(visualType) = @symbol(DirectColor);
  6104 		__INST(visualType) = @symbol(DirectColor);
  6104                 break;
  6105 		break;
  6105         }
  6106 	}
  6106         if (DisplayCells(dpy, scr) == 2) {
  6107 	if (DisplayCells(dpy, scr) == 2) {
  6107             __INST(hasColors) = false;
  6108 	    __INST(hasColors) = false;
  6108             __INST(hasGreyscales) = false;
  6109 	    __INST(hasGreyscales) = false;
  6109             __INST(monitorType) = @symbol(monochrome);
  6110 	    __INST(monitorType) = @symbol(monochrome);
  6110         }
  6111 	}
  6111         __INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb);
  6112 	__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb);
  6112         __INST(redMask)   = __MKSMALLINT(visual->red_mask);
  6113 	__INST(redMask)   = __MKSMALLINT(visual->red_mask);
  6113         __INST(greenMask) = __MKSMALLINT(visual->green_mask);
  6114 	__INST(greenMask) = __MKSMALLINT(visual->green_mask);
  6114         __INST(blueMask)  = __MKSMALLINT(visual->blue_mask);
  6115 	__INST(blueMask)  = __MKSMALLINT(visual->blue_mask);
  6115         switch (visual->class) {
  6116 	switch (visual->class) {
  6116             case TrueColor:
  6117 	    case TrueColor:
  6117                 /* extract number of bits and shift counts */
  6118 		/* extract number of bits and shift counts */
  6118                 mask = visual->red_mask;
  6119 		mask = visual->red_mask;
  6119                 shift = 0;
  6120 		shift = 0;
  6120                 while (mask && ((mask & 1) == 0)) {
  6121 		while (mask && ((mask & 1) == 0)) {
  6121                     mask >>= 1;
  6122 		    mask >>= 1;
  6122                     shift++;
  6123 		    shift++;
  6123                 }
  6124 		}
  6124                 __INST(redShift) = __MKSMALLINT(shift);
  6125 		__INST(redShift) = __MKSMALLINT(shift);
  6125                 nBits = 0;
  6126 		nBits = 0;
  6126                 while (mask) {
  6127 		while (mask) {
  6127                     mask >>= 1;
  6128 		    mask >>= 1;
  6128                     nBits++;
  6129 		    nBits++;
  6129                 }
  6130 		}
  6130                 __INST(bitsRed) = __MKSMALLINT(nBits);
  6131 		__INST(bitsRed) = __MKSMALLINT(nBits);
  6131 
  6132 
  6132                 mask = visual->green_mask;
  6133 		mask = visual->green_mask;
  6133                 shift = 0;
  6134 		shift = 0;
  6134                 while (mask && ((mask & 1) == 0)) {
  6135 		while (mask && ((mask & 1) == 0)) {
  6135                     mask >>= 1;
  6136 		    mask >>= 1;
  6136                     shift++;
  6137 		    shift++;
  6137                 }
  6138 		}
  6138                 __INST(greenShift) = __MKSMALLINT(shift);
  6139 		__INST(greenShift) = __MKSMALLINT(shift);
  6139                 nBits = 0;
  6140 		nBits = 0;
  6140                 while (mask) {
  6141 		while (mask) {
  6141                     mask >>= 1;
  6142 		    mask >>= 1;
  6142                     nBits++;
  6143 		    nBits++;
  6143                 }
  6144 		}
  6144                 __INST(bitsGreen) = __MKSMALLINT(nBits);
  6145 		__INST(bitsGreen) = __MKSMALLINT(nBits);
  6145 
  6146 
  6146                 mask = visual->blue_mask;
  6147 		mask = visual->blue_mask;
  6147                 shift = 0;
  6148 		shift = 0;
  6148                 while (mask && ((mask & 1) == 0)) {
  6149 		while (mask && ((mask & 1) == 0)) {
  6149                     mask >>= 1;
  6150 		    mask >>= 1;
  6150                     shift++;
  6151 		    shift++;
  6151                 }
  6152 		}
  6152                 __INST(blueShift) = __MKSMALLINT(shift);
  6153 		__INST(blueShift) = __MKSMALLINT(shift);
  6153                 nBits = 0;
  6154 		nBits = 0;
  6154                 while (mask) {
  6155 		while (mask) {
  6155                     mask >>= 1;
  6156 		    mask >>= 1;
  6156                     nBits++;
  6157 		    nBits++;
  6157                 }
  6158 		}
  6158                 __INST(bitsBlue) = __MKSMALLINT(nBits);
  6159 		__INST(bitsBlue) = __MKSMALLINT(nBits);
  6159                 break;
  6160 		break;
  6160         }
  6161 	}
  6161 
  6162 
  6162 #ifndef XA_PRIMARY
  6163 #ifndef XA_PRIMARY
  6163         __INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) );
  6164 	__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) );
  6164 #else
  6165 #else
  6165         __INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY );
  6166 	__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY );
  6166 #endif
  6167 #endif
  6167 #ifndef XA_SECONDARY
  6168 #ifndef XA_SECONDARY
  6168         __INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) );
  6169 	__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) );
  6169 #else
  6170 #else
  6170         __INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY );
  6171 	__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY );
  6171 #endif
  6172 #endif
  6172 #ifndef XA_CUT_BUFFER0
  6173 #ifndef XA_CUT_BUFFER0
  6173         __INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) );
  6174 	__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) );
  6174 #else
  6175 #else
  6175         __INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 );
  6176 	__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 );
  6176 #endif
  6177 #endif
  6177 #ifndef XA_STRING
  6178 #ifndef XA_STRING
  6178         __INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) );
  6179 	__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) );
  6179 #else
  6180 #else
  6180         __INST(stringAtom) = __MKATOMOBJ( XA_STRING );
  6181 	__INST(stringAtom) = __MKATOMOBJ( XA_STRING );
  6181 #endif
  6182 #endif
  6182 #ifndef XA_LENGTH
  6183 #ifndef XA_LENGTH
  6183         __INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) );
  6184 	__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) );
  6184 #else
  6185 #else
  6185         __INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH );
  6186 	__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH );
  6186 #endif
  6187 #endif
  6187 
  6188 
  6188         END_INTERRUPTSBLOCKED
  6189 	END_INTERRUPTSBLOCKED
  6189     }
  6190     }
  6190 %}.
  6191 %}.
  6191 !
  6192 !
  6192 
  6193 
  6193 initializeSpecialFlags
  6194 initializeSpecialFlags
  6572     w = getRootWindow(myDpy, screen);
  6573     w = getRootWindow(myDpy, screen);
  6573 #else
  6574 #else
  6574     w = RootWindow(dpy, screen);
  6575     w = RootWindow(dpy, screen);
  6575 #endif
  6576 #endif
  6576     XQueryPointer(dpy, w, &rootRet, &childRet,
  6577     XQueryPointer(dpy, w, &rootRet, &childRet,
  6577                           &rootX, &rootY,
  6578 			  &rootX, &rootY,
  6578                           &winX, &winY,
  6579 			  &winX, &winY,
  6579                           &mask);
  6580 			  &mask);
  6580     END_INTERRUPTSBLOCKED
  6581     END_INTERRUPTSBLOCKED
  6581     RETURN (__MKSMALLINT(mask));
  6582     RETURN (__MKSMALLINT(mask));
  6582 %}
  6583 %}
  6583 
  6584 
  6584     "
  6585     "
  6690 
  6691 
  6691 %{  /* NOCONTEXT */
  6692 %{  /* NOCONTEXT */
  6692     Atom prop;
  6693     Atom prop;
  6693 
  6694 
  6694     if (ISCONNECTED) {
  6695     if (ISCONNECTED) {
  6695         if (__isString(aStringOrSymbol)
  6696 	if (__isString(aStringOrSymbol)
  6696          || __isSymbol(aStringOrSymbol)) {
  6697 	 || __isSymbol(aStringOrSymbol)) {
  6697             prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), 
  6698 	    prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), 
  6698                                       (create == true) ? False : True);
  6699 				      (create == true) ? False : True);
  6699             if (prop == None) {
  6700 	    if (prop == None) {
  6700                 RETURN (nil);
  6701 		RETURN (nil);
  6701             }
  6702 	    }
  6702             RETURN ( __MKATOMOBJ(prop) );
  6703 	    RETURN ( __MKATOMOBJ(prop) );
  6703         }
  6704 	}
  6704     }
  6705     }
  6705 %}.
  6706 %}.
  6706     self primitiveFailed.
  6707     self primitiveFailed.
  6707     ^ nil
  6708     ^ nil
  6708 
  6709 
  6767 %{  /* NOCONTEXT */ 
  6768 %{  /* NOCONTEXT */ 
  6768     OBJ str;
  6769     OBJ str;
  6769     char *name;
  6770     char *name;
  6770 
  6771 
  6771     if (ISCONNECTED) {
  6772     if (ISCONNECTED) {
  6772         if (__isAtomID(anAtomID)) {
  6773 	if (__isAtomID(anAtomID)) {
  6773             name = XGetAtomName(myDpy, _AtomVal(anAtomID));
  6774 	    name = XGetAtomName(myDpy, _AtomVal(anAtomID));
  6774             if (name == 0) {
  6775 	    if (name == 0) {
  6775                 RETURN (nil);
  6776 		RETURN (nil);
  6776             }
  6777 	    }
  6777             str = __MKSTRING(name COMMA_CON);
  6778 	    str = __MKSTRING(name COMMA_CON);
  6778             XFree(name);
  6779 	    XFree(name);
  6779             RETURN ( str );
  6780 	    RETURN ( str );
  6780         }
  6781 	}
  6781     }
  6782     }
  6782 %}.
  6783 %}.
  6783     self primitiveFailed.
  6784     self primitiveFailed.
  6784     ^ nil
  6785     ^ nil
  6785 
  6786 
  6799     "access the displays resource database for a default value
  6800     "access the displays resource database for a default value
  6800      of name in a resource class.
  6801      of name in a resource class.
  6801      This is highly X specific and  currently not used.
  6802      This is highly X specific and  currently not used.
  6802 
  6803 
  6803      Notice: 
  6804      Notice: 
  6804         we do not plan to use X's resources for ST/X's defaults,
  6805 	we do not plan to use X's resources for ST/X's defaults,
  6805         styles or resources. This would make porting of applications
  6806 	styles or resources. This would make porting of applications
  6806         to different platforms much more difficult (Windows has no resource
  6807 	to different platforms much more difficult (Windows has no resource
  6807         database). If you stay within ST/X's resource files, these can be
  6808 	database). If you stay within ST/X's resource files, these can be
  6808         easily transported to other platforms.
  6809 	easily transported to other platforms.
  6809 
  6810 
  6810      This method is provided for special applications which want to access
  6811      This method is provided for special applications which want to access
  6811      existing X resources and are not planned to be ever ported to other
  6812      existing X resources and are not planned to be ever ported to other
  6812      platforms."
  6813      platforms."
  6813 
  6814 
  6815     char *rslt;
  6816     char *rslt;
  6816 
  6817 
  6817     if ((__isString(name) || __isSymbol(name))
  6818     if ((__isString(name) || __isSymbol(name))
  6818      && (__isString(cls) || __isSymbol(cls))
  6819      && (__isString(cls) || __isSymbol(cls))
  6819      && ISCONNECTED) {
  6820      && ISCONNECTED) {
  6820         BEGIN_INTERRUPTSBLOCKED
  6821 	BEGIN_INTERRUPTSBLOCKED
  6821         rslt = XGetDefault(myDpy, (char *)_stringVal(cls),
  6822 	rslt = XGetDefault(myDpy, (char *)_stringVal(cls),
  6822                                   (char *)_stringVal(name));
  6823 				  (char *)_stringVal(name));
  6823         END_INTERRUPTSBLOCKED
  6824 	END_INTERRUPTSBLOCKED
  6824         RETURN (rslt ? __MKSTRING(rslt COMMA_CON) : nil );
  6825 	RETURN (rslt ? __MKSTRING(rslt COMMA_CON) : nil );
  6825     }
  6826     }
  6826 %}.
  6827 %}.
  6827     self primitiveFailed.
  6828     self primitiveFailed.
  6828     ^ nil
  6829     ^ nil
  6829 
  6830 
  6830     "if your ~/.Xdefaults contains an entry such as:
  6831     "if your ~/.Xdefaults contains an entry such as:
  6831         OpenWindows.Beep:       notices
  6832 	OpenWindows.Beep:       notices
  6832      the following returns 'notices'.
  6833      the following returns 'notices'.
  6833 
  6834 
  6834          Display getResource:'Beep' class:'OpenWindows'   
  6835 	 Display getResource:'Beep' class:'OpenWindows'   
  6835 
  6836 
  6836      if your ~/.Xdefaults contains an entry such as:
  6837      if your ~/.Xdefaults contains an entry such as:
  6837         *.beNiceToColormap:       false
  6838 	*.beNiceToColormap:       false
  6838      the following return 'false'.
  6839      the following return 'false'.
  6839 
  6840 
  6840          Display getResource:'beNiceToColormap' class:'any'  
  6841 	 Display getResource:'beNiceToColormap' class:'any'  
  6841          Display getResource:'beNiceToColormap' class:''  
  6842 	 Display getResource:'beNiceToColormap' class:''  
  6842     "
  6843     "
  6843 ! !
  6844 ! !
  6844 
  6845 
  6845 !XWorkstation methodsFor:'retrieving pixels'!
  6846 !XWorkstation methodsFor:'retrieving pixels'!
  6846 
  6847 
  6901     XImage *img;
  6902     XImage *img;
  6902     int ret;
  6903     int ret;
  6903     int xpos, ypos;
  6904     int xpos, ypos;
  6904 
  6905 
  6905     if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
  6906     if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
  6906         win = _WindowVal(aDrawableId);
  6907 	win = _WindowVal(aDrawableId);
  6907         xpos = __intVal(x);
  6908 	xpos = __intVal(x);
  6908         ypos = __intVal(y);
  6909 	ypos = __intVal(y);
  6909         if ((xpos < 0) || (ypos < 0)) {
  6910 	if ((xpos < 0) || (ypos < 0)) {
  6910             RETURN ( __MKSMALLINT(0) );
  6911 	    RETURN ( __MKSMALLINT(0) );
  6911         }
  6912 	}
  6912         img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
  6913 	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
  6913         if (img != 0) {
  6914 	if (img != 0) {
  6914             ret = XGetPixel(img, 0, 0);
  6915 	    ret = XGetPixel(img, 0, 0);
  6915             XDestroyImage(img);
  6916 	    XDestroyImage(img);
  6916             RETURN (  __MKSMALLINT(ret) );
  6917 	    RETURN (  __MKSMALLINT(ret) );
  6917         }
  6918 	}
  6918     }
  6919     }
  6919 %}.
  6920 %}.
  6920     ^ nil
  6921     ^ nil
  6921 !
  6922 !
  6922 
  6923 
  8051 ! !
  8052 ! !
  8052 
  8053 
  8053 !XWorkstation class methodsFor:'documentation'!
  8054 !XWorkstation class methodsFor:'documentation'!
  8054 
  8055 
  8055 version
  8056 version
  8056     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.144 1996-06-14 11:19:42 cg Exp $'
  8057     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.145 1996-06-14 11:28:18 cg Exp $'
  8057 ! !
  8058 ! !
  8058 XWorkstation initialize!
  8059 XWorkstation initialize!