--- a/XWorkstation.st Mon Aug 11 22:04:43 2003 +0200
+++ b/XWorkstation.st Tue Aug 12 12:24:08 2003 +0200
@@ -408,9 +408,9 @@
*/
# if !defined(IRIS) || defined(IRIX5)
if (root) {
- if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
- vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
- if (vRootAtom != None) {
+ vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
+ if (vRootAtom != None) {
+ if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
for (i=0; i < numChildren; i++) {
Atom actual_type;
int actual_format;
@@ -551,12 +551,12 @@
"
s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil.
s notNil ifTrue:[
- match := 'XRequest.' , requestCode printString.
- line := s peekForLineStartingWith:match.
- line notNil ifTrue:[
- string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
- ].
- s close.
+ match := 'XRequest.' , requestCode printString.
+ line := s peekForLineStartingWith:match.
+ line notNil ifTrue:[
+ string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
+ ].
+ s close.
].
^ string
!
@@ -796,15 +796,17 @@
w1 = __WindowVal(windowId1);
w2 = __WindowVal(windowId2);
-#ifdef VIRTUAL_ROOT
+#ifdef VIRTUAL_ROOT
rootWin = RootWindow(dpy, screen);
- if ((w1 == rootWin) || (w2 == rootWin)) {
- if (w1 == rootWin) {
- w1 = getRootWindow(dpy, screen);
- }
- if (w2 == rootWin) {
- w2 = getRootWindow(dpy, screen);
- }
+ if (w1 == rootWin) {
+ ENTER_XLIB();
+ w1 = getRootWindow(dpy, screen);
+ LEAVE_XLIB();
+ }
+ if (w2 == rootWin) {
+ ENTER_XLIB();
+ w2 = getRootWindow(dpy, screen);
+ LEAVE_XLIB();
}
#endif
@@ -2377,22 +2379,22 @@
aStream isNil ifTrue:[^ nil].
list := OrderedCollection new.
[aStream atEnd] whileFalse:[
- line := aStream nextLine.
- line notNil ifTrue:[
- "skip the r/g/b numbers"
- index := 1.
- [(line at:index) isSeparator] whileTrue:[index := index + 1].
- [(line at:index) isDigit] whileTrue:[index := index + 1].
- [(line at:index) isSeparator] whileTrue:[index := index + 1].
- [(line at:index) isDigit] whileTrue:[index := index + 1].
- [(line at:index) isSeparator] whileTrue:[index := index + 1].
- [(line at:index) isDigit] whileTrue:[index := index + 1].
- [(line at:index) isSeparator] whileTrue:[index := index + 1].
- colorName := line copyFrom:index.
- ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
- list add:colorName
- ]
- ]
+ line := aStream nextLine.
+ line notNil ifTrue:[
+ "skip the r/g/b numbers"
+ index := 1.
+ [(line at:index) isSeparator] whileTrue:[index := index + 1].
+ [(line at:index) isDigit] whileTrue:[index := index + 1].
+ [(line at:index) isSeparator] whileTrue:[index := index + 1].
+ [(line at:index) isDigit] whileTrue:[index := index + 1].
+ [(line at:index) isSeparator] whileTrue:[index := index + 1].
+ [(line at:index) isDigit] whileTrue:[index := index + 1].
+ [(line at:index) isSeparator] whileTrue:[index := index + 1].
+ colorName := line copyFrom:index.
+ ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
+ list add:colorName
+ ]
+ ]
].
aStream close.
^ list sort
@@ -4296,13 +4298,13 @@
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
self
- getProperty:(self atomIDOf:#DndSelection)
- from:rootId
- delete:false
- into:[:type :value |
- t := type.
- dropValue := value
- ].
+ getProperty:(self atomIDOf:#DndSelection)
+ from:rootId
+ delete:false
+ into:[:type :value |
+ t := type.
+ dropValue := value
+ ].
"/ preconvert into a collection
"/ of fileNames, string or byteArray
@@ -4313,83 +4315,83 @@
"/ in the default dropMessage handling of SimpleView.
dropType == #DndFiles ifTrue:[
- "/ actually, a list of fileNames
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ 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
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ 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:[
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ self
- ].
-
- dropValue := dropValue asFilename.
- dropType := #file.
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ self
+ ].
+
+ dropValue := dropValue asFilename.
+ dropType := #file.
] ifFalse:[ (dropType == #DndDir) ifTrue:[
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ self
- ].
-
- dropValue := dropValue asFilename.
- dropType := #directory.
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ self
+ ].
+
+ dropValue := dropValue asFilename.
+ dropType := #directory.
] ifFalse:[ (dropType == #DndText) ifTrue:[
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ self
- ].
-
- dropValue := dropValue.
- dropType := #text.
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ self
+ ].
+
+ dropValue := dropValue.
+ dropType := #text.
] ifFalse:[ (dropType == #DndExe) ifTrue:[
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ self
- ].
-
- dropValue := dropValue.
- dropType := #executable.
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ self
+ ].
+
+ dropValue := dropValue.
+ dropType := #executable.
] ifFalse:[ (dropType == #DndLink) ifTrue:[
- t ~~ stringAtom ifTrue:[
- 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
- ^ self
- ].
-
- dropValue := dropValue.
- dropType := #link.
+ t ~~ stringAtom ifTrue:[
+ 'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
+ ^ self
+ ].
+
+ dropValue := dropValue.
+ dropType := #link.
] ifFalse:[ (dropType == #DndRawData) ifTrue:[
- dropValue := dropValue.
- dropType := #rawData.
+ dropValue := dropValue.
+ dropType := #rawData.
] ifFalse:[
- 'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
- 'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR.
-
- dropValue := dropValue.
- dropType := #unknown.
+ 'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
+ 'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR.
+
+ dropValue := dropValue.
+ dropType := #unknown.
]]]]]]].
(sensor := targetView sensor) notNil ifTrue:[
- sensor dropMessage:dropType data:dropValue view:targetView
+ sensor dropMessage:dropType data:dropValue view:targetView
] ifFalse:[
- "
- not posted, if there is no sensor ...
- "
+ "
+ not posted, if there is no sensor ...
+ "
]
"Created: 4.4.1997 / 17:59:37 / cg"
@@ -4513,8 +4515,8 @@
This is a very X-specific mechanism."
aView isNil ifTrue:[
- "/ event arrived, after I destroyed it myself
- ^ self
+ "/ event arrived, after I destroyed it myself
+ ^ self
].
"/ aView propertyChange:atom state:aSymbol.
!
@@ -4542,20 +4544,20 @@
|clipBoardContents|
targetID == (self atomIDOf:#STRING) ifTrue:[
- "a returned string"
- clipBoardContents := self getTextProperty:propertyID from:requestorID.
- clipBoardContents notNil ifTrue:[
- (clipBoardContents endsWith:Character cr) ifTrue:[
- clipBoardContents := clipBoardContents asStringCollection copyWith:''
- ]
- ]
+ "a returned string"
+ clipBoardContents := self getTextProperty:propertyID from:requestorID.
+ clipBoardContents notNil ifTrue:[
+ (clipBoardContents endsWith:Character cr) ifTrue:[
+ clipBoardContents := clipBoardContents asStringCollection copyWith:''
+ ]
+ ]
] ifFalse:[
- "a returned object"
- clipBoardContents := self getObjectProperty:propertyID from:requestorID.
+ "a returned object"
+ clipBoardContents := self getObjectProperty:propertyID from:requestorID.
].
clipBoardContents notNil ifTrue:[
- aView sensor pasteFromClipBoard:clipBoardContents view:aView
+ aView sensor pasteFromClipBoard:clipBoardContents view:aView
]
!
@@ -4603,7 +4605,7 @@
visibilityNotify:aView state:how
aView notNil ifTrue:[
- aView visibilityChange:how
+ aView visibilityChange:how
]
! !
@@ -4680,11 +4682,11 @@
%{ /* NOCONTEXT */
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
- KeyPressMask | KeyReleaseMask |
- PointerMotionMask |
- EnterWindowMask | LeaveWindowMask |
- ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
- PropertyChangeMask ));
+ KeyPressMask | KeyReleaseMask |
+ PointerMotionMask |
+ EnterWindowMask | LeaveWindowMask |
+ ButtonPressMask | ButtonMotionMask | ButtonReleaseMask |
+ PropertyChangeMask ));
%}
!
@@ -8724,7 +8726,9 @@
#ifdef VIRTUAL_ROOT
+ ENTER_XLIB();
w = getRootWindow(dpy, screen);
+ LEAVE_XLIB();
#else
w = RootWindow(dpy, screen);
#endif
@@ -8802,7 +8806,9 @@
#ifdef VIRTUAL_ROOT
+ ENTER_XLIB();
w = getRootWindow(dpy, screen);
+ LEAVE_XLIB();
#else
w = RootWindow(dpy, screen);
#endif
@@ -8924,12 +8930,12 @@
"get an object property from the server; return object or nil"
self getProperty:propertyID from:aWindowID delete:true into:[:type :value |
- type == stringAtom ifTrue:[
- ^ value
- ].
- (value isMemberOf:ByteArray) ifTrue:[
- ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
- ]
+ type == stringAtom ifTrue:[
+ ^ value
+ ].
+ (value isMemberOf:ByteArray) ifTrue:[
+ ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
+ ]
].
^ nil
@@ -8944,9 +8950,9 @@
|val typeID propertyID|
propertySymbolOrID isString ifTrue:[
- propertyID := self atomIDOf:propertySymbolOrID create:false.
+ propertyID := self atomIDOf:propertySymbolOrID create:false.
] ifFalse:[
- propertyID := propertySymbolOrID.
+ propertyID := propertySymbolOrID.
].
%{
@@ -8961,74 +8967,74 @@
# define PROP_SIZE 2048
if (ISCONNECTED) {
- Display *dpy = myDpy;
-
- if (__isAtomID(propertyID)) {
- property = __AtomVal(propertyID);
- if (__isExternalAddress(aWindowID)) {
- window = __WindowVal(aWindowID);
- } else if (aWindowID == nil) {
- window = DefaultRootWindow(dpy);
- } else
- goto fail;
-
- nread = 0;
- cp = 0;
+ Display *dpy = myDpy;
+
+ if (__isAtomID(propertyID)) {
+ property = __AtomVal(propertyID);
+ if (__isExternalAddress(aWindowID)) {
+ window = __WindowVal(aWindowID);
+ } else if (aWindowID == nil) {
+ window = DefaultRootWindow(dpy);
+ } else
+ goto fail;
+
+ nread = 0;
+ cp = 0;
/*
- fprintf(stderr, "getProperty: ");
+ fprintf(stderr, "getProperty: ");
*/
- do {
- int retVal;
-
- ENTER_XLIB();
- retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
- doDelete == true,
- AnyPropertyType, &actual_type, &actual_format,
- &nitems, &bytes_after, (unsigned char **)&data);
- LEAVE_XLIB();
- if (retVal != Success) {
- ok = 0;
- break;
- }
- typeID = __MKATOMOBJ(actual_type);
- if (! cp) {
- cp = cp2 = (char *)malloc(nitems+1);
- } else {
- cp = (char *)realloc(cp, nread + nitems + 1);
- cp2 = cp + nread;
- }
- if (! cp) {
- XFree(data);
- goto fail;
- }
+ do {
+ int retVal;
+
+ ENTER_XLIB();
+ retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE,
+ doDelete == true,
+ AnyPropertyType, &actual_type, &actual_format,
+ &nitems, &bytes_after, (unsigned char **)&data);
+ LEAVE_XLIB();
+ if (retVal != Success) {
+ ok = 0;
+ break;
+ }
+ typeID = __MKATOMOBJ(actual_type);
+ if (! cp) {
+ cp = cp2 = (char *)malloc(nitems+1);
+ } else {
+ cp = (char *)realloc(cp, nread + nitems + 1);
+ cp2 = cp + nread;
+ }
+ if (! cp) {
+ XFree(data);
+ goto fail;
+ }
- nread += nitems;
- bcopy(data, cp2, nitems);
- XFree(data);
+ nread += nitems;
+ bcopy(data, cp2, nitems);
+ XFree(data);
/*
- fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
+ fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
*/
- } while (bytes_after > 0);
+ } while (bytes_after > 0);
/*
- fprintf(stderr, "\n");
+ fprintf(stderr, "\n");
*/
- if (ok) {
- if (actual_type == XA_STRING) {
- cp[nread] = '\0';
- val = __MKSTRING_L(cp, nread);
- } else {
- val = __MKBYTEARRAY(cp, nread);
- }
- }
- if (cp)
- free(cp);
- }
+ if (ok) {
+ if (actual_type == XA_STRING) {
+ cp[nread] = '\0';
+ val = __MKSTRING_L(cp, nread);
+ } else {
+ val = __MKBYTEARRAY(cp, nread);
+ }
+ }
+ if (cp)
+ free(cp);
+ }
}
fail: ;
%}.
typeID isNil ifTrue:[
- ^ false
+ ^ false
].
aTwoArgBlock value:typeID value:val.
^ true
@@ -9040,20 +9046,20 @@
|stringClass|
self getProperty:propertyID from:aWindowID delete:true into:[:type :value |
- type == stringAtom ifTrue:[
- clipBoardEncoding notNil ifTrue:[
- stringClass := (CharacterArray classForEncoding:clipBoardEncoding).
- stringClass ~~ String ifTrue:[
- ^ stringClass fromBytes:(value asByteArray)
- ].
- ^ value decodeFrom:clipBoardEncoding
- ].
- ^ value
- ].
- type == (self atomIDOf:#INCR) ifTrue:[
+ type == stringAtom ifTrue:[
+ clipBoardEncoding notNil ifTrue:[
+ stringClass := (CharacterArray classForEncoding:clipBoardEncoding).
+ stringClass ~~ String ifTrue:[
+ ^ stringClass fromBytes:(value asByteArray)
+ ].
+ ^ value decodeFrom:clipBoardEncoding
+ ].
+ ^ value
+ ].
+ type == (self atomIDOf:#INCR) ifTrue:[
type printCR.
value printCR.
- ].
+ ].
].
^ nil
@@ -10996,7 +11002,7 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.433 2003-05-07 15:03:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.434 2003-08-12 10:24:08 stefan Exp $'
! !
XWorkstation initialize!