mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 10:50:53 +02:00
cocoa: updating in mouse handling events. Restrict Cocoa from handling events for design-time, but always allow in other cases
git-svn-id: trunk@57084 -
This commit is contained in:
parent
5c58ede9d0
commit
7b2be45ba9
@ -2363,10 +2363,10 @@ end;
|
||||
|
||||
procedure TCocoaButton.mouseDown(event: NSEvent);
|
||||
begin
|
||||
callback.MouseUpDownEvent(event);
|
||||
if not Assigned(callback) or not callback.MouseUpDownEvent(event) then
|
||||
// We need to call the inherited regardless of the result of the call to
|
||||
// MouseUpDownEvent otherwise mouse clicks don't work, see bug 30131
|
||||
inherited mouseDown(event);
|
||||
inherited mouseDown(event);
|
||||
end;
|
||||
|
||||
procedure TCocoaButton.mouseDragged(event: NSEvent);
|
||||
|
@ -771,10 +771,16 @@ var
|
||||
//Str: string;
|
||||
lEventType: NSEventType;
|
||||
begin
|
||||
Result := False; // allow cocoa to handle message
|
||||
if Assigned(Owner) and not Owner.lclIsEnabled then
|
||||
begin
|
||||
Result := True; // Cocoa should not handle the message.
|
||||
Exit; // LCL should get the notification either.
|
||||
end;
|
||||
|
||||
if Assigned(Target) and (not (csDesigning in Target.ComponentState) and not Owner.lclIsEnabled) then
|
||||
Exit;
|
||||
// If LCL control is provided and it's in designing state.
|
||||
// The default resolution: Notify LCL about event, but don't let Cocoa
|
||||
// do anything with it. (Result=true)
|
||||
Result := Assigned(Target) and (csDesigning in Target.ComponentState);
|
||||
|
||||
lCaptureControlCallback := GetCaptureControlCallback();
|
||||
//Str := (Format('MouseUpDownEvent Target=%s Self=%x CaptureControlCallback=%x', [Target.name, PtrUInt(Self), PtrUInt(lCaptureControlCallback)]));
|
||||
@ -822,7 +828,6 @@ begin
|
||||
|
||||
NotifyApplicationUserInput(Target, Msg.Msg);
|
||||
DeliverMessage(Msg);
|
||||
Result := True;
|
||||
|
||||
// TODO: Check if Cocoa has special context menu check event
|
||||
if (Event.type_ = NSRightMouseDown) and (GetTarget is TControl) then
|
||||
@ -835,7 +840,6 @@ begin
|
||||
MsgContext.XPos := Round(MousePos.X);
|
||||
MsgContext.YPos := Round(MousePos.Y);
|
||||
DeliverMessage(MsgContext);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
NSLeftMouseUp,
|
||||
@ -852,7 +856,6 @@ begin
|
||||
|
||||
NotifyApplicationUserInput(Target, Msg.Msg);
|
||||
DeliverMessage(Msg);
|
||||
Result := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -871,10 +874,16 @@ var
|
||||
targetControl: TWinControl;
|
||||
childControl:TWinControl;
|
||||
begin
|
||||
Result := False; // allow cocoa to handle message
|
||||
if Assigned(Owner) and not Owner.lclIsEnabled then
|
||||
begin
|
||||
Result := True; // Cocoa should not handle the message.
|
||||
Exit; // LCL should get the notification either.
|
||||
end;
|
||||
|
||||
if Assigned(Target) and (not (csDesigning in Target.ComponentState) and not Owner.lclIsEnabled) then
|
||||
Exit;
|
||||
// If LCL control is provided and it's in designing state.
|
||||
// The default resolution: Notify LCL about event, but don't let Cocoa
|
||||
// do anything with it. (Result=true)
|
||||
Result := Assigned(Target) and (csDesigning in Target.ComponentState);
|
||||
|
||||
MousePos := Event.locationInWindow;
|
||||
OffsetMousePos(MousePos);
|
||||
|
Loading…
Reference in New Issue
Block a user