Skip to content

Commit

Permalink
Win: Send Alt-F4 to server if KB grabbing enabled
Browse files Browse the repository at this point in the history
Closes #434
  • Loading branch information
dcommander committed Jan 11, 2025
1 parent c7c698f commit 8a52181
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ sized, if multi-screen spanning was enabled, the scaled remote desktop was
larger than the viewer window, and "Displays have separate Spaces" was enabled
in the system settings.

23. The Windows TurboVNC Viewer now sends Alt-F4 keystrokes to the VNC server
if keyboard grabbing is enabled.


3.0.3
=====
Expand Down
10 changes: 7 additions & 3 deletions java/com/turbovnc/vncviewer/DesktopWindow.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2010, 2012-2013, 2015-2018, 2020-2024 D. R. Commander.
/* Copyright (C) 2010, 2012-2013, 2015-2018, 2020-2025 D. R. Commander.
* All Rights Reserved.
* Copyright (C) 2011-2013 Brian P. Hinz
* Copyright (C) 2009 Paul Donohue. All Rights Reserved.
Expand Down Expand Up @@ -99,9 +99,13 @@ class DesktopWindow extends JPanel implements Runnable, MouseListener,
private final KeyEventDispatcher keyEventDispatcher =
new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
if ((e.getKeyCode() == 18 &&
if ((e.getKeyCode() == KeyEvent.VK_ALT &&
e.getKeyLocation() == KeyEvent.KEY_LOCATION_LEFT) ||
e.getKeyCode() == 121) {
e.getKeyCode() == KeyEvent.VK_F10 ||
// Also send Alt-F4 to the VNC server if the keyboard is grabbed.
(Utils.isWindows() && VncViewer.isKeyboardGrabbed(cc.viewport) &&
e.getKeyCode() == KeyEvent.VK_F4 &&
e.getModifiersEx() == KeyEvent.ALT_DOWN_MASK)) {
if (e.getID() == KeyEvent.KEY_PRESSED)
cc.desktop.keyPressed(e);
else if (e.getID() == KeyEvent.KEY_RELEASED)
Expand Down

0 comments on commit 8a52181

Please sign in to comment.