--- a/XWorkstation.st Sat Jan 21 04:04:02 2017 +0100
+++ b/XWorkstation.st Sun Jan 22 10:50:57 2017 +0100
@@ -1029,7 +1029,7 @@
on a device where xft-drawing into pixmaps is broken.
This is a temporary hack, to be removed when that problem is fixed in xft;
then, we should return self here."
-
+
^ PseudoDeviceWithoutXFTSupport basicNew realDevice:self
!
@@ -2859,7 +2859,9 @@
colorNamed:aString
"allocate a color with color name - return the color index (i.e. colorID).
- Don't use this method, colornames are mostly X specific"
+ On trueColor displays, nothing is actually allocated,
+ and the returned colorID is formed by simply packing the RGB values.
+ Don't use this method, colornames are mostly X specific."
<context: #return>
%{
@@ -2872,42 +2874,45 @@
if (ISCONNECTED
&& __isStringLike(aString)) {
- Display *dpy = myDpy;
-
- colorname = (char *) __stringVal(aString);
-
-
- ENTER_XLIB();
- ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
- LEAVE_XLIB();
- if (ok) {
+ Display *dpy = myDpy;
+
+ colorname = (char *) __stringVal(aString);
+
+
+ ENTER_XLIB();
+ ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
+ LEAVE_XLIB();
+ if (ok) {
#ifdef QUICK_TRUE_COLORS
- if (__INST(visualType) == @symbol(TrueColor)) {
- id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
- id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
- id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
- RETURN ( __MKSMALLINT(id) );
- }
-#endif
- ENTER_XLIB();
- ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
- LEAVE_XLIB();
- }
-
- if (! ok) {
- RETURN ( nil );
- }
+ if (__INST(visualType) == @symbol(TrueColor)) {
+ id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
+ id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
+ id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
+ RETURN ( __MKSMALLINT(id) );
+ }
+#endif
+ ENTER_XLIB();
+ ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
+ LEAVE_XLIB();
+ }
+
+ if (! ok) {
+ RETURN ( nil );
+ }
#ifdef COUNT_RESOURCES
- __cnt_color++;
-#endif
- RETURN ( __MKSMALLINT(ecolor.pixel) );
+ __cnt_color++;
+#endif
+ RETURN ( __MKSMALLINT(ecolor.pixel) );
}
%}.
^ super colorNamed:aString
!
colorScaledRed:r scaledGreen:g scaledBlue:b
- "allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)"
+ "allocate a color with rgb values (0..16rFFFF)
+ - return the color index (i.e. colorID).
+ On trueColor displays, nothing is actually allocated,
+ and the returned colorID is formed by simply packing the RGB values."
<context: #return>
%{
@@ -5152,29 +5157,29 @@
].
logicalButton isInteger ifTrue:[
- buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
+ buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1).
].
(multiClickTimeDelta notNil and:[lastButtonPressTime notNil]) ifTrue:[
- time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[
- lastButtonPressTime := time.
- self buttonMultiPress:logicalButton x:x y:y view:view.
- ^ self.
- ].
+ time < (lastButtonPressTime + multiClickTimeDelta) ifTrue:[
+ lastButtonPressTime := time.
+ self buttonMultiPress:logicalButton x:x y:y view:view.
+ ^ self.
+ ].
].
lastButtonPressTime := time.
view isNil ifTrue:[
- "/ event arrived, after I destroyed it myself
- ^ self
+ "/ event arrived, after I destroyed it myself
+ ^ self
].
logicalButton == 1 ifTrue:[
- activateOnClick == true ifTrue:[
- "/ don't raise above an active popup view.
- (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
- view topView raise.
- ]
- ].
+ activateOnClick == true ifTrue:[
+ "/ don't raise above an active popup view.
+ (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
+ view topView raise.
+ ]
+ ].
].
super buttonPress:logicalButton x:x y:y view:view
!
@@ -6616,19 +6621,19 @@
"forward a button-press event for some view"
aView isNil ifTrue:[
- "/ event arrived, after I destroyed it myself
- ^ self
+ "/ event arrived, after I destroyed it myself
+ ^ self
].
button == 1 ifTrue:[
- activateOnClick == true ifTrue:[
- "/ don't raise above an active popup view.
- (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
- aView topView raise.
+ activateOnClick == true ifTrue:[
+ "/ don't raise above an active popup view.
+ (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
+ aView topView raise.
"/ ] ifFalse:[
"/ activeKeyboardGrab printCR.
"/ activePointerGrab printCR.
- ]
- ].
+ ]
+ ].
].
super buttonPress:button x:x y:y view:aView
! !
@@ -9398,12 +9403,12 @@
hasColors := hasGreyscales := true.
(visualType == #StaticGray
or:[ visualType == #GrayScale]) ifTrue:[
- hasColors := false.
- monitorType := #monochrome.
+ hasColors := false.
+ monitorType := #monochrome.
].
ncells == 2 ifTrue:[
- hasColors := hasGreyscales := false.
+ hasColors := hasGreyscales := false.
].
masks := self queryRGBMasks.
@@ -9413,13 +9418,13 @@
bitsPerRGB := masks at:4.
visualType == #TrueColor ifTrue:[
- redShift := redMask lowBit - 1.
- greenShift := greenMask lowBit - 1.
- blueShift := blueMask lowBit - 1.
-
- bitsRed := redMask highBit - redMask lowBit + 1.
- bitsGreen := greenMask highBit - greenMask lowBit + 1.
- bitsBlue := blueMask highBit - blueMask lowBit + 1.
+ redShift := redMask lowBit - 1.
+ greenShift := greenMask lowBit - 1.
+ blueShift := blueMask lowBit - 1.
+
+ bitsRed := redMask highBit - redMask lowBit + 1.
+ bitsGreen := greenMask highBit - greenMask lowBit + 1.
+ bitsBlue := blueMask highBit - blueMask lowBit + 1.
].
%{
@@ -9438,52 +9443,52 @@
int dummy;
if (ISCONNECTED) {
- dpy = myDpy;
-
- /*
- * look for RGB visual with the highest depth
- */
- nvi = 0;
- viproto.screen = scr;
- vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
- maxRGBDepth = maxRGBADepth = 0;
- for (i = 0; i < nvi; i++) {
- int thisDepth = vip[i].depth;
-
- switch (vip[i].class) {
- case TrueColor:
- if (thisDepth > maxRGBDepth) {
- if (thisDepth <= 24) {
- maxRGBDepth = thisDepth;
- rgbRedMask = vip[i].red_mask;
- rgbGreenMask = vip[i].green_mask;
- rgbBlueMask = vip[i].blue_mask;
- rgbVisualID = vip[i].visualid;
- } else {
- if (thisDepth > maxRGBADepth) {
- // printf("found rgba visual!\n");
- maxRGBADepth = thisDepth;
- rgbaRedMask = vip[i].red_mask;
- rgbaGreenMask = vip[i].green_mask;
- rgbaBlueMask = vip[i].blue_mask;
- rgbaVisualID = vip[i].visualid;
- }
- }
- }
- break;
- }
- }
- if (vip) XFree ((char *) vip);
-
- if (maxRGBDepth) {
- __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
- }
- if (maxRGBADepth) {
- __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
- if (!maxRGBDepth) {
- __INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
- }
- }
+ dpy = myDpy;
+
+ /*
+ * look for RGB visual with the highest depth
+ */
+ nvi = 0;
+ viproto.screen = scr;
+ vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
+ maxRGBDepth = maxRGBADepth = 0;
+ for (i = 0; i < nvi; i++) {
+ int thisDepth = vip[i].depth;
+
+ switch (vip[i].class) {
+ case TrueColor:
+ if (thisDepth > maxRGBDepth) {
+ if (thisDepth <= 24) {
+ maxRGBDepth = thisDepth;
+ rgbRedMask = vip[i].red_mask;
+ rgbGreenMask = vip[i].green_mask;
+ rgbBlueMask = vip[i].blue_mask;
+ rgbVisualID = vip[i].visualid;
+ } else {
+ if (thisDepth > maxRGBADepth) {
+ // printf("found rgba visual!\n");
+ maxRGBADepth = thisDepth;
+ rgbaRedMask = vip[i].red_mask;
+ rgbaGreenMask = vip[i].green_mask;
+ rgbaBlueMask = vip[i].blue_mask;
+ rgbaVisualID = vip[i].visualid;
+ }
+ }
+ }
+ break;
+ }
+ }
+ if (vip) XFree ((char *) vip);
+
+ if (maxRGBDepth) {
+ __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
+ }
+ if (maxRGBADepth) {
+ __INST(rgbaVisual) = __MKEXTERNALADDRESS(rgbaVisualID); __STORESELF(rgbaVisual);
+ if (!maxRGBDepth) {
+ __INST(rgbVisual) = __INST(rgbaVisual); __STORESELF(rgbVisual);
+ }
+ }
}
%}.
!
@@ -13306,9 +13311,9 @@
For this, a pseudoDevice instance is set as device into the pixmap's GC,
so it will draw using non-xft fonts.
This should vanish, once the xft drawing works.
-
+
[author:]
- cg
+ cg
"
! !