revised patch (ignore prev message about "Forms.pp function error").
Needs some testing on Carbon/Cocoa, because MK_ALT const is defined in Mac WS'es.
-- Regards, Alexey
Index: lcl/interfaces/carbon/carbonproc.pp =================================================================== --- lcl/interfaces/carbon/carbonproc.pp (revision 59355) +++ lcl/interfaces/carbon/carbonproc.pp (working copy) @@ -329,7 +329,7 @@ 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 @@ 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; Index: lcl/interfaces/cocoa/cocoautils.pas =================================================================== --- lcl/interfaces/cocoa/cocoautils.pas (revision 59355) +++ lcl/interfaces/cocoa/cocoautils.pas (working copy) @@ -815,7 +815,7 @@ 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; Index: lcl/interfaces/cocoa/cocoawscommon.pas =================================================================== --- lcl/interfaces/cocoa/cocoawscommon.pas (revision 59355) +++ lcl/interfaces/cocoa/cocoawscommon.pas (working copy) @@ -253,7 +253,7 @@ 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 @@ 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 @@ 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); Index: lcl/interfaces/gtk3/gtk3widgets.pas =================================================================== --- lcl/interfaces/gtk3/gtk3widgets.pas (revision 59355) +++ lcl/interfaces/gtk3/gtk3widgets.pas (working copy) @@ -1494,7 +1494,7 @@ if AIsKeyEvent then Result := Result or KF_ALTDOWN else - Result := Result or $20000000; + Result := Result or MK_ALT; end; end; @@ -1581,7 +1581,7 @@ 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); Index: lcl/interfaces/mui/muibaseunit.pas =================================================================== --- lcl/interfaces/mui/muibaseunit.pas (revision 59355) +++ lcl/interfaces/mui/muibaseunit.pas (working copy) @@ -1574,9 +1574,9 @@ 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; Index: lcl/interfaces/qt/qtwidgets.pas =================================================================== --- lcl/interfaces/qt/qtwidgets.pas (revision 59355) +++ lcl/interfaces/qt/qtwidgets.pas (working copy) @@ -3818,7 +3818,7 @@ 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 @@ 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; Index: lcl/interfaces/qt5/qtwidgets.pas =================================================================== --- lcl/interfaces/qt5/qtwidgets.pas (revision 59355) +++ lcl/interfaces/qt5/qtwidgets.pas (working copy) @@ -3740,7 +3740,7 @@ 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 @@ 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; Index: lcl/lclintf.pas =================================================================== --- lcl/lclintf.pas (revision 59355) +++ lcl/lclintf.pas (working copy) @@ -201,7 +201,7 @@ 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} Index: lcl/lcltype.pp =================================================================== --- lcl/lcltype.pp (revision 59355) +++ lcl/lcltype.pp (working copy) @@ -2836,6 +2836,7 @@ MK_DOUBLECLICK = $80; MK_TRIPLECLICK = $100; MK_QUADCLICK = $200; + MK_ALT = $20000000; //============================================== // Constants from commctrl
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus