Re: insert idle/timeout handler into gtk loop
- From: Havoc Pennington <hp redhat com>
- To: "Riswick, J.G.A. van" <J G A v Riswick tue nl>
- Cc: "'gtk-app-devel-list gnome org'" <gtk-app-devel-list gnome org>
- Subject: Re: insert idle/timeout handler into gtk loop
- Date: 11 Oct 2001 16:52:37 -0400
"Riswick, J.G.A. van" <J G A v Riswick tue nl> writes:
In a gnome applet I'm writing, I'd like to monitor if
the user changed workspaces. The function gnome_wmhints_
get_current_workspace() returns the workspace number. So
I figured I'd insert an idle handler into the gtk main
loop, with low priority, that can monitor workspace
changes if gtk is not doing anything else. This works,
but even when I use the lowest priority (G_PRIORITY_LOW)
for inserting the handler, the app takes up so much cpu
time that my laptop fan has to blow all the time (50%
cpu time on a 800Mhz pIII). So for now I solved the
problem by using a 100ms timeout instead of an idle
handler. I was wondering if here is anothere way of
monitoring a quantity and it also seems strange to me that
an idle handler with the lowest priority takes up so
much cpu time.
You need to monitor PropertyNotify for the X property that indicates
the current workspace. i.e. ask for PropertyNotify on the root
window with gdk_window_set_events(GDK_ROOT_PARENT()), then check
for that hint in the PropertyNotify.
The GNOME hints are on the way out anyway though, module "libwnck" in
GNOME CVS has a library for using the new hints. It requires GTK 2
however.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]