forked from enlightenment/terminology
add mouse-over focus. Closes T589
This commit is contained in:
parent
8db12b97a6
commit
35f8d46c11
|
@ -123,6 +123,9 @@ config_init(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||
(edd_base, Config, "application_server_restore_views",
|
||||
application_server_restore_views, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||
(edd_base, Config, "mouse_over_focus",
|
||||
mouse_over_focus, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC
|
||||
(edd_base, Config, "colors_use", colors_use, EET_T_UCHAR);
|
||||
EET_DATA_DESCRIPTOR_ADD_ARRAY
|
||||
|
@ -221,6 +224,7 @@ config_sync(const Config *config_src, Config *config)
|
|||
config->cg_height = config_src->cg_height;
|
||||
config->colors_use = config_src->colors_use;
|
||||
memcpy(config->colors, config_src->colors, sizeof(config->colors));
|
||||
config->mouse_over_focus = config_src->mouse_over_focus;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -527,6 +531,7 @@ config_load(const char *key)
|
|||
config->colors[(j * 12) + i].a = aa;
|
||||
}
|
||||
}
|
||||
config->mouse_over_focus = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,6 +593,7 @@ config_fork(Config *config)
|
|||
CPY(cg_height);
|
||||
CPY(colors_use);
|
||||
memcpy(config2->colors, config->colors, sizeof(config->colors));
|
||||
CPY(mouse_over_focus);
|
||||
|
||||
CPY(temporary);
|
||||
SCPY(config_key);
|
||||
|
|
|
@ -53,6 +53,7 @@ struct _Config
|
|||
Eina_Bool custom_geometry;
|
||||
Eina_Bool drag_links;
|
||||
Eina_Bool login_shell;
|
||||
Eina_Bool mouse_over_focus;
|
||||
int cg_width;
|
||||
int cg_height;
|
||||
Eina_Bool colors_use;
|
||||
|
|
|
@ -749,6 +749,24 @@ _cb_focus_out(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
|||
elm_cache_all_flush();
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_term_mouse_in(void *data, Evas *e EINA_UNUSED,
|
||||
Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
Term *term = data;
|
||||
Config *config;
|
||||
|
||||
if ((!term) || (!term->term)) return;
|
||||
|
||||
config = termio_config_get(term->term);
|
||||
|
||||
if ((!config) || (!config->mouse_over_focus)) return;
|
||||
|
||||
term->focused = EINA_TRUE;
|
||||
|
||||
_term_focus(term);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_term_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event )
|
||||
{
|
||||
|
@ -1962,7 +1980,7 @@ main_win_new(const char *name, const char *role, const char *title,
|
|||
|
||||
evas_object_smart_callback_add(wn->win, "focus,in", _cb_focus_in, wn);
|
||||
evas_object_smart_callback_add(wn->win, "focus,out", _cb_focus_out, wn);
|
||||
|
||||
|
||||
wins = eina_list_append(wins, wn);
|
||||
return wn;
|
||||
}
|
||||
|
@ -2227,6 +2245,8 @@ main_term_new(Win *wn, Config *config, const char *cmd,
|
|||
_cb_term_mouse_down, term);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
|
||||
_cb_term_mouse_up, term);
|
||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
|
||||
_cb_term_mouse_in, term);
|
||||
|
||||
if (!wn->terms)
|
||||
{
|
||||
|
|
|
@ -261,6 +261,15 @@ _cb_op_behavior_login_shell_chg(void *data, Evas_Object *obj, void *event EINA_U
|
|||
config_save(config, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_op_behavior_mouse_over_focus_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *term = data;
|
||||
Config *config = termio_config_get(term);
|
||||
config->mouse_over_focus = elm_check_state_get(obj);
|
||||
config_save(config, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
options_behavior(Evas_Object *opbox, Evas_Object *term)
|
||||
{
|
||||
|
@ -415,6 +424,16 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
|
|||
evas_object_smart_callback_add(o, "changed",
|
||||
_cb_op_behavior_login_shell_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, "Focus split under the Mouse");
|
||||
elm_check_state_set(o, config->mouse_over_focus);
|
||||
elm_box_pack_end(bx, o);
|
||||
evas_object_show(o);
|
||||
evas_object_smart_callback_add(o, "changed",
|
||||
_cb_op_behavior_mouse_over_focus_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);
|
||||
|
|
Loading…
Reference in New Issue