add an option to decide whether the bell rings

This commit is contained in:
Boris Faure 2014-04-22 23:32:04 +02:00
parent 40c83a0113
commit 6fd4e8c57a
8 changed files with 43 additions and 3 deletions

View File

@ -628,7 +628,7 @@ collections {
}
}
program {
signal: "bell"; source: "terminology";
signal: "bell,ring"; source: "terminology";
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 9)
action: PLAY_SAMPLE "bell" 1.0 ALERT;
#else

View File

@ -203,8 +203,12 @@ collections {
}
}
program {
signal: "bell"; source: "terminology";
signal: "bell,ring"; source: "terminology";
#if (EFL_VERSION_MAJOR > 1) || (EFL_VERSION_MINOR >= 9)
action: PLAY_SAMPLE "bell" 1.0 ALERT;
#else
action: PLAY_SAMPLE "bell" 1.0;
#endif
}
program {
signal: "bell";

View File

@ -96,6 +96,8 @@ config_init(void)
(edd_base, Config, "disable_cursor_blink", disable_cursor_blink, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "disable_visual_bell", disable_visual_bell, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "bell_rings", bell_rings, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "active_links", active_links, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
@ -212,6 +214,7 @@ config_sync(const Config *config_src, Config *config)
config->flicker_on_key = config_src->flicker_on_key;
config->disable_cursor_blink = config_src->disable_cursor_blink;
config->disable_visual_bell = config_src->disable_visual_bell;
config->bell_rings = config_src->bell_rings;
config->active_links = config_src->active_links;
config->mute = config_src->mute;
config->urg_bell = config_src->urg_bell;
@ -289,6 +292,7 @@ config_load(const char *key)
/* upgrade to v3 */
config->active_links = EINA_TRUE;
config->bell_rings = EINA_TRUE;
config->version = 3;
/*pass through*/
case CONF_VER: /* 3*/
@ -508,6 +512,7 @@ config_load(const char *key)
config->flicker_on_key = EINA_FALSE;
config->disable_cursor_blink = EINA_FALSE;
config->disable_visual_bell = EINA_FALSE;
config->bell_rings = EINA_TRUE;
config->active_links = EINA_TRUE;
s = eina_unicode_unicode_to_utf8(sep, &slen);
if (s)
@ -589,6 +594,7 @@ config_fork(Config *config)
CPY(flicker_on_key);
CPY(disable_cursor_blink);
CPY(disable_visual_bell);
CPY(bell_rings);
CPY(active_links);
CPY(translucent);
CPY(mute);

View File

@ -42,6 +42,7 @@ struct _Config
Eina_Bool flicker_on_key;
Eina_Bool disable_cursor_blink;
Eina_Bool disable_visual_bell;
Eina_Bool bell_rings;
Eina_Bool active_links;
Eina_Bool translucent;
Eina_Bool mute;

View File

@ -1003,9 +1003,14 @@ _cb_bell(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
if (!config->disable_visual_bell)
{
Split *sp;
edje_object_signal_emit(term->bg, "bell", "terminology");
edje_object_signal_emit(term->base, "bell", "terminology");
if (config->bell_rings)
{
edje_object_signal_emit(term->bg, "bell,ring", "terminology");
edje_object_signal_emit(term->base, "bell,ring", "terminology");
}
sp = _split_find(term->wn->win, term->term);
if (sp)
{

View File

@ -57,6 +57,15 @@ _cb_op_behavior_visual_bell_chg(void *data, Evas_Object *obj, void *event EINA_U
config_save(config, NULL);
}
static void
_cb_op_behavior_bell_rings_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->bell_rings = elm_check_state_get(obj);
config_save(config, NULL);
}
static void
_cb_op_behavior_flicker_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
@ -359,6 +368,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_visual_bell_chg, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, "Bell rings");
elm_check_state_set(o, !config->bell_rings);
elm_box_pack_end(bx, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_bell_rings_chg, term);
o = elm_check_add(bx);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);

View File

@ -683,6 +683,9 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Boo
if (bell)
{
edje_object_signal_emit(en->bg, "bell", "terminology");
if (!config->bell_rings)
edje_object_signal_emit(en->bg, "bell,ring", "terminology");
edje_object_message_signal_process(en->bg);
}
sd->interp = 1.0;

View File

@ -4104,6 +4104,8 @@ _smart_pty_bell(void *data)
EINA_SAFETY_ON_NULL_RETURN(sd);
evas_object_smart_callback_call(data, "bell", NULL);
edje_object_signal_emit(sd->cursor.obj, "bell", "terminology");
if (sd->config->bell_rings)
edje_object_signal_emit(sd->cursor.obj, "bell,ring", "terminology");
}
static void