Revision: 5029
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=5029&view=rev
Author:   bphinz
Date:     2013-01-15 22:45:29 +0000 (Tue, 15 Jan 2013)
Log Message:
-----------
more fixes for remote cursor rendering. State wasn't always being initialized 
correctly.

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/DesktopWindow.java

Modified: trunk/java/com/tigervnc/vncviewer/DesktopWindow.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/DesktopWindow.java        2013-01-15 
22:12:34 UTC (rev 5028)
+++ trunk/java/com/tigervnc/vncviewer/DesktopWindow.java        2013-01-15 
22:45:29 UTC (rev 5029)
@@ -182,7 +182,7 @@
 
     if (softCursor != null) {
       setCursor(softCursor); 
-      cursorAvailable = true;
+      cursorAvailable = false;
       return;
     }
 
@@ -191,7 +191,6 @@
     }
 
     showLocalCursor();
-    return;
   }
 
   public void setServerPF(PixelFormat pf) {
@@ -254,8 +253,7 @@
     if (overlapsCursor(x, y, w, h)) hideLocalCursor();
     im.fillRect(x, y, w, h, pix);
     damageRect(new Rect(x, y, x+w, y+h));
-    if (!cc.cp.supportsLocalCursor)
-      showLocalCursor();
+    showLocalCursor();
   }
 
   final public void imageRect(int x, int y, int w, int h,
@@ -263,8 +261,7 @@
     if (overlapsCursor(x, y, w, h)) hideLocalCursor();
     im.imageRect(x, y, w, h, pix);
     damageRect(new Rect(x, y, x+w, y+h));
-    if (!cc.cp.supportsLocalCursor)
-      showLocalCursor();
+    showLocalCursor();
   }
 
   final public void copyRect(int x, int y, int w, int h,
@@ -273,6 +270,7 @@
       hideLocalCursor();
     im.copyRect(x, y, w, h, srcX, srcY);
     damageRect(new Rect(x, y, x+w, y+h));
+    showLocalCursor();
   }
 
 
@@ -392,8 +390,11 @@
 
   /** Mouse-Motion callback function */
   private void mouseMotionCB(MouseEvent e) {
-    if (!cc.viewer.viewOnly.getValue())
+    if (!cc.viewer.viewOnly.getValue()) {
       cc.writePointerEvent(e);
+      lastX = e.getX();
+      lastY = e.getY();      
+    }
     // - If local cursor rendering is enabled then use it
     if (cursorAvailable) {
       // - Render the cursor!
@@ -403,13 +404,10 @@
             e.getY() >= 0 && e.getY() < im.height()) {
           cursorPosX = e.getX();
           cursorPosY = e.getY();
-          if (!cc.cp.supportsLocalCursor)
-            showLocalCursor();
+          showLocalCursor();
         }
       }
     }
-    lastX = e.getX();
-    lastY = e.getY();      
   }
   public void mouseDragged(MouseEvent e) { mouseMotionCB(e);}
   public void mouseMoved(MouseEvent e) { mouseMotionCB(e);}
@@ -468,6 +466,9 @@
       cursorVisible = false;
       im.imageRect(cursorBackingX, cursorBackingY, cursorBacking.width(),
                    cursorBacking.height(), cursorBacking.data);
+      damageRect(new Rect(cursorBackingX, cursorBackingY,
+                          cursorBackingX+cursorBacking.width(),
+                          cursorBackingY+cursorBacking.height()));
     }
   }
 
@@ -480,7 +481,6 @@
         return;
       }
       cursorVisible = true;
-      if (cc.cp.supportsLocalCursor) return;
 
       int cursorLeft = cursor.hotspot.x;
       int cursorTop = cursor.hotspot.y;
@@ -502,6 +502,7 @@
 
       im.maskRect(cursorLeft, cursorTop, cursor.width(), cursor.height(),
                   cursor.data, cursor.mask);
+      damageRect(new Rect(x, y, x+w, y+h));
     }
   }
 
@@ -532,8 +533,8 @@
   Thread setColourMapEntriesTimerThread;
 
   Cursor cursor;
-  boolean cursorVisible;     // Is cursor currently rendered?
-  boolean cursorAvailable;   // Is cursor available for rendering?
+  boolean cursorVisible = false;     // Is cursor currently rendered?
+  boolean cursorAvailable = false;   // Is cursor available for rendering?
   int cursorPosX, cursorPosY;
   ManagedPixelBuffer cursorBacking;
   int cursorBackingX, cursorBackingY;

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


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to