mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-26 17:47:40 +00:00
Fixes #601 -- was using KVK modifier flags instead of KMX modifier flags
This commit is contained in:
parent
60790ee33b
commit
ed7fc51bdb
2 changed files with 38 additions and 11 deletions
|
|
@ -1022,17 +1022,18 @@ function TCompileKeymanWeb.VisualKeyboardFromFile(const FVisualKeyboardFileName:
|
|||
function VKShiftToLayerName(Shift: Integer): string;
|
||||
const
|
||||
masks: array[0..6] of string = (
|
||||
'shift',
|
||||
'ctrl',
|
||||
'alt',
|
||||
'leftctrl',
|
||||
'rightctrl',
|
||||
'leftalt',
|
||||
'rightalt'
|
||||
'rightalt',
|
||||
'shift',
|
||||
'ctrl',
|
||||
'alt'
|
||||
);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
shift := VkShiftStateToKmxShiftState(shift);
|
||||
if shift = 0 then
|
||||
Result := 'default'
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
(*
|
||||
Name: VisualKeyboard
|
||||
Copyright: Copyright (C) SIL International.
|
||||
Documentation:
|
||||
Description:
|
||||
Documentation:
|
||||
Description:
|
||||
Create Date: 23 Aug 2006
|
||||
|
||||
Modified Date: 8 Jun 2012
|
||||
Authors: mcdurdin
|
||||
Related Files:
|
||||
Dependencies:
|
||||
Related Files:
|
||||
Dependencies:
|
||||
|
||||
Bugs:
|
||||
Todo:
|
||||
Notes:
|
||||
Bugs:
|
||||
Todo:
|
||||
Notes:
|
||||
History: 23 Aug 2006 - mcdurdin - Add ExtShiftStateToVkShiftState function
|
||||
19 Mar 2007 - mcdurdin - I699 - Fix crash when exporting on screen keyboard with some shift states
|
||||
19 Nov 2007 - mcdurdin - I1157 - const string parameters
|
||||
|
|
@ -44,6 +44,7 @@ const
|
|||
KVKS_RALT = 64;
|
||||
|
||||
function ExtShiftStateToVkShiftState(ShiftState: TExtShiftState): WORD;
|
||||
function VkShiftStateToKmxShiftState(ShiftState: WORD): WORD;
|
||||
|
||||
type
|
||||
TVisualKeyboardKeyFlags = set of (kvkkBitmap, kvkkUnicode); // if not set, is kvkkText, kvkkANSI resp.
|
||||
|
|
@ -205,6 +206,7 @@ function GetVKLegalShiftStateIndex(Shift: Integer): Integer;
|
|||
implementation
|
||||
|
||||
uses
|
||||
kmxfile,
|
||||
VisualKeyboardLoaderBinary,
|
||||
VisualKeyboardLoaderXML,
|
||||
VisualKeyboardSaverBinary,
|
||||
|
|
@ -535,5 +537,29 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function VkShiftStateToKmxShiftState(ShiftState: WORD): WORD;
|
||||
type
|
||||
TVKToKMX = record
|
||||
VK, KMX: Word;
|
||||
end;
|
||||
const
|
||||
Map: array[0..6] of TVKToKMX = (
|
||||
(VK: KVKS_SHIFT; KMX: KMX_SHIFTFLAG),
|
||||
(VK: KVKS_CTRL; KMX: KMX_CTRLFLAG),
|
||||
(VK: KVKS_ALT; KMX: KMX_ALTFLAG),
|
||||
(VK: KVKS_LCTRL; KMX: KMX_LCTRLFLAG),
|
||||
(VK: KVKS_RCTRL; KMX: KMX_RCTRLFLAG),
|
||||
(VK: KVKS_LALT; KMX: KMX_LALTFLAG),
|
||||
(VK: KVKS_RALT; KMX: KMX_RALTFLAG)
|
||||
);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
for i := Low(Map) to High(Map) do
|
||||
if (ShiftState and Map[i].VK) = Map[i].VK then
|
||||
Result := Result or Map[i].KMX;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue