XWorkstation.st
changeset 8162 5f5abe24389b
parent 8160 44372900d464
child 8189 44ec3d35edcd
equal deleted inserted replaced
8161:0a740f1a0111 8162:5f5abe24389b
  1688 preferredIconSize
  1688 preferredIconSize
  1689     "return the display's preferred size for icons.
  1689     "return the display's preferred size for icons.
  1690      Redefined to return a special value on SGI servers."
  1690      Redefined to return a special value on SGI servers."
  1691 
  1691 
  1692     self serverVendor = 'Silicon Graphics' ifTrue:[
  1692     self serverVendor = 'Silicon Graphics' ifTrue:[
  1693         ^ 86@68
  1693 	^ 86@68
  1694     ].
  1694     ].
  1695     ^ super preferredIconSize
  1695     ^ super preferredIconSize
  1696 
  1696 
  1697     "Created: / 10-06-1996 / 21:06:48 / cg"
  1697     "Created: / 10-06-1996 / 21:06:48 / cg"
  1698     "Modified (comment): / 01-09-2017 / 09:58:31 / cg"
  1698     "Modified (comment): / 01-09-2017 / 09:58:31 / cg"
  4922 %}.
  4922 %}.
  4923     "badGC, badDrawable or coordinates not integer"
  4923     "badGC, badDrawable or coordinates not integer"
  4924     self primitiveFailedOrClosedConnection
  4924     self primitiveFailedOrClosedConnection
  4925 !
  4925 !
  4926 
  4926 
  4927 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
  4927 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
  4928 			     extent:imageExtent sourceOrigin:srcOrg
  4928     msb:msb masks:maskArray padding:bitPadding
  4929 			       into:aDrawableId
  4929     extent:imageExtent sourceOrigin:srcOrg
  4930 		  destinationOrigin:dstOrg extent:dstExtent
  4930     into:aDrawableId
  4931 			       with:aGCId
  4931     destinationOrigin:dstOrg extent:dstExtent
       
  4932     with:aGCId
  4932 
  4933 
  4933     <context: #return>
  4934     <context: #return>
  4934 
  4935 
  4935     |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
  4936     |imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h|
  4936 
  4937 
  5046     ^ false
  5047     ^ false
  5047 
  5048 
  5048     "Modified: / 08-08-2017 / 14:16:05 / cg"
  5049     "Modified: / 08-08-2017 / 14:16:05 / cg"
  5049 !
  5050 !
  5050 
  5051 
  5051 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
  5052 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth
  5052 			      width:imageWidth height:imageHeight
  5053     msb:msb padding:bitPadding
  5053 				  x:srcx y:srcy
  5054     width:imageWidth height:imageHeight
  5054 			       into:aDrawableId
  5055     x:srcx y:srcy
  5055 				  x:dstx y:dsty
  5056     into:aDrawableId
  5056 			      width:w height:h
  5057     x:dstx y:dsty
  5057 			       with:aGCId
  5058     width:w height:h
       
  5059     with:aGCId
  5058 
  5060 
  5059     <context: #return>
  5061     <context: #return>
  5060 
  5062 
  5061     "since XPutImage may allocate huge amount of stack space
  5063     "since XPutImage may allocate huge amount of stack space
  5062      (some implementations use alloca), this must run with unlimited stack."
  5064      (some implementations use alloca), this must run with unlimited stack."
  7564 
  7566 
  7565     props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
  7567     props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId.
  7566     resX := props at:1.
  7568     resX := props at:1.
  7567     resY := props at:2.
  7569     resY := props at:2.
  7568     (resX notNil and:[resY notNil]) ifTrue:[
  7570     (resX notNil and:[resY notNil]) ifTrue:[
  7569         ^ resX @ resY
  7571 	^ resX @ resY
  7570     ].
  7572     ].
  7571     res := props at:3.
  7573     res := props at:3.
  7572     res notNil ifTrue:[
  7574     res notNil ifTrue:[
  7573         ^ res @ res
  7575 	^ res @ res
  7574     ].
  7576     ].
  7575     ^ self resolution
  7577     ^ self resolution
  7576 
  7578 
  7577     "
  7579     "
  7578       Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
  7580       Screen current fontResolutionOf:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
 10624     <context: #return>
 10626     <context: #return>
 10625 
 10627 
 10626     |val typeID propertyID windowID|
 10628     |val typeID propertyID windowID|
 10627 
 10629 
 10628     propertySymbolOrAtomID isString ifTrue:[
 10630     propertySymbolOrAtomID isString ifTrue:[
 10629         propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
 10631 	propertyID := self atomIDOf:propertySymbolOrAtomID create:false.
 10630         propertyID isNil ifTrue:[^ nil].
 10632 	propertyID isNil ifTrue:[^ nil].
 10631     ] ifFalse:[
 10633     ] ifFalse:[
 10632         propertyID := propertySymbolOrAtomID.
 10634 	propertyID := propertySymbolOrAtomID.
 10633     ].
 10635     ].
 10634     aWindowOrWindowIDOrNil isView ifTrue:[
 10636     aWindowOrWindowIDOrNil isView ifTrue:[
 10635         windowID := aWindowOrWindowIDOrNil id.
 10637 	windowID := aWindowOrWindowIDOrNil id.
 10636     ] ifFalse:[
 10638     ] ifFalse:[
 10637         windowID := aWindowOrWindowIDOrNil.
 10639 	windowID := aWindowOrWindowIDOrNil.
 10638     ].
 10640     ].
 10639 
 10641 
 10640 %{
 10642 %{
 10641     Window window;
 10643     Window window;
 10642     Atom property;
 10644     Atom property;
 10647     unsigned char *data;
 10649     unsigned char *data;
 10648     int ok = 1;
 10650     int ok = 1;
 10649 #   define PROP_SIZE    2048
 10651 #   define PROP_SIZE    2048
 10650 
 10652 
 10651     if (ISCONNECTED) {
 10653     if (ISCONNECTED) {
 10652         Display *dpy = myDpy;
 10654 	Display *dpy = myDpy;
 10653 
 10655 
 10654         if (__isAtomID(propertyID)) {
 10656 	if (__isAtomID(propertyID)) {
 10655             property = __AtomVal(propertyID);
 10657 	    property = __AtomVal(propertyID);
 10656 
 10658 
 10657             if (__isExternalAddress(windowID)) {
 10659 	    if (__isExternalAddress(windowID)) {
 10658                 window = __WindowVal(windowID);
 10660 		window = __WindowVal(windowID);
 10659             } else if (windowID == nil) {
 10661 	    } else if (windowID == nil) {
 10660                 window = DefaultRootWindow(dpy);
 10662 		window = DefaultRootWindow(dpy);
 10661             } else
 10663 	    } else
 10662                 goto fail;
 10664 		goto fail;
 10663 
 10665 
 10664             nread = 0;
 10666 	    nread = 0;
 10665             cp = 0;
 10667 	    cp = 0;
 10666 #ifdef PROPERTY_DEBUG
 10668 #ifdef PROPERTY_DEBUG
 10667             console_fprintf(stderr, "getProperty %x\n", property);
 10669 	    console_fprintf(stderr, "getProperty %x\n", property);
 10668 #endif
 10670 #endif
 10669 
 10671 
 10670             do {
 10672 	    do {
 10671                 int retVal;
 10673 		int retVal;
 10672 
 10674 
 10673                 ENTER_XLIB();
 10675 		ENTER_XLIB();
 10674                 retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
 10676 		retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
 10675                                             doDelete == true,
 10677 					    doDelete == true,
 10676                                             AnyPropertyType, &actual_type, &actual_format,
 10678 					    AnyPropertyType, &actual_type, &actual_format,
 10677                                             &nitems, &bytes_after, (unsigned char **)&data);
 10679 					    &nitems, &bytes_after, (unsigned char **)&data);
 10678                 LEAVE_XLIB();
 10680 		LEAVE_XLIB();
 10679                 if (retVal != Success) {
 10681 		if (retVal != Success) {
 10680 #ifdef PROPERTY_DEBUG
 10682 #ifdef PROPERTY_DEBUG
 10681                     console_fprintf(stderr, "- no success\n");
 10683 		    console_fprintf(stderr, "- no success\n");
 10682 #endif
 10684 #endif
 10683                     ok = 0;
 10685 		    ok = 0;
 10684                     break;
 10686 		    break;
 10685                 }
 10687 		}
 10686 #ifdef PROPERTY_DEBUG
 10688 #ifdef PROPERTY_DEBUG
 10687                 console_fprintf(stderr, "- type:%x\n", actual_type);
 10689 		console_fprintf(stderr, "- type:%x\n", actual_type);
 10688 #endif
 10690 #endif
 10689                 nitems *= (actual_format / 8);
 10691 		nitems *= (actual_format / 8);
 10690                 typeID = __MKATOMOBJ(actual_type);
 10692 		typeID = __MKATOMOBJ(actual_type);
 10691                 if (! cp) {
 10693 		if (! cp) {
 10692                     cp = cp2 = (char *)malloc(nitems+bytes_after);
 10694 		    cp = cp2 = (char *)malloc(nitems+bytes_after);
 10693                 } else {
 10695 		} else {
 10694                     cp2 = cp + nread;
 10696 		    cp2 = cp + nread;
 10695                 }
 10697 		}
 10696                 if (! cp) {
 10698 		if (! cp) {
 10697                     XFree(data);
 10699 		    XFree(data);
 10698                     goto fail;
 10700 		    goto fail;
 10699                 }
 10701 		}
 10700 
 10702 
 10701                 nread += nitems;
 10703 		nread += nitems;
 10702                 bcopy(data, cp2, nitems);
 10704 		bcopy(data, cp2, nitems);
 10703                 XFree(data);
 10705 		XFree(data);
 10704 #ifdef PROPERTY_DEBUG
 10706 #ifdef PROPERTY_DEBUG
 10705                 console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
 10707 		console_fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
 10706 #endif
 10708 #endif
 10707             } while (bytes_after > 0);
 10709 	    } while (bytes_after > 0);
 10708 
 10710 
 10709             if (ok) {
 10711 	    if (ok) {
 10710                 switch (actual_format) {
 10712 		switch (actual_format) {
 10711                 case 32:
 10713 		case 32:
 10712                     // bad design: even though it says "32",
 10714 		    // bad design: even though it says "32",
 10713                     // what is really returned are longs.
 10715 		    // what is really returned are longs.
 10714                     // this does make a difference on 64bit machines!
 10716 		    // this does make a difference on 64bit machines!
 10715                     val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
 10717 		    val = __stArrayFromCULongArray((unsigned long*)cp, nread/sizeof(long));
 10716                     break;
 10718 		    break;
 10717                 case 16:
 10719 		case 16:
 10718                     val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
 10720 		    val = __stArrayFromCUShortArray((unsigned short*)cp, nread/2);
 10719                     break;
 10721 		    break;
 10720                 case 8:
 10722 		case 8:
 10721                 default:
 10723 		default:
 10722                     if (actual_type == XA_STRING) {
 10724 		    if (actual_type == XA_STRING) {
 10723                         val = __MKSTRING_L(cp, nread);
 10725 			val = __MKSTRING_L(cp, nread);
 10724                     } else {
 10726 		    } else {
 10725                         val = __MKBYTEARRAY(cp, nread);
 10727 			val = __MKBYTEARRAY(cp, nread);
 10726                     }
 10728 		    }
 10727                     break;
 10729 		    break;
 10728                 }
 10730 		}
 10729             }
 10731 	    }
 10730             if (cp)
 10732 	    if (cp)
 10731                 free(cp);
 10733 		free(cp);
 10732         }
 10734 	}
 10733     }
 10735     }
 10734 fail: ;
 10736 fail: ;
 10735 %}.
 10737 %}.
 10736     (typeID isNil or:[typeID == 0]) ifTrue:[
 10738     (typeID isNil or:[typeID == 0]) ifTrue:[
 10737         "typeID == 0 (None): The property does not exist in the specified window"
 10739 	"typeID == 0 (None): The property does not exist in the specified window"
 10738         ^ nil
 10740 	^ nil
 10739     ].
 10741     ].
 10740     ^ typeID->val
 10742     ^ typeID->val
 10741 
 10743 
 10742     "
 10744     "
 10743      Display
 10745      Display
 10744         getProperty:#'_NET_WM_ICON_GEOMETRY'
 10746 	getProperty:#'_NET_WM_ICON_GEOMETRY'
 10745         from:nil
 10747 	from:nil
 10746         delete:false
 10748 	delete:false
 10747 
 10749 
 10748      Display
 10750      Display
 10749         getProperty:#'_NET_SUPPORTED'
 10751 	getProperty:#'_NET_SUPPORTED'
 10750         from:nil
 10752 	from:nil
 10751         delete:false
 10753 	delete:false
 10752 
 10754 
 10753      Transcript showCR:(    
 10755      Transcript showCR:(
 10754          (Display
 10756 	 (Display
 10755             getProperty:#'_NET_SUPPORTED'
 10757 	    getProperty:#'_NET_SUPPORTED'
 10756             from:nil
 10758 	    from:nil
 10757             delete:false) 
 10759 	    delete:false)
 10758                 value
 10760 		value
 10759                     collect:[:eachID | Display atomName:eachID])
 10761 		    collect:[:eachID | Display atomName:eachID])
 10760         
 10762 
 10761     "
 10763     "
 10762 
 10764 
 10763     "Modified: / 31-08-2017 / 22:01:44 / cg"
 10765     "Modified: / 31-08-2017 / 22:01:44 / cg"
 10764 !
 10766 !
 10765 
 10767