+ int origin_x, origin_y, origin_dim;
+ if(input_focus)
+ {
+ const Geometry &fgeom = input_focus->get_geometry();
+ origin_x = fgeom.x+(nav_x*0.5+0.5)*fgeom.w;
+ origin_y = fgeom.y+(nav_y*0.5+0.5)*fgeom.h;
+ origin_dim = abs(nav_x)*fgeom.h+abs(nav_y)*fgeom.w;
+ }
+ else
+ {
+ origin_x = geom.w*(0.5-nav_x*0.5);
+ origin_y = geom.h*(0.5-nav_y*0.5);
+ origin_dim = abs(nav_x)*geom.h+abs(nav_y)*geom.w;
+ }
+
+ if(pointer_grabbed && pointer_focus==input_focus)
+ return false;
+
+ Widget *sibling = find_next_child(origin_x, origin_y, origin_dim, nav_x, nav_y);
+ if(!sibling && input_focus)
+ {
+ const Geometry &fgeom = input_focus->get_geometry();
+ origin_x -= fgeom.w*(nav_x*0.5);
+ origin_y -= fgeom.h*(nav_y*0.5);
+ sibling = find_next_child(origin_x, origin_y, origin_dim, nav_x, nav_y);
+ }
+
+ if(sibling)
+ {
+ set_input_focus(sibling);
+ if(Panel *panel = dynamic_cast<Panel *>(sibling))
+ panel->navigate(nav);
+ return true;
+ }