From 1ad0f9600a83448a0c86b746fe86bb978f5fe6a2 Mon Sep 17 00:00:00 2001 From: juha Date: Mon, 1 Dec 2014 17:46:14 +0000 Subject: [PATCH] LCL, Win32: Read message data correctly. Affected keyboard accelerators when compiled with -O2. Issue #26562, patch from ChrisF. git-svn-id: trunk@47048 - --- lcl/interfaces/win32/win32callback.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index bcc6dbb146..56ed10f2cf 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -272,6 +272,7 @@ var TmpSize: TSize; // used by WM_MEASUREITEM Info: TComboboxInfo; OrgCharCode: word; // used in WM_CHAR handling + CharCodeNotEmpty: boolean; // used by WM_CHAR, WM_SYSCHAR and WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, WM_SYSKEYUP function GetMenuParent(ASearch, AParent: HMENU): HMENU; var @@ -2599,10 +2600,16 @@ begin end; end; + case Msg of + WM_CHAR, WM_SYSCHAR: + CharCodeNotEmpty := (LMChar.CharCode<>0); + else + CharCodeNotEmpty := (LMKey.CharCode<>0); + end; // we cannot tell for sure windows didn't want the key // for WM_CHAR check WM_GETDLGCODE/DLGC_WANTCHARS // winapi too inconsistent about return value - if (lWinControl <> nil) and (PLMsg^.Result = 0) and (LMKey.CharCode<>0) then + if (lWinControl <> nil) and (PLMsg^.Result = 0) and CharCodeNotEmpty then DeliverMessage(lWinControl, PLMsg^); // handle Ctrl-A for edit controls