#REFACTORING
authorStefan Vogel <sv@exept.de>
Sat, 13 Feb 2016 21:23:57 +0100
changeset 7141 83d745d0d70f
parent 7140 9c2e17ff88f8
child 7142 439177d49d77
#REFACTORING class: XWorkstation changed: #iconSizes
XWorkstation.st
--- a/XWorkstation.st	Sat Feb 13 21:23:27 2016 +0100
+++ b/XWorkstation.st	Sat Feb 13 21:23:57 2016 +0100
@@ -1302,50 +1302,49 @@
 
     |xIconSizes count ret|
 
+    count := 0.
 %{
     int screen = __intVal(__INST(screen));
     XIconSize *sizeList;
     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);
-	}
-    }
-%}.
-    xIconSizes isNil ifTrue:[^ nil].
-
-    ret := OrderedCollection new:count.
+        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;
-
-	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.
-	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 add: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.