}
+void mplex_set_szplcy(WMPlex *mplex, WRegion *sub, WSizePolicy szplcy)
+{
+ WStacking *node;
+
+ node=mplex_find_stacking(mplex, sub);
+
+ if(node!=NULL)
+ node->szplcy=szplcy;
+}
+
+
+WSizePolicy mplex_get_szplcy(WMPlex *mplex, WRegion *sub)
+{
+ WStacking *node;
+
+ node=mplex_find_stacking(mplex, sub);
+
+ return (node==NULL ? SIZEPOLICY_DEFAULT : node->szplcy);
+}
+
+
/*}}}*/
static WStacking *mplex_do_to_focus_on(WMPlex *mplex, WStacking *node,
WStacking *to_try,
- PtrList **hidelist)
+ PtrList **hidelist, bool *within)
{
WGroup *grp=OBJ_CAST(node->reg, WGroup);
WStacking *st;
if(grp!=NULL){
if(to_try==NULL)
to_try=grp->current_managed;
+ /* Only will return stuff within 'node' */
st=mplex_find_to_focus(mplex, to_try, node, hidelist);
- if(st!=NULL || to_try!=NULL)
+ if(st!=NULL){
+ if(within!=NULL)
+ *within=TRUE;
return st;
- if(hidelist!=NULL)
- ptrlist_clear(hidelist);
- /* We don't know whether something is blocking focus here,
- * or if there was nothing to focus (as node->reg itself
- * isn't on the stacking list).
- */
+ }
}
st=mplex_do_to_focus(mplex, node, hidelist);
- if(st==node)
- return st;
+ if(st==node && within!=NULL)
+ *within=TRUE;
- if(hidelist!=NULL)
- ptrlist_clear(hidelist);
-
- return NULL;
+ return st;
}
static bool mplex_refocus(WMPlex *mplex, WStacking *node, bool warp)
{
WStacking *foc=NULL;
- bool ret=TRUE;
+ bool within=FALSE;
- if(node!=NULL){
- foc=mplex_do_to_focus_on(mplex, node, NULL, NULL);
- ret=(foc!=NULL);
- }
+ if(node!=NULL)
+ foc=mplex_do_to_focus_on(mplex, node, NULL, NULL, &within);
- if(foc==NULL){
- ret=FALSE;
+ if(foc==NULL || !within)
foc=mplex_to_focus(mplex);
- }
if(foc!=NULL)
region_maybewarp(foc->reg, warp);
- return ret;
+ return within;
}
PtrList *hidelist=NULL;
PtrList **hidelistp=(ew ? NULL : &hidelist);
WStacking *foc;
+ /*bool within=FALSE;*/
if(sub==NULL && node==NULL)
return FALSE;
if(!region_prepare_focus((WRegion*)mplex, flags, res))
return FALSE;
- if(node!=NULL)
- foc=mplex_do_to_focus_on(mplex, node, sub, hidelistp);
- else
- foc=mplex_do_to_focus(mplex, sub, hidelistp);
+ foc=mplex_do_to_focus_on(mplex, node, sub, hidelistp, NULL /*&within*/);
if(foc!=NULL){
while(hidelist!=NULL){
res->reg=foc->reg;
res->flags=flags;
- if(sub==NULL)
- return (foc==node);
- else
- return (foc==sub);
+ return (foc==sub || (sub==NULL && foc==node));
}else{
return FALSE;
}
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)
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)));
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);
region_set_manager(reg, (WRegion*)mplex);
+ if(param->flags&MPLEX_ATTACH_PASSIVE)
+ reg->flags|=REGION_SKIP_FOCUS;
+
if(!(param->flags&MPLEX_ATTACH_WHATEVER)){
WFitParams fp;
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);
if(extl_table_is_bool_set(tab, "hidden"))
par->flags|=MPLEX_ATTACH_HIDDEN&ok;
+ if(extl_table_is_bool_set(tab, "passive"))
+ par->flags|=MPLEX_ATTACH_PASSIVE&ok;
+
if(extl_table_is_bool_set(tab, "pseudomodal"))
par->flags|=MPLEX_ATTACH_PSEUDOMODAL&ok;
* \var{hidden} & (boolean) Attach hidden, if not prevented
* by e.g. the mutually exclusive list being empty.
* This option overrides \var{switchto}. \\
+ * \var{passive} & (boolean) Skip in certain focusing operations. \\
* \var{pseudomodal} & (boolean) The attached region is ``pseudomodal''
* if the stacking level dictates it to be modal.
* This means that the region may be hidden to display
{
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,