Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Window Position - Mac

What I can see you can use the CGWindowListCopyWindowInfo function described here: 


Call that function with like this:

CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID);

This function will return a CFArray containing CFDictionaries. The documentation for CFArray and CFDictionary can be found here:

CFArray:

CFDictionary:

I guess you just have to make the function, mentioned above and the needed functions from CFArray and CFDictionary, available via JNI. I have no experience with JNI so I can not help you there.


/Jacob


On Apr 29, 2010, at 16:40, Belcher, Josh wrote:

Jacob, I followed your advice by posing at the apple discussions forum – Here is a link to the post: 
 
Basically, from there they sent me here:
 
Saying it is difficult, if not impossible to get the main window of other apps  unless they participate in inter-Application Communication – I don’t have any guarantees that that will be the case; but, there seems to be at least one person who has posted here that thinks this IS possible.  Unfortunately, I don’t have any Objective-C experience by which I can begin implementing a solution, and it seems that when I do find a particular Objective-C hint or clue, I have no way of using it in eclipse’s SWT.  Case in point:  I have no idea how to access CGWindow.h’s methods/variables in SWT – I can create an NSWindow, but then comes the problem of initializing it with my application. 
So I’m back to the original issue, and whether or not it is actually possible.  Unless there is a different approach or hack that someone knows about.
 
 
From: platform-swt-dev-bounces@xxxxxxxxxxx [mailto:platform-swt-dev-bounces@xxxxxxxxxxx] On Behalf Of Jacob
Sent: Saturday, April 24, 2010 2:34 AM
To: Eclipse Platform SWT component developers list.
Subject: Re: [platform-swt-dev] Window Position - Mac
 
I think this is looking more like a question for a Mac specific channel. I suggest posting in Apple's forum: http://discussions.apple.com/index.jspa . When you've got a solution to your problem in Objective-C/C we can help you integrate/port it to Java and SWT.
 
On Apr 22, 2010, at 17:04, Belcher, Josh wrote:


What about from a process that I start?  I can start the application I want from my program, so I could store the process and access it –
 
Do you have an example of how to access the window information with the current process?  The bare minimum that would get me by would be to find it’s x,y screen coordinates… anything else beyond that is icing.
------------------------
 
I'm pretty sure it's doable, I've seen applications on Mac that can affect windows on a global level. A quick look in the documentation for the NSWindow class I found this: http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/clm/NSWindow/windowNumbersWithOptions:
 
I think it may be what he wants but I don't know how to get from a window number to an actual window. 
 
On Apr 21, 2010, at 03:54, Sky Yan wrote:



If the "any application" means the application in other process, the answer is: no. Mac do not have global window or control handle as HWND on win32. So you can just get window information within current process but have no idea about window in other process. 
 
But there is other method to get position of window in other process, you could try Accessibility API on Mac. You may need to write c code to use it. 
 

sendmsg in cocoa is object-c method. It is totally different with SendMessage on win32. 

On Tue, Apr 20, 2010 at 11:06 PM, Belcher, Josh <Josh.Belcher@xxxxxxxxxx> wrote:
I have been searching for awhile now for a Mac equivalent of the org.eclipse.swt.internal.win32 functions  FindWindow() and GetWindowRect().  I would like to be able to launch any application, gain control of it and query it to find out where it’s top left position is.  If there is a way to do it by setting its position, that would also work for me.
In the org.eclipse.swt.internal.cocoa I have seen some things about sendmsg – but I haven’t been able to find any good examples of how that works in swt, or if that is even what I need.


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev




-- 


Thanks,

Sky Yan
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
 
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
 
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top