Apply scaling-shortcut-kludge.patch for Windows

... as proposed by Manolo in a private mail.

This patch allows to detect "ctrl+'-' on keyboards with digits in
uppercase positions (e.g. French)" but this is only preliminary for
FLTK 1.4.0.

Windows keyboard handling should be revised in FLTK 1.5.0 or higher.
This commit is contained in:
Albrecht Schlosser 2024-09-10 12:14:56 +02:00
parent 0594d9a1a0
commit 3fbd4f944f

View File

@ -1,7 +1,7 @@
//
// Windows-specific code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2023 by Bill Spitzak and others.
// Copyright 1998-2024 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -1157,6 +1157,7 @@ static const struct {
{0xdc, '\\'},
{0xdd, ']'},
{0xde, '\''},
{VK_OEM_PLUS, '+'},
{VK_OEM_102, FL_Iso_Key}
};
static int ms2fltk(WPARAM vk, int extended) {
@ -1439,6 +1440,10 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_SYSKEYUP:
// save the keysym until we figure out the characters:
Fl::e_keysym = Fl::e_original_keysym = ms2fltk(wParam, lParam & (1 << 24));
// Kludge to allow recognizing ctrl+'-' on keyboards with digits in uppercase positions (e.g. French)
if (Fl::e_keysym == '6' && (VkKeyScanA('-') & 0xff) == '6') {
Fl::e_keysym = '-';
}
// See if TranslateMessage turned it into a WM_*CHAR message:
if (PeekMessageW(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE)) {
uMsg = fl_msg.message;