tags:

views:

30

answers:

1

Hello

What's the difference between "focus" and "focus-in(out)-event" signals in GTK+? Which one is emitted firs? How are they related to keyboard(TAB) & mouse clicks. Do they depend on each other?

I'm asking this because I want to keep track of currently focused widget within toplevel window and I don't want to test HAS_FOCUS flag of every widget when I need it. The widgets I'm interested of are deep inside other containers, boxes etc. What would be the best way in this situation for keeping & updating focused widget pointer?

+1  A: 

gtk_window_get_focus() does what you need.

The focus-{in,out}-event are low-level events generated by the XWindow system (or whatever in its place) and are generated first. focus is generated by GTK+ itsself: you can think of it as a higher level focus-in-event. This also means that, at least theoretically, you can have a window-less widget (that is a widget without an associated GdkWindow) that emits focus but does not emit focus-in-event.

ntd
I want to manage focus myself. Is there a way to disable focus traveling completely? How?
spajak
What's wrong in just ignoring the signals?
ntd