diff options
author | swick <empty> | 1989-12-14 12:33:09 +0000 |
---|---|---|
committer | swick <empty> | 1989-12-14 12:33:09 +0000 |
commit | 409439335a9894a4c59f2fd3e2f62cbbe955699d (patch) | |
tree | be1c22ca7700bd8683b7e03439b9dcf096784d3d /xc/lib/Xt/Keyboard.c | |
parent | 17678dcd6f8cc50d9683ffa2c64afb155c044f6c (diff) |
Gabe's fix to _FindFocusWidget
Diffstat (limited to 'xc/lib/Xt/Keyboard.c')
-rw-r--r-- | xc/lib/Xt/Keyboard.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/xc/lib/Xt/Keyboard.c b/xc/lib/Xt/Keyboard.c index f5def9aba..42b7617db 100644 --- a/xc/lib/Xt/Keyboard.c +++ b/xc/lib/Xt/Keyboard.c @@ -1,5 +1,5 @@ #ifndef lint -static char Xrcsid[] = "$XConsortium: Keyboard.c,v 1.1 89/12/13 20:02:29 swick Exp $"; +static char Xrcsid[] = "$XConsortium: Keyboard.c,v 1.2 89/12/14 07:48:33 swick Exp $"; #endif /******************************************************** @@ -108,44 +108,39 @@ static Widget _FindFocusWidget(widget, trace, traceDepth, activeCheck) register Widget w; int i; int src; - Widget dst = widget; + Widget dst; XtPerWidgetInput pwi; Boolean isAncestor; - dst = widget; - /* For each ancestor, starting at the top, see if it's forwarded */ /* first check the trace list till done or we go to branch */ isAncestor = TRUE; - for (src = traceDepth-1; - ((src >= 0) && isAncestor); + for (src = traceDepth-1, dst = widget; + ((src > 0) && isAncestor); ) { if (pwi = _XtGetPerWidgetInput(trace[src], FALSE)) { - if (activeCheck && !pwi->haveFocus && src == 0) - return widget; - else if (pwi->focusKid) + if (pwi->focusKid) { dst = pwi->focusKid; - for (i = src-1; i > 0 && trace[i] != dst; i--) {} + for (i = src-1; i >= 0 && trace[i] != dst; i--) {} - if (i <= 0) + if (i < 0) isAncestor = FALSE; else src = i; } + else dst = trace[--src]; } - else - src--; + else dst = trace[--src]; } - if ((src < 0) && (widget != dst)) - { - while ((pwi = _XtGetPerWidgetInput(dst, FALSE)) && pwi->focusKid) - dst = pwi->focusKid; - } + + if (!activeCheck) + while (XtIsWidget(dst) && (pwi = _XtGetPerWidgetInput(dst, FALSE)) && pwi->focusKid) + dst = pwi->focusKid; return dst; } |