View Issue Details

IDProjectCategoryView StatusLast Update
0030814PatchesWidgetsetpublic2017-04-07 19:00
ReporterDavid JenkinsAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
PlatformCocoaOSOSXOS VersionEl Capitan
Product Version1.6RC1Product Build 
Target VersionFixed in Version 
Summary0030814: [Patch] Add Application level callbacks for AppMinimize, AppRestore, AppActivate, AppDeactivate, and AppScreenChange
DescriptionProvided functionality to map the following Cocoa level NSApp callbacks to LCL functions:

applicationDidHide -> IntFAppMinimize
applicationDidUnhide -> IntfAppRestore
applicationDidBecomeActive -> IntfAppActivate
applicationDidResignActive -> IntfAppDeactivate
applicationDidChangeScreenParameters -> (Screen.UpdateMoniors, Screen.UpdateScreen)
TagsNo tags attached.
Fixed in Revisionr54561
LazTarget-
WidgetsetCocoa
Attached Files
  • AppFunctions.diff (1,879 bytes)
    Index: lcl/interfaces/cocoa/cocoaint.pas
    ===================================================================
    --- lcl/interfaces/cocoa/cocoaint.pas	(revision 53249)
    +++ lcl/interfaces/cocoa/cocoaint.pas	(working copy)
    @@ -68,6 +68,11 @@
     
       TAppDelegate = objcclass(NSObject, NSApplicationDelegateProtocol)
         procedure application_openFiles(sender: NSApplication; filenames: NSArray);
    +    procedure applicationDidHide(notification: NSNotification);
    +    procedure applicationDidUnhide(notification: NSNotification);
    +    procedure applicationDidBecomeActive(notification: NSNotification);
    +    procedure applicationDidResignActive(notification: NSNotification);
    +    procedure applicationDidChangeScreenParameters(notification: NSNotification);
       end;
     
       { TCocoaWidgetSet }
    Index: lcl/interfaces/cocoa/cocoaobject.inc
    ===================================================================
    --- lcl/interfaces/cocoa/cocoaobject.inc	(revision 53249)
    +++ lcl/interfaces/cocoa/cocoaobject.inc	(working copy)
    @@ -632,6 +632,32 @@
       Application.IntfDropFiles(lFiles);
     end;
     
    +procedure TAppDelegate.applicationDidHide(notification: NSNotification);
    +begin
    +  Application.IntfAppMinimize;
    +end;
    +
    +procedure TAppDelegate.applicationDidUnhide(notification: NSNotification);
    +begin
    +  Application.IntfAppRestore;
    +end;
    +
    +procedure TAppDelegate.applicationDidBecomeActive(notification: NSNotification);
    +begin
    +  Application.IntfAppActivate;
    +end;
    +
    +procedure TAppDelegate.applicationDidResignActive(notification: NSNotification);
    +begin
    +  Application.IntfAppDeactivate;
    +end;
    +
    +procedure TAppDelegate.applicationDidChangeScreenParameters(notification: NSNotification);
    +begin
    +  Screen.UpdateMonitors;
    +  Screen.UpdateScreen;
    +end;
    +
     {------------------------------------------------------------------------------
       Method:  TCocoaWidgetSet.RawImage_DescriptionFromCocoaBitmap
    AppFunctions.diff (1,879 bytes)

Activities

David Jenkins

2016-10-28 18:15

reporter  

AppFunctions.diff (1,879 bytes)
Index: lcl/interfaces/cocoa/cocoaint.pas
===================================================================
--- lcl/interfaces/cocoa/cocoaint.pas	(revision 53249)
+++ lcl/interfaces/cocoa/cocoaint.pas	(working copy)
@@ -68,6 +68,11 @@
 
   TAppDelegate = objcclass(NSObject, NSApplicationDelegateProtocol)
     procedure application_openFiles(sender: NSApplication; filenames: NSArray);
+    procedure applicationDidHide(notification: NSNotification);
+    procedure applicationDidUnhide(notification: NSNotification);
+    procedure applicationDidBecomeActive(notification: NSNotification);
+    procedure applicationDidResignActive(notification: NSNotification);
+    procedure applicationDidChangeScreenParameters(notification: NSNotification);
   end;
 
   { TCocoaWidgetSet }
Index: lcl/interfaces/cocoa/cocoaobject.inc
===================================================================
--- lcl/interfaces/cocoa/cocoaobject.inc	(revision 53249)
+++ lcl/interfaces/cocoa/cocoaobject.inc	(working copy)
@@ -632,6 +632,32 @@
   Application.IntfDropFiles(lFiles);
 end;
 
+procedure TAppDelegate.applicationDidHide(notification: NSNotification);
+begin
+  Application.IntfAppMinimize;
+end;
+
+procedure TAppDelegate.applicationDidUnhide(notification: NSNotification);
+begin
+  Application.IntfAppRestore;
+end;
+
+procedure TAppDelegate.applicationDidBecomeActive(notification: NSNotification);
+begin
+  Application.IntfAppActivate;
+end;
+
+procedure TAppDelegate.applicationDidResignActive(notification: NSNotification);
+begin
+  Application.IntfAppDeactivate;
+end;
+
+procedure TAppDelegate.applicationDidChangeScreenParameters(notification: NSNotification);
+begin
+  Screen.UpdateMonitors;
+  Screen.UpdateScreen;
+end;
+
 {------------------------------------------------------------------------------
   Method:  TCocoaWidgetSet.RawImage_DescriptionFromCocoaBitmap
AppFunctions.diff (1,879 bytes)

Alexey Tor.

2017-03-22 18:39

reporter   ~0099146

Last edited: 2017-03-22 18:40

View 2 revisions

Checked this pch on Cocoa:
- TApplicationProperties.OnActivate,
- TApplicationProperties.OnDeactivate: both called now
- TApplicationProperties.OnRestore: called now
- TApplicationProperties.OnMinimize: same as Carbon, called but only
if i "hide" app via taskbar context menu, not called if i minimize
window via yellow title icon.
- Screen.*: dont know how to check

Juha Manninen

2017-04-07 19:00

developer   ~0099477

Applied, thanks.

Issue History

Date Modified Username Field Change
2016-10-28 18:15 David Jenkins New Issue
2016-10-28 18:15 David Jenkins File Added: AppFunctions.diff
2017-03-22 18:39 Alexey Tor. Note Added: 0099146
2017-03-22 18:40 Alexey Tor. Note Edited: 0099146 View Revisions
2017-04-07 16:48 Juha Manninen Assigned To => Juha Manninen
2017-04-07 16:48 Juha Manninen Status new => assigned
2017-04-07 19:00 Juha Manninen Fixed in Revision => r54561
2017-04-07 19:00 Juha Manninen LazTarget => -
2017-04-07 19:00 Juha Manninen Note Added: 0099477
2017-04-07 19:00 Juha Manninen Status assigned => resolved
2017-04-07 19:00 Juha Manninen Resolution open => fixed