Revision: 4466
          http://vexi.svn.sourceforge.net/vexi/?rev=4466&view=rev
Author:   clrg
Date:     2012-12-13 03:47:32 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
Prevent mousewheel messages stacking

Modified Paths:
--------------
    trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.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-12-10 06:30:01 UTC (rev 4465)
+++ trunk/org.vexi-core.main/src/main/java/org/vexi/core/Surface.java   
2012-12-13 03:47:32 UTC (rev 4466)
@@ -237,10 +237,16 @@
         message(SC_Focused, b ? JSU.T : JSU.F);
     }
 
-    protected final void HScroll(int pixels) { message(SC_HScroll, 
SC__HScroll, JSU.N(pixels)); }
-    protected final void VScroll(int pixels) { message(SC_VScroll, 
SC__VScroll, JSU.N(pixels)); }
-    protected final void HScroll(float lines) { message(SC_HScroll, 
SC__HScroll, JSU.N(lines)); }
-    protected final void VScroll(float lines) { message(SC_VScroll, 
SC__VScroll, JSU.N(lines)); }
+    // prevent scrolling requests from stacking
+    // as scrolling often results in a delayed
+    // response/render as the screen updates;
+    // these values get reset by Message
+    private static int hscroll = 0;
+    private static int vscroll = 0;
+    protected final void HScroll(int pixels) { hscroll += pixels; 
message(SC_HScroll, SC__HScroll, null); }
+    protected final void VScroll(int pixels) { vscroll += pixels; 
message(SC_VScroll, SC__VScroll, null); }
+    protected final void HScroll(float lines) { /* UNSUPPORTED 
message(SC_HScroll, SC__HScroll, JSU.N(lines)); */ }
+    protected final void VScroll(float lines) { /* UNSUPPORTED 
message(SC_VScroll, SC__VScroll, JSU.N(lines)); */ }
 
     protected final void Press(final int button) {
         last_press_x = mousex;
@@ -429,8 +435,8 @@
                 return o;
             }
             
-            // set up appropriate combination key values and allow clipboard 
access
             if (event==SC_KeyPressed) {
+                // set up appropriate combination key values
                 String value = JSU.toString(this.value);
                 if (shift && !value.equals("shift")) {
                     value = value.toUpperCase();
@@ -443,6 +449,13 @@
                 }
                 this.value = JSU.S(value);
                 surface.keypress_scheduled = false;
+                
+            } else if (event==SC_HScroll) {
+               value = JSU.N(hscroll);
+               hscroll = 0;
+            } else if (event==SC_VScroll) {
+               value = JSU.N(vscroll);
+               vscroll = 0;
             }
             
             // propagate message through box tree

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to