Re: Key focus and widgets without GdkWindow



>I guess this is a very basic question, bit I still don't get it :/
>
>I've understood that only widgets with a GdkWindow of their own can grab
>focus. What is the reason for this? Or have I completely misunderstood
>something here?
>
>When I look in the code, it seems Gdk passes all key press events to a
>GtkWindow widget, which in turn dispatches that event to its' focus widget.
>I don't see the connection with GdkWindows here.
>
>I'm about to write a widget which really doesn't need a window of its own,
>but it needs to be able to grab focus. 

the underlying window system (for example X Window) notifies GDK of
key events that occur within "native" windows (i.e. those known to the
native window system). These native windows correspond to
GdkWindows. When a key event gets delivered to GDK, it passes it along
to the relevant widget in GTK, which is generally (but not always) a
GtkWindow. The GtkWindow then has to decide which child widget the key
event should be delivered to, which is generally decided using GTK's
focus model.

--p




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