Revision: 4316
          http://vexi.svn.sourceforge.net/vexi/?rev=4316&view=rev
Author:   clrg
Date:     2012-01-06 16:37:27 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
Fix frameicon only being set if icon was not yet loaded

Modified Paths:
--------------
    trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
    trunk/org.vexi-core.main/src/main/java/org/vexi/graphics/Picture.java

Modified: trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java
===================================================================
--- trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java   
2012-01-06 11:53:40 UTC (rev 4315)
+++ trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java   
2012-01-06 16:37:27 UTC (rev 4316)
@@ -472,20 +472,19 @@
     // FIXME: handle exceptions etc - better checking of types?
     /** Prepare an image for setting it as the icon of this surface */
     public final void setIcon(JS newicon) throws JSExn {
+        final Callable seticon = new Callable() {
+            public Object run(Object o) {
+               _setIcon(icon);
+                return o;
+            }
+        };
         icon = newicon == null ? null : Picture.load(newicon, seticon);
-        if (icon==null) {
-            _setIcon(icon);
-            Refresh();
+        if (icon.isLoaded) {
+               // if Picture is already loaded then
+               // the callable is not used
+               _setIcon(icon);
         }
     }
-    private Callable seticon = new Callable() {
-        private synchronized void call() { _setIcon(icon); }
-        public Object run(Object o) {
-            call();
-            Refresh();
-            return o;
-        }
-    };
 
     public final void setMaximized(boolean b) { if (b != maximized) 
_setMaximized(maximized = b); }
     public final void setMinimized(boolean b) { if (b != minimized) 
_setMinimized(minimized = b); }

Modified: trunk/org.vexi-core.main/src/main/java/org/vexi/graphics/Picture.java
===================================================================
--- trunk/org.vexi-core.main/src/main/java/org/vexi/graphics/Picture.java       
2012-01-06 11:53:40 UTC (rev 4315)
+++ trunk/org.vexi-core.main/src/main/java/org/vexi/graphics/Picture.java       
2012-01-06 16:37:27 UTC (rev 4316)
@@ -112,7 +112,9 @@
         return ret;
     }
     
-    /** turns a stream into a Picture.Source and passes it to the callback */
+    /** turns a stream into a Picture.Source and once loaded invokes the
+     *  given notification callback (which is added to the Scheduler)
+     *  NOTE: the callback is not invoked if picture is already loaded */
     private void load(final Callable callback) {
         synchronized (this) {
             if (isLoaded || callback == null) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to