Re: wnck_screen_get_windows() returns empty window list

On 6/25/06, Ben Liblit <liblit cs wisc edu> wrote:
(I hereby join the growing list of people asking libwnck questions on
the Metacity development list, since it's really not clear where libwnck
questions belong.  Please accept my apologies if this is not the
appropriate forum.)

I'm trying to get a list of windows on the default screen.  However, the
obvious combination of wnck_screen_get_default() plus
wnck_screen_get_windows() returns a NULL GList:

(Letting this go to the list instead of answering outside, as it seems
a lot more people are asking this recently, and I've been meaning to
ask Havoc about it...)

It's not anything obvious you're missing, as evidenced by the fact
that it seems to trip up everyone who ever tries to use libwnck.  If
we ever get around to writing a FAQ or some documentation, this
particular question would need to be covered first.  libwnck is
essentially unusable until the idle handler has run, as it merely
queues an update when the screen is first constructed (with e.g. the
wnck_screen_get_default() call).  Any calls to get the window list
will merely return the "current" list of windows -- this is a list
that will always lag the correct list since libwnck has to wait for
notification from the Xserver of the various changes; in particular,
this is a problem when first starting as the "lagging" means that the
window list is empty until the idle handler runs for the first time.

We could get rid of this stumbling block, I believe, by calling
wnck_screen_force_update() within wnck_screen_construct().  But, there
might have been a reason to not do that, so I need to ask Havoc if
such a change would be a good idea or not.

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