Re: Notification when switching Spaces?
Re: Notification when switching Spaces?
- Subject: Re: Notification when switching Spaces?
- From: Jayson Adams <email@hidden>
- Date: Sun, 11 Nov 2007 04:51:11 -0800
On Nov 10, 2007, at 11:01 PM, Eric Schlegel wrote:
My response stemmed from the fact that it would seem to be fairly
trivial for Apple to post a notification when a Spaces switch
occurred, and also fairly typical for them to not do so, which is
kind of annoying when someone like me wants to play with the new
hotness too.
It would be trivial, but it's also not clear that it's something we
want to do. Notifications are API just as much as a function call
or method are; once we start posting a notification on Spaces
switch, and apps start depending on it, we have to continue to
support that notification forever. It's entirely possible that a
future version of Mac OS X will have some new UI for Spaces that
will make it difficult to continue to support a simple
notification. We also generally prefer to avoid providing avenues
for apps to do arbitrary things in response to UI effects such as
Spaces or Expose, because as soon as one app starts doing something
on a Space switch, lots of other apps will too, and the end result
is that the Space switch stops being an extremely smooth animation
and starts getting jerky and ugly.
So you need to make an asynchronous distributed notification?
In general, we prefer to use data-driven approaches, where you tell
us in advance what you want to do when a space switch happens
("move this window to the active space", for example), and we take
care of doing it for you. That allows us to keep the space switch
animation fast and fluid, and also allows us to change the space
switch behavior in future releases while still keeping
compatibility with what your app requested.
It's true that this does prevent some developers from doing
interesting and useful things. The bottom line, though, is that
when providing an API, including a notification, we have to think
in the long term - is this something we can support for the next
ten years? That makes us very conservative about providing new API.
What would your code do, if you had a notification of a Space switch?
It is exactly because Apple cannot predict why an app might find a
Spaces switch notification useful that it should provide the API.
But here's an Appkit release note excerpt that might give you one idea:
We added NSWorkspaceSessionDidBecomeActiveNotification and
NSWorkspaceSessionDidResignActiveNotification notifications to
NSWorkspace, for applications that need to be aware of session
switching (aka "fast user switching"). For example, an application
may decide to disable some processing when its user session is
switched out, and reenable when that session gets switched back in.
Such an application should register for these notifications.
Best,
__jayson
Circus Ponies NoteBook - Organization for a Creative Mind
www.circusponies.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden