+/*{{{ Attributes */
+
+
+GR_DEFATTR(active);
+GR_DEFATTR(inactive);
+GR_DEFATTR(selected);
+GR_DEFATTR(unselected);
+GR_DEFATTR(tagged);
+GR_DEFATTR(not_tagged);
+GR_DEFATTR(dragged);
+GR_DEFATTR(not_dragged);
+GR_DEFATTR(activity);
+GR_DEFATTR(no_activity);
+GR_DEFATTR(quasiactive);
+GR_DEFATTR(not_quasiactive);
+
+
+static void ensure_create_attrs()
+{
+ GR_ALLOCATTR_BEGIN;
+ GR_ALLOCATTR(active);
+ GR_ALLOCATTR(inactive);
+ GR_ALLOCATTR(selected);
+ GR_ALLOCATTR(unselected);
+ GR_ALLOCATTR(tagged);
+ GR_ALLOCATTR(not_tagged);
+ GR_ALLOCATTR(dragged);
+ GR_ALLOCATTR(not_dragged);
+ GR_ALLOCATTR(no_activity);
+ GR_ALLOCATTR(activity);
+ GR_ALLOCATTR(quasiactive);
+ GR_ALLOCATTR(not_quasiactive);
+ GR_ALLOCATTR_END;
+}
+
+
+void frame_update_attr(WFrame *frame, int i, WRegion *reg)
+{
+ GrStyleSpec *spec;
+ bool selected, tagged, dragged, activity;
+
+ if(i>=frame->titles_n){
+ /* Might happen when deinitialising */
+ return;
+ }
+
+ ensure_create_attrs();
+
+ spec=&frame->titles[i].attr;
+
+ selected=(reg==FRAME_CURRENT(frame));
+ tagged=(reg!=NULL && reg->flags®ION_TAGGED);
+ dragged=(i==frame->tab_dragged_idx);
+ activity=(reg!=NULL && region_is_activity_r(reg));
+
+ gr_stylespec_unalloc(spec);
+ gr_stylespec_set(spec, selected ? GR_ATTR(selected) : GR_ATTR(unselected));
+ gr_stylespec_set(spec, tagged ? GR_ATTR(tagged) : GR_ATTR(not_tagged));
+ gr_stylespec_set(spec, dragged ? GR_ATTR(dragged) : GR_ATTR(not_dragged));
+ gr_stylespec_set(spec, activity ? GR_ATTR(activity) : GR_ATTR(no_activity));
+}
+
+
+/*}}}*/
+
+