*
* 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 <string.h>
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;
{
frame_free_titles(frame);
frame_release_brushes(frame);
+ gr_stylespec_unalloc(&frame->baseattr);
mplex_deinit((WMPlex*)frame);
}
/*{{{ 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;
}
ph=region_make_return_pholder((WRegion*)frame);
- if(ph==NULL)
+ if(ph==NULL){
return NULL;
-
+ }
+
fparam.mode=frame->mode;
fph=create_framedpholder(ph, &fparam);
}
+bool frame_rescue_clientwins(WFrame *frame, WRescueInfo *info)
+{
+ frame_modify_pholders(frame);
+ return mplex_rescue_clientwins(&frame->mplex, info);
+}
+
+
/*}}}*/
/*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)
}
-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;
+ }
}
{
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
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);
}
/*}}}*/
+/*{{{ 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 */
{(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
};