mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 05:10:58 +00:00
Improve interoperation with workspace manager.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22400 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2fe4dfa138
commit
9bf1d32a7b
3 changed files with 95 additions and 115 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-02-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSApplication.m: Send activation/deactivation notifications
|
||||||
|
to workspace center too ... so workspace manager will know about it.
|
||||||
|
* Source/NSWorkspace.m: Change internal method to launch applications
|
||||||
|
so that it never asks the workspace manager to do it ... that should
|
||||||
|
be handled by the public methods instead. Simplify a little to take
|
||||||
|
advantage of change to NSApplication.
|
||||||
|
|
||||||
2006-01-27 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-01-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSApplication.m: pass more informative user info in
|
* Source/NSApplication.m: pass more informative user info in
|
||||||
|
|
|
@ -1126,6 +1126,7 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||||
{
|
{
|
||||||
unsigned count;
|
unsigned count;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
NSDictionary *info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menus should observe this notification in order to make themselves
|
* Menus should observe this notification in order to make themselves
|
||||||
|
@ -1174,9 +1175,14 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||||
[menu_window windowNumber]];
|
[menu_window windowNumber]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info = [self _notificationUserInfo];
|
||||||
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||||
object: self
|
object: self
|
||||||
userInfo: [self _notificationUserInfo]];
|
userInfo: info];
|
||||||
|
nc = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||||
|
[nc postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||||
|
object: [NSWorkspace sharedWorkspace]
|
||||||
|
userInfo: info];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,6 +1197,7 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||||
NSArray *windows_list = [self windows];
|
NSArray *windows_list = [self windows];
|
||||||
unsigned count = [windows_list count];
|
unsigned count = [windows_list count];
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
NSDictionary *info;
|
||||||
|
|
||||||
[nc postNotificationName: NSApplicationWillResignActiveNotification
|
[nc postNotificationName: NSApplicationWillResignActiveNotification
|
||||||
object: self];
|
object: self];
|
||||||
|
@ -1237,9 +1244,14 @@ static NSSize scaledIconSizeForSize(NSSize imageSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info = [self _notificationUserInfo];
|
||||||
[nc postNotificationName: NSApplicationDidResignActiveNotification
|
[nc postNotificationName: NSApplicationDidResignActiveNotification
|
||||||
object: self
|
object: self
|
||||||
userInfo: [self _notificationUserInfo]];
|
userInfo: info];
|
||||||
|
nc = [[NSWorkspace sharedWorkspace] notificationCenter];
|
||||||
|
[nc postNotificationName: NSApplicationDidResignActiveNotification
|
||||||
|
object: [NSWorkspace sharedWorkspace]
|
||||||
|
userInfo: info];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,6 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
{
|
{
|
||||||
NSDistributedNotificationCenter *remote;
|
NSDistributedNotificationCenter *remote;
|
||||||
}
|
}
|
||||||
- (void) _handleApplicationNotification: (NSNotification*)aNotification;
|
|
||||||
- (void) _handleRemoteNotification: (NSNotification*)aNotification;
|
- (void) _handleRemoteNotification: (NSNotification*)aNotification;
|
||||||
- (void) _postLocal: (NSString*)name userInfo: (NSDictionary*)info;
|
- (void) _postLocal: (NSString*)name userInfo: (NSDictionary*)info;
|
||||||
@end
|
@end
|
||||||
|
@ -250,14 +249,6 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
removeObserver: self
|
|
||||||
name: NSApplicationDidBecomeActiveNotification
|
|
||||||
object: nil];
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
removeObserver: self
|
|
||||||
name: NSApplicationDidResignActiveNotification
|
|
||||||
object: nil];
|
|
||||||
[remote removeObserver: self name: nil object: GSWorkspaceNotification];
|
[remote removeObserver: self name: nil object: GSWorkspaceNotification];
|
||||||
RELEASE(remote);
|
RELEASE(remote);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -268,17 +259,6 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
addObserver: self
|
|
||||||
selector: @selector(_handleApplicationNotification:)
|
|
||||||
name: NSApplicationDidResignActiveNotification
|
|
||||||
object: nil];
|
|
||||||
[[NSNotificationCenter defaultCenter]
|
|
||||||
addObserver: self
|
|
||||||
selector: @selector(_handleApplicationNotification:)
|
|
||||||
name: NSApplicationDidBecomeActiveNotification
|
|
||||||
object: nil];
|
|
||||||
|
|
||||||
remote = RETAIN([NSDistributedNotificationCenter defaultCenter]);
|
remote = RETAIN([NSDistributedNotificationCenter defaultCenter]);
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
|
@ -318,7 +298,9 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
NSDictionary *info = [aNotification userInfo];
|
NSDictionary *info = [aNotification userInfo];
|
||||||
|
|
||||||
if ([name isEqual: NSWorkspaceDidTerminateApplicationNotification] == YES
|
if ([name isEqual: NSWorkspaceDidTerminateApplicationNotification] == YES
|
||||||
|| [name isEqual: NSWorkspaceDidLaunchApplicationNotification] == YES)
|
|| [name isEqual: NSWorkspaceDidLaunchApplicationNotification] == YES
|
||||||
|
|| [name isEqualToString: NSApplicationDidBecomeActiveNotification] == YES
|
||||||
|
|| [name isEqualToString: NSApplicationDidResignActiveNotification] == YES)
|
||||||
{
|
{
|
||||||
GSLaunched(aNotification, YES);
|
GSLaunched(aNotification, YES);
|
||||||
}
|
}
|
||||||
|
@ -363,17 +345,6 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
userInfo: info]];
|
userInfo: info]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _handleApplicationNotification: (NSNotification*)aNotification
|
|
||||||
{
|
|
||||||
NSString *name = [aNotification name];
|
|
||||||
|
|
||||||
if ([name isEqualToString: NSApplicationDidBecomeActiveNotification] == YES
|
|
||||||
|| [name isEqualToString: NSApplicationDidResignActiveNotification] == YES)
|
|
||||||
{
|
|
||||||
GSLaunched(aNotification, YES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forward a notification from a remote application to observers in this
|
* Forward a notification from a remote application to observers in this
|
||||||
* application.
|
* application.
|
||||||
|
@ -413,8 +384,7 @@ static id GSLaunched(NSNotification *notification, BOOL active)
|
||||||
|
|
||||||
// application communication
|
// application communication
|
||||||
- (BOOL) _launchApplication: (NSString*)appName
|
- (BOOL) _launchApplication: (NSString*)appName
|
||||||
arguments: (NSArray*)args
|
arguments: (NSArray*)args;
|
||||||
locally: (BOOL)locally;
|
|
||||||
- (id) _connectApplication: (NSString*)appName;
|
- (id) _connectApplication: (NSString*)appName;
|
||||||
- (id) _workspaceApplication;
|
- (id) _workspaceApplication;
|
||||||
|
|
||||||
|
@ -732,7 +702,7 @@ static NSString *_rootPath = @"/";
|
||||||
NSArray *args;
|
NSArray *args;
|
||||||
|
|
||||||
args = [NSArray arrayWithObjects: @"-GSFilePath", fullPath, nil];
|
args = [NSArray arrayWithObjects: @"-GSFilePath", fullPath, nil];
|
||||||
return [self _launchApplication: appName arguments: args locally: NO];
|
return [self _launchApplication: appName arguments: args];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -794,7 +764,7 @@ static NSString *_rootPath = @"/";
|
||||||
NSArray *args;
|
NSArray *args;
|
||||||
|
|
||||||
args = [NSArray arrayWithObjects: @"-GSTempPath", fullPath, nil];
|
args = [NSArray arrayWithObjects: @"-GSTempPath", fullPath, nil];
|
||||||
return [self _launchApplication: appName arguments: args locally: NO];
|
return [self _launchApplication: appName arguments: args];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1393,7 +1363,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
{
|
{
|
||||||
args = [NSArray arrayWithObjects: @"-autolaunch", @"YES", nil];
|
args = [NSArray arrayWithObjects: @"-autolaunch", @"YES", nil];
|
||||||
}
|
}
|
||||||
return [self _launchApplication: appName arguments: args locally: NO];
|
return [self _launchApplication: appName arguments: args];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2349,24 +2319,15 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch an application ... if there is a workspace application and
|
* Launch an application locally (ie without reference to the workspace
|
||||||
* we have not been specifically asked to launch locally, ask the
|
* manager application). We should only call this method when we want
|
||||||
* workspace application to perform the launch for us.
|
* the application launched by this process, either because what we are
|
||||||
* Otherwise we try to launch the app ourself as long as it is on
|
* launching IS the workspace manager, or because we have tried to get
|
||||||
* the same host as we are.
|
* the workspace manager to do the job and been unable to do so.
|
||||||
*/
|
*/
|
||||||
- (BOOL) _launchApplication: (NSString*)appName
|
- (BOOL) _launchApplication: (NSString*)appName
|
||||||
arguments: (NSArray*)args
|
arguments: (NSArray*)args
|
||||||
locally: (BOOL)locally
|
|
||||||
{
|
{
|
||||||
id app;
|
|
||||||
|
|
||||||
if (locally == NO && (app = [self _workspaceApplication]) != nil)
|
|
||||||
{
|
|
||||||
return [app _launchApplication: appName arguments: args locally: YES];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSTask *task;
|
NSTask *task;
|
||||||
NSString *path;
|
NSString *path;
|
||||||
NSDictionary *userinfo;
|
NSDictionary *userinfo;
|
||||||
|
@ -2433,7 +2394,6 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
*/
|
*/
|
||||||
[_launched setObject: task forKey: appName];
|
[_launched setObject: task forKey: appName];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) _connectApplication: (NSString*)appName
|
- (id) _connectApplication: (NSString*)appName
|
||||||
|
@ -2589,8 +2549,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
|
||||||
if ([host isEqual: @""] == YES)
|
if ([host isEqual: @""] == YES)
|
||||||
{
|
{
|
||||||
if ([self _launchApplication: appName
|
if ([self _launchApplication: appName
|
||||||
arguments: nil
|
arguments: nil] == YES)
|
||||||
locally: YES] == YES)
|
|
||||||
{
|
{
|
||||||
app = [self _connectApplication: appName];
|
app = [self _connectApplication: appName];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue