Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Jeremy Pereira


On 22 Sep 2009, at 17:19, Eric Schlegel wrote:


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?


No, there is no API (in Cocoa or otherwise) to control the active  
space.


Speaking as a user of Mac OS X, I am relieved about this.  Spaces is a  
feature that is designed to allow the user to manage the way his/her  
apps appear.  Applications which interfere with the user's preferences  
(e.g. by changing the space from the one I want to view) are likely to  
be annoying and uninstalled (at least on my Mac).





-eric

___

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/adc%40jeremyp.net

This email sent to a...@jeremyp.net


___

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
On Wed, Sep 23, 2009 at 06:46, Jeremy Pereira a...@jeremyp.net wrote:
 Speaking as a user of Mac OS X, I am relieved about this.  Spaces is a
 feature that is designed to allow the user to manage the way his/her apps
 appear.  Applications which interfere with the user's preferences (e.g. by
 changing the space from the one I want to view) are likely to be annoying
 and uninstalled (at least on my Mac).

Understood. But I'm wanting to write my _own_ app to control window
placement within Spaces on my _own_ computer. I want to automate this
instead of having to do a lot of mouse clicking and dragging.

-- 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
On Tue, Sep 22, 2009 at 12:19, Eric Schlegel eri...@apple.com wrote:

 On Sep 21, 2009, at 4:39 PM, Hippo Man wrote:

 Is there a way in Cocoa to programmatically query which Space the user
 is currently looking at? [ ... ]

 You could use the (CoreGraphics, not Cocoa) API
 CGWindowListCreateDescriptionFromArray to get a window description
 dictionary for a window, and then look at the WorkspaceID data in that
 dictionary. There is no defined mapping from WorkspaceID to a particular
 space, however.

Thank you.


 Secondly, is there any way in any of those environments to
 programmatically switch Spaces? [ ... ]

 No, there is no API (in Cocoa or otherwise) to control the active space.

But how does Spaces do it? Is it via an internal, private API that
people like us don't have access to?


-- 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
On Tue, Sep 22, 2009 at 12:27, Jesper Storm Bache jsba...@adobe.com wrote:
 So far we have the following:
 [ ... etc. ... ]

 For example, to determine whether or not a (candidate) window is on
 the active Space on 10.5, I ended up doing:
 [ ... etc. ... ]

 Obviously this is not desirable code, but this is all we have at the
 current point in time.

Well, at least it's better than nothing. Thank you!

-- 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Kyle Sluder
On Wed, Sep 23, 2009 at 11:24 AM, Hippo Man apple.hippo...@gmail.com wrote:
 Understood. But I'm wanting to write my _own_ app to control window
 placement within Spaces on my _own_ computer. I want to automate this
 instead of having to do a lot of mouse clicking and dragging.

This issue has come up a few times recently: I want to do X on my own
computer!  I should be able to do it!  Philosophically this is a very
reasonable point.

Practically, however, there's no easy way to let you do whatever you
want with your machine while simultaneously preventing other
applications from doing the same things.  Under the current model,
every application you run is given equal permissions.  (Yes, they can
drop permissions or be put into a sandbox, but fundamentally the Unix
process model assigns one effective UID and one effective GID to each
process, and all processes that have the same EUID and EGID behave the
same way.)

Keep this in mind when filing bugs about exposing private API or
access to operating system features.

--Kyle Sluder
___

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
On Wed, Sep 23, 2009 at 14:44, Kyle Sluder kyle.slu...@gmail.com wrote:
 This issue has come up a few times recently: I want to do X on my own
 computer!  I should be able to do it!

I'm not trying to assert that I _should_ be able to anything. Please
re-read my messages here, so you can disabuse yourself of that
mistaken notion.

All I want to know is _whether_ I can do what I'm asking about, and if
so, _how_.


-- 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
On Tue, Sep 22, 2009 at 12:27, Jesper Storm Bache jsba...@adobe.com wrote:
 There is very little external control over Spaces.
 Be sure to file enhancement request radars.

One related question: I'm new to the Apple development world, and I
want to make sure that I know the right place to file such an
enhancement request. Is it here? ...

http://bugreport.apple.com

Thanks.

-- 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man

Randall Meadows wrote:

On Sep 23, 2009, at 2:27 PM, Hippo Man wrote:

On Tue, Sep 22, 2009 at 12:27, Jesper Storm Bache jsba...@adobe.com 
wrote:

There is very little external control over Spaces.
Be sure to file enhancement request radars.


One related question: I'm new to the Apple development world, and I
want to make sure that I know the right place to file such an
enhancement request. Is it here? ...

http://bugreport.apple.com


Yes.


Thank you!


--
 Hippo Man 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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Graham Cox


On 24/09/2009, at 4:26 AM, Hippo Man wrote:


But how does Spaces do it? Is it via an internal, private API that
people like us don't have access to?



Yep. There are many of these - probably more than there are public  
ones. Get used to it!


--Graham


___

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Chris Idou



 Secondly, is there any way in any of those environments to
 programmatically switch Spaces? [ ... ]

 No, there is no API (in Cocoa or otherwise) to control the active space.

But how does Spaces do it? Is it via an internal, private API that
people like us don't have access to?

There may not be any API, internal or otherwise. It might be all just built 
into the internal workings of the window manager process.

One would presume there is an internal API for switching to the grid view, 
since Spaces.app does that.


  
__
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-23 Thread Hippo Man
  Secondly, is there any way in any of those environments to
  programmatically switch Spaces? [ ... ]
 
  No, there is no API (in Cocoa or otherwise) to control the active
 space.
 
 But how does Spaces do it? Is it via an internal, private API that
 people like us don't have access to?
 
 There may not be any API, internal or otherwise. It might be all just
 built into the internal
 workings of the window manager process.
 
 One would presume there is an internal API for switching to the grid
 view, since Spaces.app does
 that.

OK. Thanks.

Well, at least I now know that can do what I want, albeit kludgily:

I can find out the current Space as described in the earlier message
here. And although there's no Cocoa nor CoreServices way for me to
switch Spaces, I can at least do that via Apple Events in a sort-of
hacky way: in the Spaces Preference Pane, I can map keystrokes to the
Switch Directly Into a Space events, and then I can use Apple Events
in my application to send these keystrokes.

None of this is ideal, of course, but it's workable and acceptable for
my purposes.

Thanks again to all.


-- 
 Hippo Man
 apple.hippo...@gmail.com

|.-, 0__0
|   /   (  oo'---,
|  /oo\
| ,\  |
| | \,=__/
|\  /
|/  /--|  /|
||__|-'|__|'
___

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-22 Thread Eric Schlegel


On Sep 21, 2009, at 4:39 PM, Hippo Man wrote:


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?


You could use the (CoreGraphics, not Cocoa) API  
CGWindowListCreateDescriptionFromArray to get a window description  
dictionary for a window, and then look at the WorkspaceID data in that  
dictionary. There is no defined mapping from WorkspaceID to a  
particular space, however.



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?


No, there is no API (in Cocoa or otherwise) to control the active space.

-eric

___

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


Re: Controlling Spaces and retrieving information about the current Space?

2009-09-22 Thread Jesper Storm Bache
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