eclipse.platform.swt icon indicating copy to clipboard operation
eclipse.platform.swt copied to clipboard

[Win32] Keybindings with F1 send SWT.Help event

Open 2wendex2 opened this issue 1 year ago • 1 comments

Description of the Bug When a user presses any keybinding that includes the F1 key (e.g., Ctrl+F1), the SWT.Help event is sent alongside the intended keybinding. This is a probrem because if client wants to create keybinding with F1 then the SWT.Help event is sent alongside with the keybinding and this behaviour cannot be disabled

Desired Behavior Keybindings with F1 should override SWT.Help in a manner similar to how keybindings override SWT.KeyDown event.

Cause of the Bug On Windows, pressing the F1 key without the Alt modifier generates two windows messages:

  1. WM_KEYDOWN with wParam == VK_F1
  2. WM_KEYF1

Keybindings are handled by KeyBindingDispatcher filter listener which listens SWT.KeyDown event. SWT.KeyDown event is sent by dispatcher of WM_KEYDOWN. SWT.Help event is sent by dispatcher of WM_KEYDOWN which sent by DefWindowProc dispatching WM_KEYF1.

Possible Fixes

  1. Prevent SWT.Help from being sent on WM_HELP, or prevent WM_HELP from being sent on WM_KEYF1.
  2. Sends SWT.Help on WM_KEYDOWN with wparam == VK_F1 if no keybindings are matched.

2wendex2 avatar Sep 26 '24 10:09 2wendex2

Can you propose a fix with a PR? However we might need to be sure that this "bug" is not used as "feature" by some consumers at least in the eclipse IDE.

jukzi avatar Sep 26 '24 10:09 jukzi