Re: Checking for window inactivity



Scanning all the children to see who has the focus seems to work good
enough, except for the case of bringing up any of the right click popup
menus. The popup menu of the textview doesn't seem to be considered a
child of the textview. And from what I remember of a comment in
gtkmenu.h, menu's can't have focus. 

I can check if the textview's popup menu is mapped, but this seems like
a bad solution because I would then have to check every widget that can
bring up a popup menu to see if it's menu is mapped.

Is there something I'm missing?

ps, sorry if this topposts, I inadvertently lost the original

~Luke


On Sun, 2005-06-05 at 17:55 -0700, Alem Dain wrote:
Unfortunately I think that when the popup menu appears, focus switches
to it automatically, and so the window really *has* lost focus.

Easiest solution I can see is to examine all the children
(recursively) of the window that has "lost" focus, and check to see if
any of them has focus.  You can do this using gtk_container_forall()
or gtk_container_foreach() (probably the latter is more approrpiate
here).  Perhaps GTK has some functionality that will check this sort
of thing for you, but I couldn't find it.

There's a gtk_window_has_toplevel_focus() which seems to me to be
intuitively what you'd want, but it seems to always report exactly the
opposite of what I'd expect.  Hmm.

-Adam



On 6/5/05, Luke McOmber <lmcomber rochester rr com> wrote:
Hey everyone,

I have hopefully a simple question. I have a window that contains a
textview in it. I want to change the background color of the textview
whenever the window becomes inactive, i.e. whenever the title bar
becomes grayed out.

I tried using the "focus-out-event" on the window along with
gtk_window_is_active(). But that changes the background color even when
you right click on the textview.

How can I truly tell when the window becomes inactive?

TIA,
Luke


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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