Fix #1009: Cocoa: Cursor related code removed by new Lcl/Cocoa version (#1017)

This commit is contained in:
rich2014 2023-06-10 23:57:09 +08:00 committed by GitHub
commit 2aeda2741c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 46 deletions

View file

@ -36,11 +36,7 @@ uses
uFileView,
uDragDropEx,
uFileViewNotebook,
uDebug
{$IFDEF LCLCOCOA}
,uMyDarwin
{$ENDIF}
;
uDebug;
type
@ -1611,9 +1607,6 @@ procedure TFileViewWithMainCtrl.WorkerFinished(const Worker: TFileViewWorker);
begin
inherited WorkerFinished(Worker);
MainControl.Cursor := crDefault;
{$IFDEF LCLCOCOA}
cocoaInvalidControlCursor( MainControl );
{$ENDIF}
// Update status line only
if not (csDestroying in ComponentState) then UpdateInfoPanel;
end;
@ -1785,9 +1778,6 @@ procedure TFileViewWithMainCtrl.WorkerStarting(const Worker: TFileViewWorker);
begin
inherited WorkerStarting(Worker);
MainControl.Cursor := crHourGlass;
{$IFDEF LCLCOCOA}
cocoaInvalidControlCursor( MainControl );
{$ENDIF}
UpdateInfoPanel; // Update status line only
end;

View file

@ -880,8 +880,6 @@ type
procedure LoadTabsCommandLine(Params: TCommandLineParams);
procedure AddTab(ANoteBook: TFileViewNotebook; aPath: String);
{$IF DEFINED(DARWIN)}
procedure resetScreenCursor;
procedure FormActivate(Sender: TObject);
procedure OnNSServiceOpenWithNewTab( filenames:TStringList );
function NSServiceMenuIsReady(): boolean;
function NSServiceMenuGetFilenames(): TStringList;
@ -1251,7 +1249,6 @@ begin
ThemeServices.OnThemeChange:= @AppThemeChange;
{$IF DEFINED(DARWIN)}
self.OnActivate:= @FormActivate;
InitNSServiceProvider( @OnNSServiceOpenWithNewTab, @NSServiceMenuIsReady, @NSServiceMenuGetFilenames );
InitNSThemeChangedObserver( @NSThemeChangedHandler );
{$ENDIF}
@ -6167,17 +6164,6 @@ begin
end;
{$IF DEFINED(DARWIN)}
procedure TfrmMain.resetScreenCursor;
begin
Screen.Cursor:= crDefault;
cocoaInvalidControlCursor( self );
end;
procedure TfrmMain.FormActivate(Sender: TObject);
begin
resetScreenCursor;
end;
procedure TfrmMain.OnNSServiceOpenWithNewTab( filenames:TStringList );
begin
if Assigned(filenames) and (filenames.Count>0) then
@ -7063,10 +7049,6 @@ end;
procedure TfrmMain.AppActivate(Sender: TObject);
begin
{$IFDEF DARWIN}
resetScreenCursor;
{$ENDIF}
if Assigned(FrameLeft) then
FrameLeft.ReloadIfNeeded;
if Assigned(FrameRight) then

View file

@ -33,10 +33,7 @@ unit uMyDarwin;
interface
uses
Classes, SysUtils, UnixType,
InterfaceBase, Controls, Menus,
MacOSAll, CocoaAll, CocoaPrivate, CocoaInt,
Cocoa_Extra, CocoaWSMenus, CocoaUtils;
Classes, SysUtils, UnixType, MacOSAll, CocoaAll, CocoaUtils, CocoaInt, Cocoa_Extra, InterfaceBase, Menus, CocoaWSMenus;
// Darwin Util Function
function StringToNSString(const S: String): NSString;
@ -46,8 +43,6 @@ function ListToNSArray(const list:TStrings): NSArray;
function getMacOSDefaultTerminal(): String;
procedure cocoaInvalidControlCursor( const control:TWinControl );
function NSGetTempPath: String;
function NSGetFolderPath(Folder: NSSearchPathDirectory): String;
@ -350,17 +345,6 @@ begin
Result:= NSWorkspace.sharedWorkspace.unmountAndEjectDeviceAtPath( StringToNSString(path) );
end;
procedure cocoaInvalidControlCursor( const control:TWinControl );
var
view: NSView;
begin
if control.HandleAllocated then
begin
view:= NSObject(control.Handle).lclContentView;
view.window.invalidateCursorRectsForView( view );
end;
end;
var
NetFS: TLibHandle = NilHandle;