fixed bugs 480 and 488
authoradam <adam@megacz.com>
Tue, 9 Mar 2004 08:19:01 +0000 (08:19 +0000)
committeradam <adam@megacz.com>
Tue, 9 Mar 2004 08:19:01 +0000 (08:19 +0000)
darcs-hash:20040309081901-5007d-1f6b2a7c3c07c17bc6a7cc6279b2df57c594b917.gz

Makefile
src/org/ibex/Font.java
src/org/ibex/Surface.java
src/org/ibex/plat/AWT.java

index 811ea86..6f0ddc0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ libwing_Solaris := -Lupstream/install/sparc-sun-solaris2.7/lib/
 libwing_Solaris +=   upstream/install/sparc-sun-solaris2.7/lib/libWINGs.a
 libwing_Solaris +=   upstream/install/sparc-sun-solaris2.7/lib/libwraster.a
 
-Java2:        build/JVM/ibex.jar
+Java2:        build/Java2/ibex.jar
 JVM:; make Java2
 Linux:    ; make gcj platform=Linux   link_flags="$(libwing_Linux) -lXpm -lX11 -lXext"
 Solaris:  ; make gcj platform=Solaris link_flags="$(libwing_Solaris) -lXpm -lX11 -lXext -lpthread"
@@ -52,7 +52,7 @@ darwin_linker_flags += build/Darwin/org/ibex/plat/OpenGL.java.o build/Darwin/org
 
 target_bin_extension_$(platform) := $(shell echo $(platform) | tr A-Z a-z)
 target_bin_extension_Win32       := exe
-target_bin_extension_JVM         := jar
+target_bin_extension_Java2       := jar
 target_bin_extension             := $(target_bin_extension_$(platform))
 target_bin                       := ibex.$(target_bin_extension)
 
@@ -85,7 +85,6 @@ include Makefile.upstream
 
 plat_classes_AWT     := org.ibex.plat.AWT
 plat_classes_Java2   := org.ibex.plat.Java2 $(plat_classes_AWT)
-plat_classes_JVM     := $(plat_classes_Java2)
 plat_classes_GCJ     := org.ibex.plat.GCJ
 plat_classes_Win32   := org.ibex.plat.Win32 $(plat_classes_GCJ)
 plat_classes_POSIX   := org.ibex.plat.POSIX $(plat_classes_GCJ)
@@ -94,7 +93,7 @@ plat_classes_Linux   := org.ibex.plat.Linux $(plat_classes_X11)
 plat_classes_Solaris := org.ibex.plat.Solaris $(plat_classes_X11)
 plat_classes_Darwin  := org.ibex.plat.Darwin org.ibex.plat.OpenGL $(plat_classes_POSIX)
 
-plat_java_src_sources     := src/org/ibex/plat/$(platform).java
+plat_java_src_sources     := $(patsubst %,build/java/%.java,$(subst .,/,$(plat_classes_$(platform))))
 java_src_sources          := $(shell find src -name '*.java' | grep -v Preprocessor | grep -v plat)
 java_src_sources          += $(plat_java_src_sources)
 java_sources              := $(patsubst src/%.java,     build/java/%.java, $(java_src_sources))
@@ -164,11 +163,10 @@ compile: .compile
 .compile: .install_mips2java .download_bcel-5.1 $(java_sources) $(java_classes); touch $@
 
 ifeq ($(platform),Java2)
-build/class/%.class: .preprocessor $(java_sources) .jikes
+build/class/%.class: build/java/%.java .preprocessor .jikes
        @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
-       rm -rf build/class
        mkdir -p build/class
-       @./.jikes $(java_sources) -d build/class
+       @./.jikes $< -d build/class
 else
 build/class/%.class: build/java/%.java
        @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
@@ -176,12 +174,12 @@ build/class/%.class: build/java/%.java
        $(gcj) -I$(bcel_jar) -C -O0 $< -d build/class
 endif
 
-build/JVM/ibex.jar: .compile build/res/builtin.jar build/class/org/ibex/translators/MIPSApps.class
-       @echo -e "\n\033[1marchiving         .class -> .jar:   build/JVM/ibex.jar\033[0m"
-       mkdir -p build/JVM
-       echo -e "Manifest-Version: 1.0\nMain-Class: org.ibex.Main\n" > build/JVM/.manifest
+build/Java2/ibex.jar: .compile build/res/builtin.jar build/class/org/ibex/translators/MIPSApps.class
+       @echo -e "\n\033[1marchiving         .class -> .jar:   build/Java2/ibex.jar\033[0m"
+       mkdir -p build/Java2
+       echo -e "Manifest-Version: 1.0\nMain-Class: org.ibex.Main\n" > build/Java2/.manifest
        cd build/class/org/ibex; ln -sf ../../../res/builtin.jar
-       cd build/class; $(jar) cfm ../JVM/ibex.jar ../JVM/.manifest \
+       cd build/class; $(jar) cfm ../Java2/ibex.jar ../Java2/.manifest \
                `find . \! -type d` \
                $(patsubst %,../../upstream/mips/build/org/xwt/mips/%*.class, Runtime Registers Syscalls Errno)
 
@@ -282,7 +280,7 @@ build/res/fonts/vera: .download_vera-1.10
        cd build/res/fonts/vera; ln -fs ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraSe.ttf
 build/res/builtin.jar: $(builtin_src:src/%=build/res/%) build/res/fonts/vera
        @echo -e "\n\033[1mzipping            res/* -> .jar: builtin.jar\033[0m"
-       cd build/res; $(jar) cf builtin.jar org/ibex/builtin/scar.png
+       cd build/res; $(jar) cf builtin.jar org/ibex/builtin/scar.png fonts
 build/$(platform)/builtin.o: build/res/builtin.jar
        @echo -e "\n\033[1mwrapping            .jar -> .o: resources.o\033[0m"
        @mkdir -p $(@D)
@@ -327,7 +325,7 @@ build/mips/mipsapps.mips: build/mips/org/ibex/translators/Freetype.c.o build/mip
 
 current_build         := $(shell cat next.build)
 strip_$(platform)     := upstream/install/$(target)/bin/strip build/$(platform)/$(target_bin) -o 
-strip_JVM             := cp build/$(platform)/$(target_bin)
+strip_Java2             := cp build/$(platform)/$(target_bin)
 install-dist:;     $(strip_$(platform)) /var/www/org/xwt/dist/master/ibex-$(current_build).$(target_bin_extension).unsigned
 dist: compile
        (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
@@ -338,7 +336,7 @@ dist: compile
        make install-dist platform=Linux
        make install-dist platform=Solaris
        make install-dist platform=Darwin
-       make install-dist platform=JVM
+       make install-dist platform=Java2
        echo -e "\n\n\n*** DONE ******************************************"
 
 propose-patch:
index fc84979..ea17dff 100644 (file)
@@ -123,9 +123,10 @@ public class Font {
         Glyph g = (Glyph)glyphsToBeRendered.remove(false);
         if (g == null) { glyphRenderingTaskIsScheduled = false; return; }
         Log.debug(Font.class, "glyphRenderingTask dequeued glyph " + g.c + " of font " + g.font);
-        if (g.isLoaded) { perform(); /* tailcall to the next glyph */ return; }
-        Log.debug(Glyph.class, "rendering glyph " + g.c);
-        try { freetype.renderGlyph(g); } catch (IOException e) { Log.info(Freetype.class, e); }
+        if (!g.isLoaded) {
+            Log.debug(Glyph.class, "rendering glyph " + g.c);
+            try { freetype.renderGlyph(g); } catch (IOException e) { Log.info(Freetype.class, e); }
+        }
         Scheduler.add(this);          // keep ourselves in the queue until there are no glyphs to render
         glyphRenderingTaskIsScheduled = true;
     } };
index 48eb198..394f299 100644 (file)
@@ -126,16 +126,17 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
     }
 
     /** we enqueue ourselves in the Scheduler when we have a Move message to deal with */
-    public void perform() {
-        if (mousex == newmousex && mousey == newmousey) return;
-        int oldmousex = mousex;     mousex = newmousex;
-        int oldmousey = mousey;     mousey = newmousey;
-        String oldcursor = cursor;  cursor = "default";
-        // Root gets motion events outside itself (if trapped)
-        if (!root.inside(oldmousex, oldmousey) && !root.inside(mousex, mousey) && (button1 || button2 || button3))
-            root.putAndTriggerTrapsAndCatchExceptions("_Move", T);
-        if (!cursor.equals(oldcursor)) syncCursor();
-    }
+    private Scheduler.Task mover = new Scheduler.Task() {
+            public void perform() {
+                if (mousex == newmousex && mousey == newmousey) return;
+                int oldmousex = mousex;     mousex = newmousex;
+                int oldmousey = mousey;     mousey = newmousey;
+                String oldcursor = cursor;  cursor = "default";
+                // Root gets motion events outside itself (if trapped)
+                if (!root.inside(oldmousex, oldmousey) && !root.inside(mousex, mousey) && (button1 || button2 || button3))
+                    root.putAndTriggerTrapsAndCatchExceptions("_Move", T);
+                if (!cursor.equals(oldcursor)) syncCursor();
+            } };
 
     /**
      *  Notify Ibex that the mouse has moved. If the mouse leaves the
@@ -146,7 +147,7 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
     protected final void Move(final int newmousex, final int newmousey) {
         this.newmousex = newmousex;
         this.newmousey = newmousey;
-        Scheduler.add(this);
+        Scheduler.add(mover);
     }
 
     protected final void HScroll(int pixels) { new Message("_HScroll", new Integer(pixels), root); }
@@ -181,7 +182,10 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
     protected final void Minimized(boolean b) { minimized = b; new Message("Minimized", b ? T : F, root); }
     protected final void Maximized(boolean b) { maximized = b; new Message("Maximized", b ? T : F, root); }
     protected final void Focused(boolean b) { new Message("Focused", b ? T : F, root); }
-    public void Refresh() { Scheduler.add(new Scheduler.Task() { public void perform() { } }); }
+
+    private boolean scheduled = false;
+    public void Refresh() { if (!scheduled) Scheduler.add(this); scheduled = true; }
+    public void perform() { scheduled = false; Scheduler.renderAll(); }
 
     public final void setMaximized(boolean b) { if (b != maximized) _setMaximized(maximized = b); }
     public final void setMinimized(boolean b) { if (b != minimized) _setMinimized(minimized = b); }
@@ -228,7 +232,7 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task {
 
     /** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
     public synchronized void render() {
-
+        scheduled = false;
         // make sure the root is properly sized
         do {
             abort = false;
index c247a97..c7a1dce 100644 (file)
@@ -324,13 +324,17 @@ public class AWT extends JVM {
 
         public void setMinimumSize(int minx, int miny, boolean resizable) { if (frame != null) frame.setResizable(resizable); }
 
+        private int oldfill = 0x0;
         public void render() {
             // useful optimizatin;
-            window.setBackground((root.fillcolor & 0xFF000000) == 0 ?
-                                 Color.white :
-                                 new Color((root.fillcolor >> 16) & 0xff,
-                                           (root.fillcolor >> 8) & 0xff,
-                                           (root.fillcolor) & 0xff));
+            if (oldfill != root.fillcolor) {
+                oldfill = root.fillcolor;
+                window.setBackground((root.fillcolor & 0xFF000000) == 0 ?
+                                     Color.white :
+                                     new Color((root.fillcolor >> 16) & 0xff,
+                                               (root.fillcolor >> 8) & 0xff,
+                                               (root.fillcolor) & 0xff));
+            }
             super.render();
         }