glima pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=1d689839c065964333cd2ee8f3e6573b1f38a020

commit 1d689839c065964333cd2ee8f3e6573b1f38a020
Author: Gustavo Lima Chaves <[email protected]>
Date:   Tue Mar 11 23:49:40 2014 -0300

    Make an option to disable tab switch animations.
    
    I bet I'm not the one driven crazy by them. So let's keep the bling by
    default, but make it possible to override that.
    
    In this patch I also sugest usage of tooltips on the config knobs.
    How do you like it?
---
 src/bin/config.c           |  5 +++++
 src/bin/config.h           |  3 +++
 src/bin/main.c             | 17 ++++++++++++++---
 src/bin/options_behavior.c | 21 +++++++++++++++++++++
 4 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/bin/config.c b/src/bin/config.c
index ba6397b..d47a893 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -97,6 +97,8 @@ config_init(void)
    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, "disable_switch_anim", disable_switch_anim, 
EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "translucent", translucent, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "mute", mute, EET_T_UCHAR);
@@ -207,6 +209,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->disable_switch_anim = config_src->disable_switch_anim;
    config->mute = config_src->mute;
    config->urg_bell = config_src->urg_bell;
    config->multi_instance = config_src->multi_instance;
@@ -495,6 +498,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->disable_switch_anim = EINA_FALSE;
              s = eina_unicode_unicode_to_utf8(sep, &slen);
              if (s)
                {
@@ -574,6 +578,7 @@ config_fork(Config *config)
    CPY(flicker_on_key);
    CPY(disable_cursor_blink);
    CPY(disable_visual_bell);
+   CPY(disable_switch_anim);
    CPY(translucent);
    CPY(mute);
    CPY(urg_bell);
diff --git a/src/bin/config.h b/src/bin/config.h
index e83b6b9..fe4451d 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -42,6 +42,9 @@ struct _Config
    Eina_Bool         flicker_on_key;
    Eina_Bool         disable_cursor_blink;
    Eina_Bool         disable_visual_bell;
+   Eina_Bool         disable_switch_anim; /* disable terminal switch
+                                           * animations when issued by
+                                           * key binds */
    Eina_Bool         translucent;
    Eina_Bool         mute;
    Eina_Bool         urg_bell;
diff --git a/src/bin/main.c b/src/bin/main.c
index 9ccb4a0..9cb805d 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1373,6 +1373,7 @@ _cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void 
*event EINA_UNUSED)
 {
    Term *term = data;
    Term *term2 = NULL;
+   Config *config = termio_config_get(term->term);
 
    if (term->focused) term2 = _term_prev_get(term);
    if (term2)
@@ -1381,7 +1382,7 @@ _cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void 
*event EINA_UNUSED)
         
         sp0 = _split_find(term->wn->win, term->term);
         sp = _split_find(term2->wn->win, term2->term);
-        if (sp == sp0)
+        if (sp == sp0 && !config->disable_switch_anim)
           _sel_go(sp, term2);
         else
           {
@@ -1396,7 +1397,8 @@ _cb_next(void *data, Evas_Object *obj EINA_UNUSED, void 
*event EINA_UNUSED)
 {
    Term *term = data;
    Term *term2 = NULL;
-   
+   Config *config = termio_config_get(term->term);
+
    if (term->focused) term2 = _term_next_get(term);
    if (term2)
      {
@@ -1404,7 +1406,7 @@ _cb_next(void *data, Evas_Object *obj EINA_UNUSED, void 
*event EINA_UNUSED)
         
         sp0 = _split_find(term->wn->win, term->term);
         sp = _split_find(term2->wn->win, term2->term);
-        if (sp == sp0)
+        if (sp == sp0 && !config->disable_switch_anim)
           _sel_go(sp, term2);
         else
           {
@@ -2584,6 +2586,8 @@ static const Ecore_Getopt options = {
                               "Set cursor blink mode."),
       ECORE_GETOPT_STORE_BOOL('G', "visual-bell",
                               "Set visual bell mode."),
+      ECORE_GETOPT_STORE_BOOL('A', "switch-anim",
+                              "Set terminal switch animations mode."),
       ECORE_GETOPT_STORE_TRUE('F', "fullscreen",
                               "Go into the fullscreen mode from start."),
       ECORE_GETOPT_STORE_TRUE('I', "iconic",
@@ -2629,6 +2633,7 @@ elm_main(int argc, char **argv)
    Eina_Bool video_mute = 0xff; /* unset */
    Eina_Bool cursor_blink = 0xff; /* unset */
    Eina_Bool visual_bell = 0xff; /* unset */
+   Eina_Bool switch_anim = 0xff; /* unset */
    Eina_Bool fullscreen = EINA_FALSE;
    Eina_Bool iconic = EINA_FALSE;
    Eina_Bool borderless = EINA_FALSE;
@@ -2663,6 +2668,7 @@ elm_main(int argc, char **argv)
      ECORE_GETOPT_VALUE_BOOL(video_mute),
      ECORE_GETOPT_VALUE_BOOL(cursor_blink),
      ECORE_GETOPT_VALUE_BOOL(visual_bell),
+     ECORE_GETOPT_VALUE_BOOL(switch_anim),
      ECORE_GETOPT_VALUE_BOOL(fullscreen),
      ECORE_GETOPT_VALUE_BOOL(iconic),
      ECORE_GETOPT_VALUE_BOOL(borderless),
@@ -2852,6 +2858,11 @@ elm_main(int argc, char **argv)
         config->disable_visual_bell = !visual_bell;
         config->temporary = EINA_TRUE;
      }
+   if (switch_anim != 0xff)
+     {
+        config->disable_switch_anim = !switch_anim;
+        config->temporary = EINA_TRUE;
+     }
 
    if (xterm_256color)
      {
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 1e671fa..6c2a216 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -58,6 +58,15 @@ _cb_op_behavior_visual_bell_chg(void *data, Evas_Object 
*obj, void *event EINA_U
 }
 
 static void
+_cb_op_behavior_switch_anim_chg(void *data, Evas_Object *obj, void *event 
EINA_UNUSED)
+{
+   Evas_Object *term = data;
+   Config *config = termio_config_get(term);
+   config->disable_switch_anim = !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)
 {
    Evas_Object *term = data;
@@ -344,6 +353,18 @@ options_behavior(Evas_Object *opbox, Evas_Object *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, "Terminal switch animation");
+   elm_object_tooltip_text_set
+      (o, "By turning this off, terminal switch actions won't be animated");
+   elm_check_state_set(o, !config->disable_switch_anim);
+   elm_box_pack_end(bx, o);
+   evas_object_show(o);
+   evas_object_smart_callback_add(o, "changed",
+                                  _cb_op_behavior_switch_anim_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, "Urgent Bell");
    elm_check_state_set(o, config->urg_bell);
    elm_box_pack_end(bx, o);

-- 


Reply via email to