X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Ffocus.c;h=573dcebb0203d334cc2a2dcdf455d44c36e8da5f;hb=refs%2Ftags%2F20070506;hp=b2341ab403b5cd99a65220b8c88e73a894473cf1;hpb=de22e45179cb3bafa490294d31d47f361047a30a;p=ion3.git diff --git a/ioncore/focus.c b/ioncore/focus.c index b2341ab..573dceb 100644 --- a/ioncore/focus.c +++ b/ioncore/focus.c @@ -3,10 +3,7 @@ * * Copyright (c) Tuomo Valkonen 1999-2007. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -166,10 +163,8 @@ void region_set_await_focus(WRegion *reg) } -static bool region_is_await(WRegion *reg) +static bool region_is_parent(WRegion *reg, WRegion *aw) { - WRegion *aw=(WRegion*)await_watch.obj; - while(aw!=NULL){ if(aw==reg) return TRUE; @@ -180,6 +175,18 @@ static bool region_is_await(WRegion *reg) } +static bool region_is_await(WRegion *reg) +{ + return region_is_parent(reg, (WRegion*)await_watch.obj); +} + + +static bool region_is_focusnext(WRegion *reg) +{ + return region_is_parent(reg, ioncore_g.focus_next); +} + + /* Only keep await status if focus event is to an ancestor of the await * region. */ @@ -299,6 +306,18 @@ bool region_is_active(WRegion *reg) } +static bool region_manager_is_focusnext(WRegion *reg) +{ + if(reg==NULL || ioncore_g.focus_next==NULL) + return FALSE; + + if(reg==ioncore_g.focus_next) + return TRUE; + + return region_manager_is_focusnext(REGION_MANAGER(reg)); +} + + bool region_may_control_focus(WRegion *reg) { if(OBJ_IS_BEING_DESTROYED(reg)) @@ -306,8 +325,11 @@ bool region_may_control_focus(WRegion *reg) if(REGION_IS_ACTIVE(reg) || REGION_IS_PSEUDOACTIVE(reg)) return TRUE; - - if(region_is_await(reg)) + + if(region_is_await(reg) || region_is_focusnext(reg)) + return TRUE; + + if(region_manager_is_focusnext(reg)) return TRUE; return FALSE;