class: XWorkstation
class definition
changed: #lastErrorString
fix X11 XErrorDB file location
--- a/XWorkstation.st Mon Feb 03 11:30:41 2014 +0100
+++ b/XWorkstation.st Mon Feb 03 11:33:05 2014 +0100
@@ -29,7 +29,8 @@
stxDeviceAtom uuidAtom primaryBuffer windowGroupWindow
maxOperationsUntilFlush operationsUntilFlush'
classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
- DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation'
+ DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation
+ ErrorDBCache'
poolDictionaries:''
category:'Interface-Graphics'
!
@@ -614,25 +615,41 @@
when buffering is on, this may be
an error for a long-ago operation"
- |string s match line|
+ |string s match line requestCode|
string := self errorStringOfLastError.
+ requestCode := self requestCodeOfLastError.
+
"
X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
and append the name of the corresponding X-request
"
- match := 'XRequest.' , self requestCodeOfLastError printString.
- s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil.
- s notNil ifTrue:[
- line := s peekForLineStartingWith:match.
- s close.
- ].
+ match := 'XRequest.' , requestCode printString.
+ ErrorDBCache isNil ifTrue:[
+ ErrorDBCache := IdentityDictionary new.
+ ].
+
+ "if there is no XErrorDB or no entry, the line for the requestCode is cached as nil"
+ line := ErrorDBCache at:requestCode ifAbsentPut:[
+ |errorLine|
+
+ s := '/usr/share/X11/XErrorDB' asFilename readStreamOrNil.
+ s notNil ifTrue:[
+ errorLine := s peekForLineStartingWith:match.
+ errorLine := errorLine copyFrom:(errorLine indexOf:$:)+1.
+ s close.
+ ].
+ errorLine
+ ].
+
line isNil ifTrue:[
- string := string, ' in ', match
- ] ifFalse:[
- string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
- ].
- ^ string
+ line := match
+ ].
+ ^ string , ' in ' , line.
+
+ "
+ Screen lastErrorString
+ "
!
minorCodeOfLastError
@@ -13027,11 +13044,11 @@
!XWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.579 2013-12-20 10:03:12 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.580 2014-02-03 10:33:05 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.579 2013-12-20 10:03:12 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.580 2014-02-03 10:33:05 stefan Exp $'
!
version_SVN