mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Merge pull request #25 from trunkmaster/master
Handle `-autolaunch YES` application argument (GUI part)
This commit is contained in:
commit
7fa72c547e
2 changed files with 28 additions and 0 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2019-04-03 Sergii Stoian <stoyan255@ukr.net>
|
||||
|
||||
* Source/NSApplication.m (activateIgnoringOtherApps:):
|
||||
Optimize `-autolaunch YES` checking code.
|
||||
|
||||
2019-04-02 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/NSApplication.m:
|
||||
(activateIgnoringOtherApps:) Do not activate application on first run
|
||||
if commandline argument `-autolaunch YES` was specified.
|
||||
|
||||
2019-03-27 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSWindow.h:
|
||||
|
|
|
@ -753,6 +753,8 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
*/
|
||||
@implementation NSApplication
|
||||
|
||||
static BOOL _isAutolaunchChecked = NO;
|
||||
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
|
@ -1259,6 +1261,21 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
*/
|
||||
- (void) activateIgnoringOtherApps: (BOOL)flag
|
||||
{
|
||||
if (_isAutolaunchChecked == NO)
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *autolaunch = [defaults objectForKey: @"autolaunch"];
|
||||
|
||||
_isAutolaunchChecked = YES;
|
||||
|
||||
/* Application was executed with an argument '-autolaunch YES'.
|
||||
Do not activate application on first call. */
|
||||
if (autolaunch && [autolaunch isEqualToString: @"YES"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Currently the flag is ignored
|
||||
if (_app_is_active == NO)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue