mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Ensure that applications get a proper app icon under WindowMaker even
when their main nib contains visible at launch time windows. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33231 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c4b717c08a
commit
12865cbdb9
3 changed files with 55 additions and 40 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-06-02 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSApplication.m (-finishLaunching): Move creation of the
|
||||
app icon from here ...
|
||||
* Source/NSApplication.m (-_appIconInit):
|
||||
* Source/Functions.m (NSApplicationMain): ... to here so that
|
||||
applications get a proper app icon under WindowMaker even when
|
||||
their main nib contains visible at launch time windows.
|
||||
|
||||
2011-05-31 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Images/common_Miniaturize.tiff
|
||||
|
|
|
@ -45,6 +45,10 @@
|
|||
|
||||
char **NSArgv = NULL;
|
||||
|
||||
@interface NSApplication(Private)
|
||||
- (void) _appIconInit;
|
||||
@end
|
||||
|
||||
/*
|
||||
* Main initialization routine for the GNUstep GUI Library Apps
|
||||
*/
|
||||
|
@ -75,6 +79,11 @@ NSApplicationMain(int argc, const char **argv)
|
|||
}
|
||||
[appClass sharedApplication];
|
||||
|
||||
/* NB Create the app icon before any other window; otherwise the app icon
|
||||
window will not be mapped by WindowMaker and the user will not get the
|
||||
proper application menu. */
|
||||
[NSApp _appIconInit];
|
||||
|
||||
mainModelFile = [infoDict objectForKey: @"NSMainNibFile"];
|
||||
if (mainModelFile != nil && [mainModelFile isEqual: @""] == NO)
|
||||
{
|
||||
|
|
|
@ -368,7 +368,7 @@ struct _NSModalSession {
|
|||
};
|
||||
|
||||
@interface NSApplication (Private)
|
||||
- _appIconInit;
|
||||
- (void) _appIconInit;
|
||||
- (NSDictionary*) _notificationUserInfo;
|
||||
- (void) _openDocument: (NSString*)name;
|
||||
- (id) _targetForAction: (SEL)aSelector
|
||||
|
@ -986,10 +986,7 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
*/
|
||||
- (void) finishLaunching
|
||||
{
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSDictionary *infoDict = [mainBundle infoDictionary];
|
||||
NSDocumentController *sdc;
|
||||
NSString *appIconFile;
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSString *filePath;
|
||||
NSArray *windows_list;
|
||||
|
@ -997,41 +994,8 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
|||
unsigned i;
|
||||
BOOL hadDuplicates = NO;
|
||||
BOOL didAutoreopen = NO;
|
||||
NSImage *image = nil;
|
||||
NSArray *files = nil;
|
||||
|
||||
appIconFile = [infoDict objectForKey: @"NSIcon"];
|
||||
if (appIconFile && ![appIconFile isEqual: @""])
|
||||
{
|
||||
image = [NSImage imageNamed: appIconFile];
|
||||
}
|
||||
|
||||
// Try to look up the icns file.
|
||||
appIconFile = [infoDict objectForKey: @"CFBundleIconFile"];
|
||||
if (appIconFile && ![appIconFile isEqual: @""])
|
||||
{
|
||||
image = [NSImage imageNamed: appIconFile];
|
||||
}
|
||||
|
||||
if (image == nil)
|
||||
{
|
||||
image = [NSImage imageNamed: @"GNUstep"];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set the new image to be named 'NSApplicationIcon' ... to do that we
|
||||
* must first check that any existing image of the same name has its
|
||||
* name removed.
|
||||
*/
|
||||
[(NSImage*)[NSImage imageNamed: @"NSApplicationIcon"] setName: nil];
|
||||
// We need to copy the image as we may have a proxy here
|
||||
image = AUTORELEASE([image copy]);
|
||||
[image setName: @"NSApplicationIcon"];
|
||||
}
|
||||
|
||||
[self setApplicationIconImage: image];
|
||||
[self _appIconInit];
|
||||
|
||||
/* post notification that launch will finish */
|
||||
[nc postNotificationName: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
|
@ -3762,11 +3726,14 @@ struct _DelegateWrapper
|
|||
|
||||
@implementation NSApplication (Private)
|
||||
|
||||
- _appIconInit
|
||||
- (void) _appIconInit
|
||||
{
|
||||
NSDictionary *infoDict;
|
||||
NSString *appIconFile;
|
||||
NSImage *image = nil;
|
||||
NSAppIconView *iv;
|
||||
unsigned mask = NSIconWindowMask;
|
||||
BOOL suppress;
|
||||
BOOL suppress;
|
||||
|
||||
suppress = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"GSSuppressAppIcon"];
|
||||
|
@ -3777,6 +3744,37 @@ struct _DelegateWrapper
|
|||
}
|
||||
#endif
|
||||
|
||||
infoDict = [[NSBundle mainBundle] infoDictionary];
|
||||
appIconFile = [infoDict objectForKey: @"NSIcon"];
|
||||
if (appIconFile && ![appIconFile isEqual: @""])
|
||||
{
|
||||
image = [NSImage imageNamed: appIconFile];
|
||||
}
|
||||
|
||||
// Try to look up the icns file.
|
||||
appIconFile = [infoDict objectForKey: @"CFBundleIconFile"];
|
||||
if (appIconFile && ![appIconFile isEqual: @""])
|
||||
{
|
||||
image = [NSImage imageNamed: appIconFile];
|
||||
}
|
||||
|
||||
if (image == nil)
|
||||
{
|
||||
image = [NSImage imageNamed: @"GNUstep"];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set the new image to be named 'NSApplicationIcon' ... to do that we
|
||||
* must first check that any existing image of the same name has its
|
||||
* name removed.
|
||||
*/
|
||||
[(NSImage*)[NSImage imageNamed: @"NSApplicationIcon"] setName: nil];
|
||||
// We need to copy the image as we may have a proxy here
|
||||
image = AUTORELEASE([image copy]);
|
||||
[image setName: @"NSApplicationIcon"];
|
||||
}
|
||||
[self setApplicationIconImage: image];
|
||||
|
||||
_app_icon_window = [[NSIconWindow alloc] initWithContentRect: NSZeroRect
|
||||
styleMask: mask
|
||||
backing: NSBackingStoreRetained
|
||||
|
@ -3803,7 +3801,6 @@ struct _DelegateWrapper
|
|||
*/
|
||||
[_app_icon_window orderFrontRegardless];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDictionary*) _notificationUserInfo
|
||||
|
|
Loading…
Reference in a new issue