[comp.windows.x] focus in and out, where is this keyboard again?

devin@lucid.com (Matthieu Devin) (03/28/89)

How can I detect if a widget has chosen to redirect Keyboard Focus to one of
its children using XtSetKeyboardFocus ? 

It seems to me I could use a XtGetKeyboardFocus function which isn't provided
by libXt. Although I can hack one using the static function FindFocusWidget,
it could be usefull to provide it for everybody in a future release. 

In my case I would need it to handle multiple text widgets inside a unique
window: widgets display different insert cursors to reflect if they have/have
not the keyboard focus.

FocusIn and FocusOut events allow to switch cursor shape, as well as
Enter/Leave with "focus" field set to 1 (to detect focus change by
PointerMotion).

If I programmatically redirect focus with XtSetKeyboardFocus, I still receive
Enter/Leave events with "focus" set to 1 (which is as described in Xlib).

This means that you get the focus on Enter events with focus 1, only if Xt
doesn't manually redirect it with XtSetKeyboardFocus. Then when handling
Enter/Leave I need to know if events will be redirected by Xt or dispatched to
the window in which they occur if I want to show the right cursor.

Did someone encountered the same problem earlier ?

Thanks for enlightments

Matt

Matthieu Devin          Lucid Inc. 707 Laurel St, Menlo Park, CA 94025
devin@lucid.com         (415)329-8400