track if a bell was missed in a background tab and display a "missed"

count and emit a signal to indicate you missed something. right now
you dont know which though has the missed bell. thats another stage -
pass missed flag to sel and display it in the theme.
This commit is contained in:
Carsten Haitzler 2013-04-17 00:35:44 +09:00
parent 6ad334c864
commit d201252033
2 changed files with 80 additions and 1 deletions

View File

@ -155,6 +155,33 @@ collections {
color: 255 255 255 255;
}
}
part { name: "terminology.tabmissed.label"; type: TEXT; mouse_events: 0;
effect: GLOW;
scale: 1;
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabcount.label";
rel2.to: "terminology.tabcount.label";
rel1.offset: -4 0;
rel2.relative: 0.0 1.0;
rel2.offset: -5 -1;
color: 255 153 51 64;
color2: 255 51 0 18;
color3: 255 0 0 8;
align: 1.0 0.5;
text { font: "Sans"; size: 8;
align: 1.0 0.5;
min: 1 1;
}
}
description { state: "over" 0.0;
inherit: "default" 0.0;
color: 255 255 64 255;
color2: 255 153 51 128;
color3: 255 0 0 20;
}
}
part { name: "terminology.tabcount.label"; type: TEXT; mouse_events: 0;
effect: GLOW;
scale: 1;
@ -343,6 +370,7 @@ collections {
target: "tabcount_glow_r2";
target: "tabcount_glow_r3";
target: "terminology.tabcount.label";
target: "terminology.tabmissed.label";
}
program {
signal: "mouse,out"; source: "tabcount_ev";
@ -357,6 +385,7 @@ collections {
target: "tabcount_glow_r2";
target: "tabcount_glow_r3";
target: "terminology.tabcount.label";
target: "terminology.tabmissed.label";
}
program {
signal: "mouse,clicked,1"; source: "tabcount_ev";
@ -374,6 +403,25 @@ collections {
transition: DECELERATE 0.5;
target: "tabcount_clip";
}
program {
signal: "tabmissed,off"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "terminology.tabmissed.label";
}
program {
signal: "tabmissed,on"; source: "terminology";
action: STATE_SET "over" 0.0;
transition: DECELERATE 0.2;
target: "terminology.tabmissed.label";
after: "tabmissed2";
}
program { name: "tabmissed2";
signal: "tabmissed,on"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 3.0;
target: "terminology.tabmissed.label";
}
////////////////////////////////////////////////////////////////////
// overlayed prettiness

View File

@ -63,6 +63,7 @@ struct _Term
Eina_Bool focused : 1;
Eina_Bool hold : 1;
Eina_Bool unswallowed : 1;
Eina_Bool missed_bell : 1;
};
struct _Split
@ -106,12 +107,19 @@ _split_free(Split *sp)
static void
_split_tabcount_update(Split *sp)
{
char buf[32];
char buf[32], bufm[32];
int n = eina_list_count(sp->terms);
int missed = 0;
Eina_List *l;
Term *term;
EINA_LIST_FOREACH(sp->terms, l, term)
{
if (term->missed_bell) missed++;
}
snprintf(buf, sizeof(buf), "%i", n);
if (missed > 0) snprintf(bufm, sizeof(bufm), "%i", missed);
else bufm[0] = 0;
EINA_LIST_FOREACH(sp->terms, l, term)
{
Evas_Coord w = 0, h = 0;
@ -127,10 +135,15 @@ _split_tabcount_update(Split *sp)
if (n > 1)
{
edje_object_part_text_set(term->bg, "terminology.tabcount.label", buf);
edje_object_part_text_set(term->bg, "terminology.tabmissed.label", bufm);
edje_object_signal_emit(term->bg, "tabcount,on", "terminology");
}
else
edje_object_signal_emit(term->bg, "tabcount,off", "terminology");
if (missed > 0)
edje_object_signal_emit(term->bg, "tabmissed,on", "terminology");
else
edje_object_signal_emit(term->bg, "tabmissed,off", "terminology");
}
}
@ -516,6 +529,13 @@ _term_focus(Term *term)
if (term->wn->cmdbox) elm_object_focus_set(term->wn->cmdbox, EINA_FALSE);
elm_object_focus_set(term->term, EINA_TRUE);
elm_win_title_set(term->wn->win, termio_title_get(term->term));
if (term->missed_bell)
{
Split *sp = _split_find(term->wn->win, term->term);
term->missed_bell = EINA_FALSE;
if (sp) _split_tabcount_update(sp);
}
}
void
@ -913,8 +933,19 @@ _cb_bell(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
if (!config) return;
if (!config->disable_visual_bell)
{
Split *sp;
edje_object_signal_emit(term->bg, "bell", "terminology");
edje_object_signal_emit(term->base, "bell", "terminology");
sp = _split_find(term->wn->win, term->term);
if (sp)
{
if (sp->term != term)
{
term->missed_bell = EINA_TRUE;
_split_tabcount_update(sp);
}
}
}
if (config->urg_bell)
{