void BC_WindowBase::focus()
{
- XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime);
+ XWindowAttributes xwa;
+ XGetWindowAttributes(top_level->display, top_level->win, &xwa);
+ if( xwa.map_state == IsViewable )
+ XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime);
}