discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: api for programmatically getting a list of all windows


From: Ivan Vučica
Subject: Re: api for programmatically getting a list of all windows
Date: Wed, 19 Sep 2012 01:02:36 +0200

Looking at source code of XGServerWindow.m (I think) this afternoon, I couldn't 
figure out if it queries the X server for all the windows or just uses an 
internal cache. The win32 version seemed to be getting the list of all windows 
on the desktop, so I presume the x11 version should do the same.

I haven't tested under either platform.

You concluded that the list seems to update only when you change number of open 
windows in the app. Perhaps the code doesn't update the internal list of 
windows? It seems to operate that way, based on what I remember reading in the 
afternoon. The list doesn't seem to be generated on the fly whenever you call 
NSWindowList(). Can you try restarting the app, changing the number of open 
non-GNUstep windows between restarts, and then compare results?

Also, this SEEMS to be RELATIVELY simple code to step through, so it may be 
time to fire up gdb and slowly step through NSWindowList(), figuring out what 
it does and how it accomplishes that?

Sent from my iPad

On 18. 9. 2012., at 22:04, Dan Hitt <dan.hitt@gmail.com> wrote:

> Thanks Riccardo, Germán, and Nikolaus.
> 
> NSWindowList(*,*) and NSWindowCount() appear to refer to the
> windows of the application.
> 
> I tested all this out with a little code
>  NSArray* wins=[NSApp windows];
>  unsigned int count=[wins count];
>  int wc;
>  NSCountWindows(&wc);
>  printf("window count is %d (%d):\n",count,wc);
>  int w[wc];
>  NSWindowList(wc,w);
>  for (int i=0;i<wc;i++) printf("  %d",w[i]);
>  printf("\n");
> 
> From experimenting around, it looks like [NSApp windows] is an
> array sized to hold a possibly expanding set of windows.  NSCountWindows()
> gives you a way to know how much space to allow on the stack to get a window
> descriptor of some sort from NSWindowList().
> 
> But in any event, changing the number of windows in the app changes
> the numbers that are put out (for example, opening and closing an info panel),
> but opening and closing windows in other programs has no effect.
> 
> Next question would be whether anybody has any advice on what library
> to use to access x windows, i.e., is there a "best practice" in this regard?
> (I would prefer to use function calls rather than trawl through xwininfo 
> output
> of course.)
> 
> Thanks in advance if anybody has any advice.
> 
> And thanks again for all the earlier ideas and function and method calls.
> 
> dan
> 
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]