options: add info to 'React to key presses' option when multisense is disabled

Summary: this informs the user that key press audio is not available

Reviewers: billiob

Tags: #terminology

Differential Revision: https://phab.enlightenment.org/D6840
This commit is contained in:
Mike Blumenkrantz 2018-08-15 19:40:06 +02:00 committed by Boris Faure
parent 780e95a8fb
commit 9822adbaa9
2 changed files with 37 additions and 0 deletions

View File

@ -21,9 +21,32 @@
int terminology_starting_up;
int _log_domain = -1;
Eina_Bool multisense_available = EINA_TRUE;
static Config *_main_config = NULL;
static void
_check_multisense(void)
{
int enabled;
Eina_Bool setting = edje_audio_channel_mute_get(EDJE_CHANNEL_EFFECT);
/* older versions of efl have no capability for determining whether multisense support
* is available
* to check, attempt to set mute on a channel and check the value: if the value has not been
* set then the multisense codepath is disabled
*
* this is a no-op in either case, as the function only sets an internal variable and returns
*/
for (enabled = 0; enabled < 2; enabled++)
{
edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, enabled);
if (enabled != edje_audio_channel_mute_get(EDJE_CHANNEL_EFFECT))
multisense_available = EINA_FALSE;
}
edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, setting);
}
Config *
main_config_get(void)
{
@ -612,6 +635,8 @@ elm_main(int argc, char **argv)
}
}
_check_multisense();
if (theme)
{
char path[PATH_MAX];

View File

@ -17,6 +17,7 @@ typedef struct _Behavior_Ctx {
Config *config;
} Behavior_Ctx;
extern Eina_Bool multisense_available;
#define CB(_cfg_name, _inv) \
static void \
@ -407,6 +408,17 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
_add_cursors_option(bx, ctx);
CX(_("React to key presses"), flicker_on_key, 0);
if (!multisense_available)
{
Evas_Object *lbl;
lbl = elm_label_add(bx);
evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(lbl, 0.0, 0.5);
elm_box_pack_before(bx, lbl, o);
elm_object_text_set(lbl, _("Audio Support for key presses <failure>DISABLED</failure>!"));
evas_object_show(lbl);
}
CX(_("Visual Bell"), disable_visual_bell, 1);
CX(_("Bell rings"), bell_rings, 0);
CX(_("Urgent Bell"), urg_bell, 0);