XWorkstation.st
changeset 7591 bce664b396f0
parent 7509 d18f375ac80d
child 7599 84f6853ec60d
child 7662 b603d95107c2
equal deleted inserted replaced
7590:3ea1659eaa70 7591:bce664b396f0
  1895      are supported on this display.
  1895      are supported on this display.
  1896      Both Smalltalk has to be compiled to support it (as client),
  1896      Both Smalltalk has to be compiled to support it (as client),
  1897      and the display we are connected to must support it,
  1897      and the display we are connected to must support it,
  1898      to return true here."
  1898      to return true here."
  1899 
  1899 
  1900      ^ XftFontDescription notNil
  1900      ^ XftFontDescription notNil and:[hasXftLibrary].
  1901 	and:[self class hasXftLibrary
       
  1902 	and:[self hasRenderExtension]]
       
  1903 
  1901 
  1904     "
  1902     "
  1905      Display supportsXftFonts
  1903      Display supportsXftFonts
  1906      Display hasRenderExtension
  1904      Display hasRenderExtension
  1907      Display class hasXftLibrary
  1905      Display class hasXftLibrary
  9335 initializeScreenProperties
  9333 initializeScreenProperties
  9336     |masks|
  9334     |masks|
  9337 
  9335 
  9338     super initializeScreenProperties.
  9336     super initializeScreenProperties.
  9339 
  9337 
  9340     hasShapeExtension := self queryShapeExtension.
  9338     hasShapeExtension := self hasExtension:#SHAPE.
  9341     hasShmExtension := self querySHMExtension.
  9339     hasShmExtension := self hasExtension:#MIT_SHM.
  9342     hasDPSExtension := self queryDPSExtension.
  9340     hasDPSExtension := self hasExtension:#DPS.
  9343     hasXVideoExtension := self queryXVideoExtension.
  9341     hasXVideoExtension := self hasExtension:#XVideo.
  9344     hasMbufExtension := self queryMBUFExtension.
  9342     hasMbufExtension := self hasExtension:#'Multi-Buffering'.
  9345     hasPEXExtension := self queryPEXExtension.
  9343     hasPEXExtension := self hasExtension:#'X3D-PEX'.
  9346     hasImageExtension := self queryXIEExtension.
  9344     hasImageExtension := self hasExtension:#XIE.
  9347     hasInputExtension := self queryXIExtension.
  9345     hasInputExtension := self hasExtension:#XInputExtension.
  9348     hasXineramaExtension := self queryXineramaExtension.
  9346     hasXineramaExtension := self hasExtension:#XINERAMA.
  9349     hasRenderExtension := self queryRenderExtension.
  9347     hasRenderExtension := self hasExtension:#RENDER.
  9350     hasXftLibrary := self queryXftLibrary.
  9348     hasXftLibrary := hasRenderExtension and:[self class hasXftLibrary].
  9351 
  9349 
  9352     primaryAtom := self atomIDOf:#PRIMARY.
  9350     primaryAtom := self atomIDOf:#PRIMARY.
  9353     stringAtom := self atomIDOf:#STRING.
  9351     stringAtom := self atomIDOf:#STRING.
  9354     clipboardAtom := self atomIDOf:#CLIPBOARD.
  9352     clipboardAtom := self atomIDOf:#CLIPBOARD.
  9355 
  9353 
  9369     visualType := self queryDefaultVisualType.
  9367     visualType := self queryDefaultVisualType.
  9370 
  9368 
  9371     hasColors := hasGreyscales := true.
  9369     hasColors := hasGreyscales := true.
  9372     (visualType == #StaticGray
  9370     (visualType == #StaticGray
  9373      or:[ visualType == #GrayScale]) ifTrue:[
  9371      or:[ visualType == #GrayScale]) ifTrue:[
  9374 	hasColors := false.
  9372         hasColors := false.
  9375 	monitorType := #monochrome.
  9373         monitorType := #monochrome.
  9376     ].
  9374     ].
  9377 
  9375 
  9378     ncells == 2 ifTrue:[
  9376     ncells == 2 ifTrue:[
  9379 	hasColors := hasGreyscales := false.
  9377         hasColors := hasGreyscales := false.
  9380     ].
  9378     ].
  9381 
  9379 
  9382     masks := self queryRGBMasks.
  9380     masks := self queryRGBMasks.
  9383     redMask := masks at:1.
  9381     redMask := masks at:1.
  9384     greenMask := masks at:2.
  9382     greenMask := masks at:2.
  9385     blueMask := masks at:3.
  9383     blueMask := masks at:3.
  9386     bitsPerRGB := masks at:4.
  9384     bitsPerRGB := masks at:4.
  9387 
  9385 
  9388     visualType == #TrueColor ifTrue:[
  9386     visualType == #TrueColor ifTrue:[
  9389 	redShift := redMask lowBit - 1.
  9387         redShift := redMask lowBit - 1.
  9390 	greenShift := greenMask lowBit - 1.
  9388         greenShift := greenMask lowBit - 1.
  9391 	blueShift := blueMask lowBit - 1.
  9389         blueShift := blueMask lowBit - 1.
  9392 
  9390 
  9393 	bitsRed := redMask highBit - redMask lowBit + 1.
  9391         bitsRed := redMask highBit - redMask lowBit + 1.
  9394 	bitsGreen := greenMask highBit - greenMask lowBit + 1.
  9392         bitsGreen := greenMask highBit - greenMask lowBit + 1.
  9395 	bitsBlue := blueMask highBit - blueMask lowBit + 1.
  9393         bitsBlue := blueMask highBit - blueMask lowBit + 1.
  9396     ].
  9394     ].
  9397 
  9395 
  9398 %{
  9396 %{
  9399 
  9397 
  9400     Display *dpy;
  9398     Display *dpy;
  9409     int nvi, i;
  9407     int nvi, i;
  9410     char *type, *nm;
  9408     char *type, *nm;
  9411     int dummy;
  9409     int dummy;
  9412 
  9410 
  9413     if (ISCONNECTED) {
  9411     if (ISCONNECTED) {
  9414 	dpy = myDpy;
  9412         dpy = myDpy;
  9415 
  9413 
  9416 	/*
  9414         /*
  9417 	 * look for RGB visual with the highest depth
  9415          * look for RGB visual with the highest depth
  9418 	 */
  9416          */
  9419 	nvi = 0;
  9417         nvi = 0;
  9420 	viproto.screen = scr;
  9418         viproto.screen = scr;
  9421 	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
  9419         vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
  9422 	maxRGBDepth = maxRGBADepth = 0;
  9420         maxRGBDepth = maxRGBADepth = 0;
  9423 	for (i = 0; i < nvi; i++) {
  9421         for (i = 0; i < nvi; i++) {
  9424 	    int thisDepth = vip[i].depth;
  9422             int thisDepth = vip[i].depth;
  9425 
  9423 
  9426 	    switch (vip[i].class) {
  9424             switch (vip[i].class) {
  9427 		case TrueColor:
  9425                 case TrueColor:
  9428 		    if (thisDepth > maxRGBDepth) {
  9426                     if (thisDepth > maxRGBDepth) {
  9429 			if (thisDepth <= 24) {
  9427                         if (thisDepth <= 24) {
  9430 			    maxRGBDepth = thisDepth;
  9428                             maxRGBDepth = thisDepth;
  9431 			    rgbRedMask = vip[i].red_mask;
  9429                             rgbRedMask = vip[i].red_mask;
  9432 			    rgbGreenMask = vip[i].green_mask;
  9430                             rgbGreenMask = vip[i].green_mask;
  9433 			    rgbBlueMask = vip[i].blue_mask;
  9431                             rgbBlueMask = vip[i].blue_mask;
  9434 			    rgbVisualID = vip[i].visualid;
  9432                             rgbVisualID = vip[i].visualid;
  9435 			} else {
  9433                         } else {
  9436 			    if (thisDepth > maxRGBADepth) {
  9434                             if (thisDepth > maxRGBADepth) {
  9437 				// printf("found rgba visual!\n");
  9435                                 // printf("found rgba visual!\n");
  9438 				maxRGBADepth = thisDepth;
  9436                                 maxRGBADepth = thisDepth;
  9439 				rgbaRedMask = vip[i].red_mask;
  9437                                 rgbaRedMask = vip[i].red_mask;
  9440 				rgbaGreenMask = vip[i].green_mask;
  9438                                 rgbaGreenMask = vip[i].green_mask;
  9441 				rgbaBlueMask = vip[i].blue_mask;
  9439                                 rgbaBlueMask = vip[i].blue_mask;
  9442 				rgbaVisualID = vip[i].visualid;
  9440                                 rgbaVisualID = vip[i].visualid;
  9443 			    }
  9441                             }
  9444 			}
  9442                         }
  9445 		    }
  9443                     }
  9446 		    break;
  9444                     break;
  9447 	    }
  9445             }
  9448 	}
  9446         }
  9449 	if (vip) XFree ((char *) vip);
  9447         if (vip) XFree ((char *) vip);
  9450 
  9448 
  9451 	if (maxRGBDepth) {
  9449         if (maxRGBDepth) {
  9452 	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
  9450             __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
  9453 	}
  9451         }
  9454 	if (maxRGBADepth) {
  9452         if (maxRGBADepth) {
  9455 	    __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
  9453             __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
  9456 	    if (!maxRGBDepth) {
  9454             if (!maxRGBDepth) {
  9457 		__INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
  9455                 __INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
  9458 	    }
  9456             }
  9459 	}
  9457         }
  9460     }
  9458     }
  9461 %}.
  9459 %}.
  9462 !
  9460 !
  9463 
  9461 
  9464 initializeSpecialFlags
  9462 initializeSpecialFlags
  9558 %}.
  9556 %}.
  9559     ^ nil
  9557     ^ nil
  9560 
  9558 
  9561     "
  9559     "
  9562      Display queryCells
  9560      Display queryCells
  9563     "
       
  9564 !
       
  9565 
       
  9566 queryDPSExtension
       
  9567 %{  /* NOCONTEXT */
       
  9568 
       
  9569 #ifdef DPS
       
  9570     if (ISCONNECTED) {
       
  9571 	Display *dpy;
       
  9572 	int dummy;
       
  9573 
       
  9574 	dpy = myDpy;
       
  9575 
       
  9576 	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) {
       
  9577 	    RETURN ( true );
       
  9578 	}
       
  9579     }
       
  9580 #endif
       
  9581 %}.
       
  9582     ^ false
       
  9583 
       
  9584     "
       
  9585      Display queryDPSExtension
       
  9586     "
  9561     "
  9587 !
  9562 !
  9588 
  9563 
  9589 queryDefaultScreen
  9564 queryDefaultScreen
  9590 %{  /* NOCONTEXT */
  9565 %{  /* NOCONTEXT */
  9711     "
  9686     "
  9712      Display queryHeightMM
  9687      Display queryHeightMM
  9713     "
  9688     "
  9714 !
  9689 !
  9715 
  9690 
  9716 queryMBUFExtension
       
  9717 %{  /* NOCONTEXT */
       
  9718 
       
  9719 #ifdef MBUF
       
  9720     if (ISCONNECTED) {
       
  9721 	Display *dpy;
       
  9722 	int dummy;
       
  9723 
       
  9724 	dpy = myDpy;
       
  9725 
       
  9726 	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) {
       
  9727 	    RETURN ( true );
       
  9728 	}
       
  9729     }
       
  9730 #endif
       
  9731 %}.
       
  9732     ^ false
       
  9733 
       
  9734     "
       
  9735      Display queryMBUFExtension
       
  9736     "
       
  9737 !
       
  9738 
       
  9739 queryPEXExtension
       
  9740 %{  /* NOCONTEXT */
       
  9741 
       
  9742 #ifdef PEX5
       
  9743     if (ISCONNECTED) {
       
  9744 	Display *dpy;
       
  9745 	int dummy;
       
  9746 
       
  9747 	dpy = myDpy;
       
  9748 
       
  9749 	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) {
       
  9750 	    RETURN ( true );
       
  9751 	}
       
  9752     }
       
  9753 #endif
       
  9754 %}.
       
  9755     ^ false
       
  9756 
       
  9757     "
       
  9758      Display queryPEXExtension
       
  9759     "
       
  9760 !
       
  9761 
       
  9762 queryRGBMasks
  9691 queryRGBMasks
  9763 %{  /* NOCONTEXT */
  9692 %{  /* NOCONTEXT */
  9764 
  9693 
  9765     if (ISCONNECTED) {
  9694     if (ISCONNECTED) {
  9766 	Display *dpy;
  9695 	Display *dpy;
  9781     "
  9710     "
  9782      Display queryRGBMasks
  9711      Display queryRGBMasks
  9783     "
  9712     "
  9784 !
  9713 !
  9785 
  9714 
  9786 queryRenderExtension
       
  9787 %{  /* NOCONTEXT */
       
  9788 
       
  9789 #ifdef XRENDER
       
  9790     if (ISCONNECTED) {
       
  9791 	Display *dpy;
       
  9792 	int dummy;
       
  9793 
       
  9794 	dpy = myDpy;
       
  9795 
       
  9796 	if (XRenderQueryExtension (dpy, &dummy, &dummy)) {
       
  9797 	    RETURN ( true );
       
  9798 	}
       
  9799     }
       
  9800 #endif
       
  9801 %}.
       
  9802     ^ false
       
  9803 
       
  9804     "
       
  9805      Display queryRenderExtension
       
  9806     "
       
  9807 !
       
  9808 
       
  9809 querySHMExtension
       
  9810 %{  /* NOCONTEXT */
       
  9811 
       
  9812 #ifdef xxSHM
       
  9813     if (ISCONNECTED) {
       
  9814 	Display *dpy;
       
  9815 	int dummy;
       
  9816 
       
  9817 	dpy = myDpy;
       
  9818 
       
  9819 	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) {
       
  9820 	    RETURN ( true );
       
  9821 	}
       
  9822     }
       
  9823 #endif
       
  9824 %}.
       
  9825     ^ false
       
  9826 
       
  9827     "
       
  9828      Display querySHMExtension
       
  9829     "
       
  9830 !
       
  9831 
       
  9832 queryShapeExtension
       
  9833 %{  /* NOCONTEXT */
       
  9834 
       
  9835 #ifdef SHAPE
       
  9836     if (ISCONNECTED) {
       
  9837 	Display *dpy;
       
  9838 	int dummy;
       
  9839 
       
  9840 	dpy = myDpy;
       
  9841 
       
  9842 	if (XShapeQueryExtension(dpy, &dummy, &dummy)) {
       
  9843 	    RETURN ( true );
       
  9844 	}
       
  9845     }
       
  9846 #endif
       
  9847 %}.
       
  9848     ^ false
       
  9849 
       
  9850     "
       
  9851      Display queryShapeExtension
       
  9852     "
       
  9853 !
       
  9854 
       
  9855 queryWhitePixel
  9715 queryWhitePixel
  9856 %{  /* NOCONTEXT */
  9716 %{  /* NOCONTEXT */
  9857 
  9717 
  9858     if (ISCONNECTED) {
  9718     if (ISCONNECTED) {
  9859 	Display *dpy;
  9719 	Display *dpy;
  9904 %}.
  9764 %}.
  9905     ^ nil
  9765     ^ nil
  9906 
  9766 
  9907     "
  9767     "
  9908      Display queryWidthMM
  9768      Display queryWidthMM
  9909     "
       
  9910 !
       
  9911 
       
  9912 queryXIEExtension
       
  9913 %{  /* NOCONTEXT */
       
  9914 
       
  9915 #ifdef XIE
       
  9916     if (ISCONNECTED) {
       
  9917 	Display *dpy;
       
  9918 	int dummy;
       
  9919 
       
  9920 	dpy = myDpy;
       
  9921 
       
  9922 	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) {
       
  9923 	    RETURN ( true );
       
  9924 	}
       
  9925     }
       
  9926 #endif
       
  9927 %}.
       
  9928     ^ false
       
  9929 
       
  9930     "
       
  9931      Display queryXIEExtension
       
  9932     "
       
  9933 !
       
  9934 
       
  9935 queryXIExtension
       
  9936 %{  /* NOCONTEXT */
       
  9937 
       
  9938 #ifdef XI
       
  9939     if (ISCONNECTED) {
       
  9940 	Display *dpy;
       
  9941 	int dummy;
       
  9942 
       
  9943 	dpy = myDpy;
       
  9944 
       
  9945 	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) {
       
  9946 	    RETURN ( true );
       
  9947 	}
       
  9948     }
       
  9949 #endif
       
  9950 %}.
       
  9951     ^ false
       
  9952 
       
  9953     "
       
  9954      Display queryXIExtension
       
  9955     "
       
  9956 !
       
  9957 
       
  9958 queryXVideoExtension
       
  9959 %{  /* NOCONTEXT */
       
  9960 
       
  9961 #ifdef XVIDEO
       
  9962     if (ISCONNECTED) {
       
  9963 	Display *dpy;
       
  9964 	int dummy;
       
  9965 
       
  9966 	dpy = myDpy;
       
  9967 
       
  9968 	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) {
       
  9969 	    RETURN ( true );
       
  9970 	}
       
  9971     }
       
  9972 #endif
       
  9973 %}.
       
  9974     ^ false
       
  9975 
       
  9976     "
       
  9977      Display queryXVideoExtension
       
  9978     "
       
  9979 !
       
  9980 
       
  9981 queryXftLibrary
       
  9982 %{
       
  9983 #ifndef XFT
       
  9984     RETURN (false);
       
  9985 #endif
       
  9986 %}.
       
  9987     ^ self queryRenderExtension
       
  9988 !
       
  9989 
       
  9990 queryXineramaExtension
       
  9991 %{  /* NOCONTEXT */
       
  9992 
       
  9993 #ifdef XINERAMA
       
  9994     if (ISCONNECTED) {
       
  9995 	Display *dpy;
       
  9996 	int dummy;
       
  9997 
       
  9998 	dpy = myDpy;
       
  9999 
       
 10000 	if (XineramaQueryExtension (dpy, &dummy, &dummy)) {
       
 10001 	    RETURN ( true );
       
 10002 	}
       
 10003     }
       
 10004 #endif
       
 10005 %}.
       
 10006     ^ false
       
 10007 
       
 10008     "
       
 10009      Display queryXineramaExtension
       
 10010     "
  9769     "
 10011 !
  9770 !
 10012 
  9771 
 10013 reinitialize
  9772 reinitialize
 10014     preWaitAction notNil ifTrue:[
  9773     preWaitAction notNil ifTrue:[