LCL: Change constant $20000000 to MK_ALT. Issue #34481, patch from AlexeyT.

git-svn-id: trunk@59393 -
This commit is contained in:
juha 2018-10-30 11:04:08 +00:00
parent 1d1c2e05e0
commit a14d6e5c9a
9 changed files with 18 additions and 15 deletions

View File

@ -329,7 +329,7 @@ begin
VK_SCROLL : Result := MK_SCRLOCK; VK_SCROLL : Result := MK_SCRLOCK;
VK_SHIFT : Result := MK_SHIFTKEY; VK_SHIFT : Result := MK_SHIFTKEY;
VK_CONTROL : Result := MK_COMMAND; VK_CONTROL : Result := MK_COMMAND;
VK_MENU : Result := MK_ALT; VK_MENU : Result := CarbonProc.MK_ALT; // see LCLType.MK_ALT
VK_OEM_3 : Result := MK_TILDE; VK_OEM_3 : Result := MK_TILDE;
//VK_OEM_MINUS : Result := MK_MINUS; //VK_OEM_MINUS : Result := MK_MINUS;
VK_OEM_PLUS : Result := MK_EQUAL; VK_OEM_PLUS : Result := MK_EQUAL;
@ -482,7 +482,7 @@ begin
if (ButtonState and 4) > 0 then Inc(Result, MK_MButton); if (ButtonState and 4) > 0 then Inc(Result, MK_MButton);
if (shiftKey and Modifiers) > 0 then Inc(Result, MK_Shift); if (shiftKey and Modifiers) > 0 then Inc(Result, MK_Shift);
if (controlKey and Modifiers) > 0 then Inc(Result, MK_Control); if (controlKey and Modifiers) > 0 then Inc(Result, MK_Control);
if (optionKey and Modifiers) > 0 then Inc(Result, $20000000); if (optionKey and Modifiers) > 0 then Inc(Result, LCLType.MK_ALT); // see CarbonProc.MK_ALT
//DebugLn('GetCarbonMsgKeyState Result=',dbgs(KeysToShiftState(Result)),' Modifiers=',hexstr(Modifiers,8),' ButtonState=',hexstr(ButtonState,8)); //DebugLn('GetCarbonMsgKeyState Result=',dbgs(KeysToShiftState(Result)),' Modifiers=',hexstr(Modifiers,8),' ButtonState=',hexstr(ButtonState,8));
end; end;

View File

@ -815,7 +815,7 @@ begin
VK_SCROLL : Result := MK_SCRLOCK; VK_SCROLL : Result := MK_SCRLOCK;
VK_SHIFT : Result := MK_SHIFTKEY; VK_SHIFT : Result := MK_SHIFTKEY;
VK_CONTROL : Result := MK_COMMAND; VK_CONTROL : Result := MK_COMMAND;
VK_MENU : Result := MK_ALT; VK_MENU : Result := CocoaUtils.MK_ALT; // LCLType.MK_ALT exists
VK_OEM_3 : Result := MK_TILDE; VK_OEM_3 : Result := MK_TILDE;
VK_OEM_MINUS : Result := MK_MINUS; VK_OEM_MINUS : Result := MK_MINUS;
VK_OEM_PLUS : Result := MK_EQUAL; VK_OEM_PLUS : Result := MK_EQUAL;

View File

@ -253,7 +253,7 @@ begin
if AModifiers and NSControlKeyMask <> 0 then if AModifiers and NSControlKeyMask <> 0 then
Result := Result or MK_CONTROL; Result := Result or MK_CONTROL;
if AModifiers and NSAlternateKeyMask <> 0 then if AModifiers and NSAlternateKeyMask <> 0 then
Result := Result or $20000000; Result := Result or LCLType.MK_ALT; // see CocoaUtils.MK_ALT
end; end;
class function TLCLCommonCallback.CocoaPressedMouseButtonsToKeyState(AMouseButtons: NSUInteger): PtrInt; class function TLCLCommonCallback.CocoaPressedMouseButtonsToKeyState(AMouseButtons: NSUInteger): PtrInt;
@ -474,7 +474,8 @@ var
IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0; IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0;
KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16; KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16;
if (Event.modifierFlags and NSAlternateKeyMask) <> 0 then if (Event.modifierFlags and NSAlternateKeyMask) <> 0 then
KeyData := KeyData or $20000000; // So that MsgKeyDataToShiftState recognizes Alt key, see bug 30129 KeyData := KeyData or LCLType.MK_ALT; // So that MsgKeyDataToShiftState recognizes Alt key, see bug 30129
// see CocoaUtils.MK_ALT
KeyCode := Event.keyCode; KeyCode := Event.keyCode;
//non-printable keys (see mackeycodes.inc) //non-printable keys (see mackeycodes.inc)
@ -844,7 +845,8 @@ begin
IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0; IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0;
KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16; KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16;
if (Event.modifierFlags and NSAlternateKeyMask) <> 0 then if (Event.modifierFlags and NSAlternateKeyMask) <> 0 then
KeyData := KeyData or $20000000; // So that MsgKeyDataToShiftState recognizes Alt key, see bug 30129 KeyData := KeyData or LCLType.MK_ALT; // So that MsgKeyDataToShiftState recognizes Alt key, see bug 30129
// see CocoaUtils.MK_ALT
KeyCode := Event.keyCode; KeyCode := Event.keyCode;
VKKeyCode := MacCodeToVK(KeyCode); VKKeyCode := MacCodeToVK(KeyCode);

View File

@ -1494,7 +1494,7 @@ begin
if AIsKeyEvent then if AIsKeyEvent then
Result := Result or KF_ALTDOWN Result := Result or KF_ALTDOWN
else else
Result := Result or $20000000; Result := Result or MK_ALT;
end; end;
end; end;
@ -1581,7 +1581,7 @@ begin
ShiftState := ShiftState + [ssShift]; ShiftState := ShiftState + [ssShift];
if AState and MK_CONTROL <> 0 then if AState and MK_CONTROL <> 0 then
ShiftState := ShiftState + [ssCtrl]; ShiftState := ShiftState + [ssCtrl];
if AState and $20000000 <> 0 then if AState and MK_ALT <> 0 then
ShiftState := ShiftState + [ssAlt]; ShiftState := ShiftState + [ssAlt];
// MappedXY := TranslateGdkPointToClientArea(AEvent^.scroll.window, EventXY, // MappedXY := TranslateGdkPointToClientArea(AEvent^.scroll.window, EventXY,
// {%H-}TGtk3Widget(AWinControl.Handle).GetContainerWidget); // {%H-}TGtk3Widget(AWinControl.Handle).GetContainerWidget);

View File

@ -1574,9 +1574,9 @@ function KeyboardShiftState(State: Word): PtrInt;
begin begin
Result := 0; Result := 0;
if State and IEQUALIFIER_LALT <> 0 then if State and IEQUALIFIER_LALT <> 0 then
Result := Result or $20000000; Result := Result or MK_ALT;
//if State and IEQUALIFIER_RALT <> 0 then //if State and IEQUALIFIER_RALT <> 0 then
// Result := Result or $20000000; // Result := Result or MK_ALT;
//writeln('ShiftState AROS: ', HexStr(Pointer(State)), ' and ', HexStr(Pointer(IEQUALIFIER_LALT)),' -> ', HexStr(Pointer(Result))); //writeln('ShiftState AROS: ', HexStr(Pointer(State)), ' and ', HexStr(Pointer(IEQUALIFIER_LALT)),' -> ', HexStr(Pointer(Result)));
end; end;

View File

@ -3818,7 +3818,7 @@ begin
if AIsKeyEvent then if AIsKeyEvent then
Result := Result or KF_ALTDOWN Result := Result or KF_ALTDOWN
else else
Result := Result or $20000000; Result := Result or MK_ALT;
end; end;
// $20000000; // $20000000;
{ TODO: add support for ALT, META and NUMKEYPAD } { TODO: add support for ALT, META and NUMKEYPAD }
@ -3965,7 +3965,7 @@ begin
Msg.State := [ssShift]; Msg.State := [ssShift];
if (ModifierState and MK_CONTROL) <> 0 then if (ModifierState and MK_CONTROL) <> 0 then
Msg.State := [ssCtrl] + Msg.State; Msg.State := [ssCtrl] + Msg.State;
if (ModifierState and $20000000) <> 0 then if (ModifierState and MK_ALT) <> 0 then
Msg.State := [ssAlt] + Msg.State; Msg.State := [ssAlt] + Msg.State;
LastMouse.WinControl := LCLObject; LastMouse.WinControl := LCLObject;

View File

@ -3740,7 +3740,7 @@ begin
if AIsKeyEvent then if AIsKeyEvent then
Result := Result or KF_ALTDOWN Result := Result or KF_ALTDOWN
else else
Result := Result or $20000000; Result := Result or MK_ALT;
end; end;
// $20000000; // $20000000;
{ TODO: add support for ALT, META and NUMKEYPAD } { TODO: add support for ALT, META and NUMKEYPAD }
@ -3888,7 +3888,7 @@ begin
Msg.State := [ssShift]; Msg.State := [ssShift];
if (ModifierState and MK_CONTROL) <> 0 then if (ModifierState and MK_CONTROL) <> 0 then
Msg.State := [ssCtrl] + Msg.State; Msg.State := [ssCtrl] + Msg.State;
if (ModifierState and $20000000) <> 0 then if (ModifierState and MK_ALT) <> 0 then
Msg.State := [ssAlt] + Msg.State; Msg.State := [ssAlt] + Msg.State;
LastMouse.WinControl := LCLObject; LastMouse.WinControl := LCLObject;

View File

@ -201,7 +201,7 @@ begin
if GetKeyState(VK_SHIFT) < 0 then Include(Result, ssShift); if GetKeyState(VK_SHIFT) < 0 then Include(Result, ssShift);
if GetKeyState(VK_CONTROL) < 0 then Include(Result, ssCtrl); if GetKeyState(VK_CONTROL) < 0 then Include(Result, ssCtrl);
if GetKeyState(VK_LWIN) < 0 then Include(Result, ssMeta); if GetKeyState(VK_LWIN) < 0 then Include(Result, ssMeta);
if KeyData and $20000000 <> 0 then Include(Result, ssAlt); if KeyData and MK_ALT <> 0 then Include(Result, ssAlt);
end; end;
{$I winapi.inc} {$I winapi.inc}

View File

@ -2836,6 +2836,7 @@ const
MK_DOUBLECLICK = $80; MK_DOUBLECLICK = $80;
MK_TRIPLECLICK = $100; MK_TRIPLECLICK = $100;
MK_QUADCLICK = $200; MK_QUADCLICK = $200;
MK_ALT = $20000000;
//============================================== //==============================================
// Constants from commctrl // Constants from commctrl