diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2024-12-24 00:12:26 -0500 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2024-12-24 00:19:03 -0500 |
commit | 11798d78e922572e4cea5c44a63308c05cb7d0c5 (patch) | |
tree | c31448760432af43ac310656bee81530573e4e4a /java/com | |
parent | 534de4aa40154ec4ae6d60705880d9110e6724f1 (diff) | |
download | tigervnc-master.tar.gz tigervnc-master.zip |
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index c293cb7d..f7ec9f51 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -200,8 +200,8 @@ class Viewport extends JPanel implements ActionListener { Graphics2D g2 = tmp.createGraphics(); g2.drawImage(cursor, 0, 0, cw, ch, 0, 0, width, height, null); g2.dispose(); - x = (int) Math.min(Math.floor((float) x * (float) cw / (float) width), cw - 1); - y = (int) Math.min(Math.floor((float) y * (float) ch / (float) height), ch - 1); + x = (int) Math.min(Math.floor((float) x * (float) cw / (float) width), Math.max(cw - 1, 0)); + y = (int) Math.min(Math.floor((float) y * (float) ch / (float) height), Math.max(ch - 1, 0)); cursor = tmp; } |