From a14d6e5c9a24109007fc4643413a226ee0ecb000 Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 30 Oct 2018 11:04:08 +0000 Subject: [PATCH] LCL: Change constant $20000000 to MK_ALT. Issue #34481, patch from AlexeyT. git-svn-id: trunk@59393 - --- lcl/interfaces/carbon/carbonproc.pp | 4 ++-- lcl/interfaces/cocoa/cocoautils.pas | 2 +- lcl/interfaces/cocoa/cocoawscommon.pas | 8 +++++--- lcl/interfaces/gtk3/gtk3widgets.pas | 4 ++-- lcl/interfaces/mui/muibaseunit.pas | 4 ++-- lcl/interfaces/qt/qtwidgets.pas | 4 ++-- lcl/interfaces/qt5/qtwidgets.pas | 4 ++-- lcl/lclintf.pas | 2 +- lcl/lcltype.pp | 1 + 9 files changed, 18 insertions(+), 15 deletions(-) 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 98588e3f2d..76d7a72517 100644 --- a/lcl/interfaces/cocoa/cocoautils.pas +++ b/lcl/interfaces/cocoa/cocoautils.pas @@ -815,7 +815,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 bed0663e91..08d9b1005e 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -253,7 +253,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; @@ -474,7 +474,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) @@ -844,7 +845,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; VKKeyCode := MacCodeToVK(KeyCode); diff --git a/lcl/interfaces/gtk3/gtk3widgets.pas b/lcl/interfaces/gtk3/gtk3widgets.pas index fc278d19e1..25d36ca986 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 da871bac3a..a7408e9a0c 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -3818,7 +3818,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 } @@ -3965,7 +3965,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 7ff818c75d..8a5532d4ba 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -3740,7 +3740,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 } @@ -3888,7 +3888,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 4aaee456c9..46b39b04b4 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -2836,6 +2836,7 @@ const MK_DOUBLECLICK = $80; MK_TRIPLECLICK = $100; MK_QUADCLICK = $200; + MK_ALT = $20000000; //============================================== // Constants from commctrl