There is very little external control over Spaces. Be sure to file enhancement request radars.
So far we have the following: 1) In 10.6 you can ask a window whether or not it is on the active Space ( [NSWindow isOnActiveSpace]) 2) CGWindow.h allows you to query for the space id (kCGWindowWorkspace) that a window is on. Note that this key is only present on visible windows. The API that you use is CGWindowListCreateDescriptionFromArray & this API is slow (I saw a lot of time spent in XML decoding on 10.5), so try to use it as little as possible 3) When you create a new document window (and show it), it is placed on the active Space Combine these as needed. For example, to determine whether or not a (candidate) window is on the active Space on 10.5, I ended up doing: - Creating a new 1 by 1 document window & show it. Use #2 to get its space id. I now have the id of the active space. (dispose of the window) - Get the space id for the candidate window & compare with the id calculated above Obviously this is not desirable code, but this is all we have at the current point in time. Jesper On Sep 21, 2009, at 4:39 PM, Hippo Man wrote: > I'm fairly new to the Cocoa world and completely new to this mailing > list. I hope that I'm posting this question to the correct forum. If > not, I'd be grateful for a pointer to a more appropriate place to > repost this. > > Before coming here, I tried to locate the answer I'm looking for on > the net. I couldn't find it, but that might just be due to the fact > that I don't know the proper way to formulate the question and thereby > construct a meaningful search. So again I beg the indulgence of all of > you if there are one or more other locations where the answer to my > question can be easily found. > > I actually have two related questions. They both pertain to the Spaces > application in Snow Leopard. > > Is there a way in Cocoa to programmatically query which Space the user > is currently looking at? In other words, if I have six Spaces defined > and Space 3 happens to be the one which is currently visible on my > screen, how can I make some sort of Cocoa-based query to find out that > Space 3 is the one that's currently visible? > > Secondly, is there any way in any of those environments to > programmatically switch Spaces? For example, if Space 3 happens to be > visible, is there any Cocoa code I can run which will switch the > visibility to, say, Space 2? > > Thanks in advance for any pointers to docs that you can provide. > > -- > HippoMan <apple.hippo...@gmail.com> > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/jsbache%40adobe.com > > This email sent to jsba...@adobe.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com