mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 11:19:10 +02:00
Cocoa: Treat control-left mouse click same as right mouse click to bring up context menu
This commit is contained in:
parent
06bfb3b56a
commit
6fc0212b11
@ -158,6 +158,13 @@ var
|
|||||||
classicFrame3d: False;
|
classicFrame3d: False;
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var
|
||||||
|
CocoaConfigMouse: TCocoaConfigMouse = (
|
||||||
|
// False: Control-Left-Click passes straight through
|
||||||
|
// True: Control-Left-Click will become Right Click
|
||||||
|
controlLeftToRightClick: False;
|
||||||
|
);
|
||||||
|
|
||||||
var
|
var
|
||||||
CocoaConfigNotification: TCocoaConfigNotification = (
|
CocoaConfigNotification: TCocoaConfigNotification = (
|
||||||
// by default on macOS, Notification is only Presented when the APP is
|
// by default on macOS, Notification is only Presented when the APP is
|
||||||
|
@ -302,6 +302,11 @@ type
|
|||||||
classicFrame3d: Boolean;
|
classicFrame3d: Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCocoaConfigMouse = record
|
||||||
|
controlLeftToRightClick: Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCocoaConfigNotification = record
|
TCocoaConfigNotification = record
|
||||||
alwaysPresent: Boolean;
|
alwaysPresent: Boolean;
|
||||||
|
@ -226,6 +226,7 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
LastMouse: TLastMouseInfo;
|
LastMouse: TLastMouseInfo;
|
||||||
|
LastMouseLeftButtonAsRight: Boolean;
|
||||||
|
|
||||||
function ButtonStateToShiftState(BtnState: PtrUInt): TShiftState;
|
function ButtonStateToShiftState(BtnState: PtrUInt): TShiftState;
|
||||||
begin
|
begin
|
||||||
@ -964,6 +965,22 @@ begin
|
|||||||
if AForceAsMouseUp then
|
if AForceAsMouseUp then
|
||||||
lEventType := NSLeftMouseUp;
|
lEventType := NSLeftMouseUp;
|
||||||
|
|
||||||
|
if CocoaConfigMouse.controlLeftToRightClick then begin
|
||||||
|
// treat ctrl+left button as right button
|
||||||
|
if (lEventType = NSLeftMouseDown) and
|
||||||
|
(Event.modifierFlags and NSControlKeyMask <> 0) then
|
||||||
|
LastMouseLeftButtonAsRight := True;
|
||||||
|
if LastMouseLeftButtonAsRight then
|
||||||
|
begin
|
||||||
|
if MButton = 0 then
|
||||||
|
MButton := 1;
|
||||||
|
if Msg.Keys and MK_LBUTTON <> 0 then
|
||||||
|
Msg.Keys := (Msg.Keys or MK_RBUTTON) and not MK_LBUTTON;
|
||||||
|
if lEventType = NSLeftMouseUp then
|
||||||
|
LastMouseLeftButtonAsRight := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
Result := Result or (BlockCocoaUpDown and not AOverrideBlock);
|
Result := Result or (BlockCocoaUpDown and not AOverrideBlock);
|
||||||
mc := CocoaWidgetSet.ModalCounter;
|
mc := CocoaWidgetSet.ModalCounter;
|
||||||
case lEventType of
|
case lEventType of
|
||||||
|
Loading…
Reference in New Issue
Block a user