Cocoa/Config: turn Notification Config to the new Style

This commit is contained in:
rich2014 2024-08-21 22:18:53 +08:00
parent 3e0fbda2b8
commit f90c864215
3 changed files with 13 additions and 8 deletions

View File

@ -91,3 +91,11 @@ var
);
);
var
CocoaConfigNotification: TCocoaConfigNotification = (
// by default on macOS, Notification is only Presented when the APP is
// in the background.
// when CocoaAlwaysPresentNotification is set to True, Notification is
// always Presented.
alwaysPresent: True;
);

View File

@ -139,7 +139,11 @@ type
end;
type
TCocoaConfigNotification = record
alwaysPresent: Boolean;
end;
type
// on macOS, the FocusRing takes up extra space, which may cause strange
// display in some cases. it may block other controls, or be partially cut off.
// for example, in the Lazarus IDE - About dialog, the FocusRing of the
@ -164,13 +168,6 @@ type
function getCocoaControlFocusRingStrategry( AClassName: NSString ): TCocoaFocusRingStrategy;
var
// by default on macOS, Notification is only Presented when the APP is
// in the background.
// when CocoaAlwaysPresentNotification is set to True, Notification is
// always Presented.
CocoaAlwaysPresentNotification : Boolean = True;
// for compatiblity with LCL 1.8 release. The macOS base is 72ppi
CocoaBasePPI : Integer = 96;

View File

@ -202,7 +202,7 @@ begin
message.setSoundName( NSUserNotificationDefaultSoundName );
nc:= NSUserNotificationCenter.defaultUserNotificationCenter;
if CocoaConfig.CocoaAlwaysPresentNotification then begin
if CocoaConfigNotification.alwaysPresent then begin
if NOT Assigned(nc.delegate) then
nc.setDelegate( TCocoaUserNotificationCenterDelegate.new );
end;