From d2dd53f5b6d71bee2fa322499dea0fb4ea0735d7 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Wed, 23 Jan 2013 23:12:32 +0000 Subject: [PATCH] When the desktop size is less than the viewport size, ignore mouse events that occur in the interstitial area git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5035 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/com/tigervnc/vncviewer/DesktopWindow.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/java/com/tigervnc/vncviewer/DesktopWindow.java b/java/com/tigervnc/vncviewer/DesktopWindow.java index 7254a0b8..0fcfcb11 100644 --- a/java/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/com/tigervnc/vncviewer/DesktopWindow.java @@ -390,11 +390,10 @@ class DesktopWindow extends JPanel implements /** Mouse-Motion callback function */ private void mouseMotionCB(MouseEvent e) { - if (!cc.viewer.viewOnly.getValue()) { + if (!cc.viewer.viewOnly.getValue() && + e.getX() >= 0 && e.getX() <= scaledWidth && + e.getY() >= 0 && e.getY() <= scaledHeight) cc.writePointerEvent(e); - lastX = e.getX(); - lastY = e.getY(); - } // - If local cursor rendering is enabled then use it if (cursorAvailable) { // - Render the cursor! @@ -408,13 +407,17 @@ class DesktopWindow extends JPanel implements } } } + lastX = e.getX(); + lastY = e.getY(); } public void mouseDragged(MouseEvent e) { mouseMotionCB(e);} public void mouseMoved(MouseEvent e) { mouseMotionCB(e);} /** Mouse callback function */ private void mouseCB(MouseEvent e) { - if (!cc.viewer.viewOnly.getValue()) + if (!cc.viewer.viewOnly.getValue() && + e.getX() >= 0 && e.getX() <= scaledWidth && + e.getY() >= 0 && e.getY() <= scaledHeight) cc.writePointerEvent(e); lastX = e.getX(); lastY = e.getY(); -- 2.39.5