[gtk-vnc] Make pointer warp check more robust



commit da3df38274629bfb8af2f09113e8dd6ef284dd88
Author: Daniel P. Berrange <berrange redhat com>
Date:   Fri Jan 28 11:58:25 2011 +0000

    Make pointer warp check more robust
    
    The pointer warp code checks whether the local cursor
    is hitting a boundary == 0, ==width, or ==height. This
    is slightly too strict, it should check <= 0, >= width
    or >= height
    
    * src/vncdisplay.c: Make boundary check more robust

 src/vncdisplay.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index f8ee9ea..c816c7f 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -637,10 +637,10 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
 		 * may still be only half way across the screen. Without
 		 * this warp, the server pointer would thus appear to hit
 		 * an invisible wall */
-		if (x == 0) x += 200;
-		if (y == 0) y += 200;
-		if (x == (gdk_screen_get_width(screen) - 1)) x -= 200;
-		if (y == (gdk_screen_get_height(screen) - 1)) y -= 200;
+		if (x <= 0) x += 200;
+		if (y <= 0) y += 200;
+		if (x >= (gdk_screen_get_width(screen) - 1)) x -= 200;
+		if (y >= (gdk_screen_get_height(screen) - 1)) y -= 200;
 
 		if (x != (int)motion->x_root || y != (int)motion->y_root) {
 			gdk_display_warp_pointer(display, screen, x, y);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]