mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:39:37 +02:00
cocoa: preventing double scrollWheel message for the pair of manualHost+manualScrollView bug #36001
git-svn-id: trunk@61771 -
This commit is contained in:
parent
ea3cda9791
commit
b3039aa65f
@ -67,6 +67,7 @@ type
|
||||
fhscroll : NSScroller;
|
||||
fvscroll : NSScroller;
|
||||
public
|
||||
isHosted: Boolean;
|
||||
callback: ICommonCallback;
|
||||
function lclGetCallback: ICommonCallback; override;
|
||||
procedure lclClearCallback; override;
|
||||
@ -144,6 +145,7 @@ type
|
||||
{ TCocoaManualScrollHost }
|
||||
|
||||
TCocoaManualScrollHost = objcclass(TCocoaScrollView)
|
||||
procedure setDocumentView(aview: NSView); override;
|
||||
function lclContentView: NSView; override;
|
||||
function lclClientFrame: TRect; override;
|
||||
end;
|
||||
@ -290,6 +292,13 @@ end;
|
||||
|
||||
{ TCocoaManualScrollHost }
|
||||
|
||||
procedure TCocoaManualScrollHost.setDocumentView(aview: NSView);
|
||||
begin
|
||||
inherited setDocumentView(aview);
|
||||
if Assigned(aview) and (aview.isKindOfClass(TCocoaManualScrollView)) then
|
||||
TCocoaManualScrollView(aview).isHosted := true;
|
||||
end;
|
||||
|
||||
function TCocoaManualScrollHost.lclContentView: NSView;
|
||||
begin
|
||||
if Assigned(documentView) then
|
||||
@ -682,8 +691,12 @@ end;
|
||||
|
||||
procedure TCocoaManualScrollView.scrollWheel(event: NSEvent);
|
||||
begin
|
||||
if isMouseEventInScrollBar(self, event) or not Assigned(callback) or not callback.scrollWheel(event) then
|
||||
inherited scrollWheel(event);
|
||||
// when hosted, the processing of scrollWheel is duplciated
|
||||
if not isHosted then
|
||||
begin
|
||||
if isMouseEventInScrollBar(self, event) or not Assigned(callback) or not callback.scrollWheel(event) then
|
||||
inherited scrollWheel(event);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user