--- a/XWorkstation.st Mon Feb 15 23:40:31 2016 +0100
+++ b/XWorkstation.st Tue Feb 16 12:23:44 2016 +0100
@@ -380,6 +380,128 @@
#undef __myInstPtr
#define __myInstPtr(obj) ((struct __XWorkstation_struct *)(obj))
+static char* requestNames[] = {
+ "X_CreateWindow", // 0
+ "X_ChangeWindowAttributes",
+ "X_GetWindowAttributes",
+ "X_DestroyWindow",
+ "X_DestroySubwindows", // 4
+ "X_ChangeSaveSet", // 5
+ "X_ReparentWindow",
+ "X_MapWindow",
+ "X_MapSubwindows",
+ "X_UnmapWindow",
+ "X_UnmapSubwindows", // 10
+ "X_ConfigureWindow",
+ "X_CirculateWindow",
+ "X_GetGeometry",
+ "X_QueryTree",
+ "X_InternAtom",
+ "X_GetAtomName",
+ "X_ChangeProperty",
+ "X_DeleteProperty",
+ "X_GetProperty",
+ "X_ListProperties",
+ "X_SetSelectionOwner",
+ "X_GetSelectionOwner",
+ "X_ConvertSelection",
+ "X_SendEvent",
+ "X_GrabPointer",
+ "X_UngrabPointer",
+ "X_GrabButton",
+ "X_UngrabButton",
+ "X_ChangeActivePointerGrab",
+ "X_GrabKeyboard",
+ "X_UngrabKeyboard",
+ "X_GrabKey",
+ "X_UngrabKey",
+ "X_AllowEvents",
+ "X_GrabServer",
+ "X_UngrabServer",
+ "X_QueryPointer",
+ "X_GetMotionEvents",
+ "X_TranslateCoords",
+ "X_WarpPointer",
+ "X_SetInputFocus",
+ "X_GetInputFocus",
+ "X_QueryKeymap",
+ "X_OpenFont",
+ "X_CloseFont",
+ "X_QueryFont",
+ "X_QueryTextExtents",
+ "X_ListFonts",
+ "X_ListFontsWithInfo",
+ "X_SetFontPath",
+ "X_GetFontPath",
+ "X_CreatePixma",
+ "X_FreePixmap",
+ "X_CreateGC",
+ "X_ChangeGC",
+ "X_CopyGC",
+ "X_SetDashes",
+ "X_SetClipRectangles",
+ "X_FreeGC",
+ "X_ClearArea",
+ "X_CopyArea",
+ "X_CopyPlane",
+ "X_PolyPoint",
+ "X_PolyLine",
+ "X_PolySegment",
+ "X_PolyRectangle",
+ "X_PolyArc",
+ "X_FillPoly",
+ "X_PolyFillRectangle",
+ "X_PolyFillArc",
+ "X_PutImage",
+ "X_GetImage",
+ "X_PolyText8",
+ "X_PolyText16",
+ "X_ImageText8",
+ "X_ImageText16",
+ "X_CreateColormap",
+ "X_FreeColormap",
+ "X_CopyColormapAndFree",
+ "X_InstallColormap",
+ "X_UninstallColormap",
+ "X_ListInstalledColormaps",
+ "X_AllocColor",
+ "X_AllocNamedColor",
+ "X_AllocColorCells",
+ "X_AllocColorPlanes",
+ "X_FreeColors",
+ "X_StoreColors",
+ "X_StoreNamedColor",
+ "X_QueryColors",
+ "X_LookupColor",
+ "X_CreateCursor",
+ "X_CreateGlyphCursor",
+ "X_FreeCursor",
+ "X_RecolorCursor",
+ "X_QueryBestSize",
+ "X_QueryExtension",
+ "X_ListExtensions",
+ "X_ChangeKeyboardMapping",
+ "X_GetKeyboardMapping",
+ "X_ChangeKeyboardControl",
+ "X_GetKeyboardControl",
+ "X_Bell",
+ "X_ChangePointerControl",
+ "X_GetPointerControl",
+ "X_SetScreenSaver",
+ "X_GetScreenSaver",
+ "X_ChangeHosts",
+ "X_ListHosts",
+ "X_SetAccessControl",
+ "X_SetCloseDownMode",
+ "X_KillClient",
+ "X_RotateProperties",
+ "X_ForceScreenSaver",
+ "X_SetPointerMapping",
+ "X_GetPointerMapping",
+ "X_SetModifierMapping",
+ "X_GetModifierMapping",
+};
+
/*
* catch X-errors and forward as errorInterrupt:#DisplayError,
* (which itself invokes my handler and optionally raises an exceptionSignal)
@@ -412,8 +534,13 @@
}
if (@global(DeviceWorkstation:ErrorPrinting) == true) {
- console_fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%"_lx_"\n",
- event->request_code, event->request_code,
+ 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);
@@ -1667,7 +1794,7 @@
Also, XQuartz does not work..."
OperatingSystem isOSXlike ifTrue:[
- ^ true
+ ^ true
].
^ super suppressShadowViews
!
@@ -2291,7 +2418,7 @@
destroyView:aViewOrNil withId:aWindowId
XftFontDescription notNil ifTrue:[
- XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
+ XftFontDescription aboutToDestroyViewWithDevice:self id:aWindowId.
].
self primDestroyViewWithId:aWindowId.
self removeKnownView:aViewOrNil withId:aWindowId.
@@ -5578,7 +5705,7 @@
"/ (especially Win32 & Xlib)
dispatchingExpose notNil ifTrue:[
- ^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
+ ^ self exposeEventPendingFor:dispatchingExpose withSync:ConservativeSync
].
^ self eventPendingWithSync:ConservativeSync
@@ -5635,20 +5762,20 @@
OBJ rslt = false;
if (ISCONNECTED) {
- Display *dpy = myDpy;
-
- if (XEventsQueued(dpy, QueuedAlready)) {
- RETURN (true);
- }
-
- ENTER_XLIB();
- if (doSync == true) {
- XSync(dpy, 0); /* make certain everything is flushed */
- }
- if (XEventsQueued(dpy, QueuedAfterFlush)) {
- rslt = true;
- }
- LEAVE_XLIB();
+ Display *dpy = myDpy;
+
+ if (XEventsQueued(dpy, QueuedAlready)) {
+ RETURN (true);
+ }
+
+ ENTER_XLIB();
+ if (doSync == true) {
+ XSync(dpy, 0); /* make certain everything is flushed */
+ }
+ if (XEventsQueued(dpy, QueuedAfterFlush)) {
+ rslt = true;
+ }
+ LEAVE_XLIB();
}
RETURN ( rslt );
%}
@@ -5673,9 +5800,9 @@
%{ /* UNLIMITEDSTACK */
if (ISCONNECTED) {
- if (XEventsQueued(myDpy, QueuedAlready)) {
- RETURN(true);
- }
+ if (XEventsQueued(myDpy, QueuedAlready)) {
+ RETURN(true);
+ }
}
RETURN ( false );
%}
@@ -7160,8 +7287,8 @@
"
Screen current
- fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
- of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
+ fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' RESOLUTION notExistent)
+ of:(Screen current getDefaultFontWithEncoding:#'iso10646-1')
"
!
@@ -7445,8 +7572,8 @@
!
getFontWithFoundry:foundry family:family weight:weight
- slant:slant spacing:spc pixelSize:pSize size:size
- encoding:encoding
+ slant:slant spacing:spc pixelSize:pSize size:size
+ encoding:encoding
"get the specified font, if not available, return nil.
Individual attributes can be left empty (i.e. '') or nil to match any.
@@ -7467,64 +7594,64 @@
"this works only on 'Release >= 3' - X-servers"
"name is:
- -foundry-family -weight -slant-
- sony helvetica bold r
- adobe courier medium i
- msic fixed o
- ... ...
+ -foundry-family -weight -slant-
+ sony helvetica bold r
+ adobe courier medium i
+ msic fixed o
+ ... ...
"
size isNil ifTrue:[
- sizeMatch := '*'
+ sizeMatch := '*'
] ifFalse:[
- sizeMatch := size printString , '0'
+ sizeMatch := size printString , '0'
].
foundry isNil ifTrue:[
- foundryMatch := '*'
+ foundryMatch := '*'
] ifFalse:[
- foundryMatch := foundry
+ foundryMatch := foundry
].
family isNil ifTrue:[
- familyMatch := '*'
+ familyMatch := '*'
] ifFalse:[
- familyMatch := family
+ familyMatch := family
].
weight isNil ifTrue:[
- weightMatch := '*'
+ weightMatch := '*'
] ifFalse:[
- weightMatch := weight
+ weightMatch := weight
].
slant isNil ifTrue:[
- slantMatch := '*'
+ slantMatch := '*'
] ifFalse:[
- slantMatch := slant
+ slantMatch := slant
].
spc isNil ifTrue:[
- spcMatch := '*'
+ spcMatch := '*'
] ifFalse:[
- spcMatch := spc
+ spcMatch := spc
].
pSize isNil ifTrue:[
- pSizeMatch := '*'
+ pSizeMatch := '*'
] ifFalse:[
- pSizeMatch := pSize printString
+ pSizeMatch := pSize printString
].
encoding isNil ifTrue:[
- encodingMatch := '*'
+ encodingMatch := '*'
] ifFalse:[
- encodingMatch := encoding
+ encodingMatch := encoding
].
theName := ('-' , foundryMatch,
- '-' , familyMatch,
- '-' , weightMatch ,
- '-' , slantMatch ,
- '-' , spcMatch ,
- '-*' ,
- '-' , pSizeMatch ,
- '-' , sizeMatch ,
- '-*-*-*-*' ,
- '-' , encodingMatch).
+ '-' , familyMatch,
+ '-' , weightMatch ,
+ '-' , slantMatch ,
+ '-' , spcMatch ,
+ '-*' ,
+ '-' , pSizeMatch ,
+ '-' , sizeMatch ,
+ '-*-*-*-*' ,
+ '-' , encodingMatch).
"/ Transcript showCR:theName; endEntry.
@@ -7533,24 +7660,24 @@
"
Display
- getFontWithFoundry:'*'
- family:'courier'
- weight:'medium'
- slant:'r'
- spacing:nil
- pixelSize:nil
- size:13
- encoding:#'iso8859-1'.
+ getFontWithFoundry:'*'
+ family:'courier'
+ weight:'medium'
+ slant:'r'
+ spacing:nil
+ pixelSize:nil
+ size:13
+ encoding:#'iso8859-1'.
Display
- getFontWithFoundry:'*'
- family:'courier'
- weight:'medium'
- slant:'r'
- spacing:nil
- pixelSize:nil
- size:13
- encoding:#'iso10646-1'
+ getFontWithFoundry:'*'
+ family:'courier'
+ weight:'medium'
+ slant:'r'
+ spacing:nil
+ pixelSize:nil
+ size:13
+ encoding:#'iso10646-1'
"
"Modified: 10.4.1997 / 19:15:44 / cg"
@@ -13253,47 +13380,47 @@
|selection|
buffer isNil ifTrue:[
- ^ nil.
+ ^ nil.
].
targetID == (display atomIDOf:#STRING) ifTrue:[
- display clipboardEncoding notNil ifTrue:[
- selection := buffer decodeFrom:display clipboardEncoding
- ].
- selection := buffer.
+ display clipboardEncoding notNil ifTrue:[
+ selection := buffer decodeFrom:display clipboardEncoding
+ ].
+ selection := buffer.
] ifFalse:[targetID == (display atomIDOf:#'UTF8_STRING') ifTrue:[
"/ Transcript show:'UTF8: '; showCR:buffer storeString.
- selection := buffer utf8Decoded.
+ selection := buffer utf8Decoded.
] ifFalse:[targetID == (display atomIDOf:#TEXT) ifTrue:[
"/ Transcript show:'TEXT: '; showCR:buffer storeString.
- selection := buffer asString
+ selection := buffer asString
] ifFalse:[targetID == (display atomIDOf:#'COMPOUND_TEXT') ifTrue:[
"/ Transcript show:'COMPOUND_TEXT: '; showCR:buffer storeString.
- selection := buffer asString
+ selection := buffer asString
]]]].
selection notNil ifTrue:[
- (selection endsWith:Character cr) ifTrue:[
- selection := selection asStringCollection copyWith:''
- ].
- ^ selection.
+ (selection endsWith:Character cr) ifTrue:[
+ selection := selection asStringCollection copyWith:''
+ ].
+ ^ selection.
].
targetID == (display atomIDOf:#'TARGETS') ifTrue:[
- ^ buffer
+ ^ buffer
].
targetID == (display atomIDOf:#'ST_OBJECT') ifTrue:[
- "require libboss to be loaded"
- (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
- 'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
- ^ nil
- ].
- ^ (Object
- readBinaryFrom:(ReadStream on:buffer)
- onError:[:ex |
- ('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
- nil
- ])
+ "require libboss to be loaded"
+ (Smalltalk isClassLibraryLoaded:'libstx_libboss') ifFalse:[
+ 'SelectionFetch: cannot decode object (libboss library missing)' errorPrintCR.
+ ^ nil
+ ].
+ ^ (Object
+ readBinaryFrom:(ReadStream on:buffer)
+ onError:[:ex |
+ ('SelectionFetch: error while decoding binary object: ',ex description) errorPrintCR.
+ nil
+ ])
].
'XWorkstation: unimplemented property targetID: ' infoPrint. (display atomName:targetID) infoPrint.