XWorkstation.st
branchjv
changeset 7372 c3559f5e9c3b
parent 7365 05f5fe42c919
parent 7371 d88ae8653ca8
child 7489 07c626716aed
--- a/XWorkstation.st	Thu May 19 07:08:44 2016 +0200
+++ b/XWorkstation.st	Wed Jun 01 07:00:26 2016 +0200
@@ -179,11 +179,21 @@
 # include <X11/extensions/XIE.h>
 #endif
 
+/*
+ * multiscreen extension - if available
+ */
 #ifdef XINERAMA
 # include <X11/extensions/Xinerama.h>
 #endif
 
 /*
+ * XCURSOR extension - if available
+ */
+#ifdef XCURSOR
+# include <X11/Xcursor/Xcursor.h>
+#endif
+
+/*
  * xft library (based on RENDER extension) - if available
  */
 #ifdef XFT
@@ -1074,7 +1084,7 @@
     "return the displays fileNumber - for select"
 
 %{  /* NOCONTEXT */
-#ifndef WIN32
+#ifndef __win32__
     if (ISCONNECTED) {
 	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
     }
@@ -1484,42 +1494,42 @@
     int cnt;
 
     if (ISCONNECTED) {
-        Display *dpy = myDpy;
-        int status;
-
-        ENTER_XLIB();
-        status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
-        LEAVE_XLIB();
-        if (status > 0) {
-           xIconSizes = __MKEXTERNALBYTES(sizeList);
-           count = __MKSMALLINT(cnt);
-        }
+	Display *dpy = myDpy;
+	int status;
+
+	ENTER_XLIB();
+	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
+	LEAVE_XLIB();
+	if (status > 0) {
+	   xIconSizes = __MKEXTERNALBYTES(sizeList);
+	   count = __MKSMALLINT(cnt);
+	}
     }
 %}.
     count == 0 ifTrue:[^ nil].
 
     ret := Array new:count.
     1 to:count do:[ :i |
-        |minWidth minHeight maxWidth maxHeight widthStep heightStep d|
-
-%{
-        XIconSize *slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
-        minWidth = __MKSMALLINT(slp->min_width);
-        minHeight = __MKSMALLINT(slp->min_height);
-        maxWidth = __MKSMALLINT(slp->max_width);
-        maxHeight = __MKSMALLINT(slp->max_height);
-        widthStep = __MKSMALLINT(slp->width_inc);
-        heightStep = __MKSMALLINT(slp->height_inc);
-%}.
-        d := IdentityDictionary new:6.
-        d at:#minWidth put:minWidth.
-        d at:#maxWidth put:maxWidth.
-        d at:#widthStep put:widthStep.
-        d at:#minHeight put:minHeight.
-        d at:#maxHeight put:maxHeight.
-        d at:#heightStep put:heightStep.
-
-        ret at:i put:d.
+	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
+
+%{
+	XIconSize *slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
+	minWidth = __MKSMALLINT(slp->min_width);
+	minHeight = __MKSMALLINT(slp->min_height);
+	maxWidth = __MKSMALLINT(slp->max_width);
+	maxHeight = __MKSMALLINT(slp->max_height);
+	widthStep = __MKSMALLINT(slp->width_inc);
+	heightStep = __MKSMALLINT(slp->height_inc);
+%}.
+	d := IdentityDictionary new:6.
+	d at:#minWidth put:minWidth.
+	d at:#maxWidth put:maxWidth.
+	d at:#widthStep put:widthStep.
+	d at:#minHeight put:minHeight.
+	d at:#maxHeight put:maxHeight.
+	d at:#heightStep put:heightStep.
+
+	ret at:i put:d.
     ].
 
     xIconSizes free.
@@ -1824,7 +1834,7 @@
      Blame: I cannot ask via server vendor, if its a Quartz display, because
      it does not return a valid server vendor string"
     OperatingSystem isOSXlike ifTrue:[
-        ^ false
+	^ false
     ].
     ^ true
 
@@ -1866,14 +1876,14 @@
 !
 
 supportsXCursor
-    "return true, if the XCursor extension (deep cursors ) are supported 
+    "return true, if the XCursor extension (deep cursors ) are supported
      on this display.
      Both Smalltalk has to be compiled to support it (as client),
      and the display we are connected to must support it,
      to return true here."
 
-     ^ self class hasXCursorLibrary 
-        and:[self hasCursorExtension]
+     ^ self class hasXCursorLibrary
+	and:[self hasCursorExtension]
 
     "
      Display supportsXCursor
@@ -1883,15 +1893,15 @@
 !
 
 supportsXftFonts
-    "return true, if XftFonts (nice looking truetype fonts) 
+    "return true, if XftFonts (nice looking truetype fonts)
      are supported on this display.
      Both Smalltalk has to be compiled to support it (as client),
      and the display we are connected to must support it,
      to return true here."
 
-     ^ XftFontDescription notNil 
-        and:[self class hasXftLibrary 
-        and:[self hasRenderExtension]]
+     ^ XftFontDescription notNil
+	and:[self class hasXftLibrary
+	and:[self hasRenderExtension]]
 
     "
      Display supportsXftFonts
@@ -1907,7 +1917,7 @@
      Also, with XQuartz, it does not work, because we cannot readout the screen..."
 
     OperatingSystem isOSXlike ifTrue:[
-        ^ true
+	^ true
     ].
     ^ super suppressShadowViews
 !
@@ -5835,10 +5845,10 @@
 	ENTER_XLIB();
 	if (__isExternalAddress(aWindowIdOrNil)) {
 	    win = __WindowVal(aWindowIdOrNil);
-	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) 
+	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev))
 		;;
 	} else {
-	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) 
+	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev))
 		;;
 	}
 	LEAVE_XLIB();
@@ -7311,7 +7321,7 @@
 
     listOfXFonts := nil.
     XftFontDescription notNil ifTrue:[
-        XftFontDescription flushListOfAvailableFonts.
+	XftFontDescription flushListOfAvailableFonts.
     ].
 
     "
@@ -7559,15 +7569,15 @@
 
     props := self fontPropertiesOf:aFontId.
     #('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try |
-        |fullNameID|
-
-        fullNameID := props at:try ifAbsent:nil.
-        fullNameID notNil ifTrue:[
-            fullName := self atomName:fullNameID.
-            fullName notEmptyOrNil ifTrue:[
-                ^ fullName
-            ].
-        ]
+	|fullNameID|
+
+	fullNameID := props at:try ifAbsent:nil.
+	fullNameID notNil ifTrue:[
+	    fullName := self atomName:fullNameID.
+	    fullName notEmptyOrNil ifTrue:[
+		^ fullName
+	    ].
+	]
     ].
 
     ^ nil.
@@ -7905,24 +7915,24 @@
     |names listOfXftFonts|
 
     listOfXFonts isNil ifTrue:[
-        names := self getAvailableFontsMatching:'*'.
-        names isNil ifTrue:[
-            "no names returned ..."
-            ^ nil
-        ].
-        listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
-        listOfXFonts := FontDescription genericFonts, listOfXFonts.
+	names := self getAvailableFontsMatching:'*'.
+	names isNil ifTrue:[
+	    "no names returned ..."
+	    ^ nil
+	].
+	listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName].
+	listOfXFonts := FontDescription genericFonts, listOfXFonts.
     ].
 
     self supportsXftFonts ifTrue:[
-        UserPreferences current useXFontsOnly ifFalse:[
-            listOfXftFonts := XftFontDescription listOfAvailableFonts.
-
-            UserPreferences current useXftFontsOnly ifTrue:[
-                ^ listOfXftFonts
-            ].
-            ^ listOfXftFonts , listOfXFonts.
-        ].
+	UserPreferences current useXFontsOnly ifFalse:[
+	    listOfXftFonts := XftFontDescription listOfAvailableFonts.
+
+	    UserPreferences current useXftFontsOnly ifTrue:[
+		^ listOfXftFonts
+	    ].
+	    ^ listOfXftFonts , listOfXFonts.
+	].
     ].
     ^ listOfXFonts
 
@@ -8912,30 +8922,30 @@
     int fun = -1;
 
     if (ISCONNECTED) {
-        if (__isExternalAddress(aGCId)) {
-            GC gc = __GCVal(aGCId);
-            if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
-            else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
-            else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
-            else if (aFunctionSymbol == @symbol(and)) fun = GXand;
-            else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
-            else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
-            else if (aFunctionSymbol == @symbol(or)) fun = GXor;
-            else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
-            else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
-            else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
-            else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
-            else if (aFunctionSymbol == @symbol(set)) fun = GXset;
-            else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
-            else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
-            else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
-            if (fun != -1) {
-                ENTER_XLIB();
-                XSetFunction(myDpy, gc, fun);
-                LEAVE_XLIB();
-                RETURN ( self );
-            }
-        }
+	if (__isExternalAddress(aGCId)) {
+	    GC gc = __GCVal(aGCId);
+	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
+	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
+	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
+	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
+	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
+	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
+	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
+	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
+	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
+	    else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert;
+	    else if (aFunctionSymbol == @symbol(clear)) fun = GXclear;
+	    else if (aFunctionSymbol == @symbol(set)) fun = GXset;
+	    else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop;
+	    else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv;
+	    else if (aFunctionSymbol == @symbol(nand)) fun = GXnand;
+	    if (fun != -1) {
+		ENTER_XLIB();
+		XSetFunction(myDpy, gc, fun);
+		LEAVE_XLIB();
+		RETURN ( self );
+	    }
+	}
     }
 %}.
     "
@@ -9103,17 +9113,17 @@
     <context: #return>
 %{
     if (ISCONNECTED) {
-        if (__isExternalAddress(aGCId)
-         && __isSmallInteger(bits)) {
-            unsigned long mask = __intVal(bits);
-            if (__intVal(bits) == -1) {
-                mask = AllPlanes;
-            }
-            ENTER_XLIB();
-            XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
-            LEAVE_XLIB();
-            RETURN ( self );
-        }
+	if (__isExternalAddress(aGCId)
+	 && __isSmallInteger(bits)) {
+	    unsigned long mask = __intVal(bits);
+	    if (__intVal(bits) == -1) {
+		mask = AllPlanes;
+	    }
+	    ENTER_XLIB();
+	    XSetPlaneMask(myDpy, __GCVal(aGCId), mask);
+	    LEAVE_XLIB();
+	    RETURN ( self );
+	}
     }
 %}.
     self primitiveFailedOrClosedConnection
@@ -9245,15 +9255,15 @@
      as hostname:number"
 
     displayId notNil ifTrue:[
-        "/ already connected - you bad guy try to trick me manually ?
-        ^ self
+	"/ already connected - you bad guy try to trick me manually ?
+	^ self
     ].
 
     displayId := self openConnectionTo:aDisplayName.
     displayId isNil ifTrue:[
-        "/ could not connect.
-        DeviceOpenErrorSignal raiseWith:aDisplayName.
-        ^ nil
+	"/ could not connect.
+	DeviceOpenErrorSignal raiseWith:aDisplayName.
+	^ nil
     ].
 
     xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
@@ -9290,8 +9300,8 @@
     self initializeDeviceSignals.
 
     Screen default isNil ifTrue:[
-        "not initialized yet?"
-        self initializeViewStyle.
+	"not initialized yet?"
+	self initializeViewStyle.
     ].
 !
 
@@ -11204,16 +11214,16 @@
     |atomSymbol atom|
 
     atomSymbol := aStringOrSymbol asSymbol.
-    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
-	^ atom.
+    (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:[nil]) notNil]) ifTrue:[
+        ^ atom.
     ].
 
     atom := self primAtomIDOf:atomSymbol create:create.
     atom notNil ifTrue:[
-	atoms isNil ifTrue:[
-	    atoms := IdentityDictionary new.
-	].
-	atoms at:atomSymbol put:atom.
+        atoms isNil ifTrue:[
+            atoms := IdentityDictionary new.
+        ].
+        atoms at:atomSymbol put:atom.
     ].
 
     ^ atom