Opened 5 years ago

Last modified 4 years ago

#1586 new bug

Win client: handle special keys properly

Reported by: PowerWyrm Owned by:
Milestone: Future Keywords:
Cc:

Description

With the old keymap system, special keys were handled with a static array:

static const byte special_key_list[] = {VK_CLEAR, VK_PAUSE, ...};

When a key was pressed, the main window procedure was intercepting these special keys and handled them directly:

if (special_key) {...; return 0;} else break;
return DefWindowProc?(hWnd, uMsg, wParam, lParam);

With the new keymap system, everything is handled in the new "handle_keydown" function:

if (special key) ...

However, the main window function now just calls handle_keydown():

handle_keydown(); break;
return DefWindowProc?(hWnd, uMsg, wParam, lParam);

This leads to special keys being processed by Windows using the default Windows behavior. For example, assigning a keymap to F10 will execute the corresponding keymap, then pop the menu up. Very annoying...

Fix:

  • make handle_keydown() return a boolean value (TRUE if the key was handled, FALSE otherwise
  • return immediately in window procs if the key was handled

Change History (1)

comment:1 Changed 4 years ago by takkaria

  • Milestone changed from Triage to 3.5.0

Assigning open bugs to 3.5 for fixing.

Note: See TracTickets for help on using tickets.