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: Dan Hitt
Subject: Re: api for programmatically getting a list of all windows
Date: Tue, 18 Sep 2012 13:04:55 -0700

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



reply via email to

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