# NOTE: Derived from blib/lib/Tk.pm.
# Changes made here will be lost when autosplit is run again.
#line 485 "blib/lib/Tk.pm (autosplit into blib/lib/auto/Tk/focusPrev.al)"
# This procedure is invoked to move the input focus to the previous
# window before a given one. "Previous" is defined in terms of the
# window stacking order, with all the windows underneath a given
# top-level (no matter how deeply nested in the hierarchy) considered.
# w - Name of a window: the procedure will set the focus
# to the previous window before this one in the traversal
# Collect information about the current window's position
# among its siblings. Also, if the window is a top-level,
# then reposition to just after the last child of the window.
if ($cur->toplevel() == $cur)
@children = $cur->FocusChildren();
$parent = $cur->parent();
@children = $parent->FocusChildren();
$i = lsearch(\@children,$cur);
# Go to the previous sibling, then descend to its last descendant
# (highest in stacking order. While doing this, ignore top-levels
# and their descendants. When we run out of descendants, go up
# one level to the parent.
next if ($cur->toplevel() == $cur);
@children = $parent->FocusChildren();
if ($cur == $w || $cur->FocusOK)