diff --git a/lcl/interfaces/carbon/carbonproc.pp b/lcl/interfaces/carbon/carbonproc.pp index ca1ffdf94e..6f64ddf98d 100644 --- a/lcl/interfaces/carbon/carbonproc.pp +++ b/lcl/interfaces/carbon/carbonproc.pp @@ -329,7 +329,7 @@ begin VK_SCROLL : Result := MK_SCRLOCK; VK_SHIFT : Result := MK_SHIFTKEY; 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_MINUS : Result := MK_MINUS; VK_OEM_PLUS : Result := MK_EQUAL; @@ -482,7 +482,7 @@ begin if (ButtonState and 4) > 0 then Inc(Result, MK_MButton); if (shiftKey and Modifiers) > 0 then Inc(Result, MK_Shift); 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)); end; diff --git a/lcl/interfaces/cocoa/cocoautils.pas b/lcl/interfaces/cocoa/cocoautils.pas index c8d1ecc1e1..acc949f799 100644 --- a/lcl/interfaces/cocoa/cocoautils.pas +++ b/lcl/interfaces/cocoa/cocoautils.pas @@ -846,7 +846,7 @@ begin VK_SCROLL : Result := MK_SCRLOCK; VK_SHIFT : Result := MK_SHIFTKEY; 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_MINUS : Result := MK_MINUS; VK_OEM_PLUS : Result := MK_EQUAL; diff --git a/lcl/interfaces/cocoa/cocoawscommon.pas b/lcl/interfaces/cocoa/cocoawscommon.pas index 5acbc308f7..4dc26a9f52 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -254,7 +254,7 @@ begin if AModifiers and NSControlKeyMask <> 0 then Result := Result or MK_CONTROL; if AModifiers and NSAlternateKeyMask <> 0 then - Result := Result or $20000000; + Result := Result or LCLType.MK_ALT; // see CocoaUtils.MK_ALT end; class function TLCLCommonCallback.CocoaPressedMouseButtonsToKeyState(AMouseButtons: NSUInteger): PtrInt; @@ -490,7 +490,8 @@ var IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0; KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16; 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; //non-printable keys (see mackeycodes.inc) @@ -861,7 +862,8 @@ begin IsSysKey := (Event.modifierFlags and NSCommandKeyMask) <> 0; KeyData := (Ord(Event.isARepeat) + 1) or Event.keyCode shl 16; 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; ignModChr := Event.charactersIgnoringModifiers; diff --git a/lcl/interfaces/gtk3/gtk3widgets.pas b/lcl/interfaces/gtk3/gtk3widgets.pas index 660fe10e6e..b4b40e6870 100644 --- a/lcl/interfaces/gtk3/gtk3widgets.pas +++ b/lcl/interfaces/gtk3/gtk3widgets.pas @@ -1494,7 +1494,7 @@ begin if AIsKeyEvent then Result := Result or KF_ALTDOWN else - Result := Result or $20000000; + Result := Result or MK_ALT; end; end; @@ -1581,7 +1581,7 @@ begin ShiftState := ShiftState + [ssShift]; if AState and MK_CONTROL <> 0 then ShiftState := ShiftState + [ssCtrl]; - if AState and $20000000 <> 0 then + if AState and MK_ALT <> 0 then ShiftState := ShiftState + [ssAlt]; // MappedXY := TranslateGdkPointToClientArea(AEvent^.scroll.window, EventXY, // {%H-}TGtk3Widget(AWinControl.Handle).GetContainerWidget); diff --git a/lcl/interfaces/mui/muibaseunit.pas b/lcl/interfaces/mui/muibaseunit.pas index c346cce3ac..e81f78f78b 100644 --- a/lcl/interfaces/mui/muibaseunit.pas +++ b/lcl/interfaces/mui/muibaseunit.pas @@ -1574,9 +1574,9 @@ function KeyboardShiftState(State: Word): PtrInt; begin Result := 0; if State and IEQUALIFIER_LALT <> 0 then - Result := Result or $20000000; + Result := Result or MK_ALT; //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))); end; diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index b0e97c0947..49c234e6f0 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -3820,7 +3820,7 @@ begin if AIsKeyEvent then Result := Result or KF_ALTDOWN else - Result := Result or $20000000; + Result := Result or MK_ALT; end; // $20000000; { TODO: add support for ALT, META and NUMKEYPAD } @@ -3967,7 +3967,7 @@ begin Msg.State := [ssShift]; if (ModifierState and MK_CONTROL) <> 0 then Msg.State := [ssCtrl] + Msg.State; - if (ModifierState and $20000000) <> 0 then + if (ModifierState and MK_ALT) <> 0 then Msg.State := [ssAlt] + Msg.State; LastMouse.WinControl := LCLObject; diff --git a/lcl/interfaces/qt5/qtwidgets.pas b/lcl/interfaces/qt5/qtwidgets.pas index 992f6542b3..fc53643c28 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -3747,7 +3747,7 @@ begin if AIsKeyEvent then Result := Result or KF_ALTDOWN else - Result := Result or $20000000; + Result := Result or MK_ALT; end; // $20000000; { TODO: add support for ALT, META and NUMKEYPAD } @@ -3895,7 +3895,7 @@ begin Msg.State := [ssShift]; if (ModifierState and MK_CONTROL) <> 0 then Msg.State := [ssCtrl] + Msg.State; - if (ModifierState and $20000000) <> 0 then + if (ModifierState and MK_ALT) <> 0 then Msg.State := [ssAlt] + Msg.State; LastMouse.WinControl := LCLObject; diff --git a/lcl/lclintf.pas b/lcl/lclintf.pas index 69642dd850..4e414e5c40 100644 --- a/lcl/lclintf.pas +++ b/lcl/lclintf.pas @@ -201,7 +201,7 @@ begin if GetKeyState(VK_SHIFT) < 0 then Include(Result, ssShift); if GetKeyState(VK_CONTROL) < 0 then Include(Result, ssCtrl); 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; {$I winapi.inc} diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 8601dec769..8859a53ff5 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -2835,6 +2835,7 @@ const MK_DOUBLECLICK = $80; MK_TRIPLECLICK = $100; MK_QUADCLICK = $200; + MK_ALT = $20000000; //============================================== // Constants from commctrl