first cut visul bell and bewll handling with urgent enable while not

focued and bell goes off (optional). gfx can be much nicer - really
quick and dirty led img



SVN revision: 72718
This commit is contained in:
Carsten Haitzler 2012-06-23 09:25:01 +00:00
parent e2c25bc45b
commit 2a2048d40f
11 changed files with 103 additions and 26 deletions

24
TODO
View File

@ -2,28 +2,20 @@
here's a short list of things i think we can do in the short to medium term to
make it a first-class terminal:
[X] evas textgrid needs creating and to be used
[X] underline and strikethrough need supporting at termio level
[ ] blink and blink2 attributes need to be supported
[ ] improve terminal emulation handling (i know it doesn't handle gfx
chars and it definitely has an incomplete escape handling core -
many are commented out and unhandled)
[ ] improve terminal emulation handling. known apps with problems:
mc
[ ] copy & paste support for clipboard not just primary (like xterm)
[ ] dnd text (to/from terminal)
[X] ecore-imf support
[ ] handle multibyte displays better (does handle utf8 only atm and
then maybe not according to convention)
then maybe not according to convention like double cell spacing
for jp/kr/zh etc.)
[ ] general input mode handling improvements (keypad, other key
input, mousereporting etc.)
[X] save of config after options changes (option checkbox for
temporary local only changes)
input, etc.)
[ ] selection of themes
[ ] selection of background "wallpapers" (and support them at all -
doesn't right now - should support regular images, animated gifs,
and edje files)
[X] transparency support (theme needs to be told to go into
tranpsarency mode and then window alpha enabled)
[ ] visual bell reporting (signals to theme)
[ ] scrollbar (elm scroller that mirrors the term smart size/position
- gives us fingerscroll - layer on top of term smart, stick
invisible rect inside to track for scrolling etc.)
@ -34,11 +26,7 @@ make it a first-class terminal:
[ ] selection should become single edje object so it can be styled nicely
[ ] selection should have handles on the start/end so u can drag and
change its size once there
[ ] improve selection text extraction logic
[X] font selector should include font previews in the list -
preferably ONLY be a list of previews
[X] options widgets should be deleted once they are hidden. they stay
in memory at the moment
[ ] improve selection text extraction logic so its reliable
[ ] clicking with ANY mouse button while options is up outside of
options should dismiss it.

View File

@ -6,6 +6,7 @@ collections {
image: "bg_shine.png" COMP;
image: "bg_glint.png" COMP;
image: "bg_shadow.png" COMP;
image: "bg_led.png" COMP;
}
parts {
part { name: "shadow";
@ -108,6 +109,23 @@ collections {
aspect_preference: HORIZONTAL;
}
}
part { name: "bell";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
min: 32 32;
max: 32 32;
rel2.offset: -5 -5;
align: 1.0 1.0;
image.normal: "bg_led.png";
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "terminology.options"; type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
@ -169,6 +187,26 @@ collections {
target: "shadow";
target: "fade";
}
program { name: "bell";
signal: "bell";
source: "terminology";
action: STATE_SET "visible" 0.0;
target: "bell";
after: "bell2";
}
program { name: "bell2";
action: STATE_SET "default" 0.0;
transition: BOUNCE 1.0 1.0 3.0;
target: "bell";
}
// program { name: "focus_in";
// signal: "focus,in";
// source: "terminology";
// }
// program { name: "focus_out";
// signal: "focus,out";
// source: "terminology";
// }
program { name: "media_off";
signal: "media,off";
source: "terminology";

View File

@ -3,6 +3,7 @@ EXTRA_DIST = \
bg_bevel.png \
bg_shine.png \
bg_glint.png \
bg_led.png \
bg_shadow.png \
cr_fill.png \
cr_key.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -48,24 +48,26 @@ config_init(void)
(edd_base, Config, "font.size", font.size, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "font.bitmap", font.bitmap, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "scrollback", scrollback, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "theme", theme, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "background", background, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "wordsep", wordsep, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "scrollback", scrollback, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "vidmod", vidmod, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "jump_on_change", jump_on_change, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "flicker_on_key", flicker_on_key, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "translucent", translucent, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "wordsep", wordsep, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "vidmod", vidmod, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "mute", mute, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
}
void
@ -142,6 +144,7 @@ config_load(const char *key)
config->wordsep = eina_stringshare_add(" '\"()[]{}=*!#$^\\:;,?`");
config->vidmod = 0;
config->mute = EINA_FALSE;
config->urg_bell = EINA_TRUE;
}
config->config_key = eina_stringshare_add(key); /* not in eet */

View File

@ -21,6 +21,8 @@ struct _Config
Eina_Bool flicker_on_key;
Eina_Bool translucent;
Eina_Bool mute;
Eina_Bool urg_bell;
Eina_Bool temporary; /* not in EET */
const char *config_key; /* not in EET, the key that config was loaded */
};

View File

@ -14,10 +14,13 @@ int _log_domain = -1;
static Evas_Object *win = NULL, *bg = NULL, *term = NULL, *media = NULL;
static Ecore_Timer *flush_timer = NULL;
static Eina_Bool focused = EINA_FALSE;
static void
_cb_focus_in(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
if (!focused) elm_win_urgent_set(win, EINA_FALSE);
focused = EINA_TRUE;
edje_object_signal_emit(bg, "focus,in", "terminology");
elm_object_focus_set(data, EINA_TRUE);
}
@ -25,6 +28,7 @@ _cb_focus_in(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
static void
_cb_focus_out(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
focused = EINA_FALSE;
edje_object_signal_emit(bg, "focus,out", "terminology");
elm_object_focus_set(data, EINA_FALSE);
elm_cache_all_flush();
@ -76,6 +80,19 @@ _cb_exited(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNU
elm_exit();
}
static void
_cb_bell(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
Config *config = termio_config_get(term);
edje_object_signal_emit(bg, "bell", "terminology");
if (!config) return;
if (config->urg_bell)
{
if (!focused) elm_win_urgent_set(win, EINA_TRUE);
}
}
void
main_trans_update(const Config *config)
{
@ -288,6 +305,7 @@ elm_main(int argc, char **argv)
evas_object_smart_callback_add(o, "options", _cb_options, NULL);
evas_object_smart_callback_add(o, "change", _cb_change, NULL);
evas_object_smart_callback_add(o, "exited", _cb_exited, NULL);
evas_object_smart_callback_add(o, "bell", _cb_bell, NULL);
evas_object_show(o);
main_trans_update(config);

View File

@ -29,6 +29,15 @@ _cb_op_behavior_flicker_chg(void *data, Evas_Object *obj, void *event __UNUSED__
config_save(config, NULL);
}
static void
_cb_op_behavior_urg_bell_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->urg_bell = elm_check_state_get(obj);
config_save(config, NULL);
}
static void
_cb_op_behavior_wsep_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
{
@ -89,6 +98,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_flicker_chg, term);
o = elm_check_add(opbox);
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 on bell");
elm_check_state_set(o, config->urg_bell);
elm_box_pack_end(opbox, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_behavior_urg_bell_chg, term);
o = elm_separator_add(opbox);
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

@ -1347,6 +1347,12 @@ _smart_pty_exited(void *data)
evas_object_smart_callback_call(data, "exited", NULL);
}
static void
_smart_pty_bell(void *data)
{
evas_object_smart_callback_call(data, "bell", NULL);
}
Evas_Object *
termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h)
{
@ -1380,6 +1386,8 @@ termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h)
sd->pty->cb.cancel_sel.data = obj;
sd->pty->cb.exited.func = _smart_pty_exited;
sd->pty->cb.exited.data = obj;
sd->pty->cb.bell.func = _smart_pty_bell;
sd->pty->cb.bell.data = obj;
_smart_size(obj, w, h, EINA_FALSE);
return obj;
}

View File

@ -1410,7 +1410,7 @@ _handle_seq(Termpty *ty, const int *c, int *ce)
return 1;
*/
case 0x07: // BEL '\a' (bell)
INF("BEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEP");
if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
ty->state.had_cr = 0;
return 1;
case 0x08: // BS '\b' (backspace)

View File

@ -80,7 +80,7 @@ struct _Termpty
struct {
void (*func) (void *data);
void *data;
} change, scroll, set_title, set_icon, cancel_sel, exited;
} change, scroll, set_title, set_icon, cancel_sel, exited, bell;
} cb;
struct {
const char *title;