X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fmplex.c;h=da1bd49b48218c0bd4cfd631cd097ed2fbf56646;hb=b355f9832d094cdb9e700e01cbc063e3fdb4f58b;hp=a9ea894f6eaa696d8677957866221509d98aa244;hpb=cd09055902de482a1be019bf4b4efdae64c98d35;p=ion3.git diff --git a/ioncore/mplex.c b/ioncore/mplex.c index a9ea894..da1bd49 100644 --- a/ioncore/mplex.c +++ b/ioncore/mplex.c @@ -855,7 +855,7 @@ bool mplex_do_prepare_focus(WMPlex *mplex, WStacking *node, PtrList *hidelist=NULL; PtrList **hidelistp=(ew ? NULL : &hidelist); WStacking *foc; - bool within=FALSE; + /*bool within=FALSE;*/ if(sub==NULL && node==NULL) return FALSE; @@ -867,7 +867,7 @@ bool mplex_do_prepare_focus(WMPlex *mplex, WStacking *node, if(!region_prepare_focus((WRegion*)mplex, flags, res)) return FALSE; - foc=mplex_do_to_focus_on(mplex, node, sub, hidelistp, &within); + foc=mplex_do_to_focus_on(mplex, node, sub, hidelistp, NULL /*&within*/); if(foc!=NULL){ while(hidelist!=NULL){ @@ -886,7 +886,7 @@ bool mplex_do_prepare_focus(WMPlex *mplex, WStacking *node, res->reg=foc->reg; res->flags=flags; - return within; + return (foc==sub || (sub==NULL && foc==node)); }else{ return FALSE; } @@ -1169,7 +1169,6 @@ bool mplex_managed_rqorder(WMPlex *mplex, WRegion *reg, WRegionOrder order) static bool mplex_stack(WMPlex *mplex, WStacking *st) { WStacking *tmp=NULL; - Window bottom=None, top=None; WStacking **stackingp=mplex_get_stackingp(mplex); if(stackingp==NULL) @@ -1232,7 +1231,7 @@ bool mplex_do_attach_final(WMPlex *mplex, WRegion *reg, WMPlexPHolder *ph) sw=(!hidden && (param->flags&MPLEX_ATTACH_SWITCHTO || (param->flags&MPLEX_ATTACH_UNNUMBERED - ? modal + ? FALSE : (mplex_current_node(mplex)==NULL)))); hidden=(hidden || (!sw && !(param->flags&MPLEX_ATTACH_UNNUMBERED))); @@ -1270,14 +1269,19 @@ bool mplex_do_attach_final(WMPlex *mplex, WRegion *reg, WMPlexPHolder *ph) node->pseudomodal=(param->flags&MPLEX_ATTACH_PSEUDOMODAL ? 1 : 0); if(lnode!=NULL){ + WMPlexPHolder *ph2, *phn, *php; + llist_link_after(&(mplex->mx_list), (ph!=NULL ? ph->after : NULL), lnode); mplex->mx_count++; - /* Move following placeholders after new node */ - while(ph->next!=NULL) - mplexpholder_move(ph->next, mplex, NULL, lnode); + + /* Move placeholders after new node */ + for(php=NULL, ph2=ph; ph2!=NULL; php=ph2, ph2=phn){ + phn=ph2->next; + mplexpholder_move(ph2, mplex, php, lnode); + } } LINK_ITEM(mplex->mgd, node, mgr_next, mgr_prev); @@ -1307,9 +1311,20 @@ bool mplex_do_attach_final(WMPlex *mplex, WRegion *reg, WMPlexPHolder *ph) mplex_do_node_display(mplex, node, FALSE); else region_unmap(reg); - - if(sw && mcf) - mplex_refocus(mplex, node, FALSE); + + if(mcf){ + if(sw){ + mplex_refocus(mplex, node, FALSE); + }else if(!hidden && + (level>=STACKING_LEVEL_MODAL1 || OBJ_IS(reg, WGroup))){ + /* New modal regions may require focusing, so try to + * give focus back to currently active object. + * (There seems to be some problem with uncontained + * client windows still..) + */ + mplex_refocus(mplex, NULL, FALSE); + } + } if(lnode!=NULL) mplex_managed_changed(mplex, MPLEX_CHANGE_ADD, sw, reg); @@ -1666,7 +1681,20 @@ bool mplex_rescue_clientwins(WMPlex *mplex, WRescueInfo *info) { bool ret1, ret2; WMPlexIterTmp tmp; + WLListIterTmp ltmp; + WLListNode *lnode, *was_current=mplex->mx_current; + /* First all mx stuff to move them nicely to another mplex (when that + * is the case), switching to the current region in the target if + * allowed by ph_flags_mask region_rescue. + */ + FOR_ALL_NODES_ON_LLIST(lnode, mplex->mx_list, ltmp){ + int sw=(lnode==was_current ? PHOLDER_ATTACH_SWITCHTO : 0); + region_do_rescue_this(lnode->st->reg, info, sw); + } + + /* Then the rest (possibly retrying failed mx stuff). + */ mplex_iter_init(&tmp, mplex); ret1=region_rescue_some_clientwins((WRegion*)mplex, info, (WRegionIterator*)mplex_iter,