diff options
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index e2d0f922..ddb3f092 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -877,8 +877,22 @@ static const iWidget *findFocusable_Widget_(const iWidget *d, const iWidget *sta | |||
877 | return NULL; | 877 | return NULL; |
878 | } | 878 | } |
879 | 879 | ||
880 | static const iWidget *findFocusRoot_Widget_(const iWidget *d) { | ||
881 | iForEach(ObjectList, i, d->children) { | ||
882 | const iWidget *root = findFocusRoot_Widget_(constAs_Widget(i.object)); | ||
883 | if (root) { | ||
884 | return root; | ||
885 | } | ||
886 | } | ||
887 | if (d->flags & focusRoot_WidgetFlag) { | ||
888 | return d; | ||
889 | } | ||
890 | return NULL; | ||
891 | } | ||
892 | |||
880 | iAny *findFocusable_Widget(const iWidget *startFrom, enum iWidgetFocusDir focusDir) { | 893 | iAny *findFocusable_Widget(const iWidget *startFrom, enum iWidgetFocusDir focusDir) { |
881 | iWidget *root = get_Window()->root; | 894 | const iWidget *root = findFocusRoot_Widget_(get_Window()->root); |
895 | iAssert(root != NULL); | ||
882 | iBool getNext = (startFrom ? iFalse : iTrue); | 896 | iBool getNext = (startFrom ? iFalse : iTrue); |
883 | const iWidget *found = findFocusable_Widget_(root, startFrom, &getNext, focusDir); | 897 | const iWidget *found = findFocusable_Widget_(root, startFrom, &getNext, focusDir); |
884 | if (!found && startFrom) { | 898 | if (!found && startFrom) { |