X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fframe.c;h=6937b3d21b27b20d70c234b21c20de07f9527d30;hb=a33db24c701fe232639d904f934f68818393f95e;hp=f0e786e77cdc1560e4dd5b92de6bac8a0e0d8efd;hpb=768d45580fc176cedd04db0b05621cdf596751d5;p=ion3.git diff --git a/ioncore/frame.c b/ioncore/frame.c index f0e786e..6937b3d 100644 --- a/ioncore/frame.c +++ b/ioncore/frame.c @@ -3,10 +3,7 @@ * * Copyright (c) Tuomo Valkonen 1999-2007. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -84,6 +81,9 @@ bool frame_init(WFrame *frame, WWindow *parent, const WFitParams *fp, frame->mode=mode; frame->tab_min_w=0; frame->bar_max_width_q=1.0; + frame->quasiact_source=NULL; + + gr_stylespec_init(&frame->baseattr); if(!mplex_init((WMPlex*)frame, parent, fp)) return FALSE; @@ -117,6 +117,7 @@ void frame_deinit(WFrame *frame) { frame_free_titles(frame); frame_release_brushes(frame); + gr_stylespec_unalloc(&frame->baseattr); mplex_deinit((WMPlex*)frame); } @@ -511,51 +512,56 @@ void frame_size_hints(WFrame *frame, WSizeHints *hints_ret) /*{{{ Focus */ -void frame_inactivated(WFrame *frame) -{ - window_draw((WWindow*)frame, FALSE); -} - - -void frame_activated(WFrame *frame) +static void frame_quasiactivation(WFrame *frame, Obj *src, bool act) { - window_draw((WWindow*)frame, FALSE); -} - - -void frame_quasiactivation(WFrame *frame, WRegion *reg, bool act) -{ - bool was, is; - - was=(frame->quasiactive_count>0); + if(frame->quasiact_source==src || act){ + bool was, is; + + was=(frame->quasiact_source!=NULL); - frame->quasiactive_count=maxof(0, frame->quasiactive_count - + (act ? 1 : -1)); - - is=(frame->quasiactive_count>0); + frame->quasiact_source=(act ? src : NULL); - if(was!=is && !REGION_IS_ACTIVE(frame)) - window_draw((WWindow*)frame, FALSE); + is=(frame->quasiact_source!=NULL); + + if(was!=is){ + frame_quasiactivity_change(frame); + if(!REGION_IS_ACTIVE(frame)) + window_draw((WWindow*)frame, FALSE); + } + } } static bool actinact(WRegion *reg, bool act) { WPHolder *returnph=region_get_return(reg); - WFrame *frame; + WFrame *frame=NULL; + Obj *src=NULL; + WRegion *tgt; if(returnph==NULL || pholder_stale(returnph)) return FALSE; - frame=OBJ_CAST(pholder_target(returnph), WFrame); + tgt=pholder_target(returnph); + + frame=OBJ_CAST(tgt, WFrame); if(frame!=NULL){ - /* Ok, reg has return placeholder set to a frame: - * do quasiactivation/inactivation + src=(Obj*)returnph; + }else{ + /* Show quasiactivation for stuff detached from + * groups contained in the frame as well. */ - frame_quasiactivation(frame, reg, act); + WGroup *grp=OBJ_CAST(tgt, WGroup); + if(grp!=NULL){ + frame=REGION_MANAGER_CHK(grp, WFrame); + src=(Obj*)grp; + } } + if(frame!=NULL) + frame_quasiactivation(frame, src, act); + return TRUE; } @@ -671,9 +677,10 @@ static WFramedPHolder *frame_make_recreate_pholder(WFrame *frame) ph=region_make_return_pholder((WRegion*)frame); - if(ph==NULL) + if(ph==NULL){ return NULL; - + } + fparam.mode=frame->mode; fph=create_framedpholder(ph, &fparam); @@ -724,6 +731,13 @@ static void frame_modify_pholders(WFrame *frame) } +bool frame_rescue_clientwins(WFrame *frame, WRescueInfo *info) +{ + frame_modify_pholders(frame); + return mplex_rescue_clientwins(&frame->mplex, info); +} + + /*}}}*/ @@ -774,7 +788,8 @@ bool frame_set_shaded(WFrame *frame, int sp) /*EXTL_DOC * Set shading state according to the parameter \var{how} - * (set/unset/toggle). Resulting state is returned, which may not be + * (\codestr{set}, \codestr{unset}, or \codestr{toggle}). + * Resulting state is returned, which may not be * what was requested. */ EXTL_EXPORT_AS(WFrame, set_shaded) @@ -795,39 +810,51 @@ bool frame_is_shaded(WFrame *frame) } -bool frame_set_numbers(WFrame *frame, int sp) +/* EXTL_DOC + * Is the attribute \var{attr} set? + */ +bool frame_is_grattr(WFrame *frame, const char *attr) { - bool set=frame->flags&FRAME_SHOW_NUMBERS; - bool nset=libtu_do_setparam(sp, set); - - if(XOR(nset, set)){ - frame->flags^=FRAME_SHOW_NUMBERS; - frame_recalc_bar(frame); - frame_draw_bar(frame, TRUE); - } - - return frame->flags&FRAME_SHOW_NUMBERS; + GrAttr a=stringstore_alloc(attr); + bool set=gr_stylespec_isset(&frame->baseattr, a); + stringstore_free(a); + return set; } -/*EXTL_DOC - * Control whether tabs show numbers (set/unset/toggle). - * Resulting state is returned, which may not be what was - * requested. - */ -EXTL_EXPORT_AS(WFrame, set_numbers) -bool frame_set_numbers_extl(WFrame *frame, const char *how) +bool frame_set_grattr(WFrame *frame, GrAttr a, int sp) { - return frame_set_numbers(frame, libtu_string_to_setparam(how)); + bool set=gr_stylespec_isset(&frame->baseattr, a); + bool nset=libtu_do_setparam(sp, set); + + if(XOR(set, nset)){ + if(nset) + gr_stylespec_set(&frame->baseattr, a); + else + gr_stylespec_unset(&frame->baseattr, a); + window_draw((WWindow*)frame, TRUE); + } + + return nset; } /*EXTL_DOC - * Does \var{frame} show numbers for tabs? + * Set extra drawing engine attributes for the frame. + * The parameter \var{attr} is the attribute, and \var{how} is + * one of \codestr{set}, \codestr{unset}, or \codestr{toggle}. */ -bool frame_is_numbers(WFrame *frame) +EXTL_EXPORT_AS(WFrame, set_grattr) +bool frame_set_grattr_extl(WFrame *frame, const char *attr, const char *how) { - return frame->flags&FRAME_SHOW_NUMBERS; + if(attr!=NULL){ + GrAttr a=stringstore_alloc(attr); + bool ret=frame_set_grattr(frame, a, libtu_string_to_setparam(how)); + stringstore_free(a); + return ret; + }else{ + return FALSE; + } } @@ -867,6 +894,14 @@ static void frame_managed_changed(WFrame *frame, int mode, bool sw, { bool need_draw=TRUE; + if(mode==MPLEX_CHANGE_REMOVE && (Obj*)reg==frame->quasiact_source){ + /* Reset indirect quasiactivation through group that + * is being removed. + */ + frame->quasiact_source=NULL; + frame_quasiactivity_change(frame); + } + if(mode!=MPLEX_CHANGE_SWITCHONLY) frame_initialise_titles(frame); else @@ -889,7 +924,7 @@ WRegion *frame_managed_disposeroot(WFrame *frame, WRegion *reg) if(DEST_EMPTY(frame) && frame->mplex.mgd!=NULL && frame->mplex.mgd->reg==reg && - frame->mplex.mgd->next==NULL){ + frame->mplex.mgd->mgr_next==NULL){ WRegion *tmp=region_disposeroot((WRegion*)frame); return (tmp!=NULL ? tmp : reg); } @@ -907,6 +942,32 @@ int frame_default_index(WFrame *frame) /*}}}*/ +/*{{{ prepare_manage_transient */ + + +WPHolder *frame_prepare_manage_transient(WFrame *frame, + const WClientWin *transient, + const WManageParams *param, + int unused) +{ + /* Transient manager searches should not cross tiled frames + * unless explicitly floated. + */ + if(IS_FLOATING_MODE(frame) || + extl_table_is_bool_set(transient->proptab, "float")){ + return region_prepare_manage_transient_default((WRegion*)frame, + transient, + param, + unused); + }else{ + return NULL; + } +} + + +/*}}}*/ + + /*{{{ Save/load */ @@ -1016,6 +1077,12 @@ static DynFunTab frame_dynfuntab[]={ {(DynFun*)mplex_default_index, (DynFun*)frame_default_index}, + + {(DynFun*)region_prepare_manage_transient, + (DynFun*)frame_prepare_manage_transient}, + + {(DynFun*)region_rescue_clientwins, + (DynFun*)frame_rescue_clientwins}, END_DYNFUNTAB };