--- a/XWorkstation.st Mon Aug 22 11:18:40 2016 +0200
+++ b/XWorkstation.st Fri Aug 26 01:14:31 2016 +0200
@@ -126,16 +126,16 @@
extern OBJ __GLOBAL_GET_BY_NAME(char *);
# define __HANDLE_VAL(type, externalAddress) \
- ((type)__externalAddressVal(externalAddress))
+ ((type)__externalAddressVal(externalAddress))
# define __HANDLE_NEW(ptr, __cls) \
- ({ \
- OBJ handle = __MKEXTERNALADDRESS(ptr); \
- OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
- __InstPtr(handle)->o_class = clsObj; \
- __STORE(handle, clsObj); \
- handle; \
- })
+ ({ \
+ OBJ handle = __MKEXTERNALADDRESS(ptr); \
+ OBJ clsObj = __GLOBAL_GET_BY_NAME(__cls);\
+ __InstPtr(handle)->o_class = clsObj; \
+ __STORE(handle, clsObj); \
+ handle; \
+ })
/*
* this define suppresses XAllocColor/XFreeColor on
@@ -295,16 +295,16 @@
*/
#define __ENTER_XLIB(whichTimeout) \
{ \
- __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
- __blockingPrimitiveTimeoutArg__ = self; \
- __blockingPrimitiveTimeout__ = whichTimeout; \
+ __blockingPrimitiveTimoutHandler__ = (voidFUNC)__XTimeoutErrorHandler; \
+ __blockingPrimitiveTimeoutArg__ = self; \
+ __blockingPrimitiveTimeout__ = whichTimeout; \
} {
#define LEAVE_XLIB() \
{ \
- __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)0; \
- __blockingPrimitiveTimeoutArg__ = nil; \
- __blockingPrimitiveTimeout__ = 0; \
+ __blockingPrimitiveTimoutHandler__ = (voidFUNC)0; \
+ __blockingPrimitiveTimeoutArg__ = nil; \
+ __blockingPrimitiveTimeout__ = 0; \
} }
#define ENTER_XLIB() __ENTER_XLIB(__intVal(__INST(xlibTimeout)) * 1000)
@@ -397,18 +397,18 @@
# endif
static void
dummyToForceLoading() {
- XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
- XCloseDisplay(0);
- XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
- XSetWindowColormap(0, 0, 0);
- XQueryColors(0,0,0,0);
+ XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
+ XCloseDisplay(0);
+ XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
+ XSetWindowColormap(0, 0, 0);
+ XQueryColors(0,0,0,0);
# ifdef SHM
- XShmAttach(0, 0);
- XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
- XShmDetach(0, 0);
- XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
- shmctl(0,0,0);
- fgetc(0);
+ XShmAttach(0, 0);
+ XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
+ XShmDetach(0, 0);
+ XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
+ shmctl(0,0,0);
+ fgetc(0);
# endif // SHM
}
#endif // !ELF
@@ -555,42 +555,42 @@
lastErrorMsg[127] = '\0';
if (lastErrorMsg[0] == '\0') {
- sprintf(lastErrorMsg, "code: %d", event->error_code);
+ sprintf(lastErrorMsg, "code: %d", event->error_code);
}
lastRequestCode = event->request_code;
lastMinorCode = event->minor_code;
lastResource = event->resourceid;
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
- /*
- * this is a BadWindow error for X_DestroyWindow.
- * ignore it here, since it results from the GC freeing windows
- * in non bottom-up window order.
- */
- return 0;
+ /*
+ * this is a BadWindow error for X_DestroyWindow.
+ * ignore it here, since it results from the GC freeing windows
+ * in non bottom-up window order.
+ */
+ return 0;
}
if (@global(DeviceWorkstation:ErrorPrinting) == true) {
- char *requestName = "?";
-
- if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
- requestName = requestNames[event->request_code];
- }
- console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) \"%s\", min=%d (0x%x), resource=%"_lx_"\n",
- event->request_code, event->request_code, requestName,
- event->minor_code, event->minor_code, (INT)(event->resourceid));
- console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
- event->error_code, lastErrorMsg);
+ char *requestName = "?";
+
+ if (event->request_code < (sizeof(requestNames)/sizeof(char *))) {
+ requestName = requestNames[event->request_code];
+ }
+ console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) \"%s\", min=%d (0x%x), resource=%"_lx_"\n",
+ event->request_code, event->request_code, requestName,
+ event->minor_code, event->minor_code, (INT)(event->resourceid));
+ console_fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
+ event->error_code, lastErrorMsg);
}
#if 0
// cg: should no longer be needed - librun no longer sends an errorInterrupt while running on C-stack
#ifdef XFT
if ((strncmp(lastErrorMsg, "RenderBadPicture", 16) == 0)) {
- /*
- * this is a RenderBadPicture error from XFT drawing.
- * ignore it for now, as this is due to an incomplete implementation
- */
- console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
- return 0;
+ /*
+ * this is a RenderBadPicture error from XFT drawing.
+ * ignore it for now, as this is due to an incomplete implementation
+ */
+ console_fprintf(stderr, "XWorkstation [info]: x-error ignored\n");
+ return 0;
}
#endif
#endif
@@ -610,10 +610,10 @@
__XIOErrorHandler__(Display *dpy)
{
if (@global(DeviceWorkstation:ErrorPrinting) == true) {
- console_fprintf(stderr, "XWorkstation [error]: I/O error\n");
+ console_fprintf(stderr, "XWorkstation [error]: I/O error\n");
}
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
- __MKEXTERNALADDRESS(dpy));
+ __MKEXTERNALADDRESS(dpy));
#if 0
/*
@@ -644,12 +644,12 @@
__XTimeoutErrorHandler(OBJ displayDeviceInst)
{
if ((displayDeviceInst == @global(MainDisplay))
- || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
- console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
- return;
+ || (displayDeviceInst == @global(DeviceWorkstation:DefaultScreen))) {
+ console_fprintf(stderr, "XWorkstation [error]: keep display connection for master display after X11 timeout (no shutdown)\n");
+ return;
}
if (@global(DeviceWorkstation:ErrorPrinting) == true) {
- console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst);
+ console_fprintf(stderr, "XWorkstation [error]: X11 request timeout dpy=%"_lx_"\n", (INT)displayDeviceInst);
}
__OINST(displayDeviceInst, hasConnectionBroken) = true;
@@ -661,14 +661,14 @@
* if we return from the error interrupt ...
*/
if (__OINST(displayDeviceInst, displayId) != nil) {
- __internalError("unhandled X11 display timeout error");
-
- /*
- * the current process failed to do an X11 request.
- * Terminate it!
- */
- __terminateProcess(0); /* soft terminate */
- __terminateProcess(1); /* hard terminate */
+ __internalError("unhandled X11 display timeout error");
+
+ /*
+ * the current process failed to do an X11 request.
+ * Terminate it!
+ */
+ __terminateProcess(0); /* soft terminate */
+ __terminateProcess(1); /* hard terminate */
}
}
#endif // __INCREMENTAL_COMPILE__
@@ -707,21 +707,21 @@
query is answered by the launcher when opening its applications.
Timeouts:
- sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
- default, this would lead to a locked ST/X system.
- Therefore, this class defines a timeOut, whenever doing an Xlib call.
- The default for this timeout is 30seconds.
- This may be a problem with windowmanagers which show a rubber-band rectangle
- when creating windows.
- If the user does not specify the rectangle within 30 seconds, the device assumes
- a timeout and closes the connection.
- As a (kludgy) workaround, a second timeout value is used for window-creation.
- This secondary timeout value defaults to 60*5 seconds (5 minutes).
+ sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
+ default, this would lead to a locked ST/X system.
+ Therefore, this class defines a timeOut, whenever doing an Xlib call.
+ The default for this timeout is 30seconds.
+ This may be a problem with windowmanagers which show a rubber-band rectangle
+ when creating windows.
+ If the user does not specify the rectangle within 30 seconds, the device assumes
+ a timeout and closes the connection.
+ As a (kludgy) workaround, a second timeout value is used for window-creation.
+ This secondary timeout value defaults to 60*5 seconds (5 minutes).
See more documentation in my superclass, DeviceWorkstation.
[author:]
- Claus Gittinger
+ Claus Gittinger
"
! !
@@ -2014,19 +2014,19 @@
Pixmap newBitmap;
if (__bothSmallInteger(w, h) && ISCONNECTED) {
- Display *dpy = myDpy;
-
-
- ENTER_XLIB();
- newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
- __intVal(w), __intVal(h), 1);
- LEAVE_XLIB();
+ Display *dpy = myDpy;
+
+
+ ENTER_XLIB();
+ newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
+ __intVal(w), __intVal(h), 1);
+ LEAVE_XLIB();
#ifdef COUNT_RESOURCES
- if (newBitmap)
- __cnt_bitmap++;
-#endif
-
- RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
+ if (newBitmap)
+ __cnt_bitmap++;
+#endif
+
+ RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
}
%}.
self primitiveFailedOrClosedConnection.
@@ -2630,86 +2630,86 @@
int bytesPerRow;
if (! ISCONNECTED) {
- RETURN (nil);
+ RETURN (nil);
}
dpy = myDpy;
if (firstCall) {
- for (index=0; index < 256; index++) {
- int t = 0;
-
- if (index & 128) t |= 1;
- if (index & 64) t |= 2;
- if (index & 32) t |= 4;
- if (index & 16) t |= 8;
- if (index & 8) t |= 16;
- if (index & 4) t |= 32;
- if (index & 2) t |= 64;
- if (index & 1) t |= 128;
-
- reverseBitTable[index] = t;
- }
- firstCall = 0;
+ for (index=0; index < 256; index++) {
+ int t = 0;
+
+ if (index & 128) t |= 1;
+ if (index & 64) t |= 2;
+ if (index & 32) t |= 4;
+ if (index & 16) t |= 8;
+ if (index & 8) t |= 16;
+ if (index & 4) t |= 32;
+ if (index & 2) t |= 64;
+ if (index & 1) t |= 128;
+
+ reverseBitTable[index] = t;
+ }
+ firstCall = 0;
}
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
- newBitmap = (Pixmap)0;
- b_width = __intVal(w);
- b_height = __intVal(h);
- bytesPerRow = (b_width + 7) / 8;
- nBytes = b_height * bytesPerRow;
- if (nBytes < sizeof(fastBits)) {
- cp = b_bits = fastBits;
- allocatedBits = 0;
- } else {
- cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
- if (! cp) goto fail;
- }
-
- if (__isArrayLike(anArray)) {
- index = 1;
- op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
- for (row = b_height; row; row--) {
- for (col = bytesPerRow; col; col--) {
- num = *op++;
- if (__isSmallInteger(num)) {
- bits = __intVal(num);
- } else {
- bits = __longIntVal(num);
- if (bits == 0) {
- goto fail;
- }
- }
- *cp++ = reverseBitTable[bits & 0xFF];
- }
- }
- } else {
- if (__isByteArrayLike(anArray)) {
- pBits = __ByteArrayInstPtr(anArray)->ba_element;
- for (col = b_height*bytesPerRow; col; col--) {
- *cp++ = reverseBitTable[*pBits++];
- }
- } else {
- goto fail;
- }
- }
-
-
- ENTER_XLIB();
- newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
- (char *)b_bits,
- b_width, b_height);
- LEAVE_XLIB();
+ newBitmap = (Pixmap)0;
+ b_width = __intVal(w);
+ b_height = __intVal(h);
+ bytesPerRow = (b_width + 7) / 8;
+ nBytes = b_height * bytesPerRow;
+ if (nBytes < sizeof(fastBits)) {
+ cp = b_bits = fastBits;
+ allocatedBits = 0;
+ } else {
+ cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
+ if (! cp) goto fail;
+ }
+
+ if (__isArrayLike(anArray)) {
+ index = 1;
+ op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
+ for (row = b_height; row; row--) {
+ for (col = bytesPerRow; col; col--) {
+ num = *op++;
+ if (__isSmallInteger(num)) {
+ bits = __intVal(num);
+ } else {
+ bits = __longIntVal(num);
+ if (bits == 0) {
+ goto fail;
+ }
+ }
+ *cp++ = reverseBitTable[bits & 0xFF];
+ }
+ }
+ } else {
+ if (__isByteArrayLike(anArray)) {
+ pBits = __ByteArrayInstPtr(anArray)->ba_element;
+ for (col = b_height*bytesPerRow; col; col--) {
+ *cp++ = reverseBitTable[*pBits++];
+ }
+ } else {
+ goto fail;
+ }
+ }
+
+
+ ENTER_XLIB();
+ newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
+ (char *)b_bits,
+ b_width, b_height);
+ LEAVE_XLIB();
#ifdef COUNT_RESOURCES
- if (newBitmap)
- __cnt_bitmap++;
+ if (newBitmap)
+ __cnt_bitmap++;
#endif
fail: ;
- if (allocatedBits)
- free(allocatedBits);
- RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
+ if (allocatedBits)
+ free(allocatedBits);
+ RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
}
%}.
^ nil
@@ -3413,128 +3413,128 @@
(msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[
- "/ DND can drop files, file, dir, links, dirLink and text
- "/ check for this.
-
- dropObjects isCollection ifFalse:[
- dropColl := Array with:dropObjects
- ] ifTrue:[
- dropColl := dropObjects
- ].
- anyFile := anyDir := anyText := anyOther := false.
- dropColl do:[:aDropObject |
- aDropObject isFileObject ifTrue:[
- aDropObject theObject isDirectory ifTrue:[
- anyDir := true
- ] ifFalse:[
- anyFile := true
- ]
- ] ifFalse:[
- aDropObject isTextObject ifTrue:[
- anyText := true
- ] ifFalse:[
- anyOther := true
- ]
- ]
- ].
-
- anyOther ifTrue:[
- "/ DND does not support this ...
- Logger info:'DND can only drop files or text'.
- ^ false
- ].
- anyText ifTrue:[
- (anyFile or:[anyDir]) ifTrue:[
- "/ DND does not support mixed types
- Logger info:'DND cannot drop both files and text'.
- ^ false
- ]
- ].
-
- dropCollSize := dropColl size.
- anyFile ifTrue:[
- dropType := #DndFiles.
- dropCollSize == 1 ifTrue:[
- dropType := #DndFile
- ]
- ] ifFalse:[
- anyDir ifTrue:[
- dropType := #DndFiles.
- dropCollSize == 1 ifTrue:[
- dropType := #DndDir
- ]
- ] ifFalse:[
- anyText ifTrue:[
- dropCollSize == 1 ifTrue:[
- dropType := #DndText
- ] ifFalse:[
- "/ can only drop a single text object
- Logger info:'DND can only drop a single text'.
- ^ false
- ]
- ] ifFalse:[
- "/ mhmh ...
- Logger info:'DND cannot drop this'.
- ^ false
- ]
- ]
- ].
-
- dropTypeCode := self dndDropTypes indexOf:dropType.
- dropTypeCode == 0 ifTrue:[
- Logger info:'DND cannot drop this'.
- ^ false
- ].
- dropTypeCode := dropTypeCode - 1.
-
-
- "/ place the selection inTo the DndSelection property
- "/ of the rootView ...
- "/ ... need a single string, with 0-terminated parts.
-
- strings := OrderedCollection new.
- sz := 0.
- dropColl do:[:anObject |
- |s o|
-
- o := anObject theObject.
- anObject isFileObject ifTrue:[
- o := o pathName
- ].
- s := o asString.
- strings add:s.
- sz := sz + (s size) + 1.
- ].
- val := String new:sz.
- idx := 1.
- strings do:[:aString |
- |sz|
-
- sz := aString size.
- val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
- idx := idx + sz.
- val at:idx put:(Character value:0).
- idx := idx + 1
- ].
-
- self
- setProperty:(self atomIDOf:#DndSelection)
- type:(self atomIDOf:#STRING)
- value:val
- for:rootId.
-
- ^ self
- sendClientEvent:msgType
- format:32
- to:destinationId
- propagate:true
- eventMask:nil
- window:destinationId
- data1:dropTypeCode
- data2:0
- data3:destinationId
- data4:nil
- data5:nil.
+ "/ DND can drop files, file, dir, links, dirLink and text
+ "/ check for this.
+
+ dropObjects isCollection ifFalse:[
+ dropColl := Array with:dropObjects
+ ] ifTrue:[
+ dropColl := dropObjects
+ ].
+ anyFile := anyDir := anyText := anyOther := false.
+ dropColl do:[:aDropObject |
+ aDropObject isFileObject ifTrue:[
+ aDropObject theObject isDirectory ifTrue:[
+ anyDir := true
+ ] ifFalse:[
+ anyFile := true
+ ]
+ ] ifFalse:[
+ aDropObject isTextObject ifTrue:[
+ anyText := true
+ ] ifFalse:[
+ anyOther := true
+ ]
+ ]
+ ].
+
+ anyOther ifTrue:[
+ "/ DND does not support this ...
+ Logger info:'DND can only drop files or text'.
+ ^ false
+ ].
+ anyText ifTrue:[
+ (anyFile or:[anyDir]) ifTrue:[
+ "/ DND does not support mixed types
+ Logger info:'DND cannot drop both files and text'.
+ ^ false
+ ]
+ ].
+
+ dropCollSize := dropColl size.
+ anyFile ifTrue:[
+ dropType := #DndFiles.
+ dropCollSize == 1 ifTrue:[
+ dropType := #DndFile
+ ]
+ ] ifFalse:[
+ anyDir ifTrue:[
+ dropType := #DndFiles.
+ dropCollSize == 1 ifTrue:[
+ dropType := #DndDir
+ ]
+ ] ifFalse:[
+ anyText ifTrue:[
+ dropCollSize == 1 ifTrue:[
+ dropType := #DndText
+ ] ifFalse:[
+ "/ can only drop a single text object
+ Logger info:'DND can only drop a single text'.
+ ^ false
+ ]
+ ] ifFalse:[
+ "/ mhmh ...
+ Logger info:'DND cannot drop this'.
+ ^ false
+ ]
+ ]
+ ].
+
+ dropTypeCode := self dndDropTypes indexOf:dropType.
+ dropTypeCode == 0 ifTrue:[
+ Logger info:'DND cannot drop this'.
+ ^ false
+ ].
+ dropTypeCode := dropTypeCode - 1.
+
+
+ "/ place the selection inTo the DndSelection property
+ "/ of the rootView ...
+ "/ ... need a single string, with 0-terminated parts.
+
+ strings := OrderedCollection new.
+ sz := 0.
+ dropColl do:[:anObject |
+ |s o|
+
+ o := anObject theObject.
+ anObject isFileObject ifTrue:[
+ o := o pathName
+ ].
+ s := o asString.
+ strings add:s.
+ sz := sz + (s size) + 1.
+ ].
+ val := String new:sz.
+ idx := 1.
+ strings do:[:aString |
+ |sz|
+
+ sz := aString size.
+ val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
+ idx := idx + sz.
+ val at:idx put:(Character value:0).
+ idx := idx + 1
+ ].
+
+ self
+ setProperty:(self atomIDOf:#DndSelection)
+ type:(self atomIDOf:#STRING)
+ value:val
+ for:rootId.
+
+ ^ self
+ sendClientEvent:msgType
+ format:32
+ to:destinationId
+ propagate:true
+ eventMask:nil
+ window:destinationId
+ data1:dropTypeCode
+ data2:0
+ data3:destinationId
+ data4:nil
+ data5:nil.
].
^ false
@@ -3591,11 +3591,11 @@
<context: #return>
operationsUntilFlush notNil ifTrue:[
- operationsUntilFlush <= 0 ifTrue:[
- self flush.
- ] ifFalse:[
- operationsUntilFlush := operationsUntilFlush - 1.
- ].
+ operationsUntilFlush <= 0 ifTrue:[
+ self flush.
+ ] ifFalse:[
+ operationsUntilFlush := operationsUntilFlush - 1.
+ ].
].
%{
@@ -3605,19 +3605,19 @@
&& __isExternalAddress(aDrawableId)
&& __bothSmallInteger(x, y)
&& __bothSmallInteger(width, height)) {
- w = __intVal(width);
- h = __intVal(height);
- /*
- * need this check here: some servers simply dump core with bad args
- */
- if ((w >= 0) && (h >= 0)) {
- ENTER_XLIB();
- XClearArea(myDpy,
- __DrawableVal(aDrawableId),
- __intVal(x), __intVal(y), w, h, 0);
- LEAVE_XLIB();
- }
- RETURN ( self );
+ w = __intVal(width);
+ h = __intVal(height);
+ /*
+ * need this check here: some servers simply dump core with bad args
+ */
+ if ((w >= 0) && (h >= 0)) {
+ ENTER_XLIB();
+ XClearArea(myDpy,
+ __DrawableVal(aDrawableId),
+ __intVal(x), __intVal(y), w, h, 0);
+ LEAVE_XLIB();
+ }
+ RETURN ( self );
}
%}.
"badGC, badDrawable or coordinates not integer"
@@ -5243,9 +5243,9 @@
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
property := self
- getProperty:(self atomIDOf:#DndSelection)
- from:rootId
- delete:false.
+ getProperty:(self atomIDOf:#DndSelection)
+ from:rootId
+ delete:false.
propertyType := property key.
dropValue := property value.
@@ -5259,69 +5259,69 @@
"/ in the default dropMessage handling of SimpleView.
dropType == #DndFiles ifTrue:[
- "/ actually, a list of fileNames
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
-
- names := OrderedCollection new.
- i1 := 1.
- [i1 ~~ 0] whileTrue:[
- i2 := dropValue indexOf:(Character value:0) startingAt:i1.
- i2 ~~ 0 ifTrue:[
- names add:(dropValue copyFrom:i1 to:(i2-1)).
- i1 := i2 + 1.
- ] ifFalse:[
- i1 := i2
- ].
- ].
- dropValue := names.
- dropValue := dropValue collect:[:nm | nm asFilename].
- dropType := #files.
+ "/ actually, a list of fileNames
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+
+ names := OrderedCollection new.
+ i1 := 1.
+ [i1 ~~ 0] whileTrue:[
+ i2 := dropValue indexOf:(Character value:0) startingAt:i1.
+ i2 ~~ 0 ifTrue:[
+ names add:(dropValue copyFrom:i1 to:(i2-1)).
+ i1 := i2 + 1.
+ ] ifFalse:[
+ i1 := i2
+ ].
+ ].
+ dropValue := names.
+ dropValue := dropValue collect:[:nm | nm asFilename].
+ dropType := #files.
] ifFalse:[ (dropType == #DndFile) ifTrue:[
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
- dropValue := dropValue asFilename.
- dropType := #file.
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+ dropValue := dropValue asFilename.
+ dropType := #file.
] ifFalse:[ (dropType == #DndDir) ifTrue:[
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
- dropValue := dropValue asFilename.
- dropType := #directory.
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+ dropValue := dropValue asFilename.
+ dropType := #directory.
] ifFalse:[ (dropType == #DndText) ifTrue:[
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
- dropType := #text.
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+ dropType := #text.
] ifFalse:[ (dropType == #DndExe) ifTrue:[
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
- dropType := #executable.
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+ dropType := #executable.
] ifFalse:[ (dropType == #DndLink) ifTrue:[
- propertyType ~~ stringAtom ifTrue:[
- Logger info:'expected a string propertyValue in drop'.
- ^ self
- ].
- dropType := #link.
+ propertyType ~~ stringAtom ifTrue:[
+ Logger info:'expected a string propertyValue in drop'.
+ ^ self
+ ].
+ dropType := #link.
] ifFalse:[ (dropType == #DndRawData) ifTrue:[
- dropType := #rawData.
+ dropType := #rawData.
] ifFalse:[
- Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
- dropType := #unknown.
+ Logger info:'unsupported dropType: %1 data: %2 ' with:dropType with:dropValue.
+ dropType := #unknown.
]]]]]]].
sensor := targetView sensor.
"not posted, if there is no sensor ..."
sensor notNil ifTrue:[
- sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
+ sensor dropMessage:dropType data:dropValue view:targetView position:nil handle:nil
].
"Created: 4.4.1997 / 17:59:37 / cg"
@@ -11294,35 +11294,35 @@
|rawInfo info|
((w <= 0) or:[h <= 0]) ifTrue:[
- self primitiveFailed.
- ^ nil
+ self primitiveFailed.
+ ^ nil
].
rawInfo := Array new:8.
- "1 -> bit order"
- "2 -> depth"
- "3 -> bytes_per_line"
- "4 -> byte_order"
- "5 -> format"
- "6 -> bitmap_unit"
- "7 -> bitmap_pad"
- "8 -> bits_per_pixel"
+ "1 -> bit order"
+ "2 -> depth"
+ "3 -> bytes_per_line"
+ "4 -> byte_order"
+ "5 -> format"
+ "6 -> bitmap_unit"
+ "7 -> bitmap_pad"
+ "8 -> bits_per_pixel"
"/ had to extract the getPixel call into a separate method, to specify
"/ unlimitedStack (some implementations use alloca and require huge amounts
"/ of temporary stack space
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
- info := IdentityDictionary new.
- info at:#bitOrder put:(rawInfo at:1).
- info at:#depth put:(rawInfo at:2).
- info at:#bytesPerLine put:(rawInfo at:3).
- info at:#byteOrder put:(rawInfo at:4).
- info at:#format put:(rawInfo at:5).
- info at:#bitmapUnit put:(rawInfo at:6).
- info at:#bitmapPad put:(rawInfo at:7).
- info at:#bitsPerPixel put:(rawInfo at:8).
- ^ info
+ info := IdentityDictionary new.
+ info at:#bitOrder put:(rawInfo at:1).
+ info at:#depth put:(rawInfo at:2).
+ info at:#bytesPerLine put:(rawInfo at:3).
+ info at:#byteOrder put:(rawInfo at:4).
+ info at:#format put:(rawInfo at:5).
+ info at:#bitmapUnit put:(rawInfo at:6).
+ info at:#bitmapPad put:(rawInfo at:7).
+ info at:#bitsPerPixel put:(rawInfo at:8).
+ ^ info
].
"
some error occurred - either args are not smallintegers, imageBits is not a ByteArray
@@ -11588,20 +11588,20 @@
buffer := self perform:bufferGetSelector.
(aTargetAtomID == (self atomIDOf:#'ST_OBJECT')) ifTrue:[
- "/ 'st-object' printCR.
- "send the selection in binaryStore format"
- "require libboss to be loaded"
- (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
- Logger error:'cannot use binary store for copy buffer (libboss missing)'.
- ^ nil -> nil.
- ].
-
- [
- ^ aTargetAtomID -> (buffer binaryStoreBytes).
- ] on:Error do:[:ex|
- Logger info:'error on binary store of copy buffer: %1' with: ex description.
- ^ nil -> nil.
- ].
+ "/ 'st-object' printCR.
+ "send the selection in binaryStore format"
+ "require libboss to be loaded"
+ (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
+ Logger error:'cannot use binary store for copy buffer (libboss missing)'.
+ ^ nil -> nil.
+ ].
+
+ [
+ ^ aTargetAtomID -> (buffer binaryStoreBytes).
+ ] on:Error do:[:ex|
+ Logger info:'error on binary store of copy buffer: %1' with: ex description.
+ ^ nil -> nil.
+ ].
].
bufferAsString := self class bufferAsString:buffer.
@@ -11609,25 +11609,25 @@
(aTargetAtomID == (self atomIDOf:#STRING)
or:[aTargetAtomID == (self atomIDOf:#'text/plain')]
) ifTrue:[
- "/ 'string' printCR.
- "the other view wants the selection as string"
- ^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
+ "/ 'string' printCR.
+ "the other view wants the selection as string"
+ ^ aTargetAtomID -> (bufferAsString asSingleByteStringReplaceInvalidWith:$#).
].
(aTargetAtomID == (self atomIDOf:#UTF8_STRING)
or:[aTargetAtomID == (self atomIDOf:#'text/plain;codeset=utf-8')]
) ifTrue:[
- "/ 'utf string' printCR.
- "the other view wants the selection as utf8 string"
- ^ aTargetAtomID -> (bufferAsString utf8Encoded).
+ "/ 'utf string' printCR.
+ "the other view wants the selection as utf8 string"
+ ^ aTargetAtomID -> (bufferAsString utf8Encoded).
].
aTargetAtomID == (self atomIDOf:#LENGTH) ifTrue:[
- "the other one wants to know the size of our selection.
- LENGTH is deprecated, since we do not know how the selection is
- going to be converted. The client must not rely on the length returned"
-
- ^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
+ "the other one wants to know the size of our selection.
+ LENGTH is deprecated, since we do not know how the selection is
+ going to be converted. The client must not rely on the length returned"
+
+ ^ (self atomIDOf:#INTEGER) -> (bufferAsString size).
].
"we do not support the requestet target type"
@@ -13812,11 +13812,11 @@
%{
#ifdef XFT
if (__isExternalAddress(id)) {
- XftDraw *address = (XftDraw *)__externalAddressVal(id);
- if (address) {
- XftDrawDestroy(address);
- __externalAddressVal(id) = 0;
- }
+ XftDraw *address = (XftDraw *)__externalAddressVal(id);
+ if (address) {
+ XftDrawDestroy(address);
+ __externalAddressVal(id) = 0;
+ }
}
#endif
%}.
@@ -13834,8 +13834,8 @@
|displayId|
font isXftFont ifTrue:[
- self displayDeviceXftString:aString from:index1 to:index2 x:x y:y opaque:opaque.
- ^ self.
+ self displayDeviceXftString:aString from:index1 to:index2 x:x y:y opaque:opaque.
+ ^ self.
].
device flushIfAppropriate.
@@ -13856,165 +13856,165 @@
&& __isNonNilObject(aString)
&& __bothSmallInteger(index1, index2)
&& __bothSmallInteger(x, y)) {
- int lMax = __intVal(@global(XWorkstation:MaxStringLength));
- Display *dpy = __DisplayVal(displayId);
- gc = __GCVal(__INST(gcId));
- win = __WindowVal(__INST(drawableId));
-
- i1 = __intVal(index1) - 1;
- if (i1 >= 0) {
- OBJ cls;
-
- i2 = __intVal(index2) - 1;
- if (i2 < i1) {
- RETURN (self);
- }
- cp = (char *) __stringVal(aString);
- l = i2 - i1 + 1;
-
- if (__isStringLike(aString)) {
- n = __stringSize(aString);
- if (i2 < n) {
- cp += i1;
- if (l > lMax) l = lMax;
- __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
- if (opaque == true)
- XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
- else
- XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
- LEAVE_XLIB();
- RETURN ( self );
- }
- }
-
- cls = __qClass(aString);
- nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
- cp += nInstBytes;
-
- if (__isBytes(aString)) {
- n = __byteArraySize(aString) - nInstBytes - 1;
-
- if (i2 < n) {
- cp += i1;
- if (l > lMax) l = lMax;
- __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
- if (opaque == true)
- XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
- else
- XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
- LEAVE_XLIB();
- RETURN ( self );
- }
- }
-
- /* TWOBYTESTRINGS */
- if (__isWords(aString)) {
- n = (__byteArraySize(aString) - nInstBytes) / 2;
- if (i2 < n) {
- union {
- char b[2];
- unsigned short s;
- } u;
- int i;
- XChar2b *cp2 = (XChar2b *)0;
- int mustFree = 0;
-
- cp += (i1 * 2);
- if (l > lMax) l = lMax;
+ int lMax = __intVal(@global(XWorkstation:MaxStringLength));
+ Display *dpy = __DisplayVal(displayId);
+ gc = __GCVal(__INST(gcId));
+ win = __WindowVal(__INST(drawableId));
+
+ i1 = __intVal(index1) - 1;
+ if (i1 >= 0) {
+ OBJ cls;
+
+ i2 = __intVal(index2) - 1;
+ if (i2 < i1) {
+ RETURN (self);
+ }
+ cp = (char *) __stringVal(aString);
+ l = i2 - i1 + 1;
+
+ if (__isStringLike(aString)) {
+ n = __stringSize(aString);
+ if (i2 < n) {
+ cp += i1;
+ if (l > lMax) l = lMax;
+ __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+ if (opaque == true)
+ XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+ else
+ XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+ LEAVE_XLIB();
+ RETURN ( self );
+ }
+ }
+
+ cls = __qClass(aString);
+ nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+ cp += nInstBytes;
+
+ if (__isBytes(aString)) {
+ n = __byteArraySize(aString) - nInstBytes - 1;
+
+ if (i2 < n) {
+ cp += i1;
+ if (l > lMax) l = lMax;
+ __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+ if (opaque == true)
+ XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+ else
+ XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+ LEAVE_XLIB();
+ RETURN ( self );
+ }
+ }
+
+ /* TWOBYTESTRINGS */
+ if (__isWords(aString)) {
+ n = (__byteArraySize(aString) - nInstBytes) / 2;
+ if (i2 < n) {
+ union {
+ char b[2];
+ unsigned short s;
+ } u;
+ int i;
+ XChar2b *cp2 = (XChar2b *)0;
+ int mustFree = 0;
+
+ cp += (i1 * 2);
+ if (l > lMax) l = lMax;
#if defined(MSBFIRST) || defined(__MSBFIRST)
- /*
- * chars already in correct order
- */
+ /*
+ * chars already in correct order
+ */
#else
# if ! (defined(LSBFIRST) || defined(__LSBFIRST))
- /*
- * ST/X TwoByteStrings store the asciiValue in native byteOrder;
- * X expects them MSB first
- * convert as required
- */
- u.s = 0x1234;
- if (u.b[0] != 0x12)
-# endif // ! (defined(LSBFIRST) || defined(__LSBFIRST))
- {
- if (l <= NLOCALBUFFER) {
- cp2 = xlatebuffer;
- } else {
- cp2 = (XChar2b *)(malloc(l * 2));
- mustFree = 1;
- }
- for (i=0; i<l; i++) {
- cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
- cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
- }
- cp = (char *) cp2;
- }
-#endif // ! (defined(MSBFIRST) || defined(__MSBFIRST))
- __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
- if (opaque == true)
- XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
- else
- XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
- LEAVE_XLIB();
-
- if (mustFree) {
- free(cp2);
- }
-
- RETURN ( self );
- }
- }
-
- /* FOURBYTESTRINGS */
- if (__isLongs(aString)) {
- n = (__byteArraySize(aString) - nInstBytes) / 4;
- if (i2 < n) {
- union {
- char b[2];
- unsigned short s;
- } u;
- int i;
- XChar2b *cp2 = (XChar2b *)0;
- int32 *ip;
- int mustFree = 0;
-
- cp += (i1 * 4);
- if (l > lMax) l = lMax;
-
- /*
- * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
- */
- if (l <= NLOCALBUFFER) {
- cp2 = xlatebuffer;
- } else {
- cp2 = (XChar2b *)(malloc(l * 2));
- mustFree = 1;
- }
- for (i=0; i<l; i++) {
- int32 codePoint = ((int32 *)cp)[i];
-
- if (codePoint > 0xFFFF) {
- codePoint = 0xFFFF;
- }
- cp2[i].byte1 = (codePoint >> 8) & 0xFF;
- cp2[i].byte2 = codePoint & 0xFF;
- }
-
- __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
- if (opaque == true)
- XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
- else
- XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
- LEAVE_XLIB();
-
- if (mustFree) {
- free(cp2);
- }
-
- RETURN ( self );
- }
- }
- }
+ /*
+ * ST/X TwoByteStrings store the asciiValue in native byteOrder;
+ * X expects them MSB first
+ * convert as required
+ */
+ u.s = 0x1234;
+ if (u.b[0] != 0x12)
+# endif // ! (defined(LSBFIRST) || defined(__LSBFIRST))
+ {
+ if (l <= NLOCALBUFFER) {
+ cp2 = xlatebuffer;
+ } else {
+ cp2 = (XChar2b *)(malloc(l * 2));
+ mustFree = 1;
+ }
+ for (i=0; i<l; i++) {
+ cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
+ cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
+ }
+ cp = (char *) cp2;
+ }
+#endif // ! (defined(MSBFIRST) || defined(__MSBFIRST))
+ __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+ if (opaque == true)
+ XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+ else
+ XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+ LEAVE_XLIB();
+
+ if (mustFree) {
+ free(cp2);
+ }
+
+ RETURN ( self );
+ }
+ }
+
+ /* FOURBYTESTRINGS */
+ if (__isLongs(aString)) {
+ n = (__byteArraySize(aString) - nInstBytes) / 4;
+ if (i2 < n) {
+ union {
+ char b[2];
+ unsigned short s;
+ } u;
+ int i;
+ XChar2b *cp2 = (XChar2b *)0;
+ int32 *ip;
+ int mustFree = 0;
+
+ cp += (i1 * 4);
+ if (l > lMax) l = lMax;
+
+ /*
+ * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
+ */
+ if (l <= NLOCALBUFFER) {
+ cp2 = xlatebuffer;
+ } else {
+ cp2 = (XChar2b *)(malloc(l * 2));
+ mustFree = 1;
+ }
+ for (i=0; i<l; i++) {
+ int32 codePoint = ((int32 *)cp)[i];
+
+ if (codePoint > 0xFFFF) {
+ codePoint = 0xFFFF;
+ }
+ cp2[i].byte1 = (codePoint >> 8) & 0xFF;
+ cp2[i].byte2 = codePoint & 0xFF;
+ }
+
+ __ENTER_XLIB(1000 * __intVal(@global(XWorkstation:DefaultXLibTimeout)));
+ if (opaque == true)
+ XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
+ else
+ XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp2, l);
+ LEAVE_XLIB();
+
+ if (mustFree) {
+ free(cp2);
+ }
+
+ RETURN ( self );
+ }
+ }
+ }
}
#undef NLOCALBUFFER
%}.
@@ -14042,67 +14042,67 @@
"limit the string len, otherwise bad output is generated"
stringLen := index2Arg - index1 + 1.
stringLen > 1000 "8000" ifTrue:[
- index2 := index1 + 1000 "8000" - 1.
+ index2 := index1 + 1000 "8000" - 1.
] ifFalse:[
- stringLen <= 0 ifTrue:[^ self].
- index2 := index2Arg.
+ stringLen <= 0 ifTrue:[^ self].
+ index2 := index2Arg.
].
bytesPerCharacter := aString bytesPerCharacter.
clipRect notNil ifTrue:[
- clipX := clipRect left.
- clipY := clipRect top.
- clipW := clipRect width.
- clipH := clipRect height.
+ clipX := clipRect left.
+ clipY := clipRect top.
+ clipW := clipRect width.
+ clipH := clipRect height.
"/clipW > 32767 ifTrue:['clipW > 32767: ' errorPrint. clipW errorPrintCR. clipW := 32767].
"/(clipX > 16384 or:[clipX < -16384]) ifTrue:['clipX > 16384: ' errorPrint. clipX errorPrintCR.].
- "/ YES YES YES: this MUST be transformed!!
- "/ (see htmlView) fix the notebook, please.
+ "/ YES YES YES: this MUST be transformed!!
+ "/ (see htmlView) fix the notebook, please.
].
fgR := paint scaledRed.
fgR notNil ifTrue:[
- fgG := paint scaledGreen.
- fgB := paint scaledBlue.
- fgA := paint scaledAlpha.
+ fgG := paint scaledGreen.
+ fgB := paint scaledBlue.
+ fgA := paint scaledAlpha.
] ifFalse:[
- "/ when drawing into a pixmap...
- fgPixel := paint colorId.
- fgPixel == 0 ifTrue:[
- fgR := fgG := fgB := 0.
- ] ifFalse:[
- fgR := fgG := fgB := 16rFFFF.
- ].
- fgA := 16rFFFF.
+ "/ when drawing into a pixmap...
+ fgPixel := paint colorId.
+ fgPixel == 0 ifTrue:[
+ fgR := fgG := fgB := 0.
+ ] ifFalse:[
+ fgR := fgG := fgB := 16rFFFF.
+ ].
+ fgA := 16rFFFF.
].
opaque ifTrue:[
- bgPaint isColor ifTrue:[
- bgR := bgPaint scaledRed.
- bgR notNil ifTrue:[
- bgG := bgPaint scaledGreen.
- bgB := bgPaint scaledBlue.
- bgA := bgPaint scaledAlpha.
- ] ifFalse:[
- "/ when drawing into a pixmap...
- bgPixel := bgPaint colorId.
- bgPixel == 0 ifTrue:[
- bgR := bgG := bgB := 0.
- ] ifFalse:[
- bgR := bgG := bgB := 16rFFFF.
- ].
- bgA := 16rFFFF.
- ].
- ] ifFalse:[
- "images as background are not yet implemented"
- "/ #todo: fill background rectangle
- bgR := bgG := bgB := bgA := 16rFFFF.
- ].
+ bgPaint isColor ifTrue:[
+ bgR := bgPaint scaledRed.
+ bgR notNil ifTrue:[
+ bgG := bgPaint scaledGreen.
+ bgB := bgPaint scaledBlue.
+ bgA := bgPaint scaledAlpha.
+ ] ifFalse:[
+ "/ when drawing into a pixmap...
+ bgPixel := bgPaint colorId.
+ bgPixel == 0 ifTrue:[
+ bgR := bgG := bgB := 0.
+ ] ifFalse:[
+ bgR := bgG := bgB := 16rFFFF.
+ ].
+ bgA := 16rFFFF.
+ ].
+ ] ifFalse:[
+ "images as background are not yet implemented"
+ "/ #todo: fill background rectangle
+ bgR := bgG := bgB := bgA := 16rFFFF.
+ ].
].
screen := device screen.
self isPixmap ifTrue:[
- pixmapDepth := depth.
+ pixmapDepth := depth.
].
fontId := font getXftFontId.
@@ -14118,81 +14118,81 @@
XftFont *__xftFont;
if (!(__bothSmallInteger(drawX, drawY)
- && __bothSmallInteger(index1, index2)
- && __isSmallInteger(bytesPerCharacter)
- && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
- && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
- && __isNonNilObject(aString)
- && __isExternalAddress(displayId)
- && __isExternalAddressLike(fontId)
+ && __bothSmallInteger(index1, index2)
+ && __isSmallInteger(bytesPerCharacter)
+ && (__isSmallInteger(fgPixel) || (__bothSmallInteger(fgR, fgG) && __bothSmallInteger(fgB, fgA)))
+ && (opaque == false || __isSmallInteger(bgPixel) || (__bothSmallInteger(bgR, bgG) && __bothSmallInteger(bgB, bgA)))
+ && __isNonNilObject(aString)
+ && __isExternalAddress(displayId)
+ && __isExternalAddressLike(fontId)
)) {
- error = @symbol(badArgument);
- goto out;
+ error = @symbol(badArgument);
+ goto out;
}
__xftFont = XFT_FONT(fontId);
__bytesPerCharacter = __intVal(bytesPerCharacter);
if (__INST(xftDrawId) != nil) {
- __xftDrawId = __externalAddressVal(__INST(xftDrawId));
+ __xftDrawId = __externalAddressVal(__INST(xftDrawId));
} else {
- if (pixmapDepth != nil) {
- int __pixmapDepth = __intVal(pixmapDepth);
-
- if (__pixmapDepth == 1) {
- __xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
- } else {
- __xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
- }
- } else {
- __xftDrawId = XftDrawCreate(DISPLAY(displayId),
- DRAWABLE(__INST(drawableId)),
- DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
- DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
- }
- __INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
- __STORE(self, newXftDrawId);
+ if (pixmapDepth != nil) {
+ int __pixmapDepth = __intVal(pixmapDepth);
+
+ if (__pixmapDepth == 1) {
+ __xftDrawId = XftDrawCreateBitmap(DISPLAY(displayId), DRAWABLE(__INST(drawableId)));
+ } else {
+ __xftDrawId = XftDrawCreateAlpha(DISPLAY(displayId), DRAWABLE(__INST(drawableId)), __pixmapDepth);
+ }
+ } else {
+ __xftDrawId = XftDrawCreate(DISPLAY(displayId),
+ DRAWABLE(__INST(drawableId)),
+ DefaultVisual(DISPLAY(displayId), SCREEN(screen)),
+ DefaultColormap(DISPLAY(displayId), SCREEN(screen)));
+ }
+ __INST(xftDrawId) = newXftDrawId = XFT_DRAW_HANDLE_NEW(__xftDrawId);
+ __STORE(self, newXftDrawId);
}
string = __stringVal(aString) + ((__intVal(index1) - 1 ) * __bytesPerCharacter);
len = __intVal(index2) - __intVal(index1) + 1;
if (clipX != nil) {
- clipRX.x = __intVal(clipX);
- clipRX.y = __intVal(clipY);
- clipRX.width = __intVal(clipW);
- clipRX.height = __intVal(clipH);
- XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
+ clipRX.x = __intVal(clipX);
+ clipRX.y = __intVal(clipY);
+ clipRX.width = __intVal(clipW);
+ clipRX.height = __intVal(clipH);
+ XftDrawSetClipRectangles(__xftDrawId, 0, 0, &clipRX, 1);
} else {
- XftDrawSetClip(__xftDrawId, 0);
+ XftDrawSetClip(__xftDrawId, 0);
}
if (opaque == true) {
- if (bgPixel != nil) {
- color.pixel = (unsigned long)__intVal(bgPixel);
- }
- color.color.red = __intVal(bgR);
- color.color.green = __intVal(bgG);
- color.color.blue = __intVal(bgB);
- color.color.alpha = __intVal(bgA);
-
- switch (__bytesPerCharacter) {
- case 1:
- XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
- break;
- case 2:
- XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
- break;
- case 4:
- XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
- break;
- }
+ if (bgPixel != nil) {
+ color.pixel = (unsigned long)__intVal(bgPixel);
+ }
+ color.color.red = __intVal(bgR);
+ color.color.green = __intVal(bgG);
+ color.color.blue = __intVal(bgB);
+ color.color.alpha = __intVal(bgA);
+
+ switch (__bytesPerCharacter) {
+ case 1:
+ XftTextExtents8(DISPLAY(displayId), __xftFont, (FcChar8*)string, len, &extents);
+ break;
+ case 2:
+ XftTextExtents16(DISPLAY(displayId), __xftFont, (FcChar16*)string, len, &extents);
+ break;
+ case 4:
+ XftTextExtents32(DISPLAY(displayId), __xftFont, (FcChar32*)string, len, &extents);
+ break;
+ }
if (extents.width < 0) printf("width: %d < 0\n", extents.width);
- XftDrawRect(__xftDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
+ XftDrawRect(__xftDrawId, &color, __intVal(drawX) - extents.x, __intVal(drawY) - __xftFont->ascent, extents.width, __xftFont->height);
}
if (__isSmallInteger(fgPixel)) {
- color.pixel = (unsigned long)__intVal(fgPixel);
+ color.pixel = (unsigned long)__intVal(fgPixel);
}
color.color.red = __intVal(fgR);
color.color.green = __intVal(fgG);
@@ -14201,39 +14201,39 @@
switch (__bytesPerCharacter) {
case 1:
- XftDrawString8(__xftDrawId, &color,__xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar8*)string,
- len);
- break;
+ XftDrawString8(__xftDrawId, &color,__xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar8*)string,
+ len);
+ break;
case 2:
- XftDrawString16(__xftDrawId, &color, __xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar16*)string,
- len);
- break;
+ XftDrawString16(__xftDrawId, &color, __xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar16*)string,
+ len);
+ break;
case 4:
- XftDrawString32(__xftDrawId, &color, __xftFont,
- __intVal(drawX),
- __intVal(drawY),
- (FcChar32*)string,
- len);
- break;
+ XftDrawString32(__xftDrawId, &color, __xftFont,
+ __intVal(drawX),
+ __intVal(drawY),
+ (FcChar32*)string,
+ len);
+ break;
default:
- error = @symbol(invalidStringSize);
- goto out;
+ error = @symbol(invalidStringSize);
+ goto out;
}
out:;
#endif
%}.
error notNil ifTrue:[
- self primitiveFailed: error.
+ self primitiveFailed: error.
].
! !
@@ -14249,29 +14249,29 @@
|pX pY nW nH pO pC|
gcId isNil ifTrue:[
- self initGC
+ self initGC
].
transformation notNil ifTrue:[
- pO := transformation transformPoint:x@y.
- pC := transformation transformPoint:(x+w-1)@(y+h-1).
- pX := pO x.
- pY := pO y.
- nW := pC x - pX + 1.
- nH := pC y - pY + 1.
-
- nW < 0 ifTrue:[
- nW := nW abs.
- pX := pX - nW.
- ].
- nH < 0 ifTrue:[
- nH := nH abs.
- pY := pY - nH.
- ].
+ pO := transformation transformPoint:x@y.
+ pC := transformation transformPoint:(x+w-1)@(y+h-1).
+ pX := pO x.
+ pY := pO y.
+ nW := pC x - pX + 1.
+ nH := pC y - pY + 1.
+
+ nW < 0 ifTrue:[
+ nW := nW abs.
+ pX := pX - nW.
+ ].
+ nH < 0 ifTrue:[
+ nH := nH abs.
+ pY := pY - nH.
+ ].
] ifFalse:[
- pX := x.
- pY := y.
- nW := w.
- nH := h.
+ pX := x.
+ pY := y.
+ nW := w.
+ nH := h.
].
pX := pX rounded.
pY := pY rounded.
@@ -14279,11 +14279,11 @@
nH := nH rounded.
device
- clearRectangleX:pX
- y:pY
- width:nW
- height:nH
- in:drawableId with:gcId
+ clearRectangleX:pX
+ y:pY
+ width:nW
+ height:nH
+ in:drawableId with:gcId
! !
!XWorkstation::X11GraphicsContext methodsFor:'view creation'!