Skip to content

Commit

Permalink
Win/Java: Don't let F10 set KB focus to sys menu
Browse files Browse the repository at this point in the history
I'm not sure when Windows 10 started hijacking the F10 key to serve the
same purpose as the left Alt key (activating the system menu), but it
must have been recently.  (In the process of integrating/implementing
the server-side key mapping feature in TurboVNC 3.1, I thoroughly tested
all possible keystrokes on Windows, macOS, and Linux clients.)

This commit simply extends the fix in
579f2d7 to cover the F10 key as well.
  • Loading branch information
dcommander committed Jan 17, 2024
1 parent dbcf89e commit 9a1c2e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ sequences are also used by Emacs and GNOME. Thus, the Java TurboVNC Viewer now
sends those key sequences to the server if no scrollbars are visible or if
keyboard grabbing is enabled.

7. Fixed an issue in the Windows/Java TurboVNC Viewer whereby a left Alt key
press, followed by a left Alt key release, caused the keyboard focus to be
redirected to the system menu, and subsequent keystrokes were consumed by the
system menu until left Alt or Esc was pressed to dismiss the menu.
7. Fixed an issue in the Windows/Java TurboVNC Viewer whereby pressing and
releasing the left Alt or F10 key caused the keyboard focus to be redirected to
the system menu, and subsequent keystrokes were consumed by the system menu
until left Alt, F10, or Esc was pressed to dismiss the menu.

8. Fixed a regression introduced by 2.2 beta1[7] that prevented the idle
timeout feature in the TurboVNC Server from working properly.
Expand Down
9 changes: 5 additions & 4 deletions java/com/turbovnc/vncviewer/DesktopWindow.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
* Copyright (C) 2006 Constantin Kaplinsky. All Rights Reserved.
* Copyright (C) 2009 Paul Donohue. All Rights Reserved.
* Copyright (C) 2010, 2012-2013, 2015-2018, 2020-2022 D. R. Commander.
* All Rights Reserved.
* Copyright (C) 2010, 2012-2013, 2015-2018, 2020-2022, 2024
* D. R. Commander. All Rights Reserved.
* Copyright (C) 2011-2013 Brian P. Hinz
*
* This is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -101,8 +101,9 @@ static final double getTime() {
private final KeyEventDispatcher keyEventDispatcher =
new KeyEventDispatcher() {
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyCode() == 18 &&
e.getKeyLocation() == KeyEvent.KEY_LOCATION_LEFT) {
if ((e.getKeyCode() == 18 &&
e.getKeyLocation() == KeyEvent.KEY_LOCATION_LEFT) ||
e.getKeyCode() == 121) {
if (e.getID() == KeyEvent.KEY_PRESSED)
cc.desktop.keyPressed(e);
else if (e.getID() == KeyEvent.KEY_RELEASED)
Expand Down

0 comments on commit 9a1c2e5

Please sign in to comment.