rem: if (focused) wSetFocusTo(scr, focused); else if (wapp->last_focused && wapp->last_focused->flags.mapped) wSetFocusTo(scr, wapp->last_focused);
add: if (wapp->last_focused && wapp->last_focused->flags.mapped) { wRaiseFrame(wapp->last_focused->frame->core); wSetFocusTo(scr, wapp->last_focused); } else if (focused) { wSetFocusTo(scr, focused); }
context: wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS){    WScreen *scr;    WWindow *wlist, *next;    WWindow *focused=NULL;    if (!wapp) {	return;    }    scr = wapp->main_window_desc->screen_ptr;    wlist = scr->focused_window;    if (!wlist) return;    /* goto beginning of list */    while (wlist->prev)      wlist = wlist->prev;        while (wlist) {	next = wlist->next;	if (wlist->main_window == wapp->main_window) {	    if (wlist->flags.focused)	      focused = wlist;	    else if (!focused || !focused->flags.focused)	      focused = wlist;	    	    if (wlist->flags.miniaturized && wlist->icon) {                if (bringToCurrentWS || wPreferences.sticky_icons		    || wlist->frame->workspace == scr->current_workspace) {		    if (!wlist->icon->mapped) {			XMapWindow(dpy, wlist->icon->core->window);			wlist->icon->mapped = 1;		    }		    wlist->flags.hidden = 0;		    WMPostNotificationName(WMNChangedState, wlist, "hide");		    if (wlist->frame->workspace != scr->current_workspace)			wWindowChangeWorkspace(wlist, scr->current_workspace);		}		if (miniwindows) {		    wDeiconifyWindow(wlist);		}	    } else if (wlist->flags.hidden) {		unhideWindow(wapp->app_icon->icon, wapp->app_icon->x_pos,			     wapp->app_icon->y_pos, wlist, 			     !wapp->flags.skip_next_animation,			     bringToCurrentWS);	    } else {		if (bringToCurrentWS		    && wlist->frame->workspace != scr->current_workspace) {		    wWindowChangeWorkspace(wlist, scr->current_workspace);		}		wRaiseFrame(wlist->frame->core);	    }	}	wlist = next;    }        wapp->flags.skip_next_animation = 0;    wapp->flags.hidden = 0;        if (focused)	wSetFocusTo(scr, focused);    else if (wapp->last_focused && wapp->last_focused->flags.mapped)	wSetFocusTo(scr, wapp->last_focused);    wapp->last_focused = NULL;    if (wPreferences.auto_arrange_icons) {        wArrangeIcons(scr, True);    }#ifdef HIDDENDOT    wAppIconPaint(wapp->app_icon);#endif }