static bool try_focus(WThing *next) { if(WTHING_IS(next, WTHING_WINOBJ) && !WTHING_IS_UNFOCUSABLE(next) && on_current_workspace((WWinObj*)next)){ do_set_focus(next); return TRUE; } return FALSE; }
void do_switch_workspace(int num) { dodo_switch_workspace(num); if(wglobal.current_winobj==NULL || !on_current_workspace(wglobal.current_winobj)){ if(circulate(1)==NULL){ do_set_focus((WThing*)SCREEN); wglobal.current_winobj=NULL; } } }
void mainloop() { XEvent ev; for(;;){ get_event(&ev); handle_event(&ev); XSync(wglobal.dpy, False); if(wglobal.focus_next!=NULL){ kill_focusenter_events(); do_set_focus(wglobal.focus_next); wglobal.focus_next=NULL; } } }
void set_focus_weak(WThing *thing) { if(wglobal.focus_next==NULL) do_set_focus(thing); }