From 7f2ea7af8bef8584873426e14a4e6d6a7e155bc1 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 3 Nov 2020 11:20:06 +0000 Subject: [PATCH] e winlist - add large mode and deprecate some old condig like geom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this adds a live exposé style set of windows in large mode and 2d navigation, allows it to stay up so you can bind to a single key or mouse button to bring up and keep thre unbtil dismissed etc. ... this requires theme changes and for now these changes have only been added to the flat theme branch in efl - they will become default in the future, so dont use this and expect it to work unless you also try the flat theme default from the flat branch in efl. see https://phab.enlightenment.org/T6726 for details on that. this is not complete. it has some TODO items at the top with XXX: but .. it's good enough now to share. @feat --- data/config/default/e.src | 13 +- data/config/standard/e.src | 13 +- data/config/tiling/e.src | 13 +- src/bin/e_comp_object.c | 122 ++++ src/bin/e_comp_object.h | 1 + src/bin/e_config.c | 31 +- src/bin/e_config.h | 16 +- .../conf_bindings/e_int_config_keybindings.c | 1 - src/modules/winlist/e_int_config_winlist.c | 148 +---- src/modules/winlist/e_mod_main.c | 15 +- src/modules/winlist/e_winlist.c | 590 ++++++++++++++---- 11 files changed, 641 insertions(+), 322 deletions(-) diff --git a/data/config/default/e.src b/data/config/default/e.src index 89ae74f09..012e468c1 100644 --- a/data/config/default/e.src +++ b/data/config/default/e.src @@ -1,5 +1,5 @@ group "E_Config" struct { - value "config_version" int: 1000030; + value "config_version" int: 1000032; value "config_type" uint: 0; // this profile seems to just be super minimalist value "desktop_default_name" string: "%i-%i"; value "desktop_default_window_profile" string: ""; @@ -55,14 +55,9 @@ group "E_Config" struct { value "winlist_list_jump_desk_while_selecting" int: 0; value "winlist_list_focus_while_selecting" int: 1; value "winlist_list_raise_while_selecting" int: 1; - value "winlist_pos_align_x" double: 0.5; - value "winlist_pos_align_y" double: 0.5; - value "winlist_pos_size_w" double: 0.5; - value "winlist_pos_size_h" double: 0.5; - value "winlist_pos_min_w" int: 0; - value "winlist_pos_min_h" int: 0; - value "winlist_pos_max_w" int: 320; - value "winlist_pos_max_h" int: 320; + value "winlist_mode" int: 0; + value "winlist_large_size" double: 0.6666; + value "winlist_list_size" double: 0.3333; value "maximize_policy" int: 49; value "allow_manip" int: 0; value "border_fix_on_shelf_toggle" int: 0; diff --git a/data/config/standard/e.src b/data/config/standard/e.src index c0e24ae64..6ad850bc0 100644 --- a/data/config/standard/e.src +++ b/data/config/standard/e.src @@ -1,5 +1,5 @@ group "E_Config" struct { - value "config_version" int: 1000030; + value "config_version" int: 1000032; value "config_type" uint: 3; value "desktop_default_name" string: "%i-%i"; value "desktop_default_window_profile" string: "standard"; @@ -51,14 +51,9 @@ group "E_Config" struct { value "winlist_list_jump_desk_while_selecting" int: 0; value "winlist_list_focus_while_selecting" int: 1; value "winlist_list_raise_while_selecting" int: 1; - value "winlist_pos_align_x" double: 0.5; - value "winlist_pos_align_y" double: 0.5; - value "winlist_pos_size_w" double: 0.5; - value "winlist_pos_size_h" double: 0.5; - value "winlist_pos_min_w" int: 0; - value "winlist_pos_min_h" int: 0; - value "winlist_pos_max_w" int: 320; - value "winlist_pos_max_h" int: 320; + value "winlist_mode" int: 0; + value "winlist_large_size" double: 0.6666; + value "winlist_list_size" double: 0.3333; value "maximize_policy" int: 50; value "allow_manip" int: 0; value "border_fix_on_shelf_toggle" int: 0; diff --git a/data/config/tiling/e.src b/data/config/tiling/e.src index e50f8b2cc..e0f14b4b6 100644 --- a/data/config/tiling/e.src +++ b/data/config/tiling/e.src @@ -1,5 +1,5 @@ group "E_Config" struct { - value "config_version" int: 1000030; + value "config_version" int: 1000032; value "config_type" uint: 3; value "desktop_default_name" string: "%i-%i"; value "desktop_default_window_profile" string: "standard"; @@ -51,14 +51,9 @@ group "E_Config" struct { value "winlist_list_jump_desk_while_selecting" int: 0; value "winlist_list_focus_while_selecting" int: 1; value "winlist_list_raise_while_selecting" int: 1; - value "winlist_pos_align_x" double: 0.5; - value "winlist_pos_align_y" double: 0.5; - value "winlist_pos_size_w" double: 0.5; - value "winlist_pos_size_h" double: 0.5; - value "winlist_pos_min_w" int: 0; - value "winlist_pos_min_h" int: 0; - value "winlist_pos_max_w" int: 320; - value "winlist_pos_max_h" int: 320; + value "winlist_mode" int: 0; + value "winlist_large_size" double: 0.6666; + value "winlist_list_size" double: 0.3333; value "maximize_policy" int: 50; value "allow_manip" int: 0; value "border_fix_on_shelf_toggle" int: 0; diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 76e2d7032..a779bd5aa 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -2898,6 +2898,8 @@ e_comp_object_util_type_set(Evas_Object *obj, E_Comp_Object_Type type) } else skip = EINA_TRUE; + if (evas_object_data_get(obj, "noshadow")) + shadow = EINA_FALSE; while (!ok) { if (skip) @@ -2939,6 +2941,8 @@ e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type) vis = evas_object_visible_get(obj); o = edje_object_add(e_comp->evas); evas_object_data_set(o, "comp_object", (void*)1); + if (evas_object_data_get(obj, "noshadow")) + evas_object_data_set(o, "noshadow", o); e_comp_object_util_type_set(o, type); evas_object_geometry_get(obj, &x, &y, &w, &h); @@ -4275,6 +4279,124 @@ e_comp_object_agent_add(Evas_Object *obj) return o; } +static void +_e_comp_object_frame_mirror_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) +{ + Evas_Object *o; + + o = evas_object_data_get(obj, "client"); + if (o) evas_object_del(o); + evas_object_data_del(obj, "client"); + + o = evas_object_data_get(obj, "icon"); + if (o) evas_object_del(o); + evas_object_data_del(obj, "icon"); + + o = evas_object_data_get(obj, "frame"); + if (o) evas_object_del(o); + evas_object_data_del(obj, "frame"); + + o = evas_object_data_get(obj, "zoomap"); + if (o) evas_object_del(o); + evas_object_data_del(obj, "zoomap"); +} + +static void +_e_comp_object_frame_mirror_resize_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) +{ + E_Client *ec; + Evas_Coord w, h; + + ec = evas_object_data_get(obj, "ec"); + if (!ec) return; + if (!evas_object_data_get(obj, "do_shadow")) return; + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if ((w == ec->w) && (h == ec->h)) + { + if (!evas_object_data_get(obj, "shadow_off")) + { + edje_object_signal_emit(obj, "e,state,shadow,off", "e"); + evas_object_data_del(obj, "shadow_on"); + evas_object_data_set(obj, "shadow_off", obj); + } + } + else + { + if (!evas_object_data_get(obj, "shadow_on")) + { + edje_object_signal_emit(obj, "e,state,shadow,on", "e"); + evas_object_data_del(obj, "shadow_off"); + evas_object_data_set(obj, "shadow_on", obj); + } + } +} + +E_API Evas_Object * +e_comp_object_util_frame_mirror_add(Evas_Object *obj) +{ + Evas_Object *o, *o_frame = NULL, *o_client, *o_icon, *o_zoomap = NULL, *o_sh; + const char *file = NULL, *group = NULL; + + API_ENTRY NULL; + + o = o_sh = edje_object_add(e_comp->evas); + evas_object_data_set(o_sh, "ec", cw->ec); + edje_object_file_get(cw->shobj, &file, &group); + edje_object_file_set(o, file, group); + if (e_client_util_shadow_state_get(cw->ec)) + { + evas_object_data_set(o, "do_shadow", o_sh); + edje_object_signal_emit(o, "e,state,shadow,on", "e"); + } + else + edje_object_signal_emit(o, "e,state,shadow,off", "e"); + edje_object_signal_emit(o, "e,state,visible", "e"); + + edje_object_file_get(cw->frame_object, &file, &group); + + if ((file) && (group)) + { + o = o_zoomap = e_zoomap_add(e_comp->evas); + evas_object_data_set(o_sh, "zoomap", o); + e_zoomap_smooth_set(o, e_comp_config_get()->smooth_windows); + edje_object_part_swallow(o_sh, "e.swallow.content", o); + evas_object_show(o); + + o = o_frame = edje_object_add(e_comp->evas); + evas_object_data_set(o_sh, "frame", o); + edje_object_file_set(o, file, group); + edje_object_signal_emit(o, "e,version,22", "e"); + edje_object_signal_emit(o, "e,state,focused", "e"); + edje_object_signal_emit(o, "e,state,visible", "e"); + edje_object_part_text_set(o, "e.text.title", cw->frame_name); + e_zoomap_child_set(o_zoomap, o); + e_zoomap_solid_set(o, EINA_FALSE); + evas_object_show(o); + } + + o = o_client = e_comp_object_util_mirror_add(obj); + evas_object_data_set(o_sh, "client", o); + if (o_frame) edje_object_part_swallow(o_frame, "e.swallow.client", o); + else edje_object_part_swallow(o_sh, "e.swallow.content", o); + evas_object_show(o); + + if (o_frame) + { + o = o_icon = e_client_icon_add(cw->ec, e_comp->evas); + evas_object_data_set(o_sh, "icon", o); + edje_object_part_swallow(o_frame, "e.swallow.icon", o); + evas_object_show(o); + } + + evas_object_event_callback_add(o_sh, EVAS_CALLBACK_DEL, + _e_comp_object_frame_mirror_del_cb, NULL); + evas_object_event_callback_add(o_sh, EVAS_CALLBACK_RESIZE, + _e_comp_object_frame_mirror_resize_cb, NULL); + if (o_zoomap) + e_zoomap_child_resize(o_zoomap, cw->ec->w, cw->ec->h); + return o_sh; +} + /* create a duplicate of an evas object */ E_API Evas_Object * e_comp_object_util_mirror_add(Evas_Object *obj) diff --git a/src/bin/e_comp_object.h b/src/bin/e_comp_object.h index 06273cfcf..893de823c 100644 --- a/src/bin/e_comp_object.h +++ b/src/bin/e_comp_object.h @@ -39,6 +39,7 @@ E_API void e_comp_object_zoomap_set(Evas_Object *obj, Eina_Bool enabled); E_API Eina_Bool e_comp_object_mirror_visibility_check(Evas_Object *obj); E_API Evas_Object *e_comp_object_client_add(E_Client *ec); E_API Evas_Object *e_comp_object_util_mirror_add(Evas_Object *obj); +E_API Evas_Object *e_comp_object_util_frame_mirror_add(Evas_Object *obj); E_API void e_comp_object_util_type_set(Evas_Object *obj, E_Comp_Object_Type type); E_API Evas_Object *e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type); E_API Evas_Object *e_comp_object_util_get(Evas_Object *obj); diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 51391c931..4d07cfd8c 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -727,14 +727,9 @@ _e_config_edd_init(Eina_Bool old) E_CONFIG_VAL(D, T, winlist_list_focus_while_selecting, INT); /**/ E_CONFIG_VAL(D, T, winlist_list_raise_while_selecting, INT); /**/ E_CONFIG_VAL(D, T, winlist_list_move_after_select, INT); /**/ - E_CONFIG_VAL(D, T, winlist_pos_align_x, DOUBLE); /**/ - E_CONFIG_VAL(D, T, winlist_pos_align_y, DOUBLE); /**/ - E_CONFIG_VAL(D, T, winlist_pos_size_w, DOUBLE); /**/ - E_CONFIG_VAL(D, T, winlist_pos_size_h, DOUBLE); /**/ - E_CONFIG_VAL(D, T, winlist_pos_min_w, INT); /**/ - E_CONFIG_VAL(D, T, winlist_pos_min_h, INT); /**/ - E_CONFIG_VAL(D, T, winlist_pos_max_w, INT); /**/ - E_CONFIG_VAL(D, T, winlist_pos_max_h, INT); /**/ + E_CONFIG_VAL(D, T, winlist_mode, INT); /**/ + E_CONFIG_VAL(D, T, winlist_list_size, DOUBLE); /**/ + E_CONFIG_VAL(D, T, winlist_large_size, DOUBLE); /**/ E_CONFIG_VAL(D, T, maximize_policy, INT); /**/ E_CONFIG_VAL(D, T, allow_manip, INT); /**/ E_CONFIG_VAL(D, T, border_fix_on_shelf_toggle, INT); /**/ @@ -1323,7 +1318,7 @@ e_config_load(void) } #define CONFIG_VERSION_CHECK(VERSION) \ - if (e_config->config_version - (E_CONFIG_FILE_EPOCH * 1000000) < (VERSION)) + if ((e_config->config_version - (E_CONFIG_FILE_EPOCH * 1000000)) < (VERSION)) #define CONFIG_VERSION_UPDATE_INFO(VERSION) \ INF("Performing config upgrade for %d.%d", E_CONFIG_FILE_EPOCH, VERSION); @@ -1773,6 +1768,13 @@ e_config_load(void) } e_config_save_queue(); } + CONFIG_VERSION_CHECK(32) + { + CONFIG_VERSION_UPDATE_INFO(32); + e_config->winlist_large_size = 0.6666; + e_config->winlist_list_size = 0.3333; + e_config_save_queue(); + } } elm_config_profile_set(_e_config_profile); if (!e_config->remember_internal_fm_windows) @@ -1826,14 +1828,9 @@ e_config_load(void) E_CONFIG_LIMIT(e_config->winlist_list_show_other_screen_windows, 0, 1); E_CONFIG_LIMIT(e_config->winlist_list_uncover_while_selecting, 0, 1); E_CONFIG_LIMIT(e_config->winlist_list_jump_desk_while_selecting, 0, 1); - E_CONFIG_LIMIT(e_config->winlist_pos_align_x, 0.0, 1.0); - E_CONFIG_LIMIT(e_config->winlist_pos_align_y, 0.0, 1.0); - E_CONFIG_LIMIT(e_config->winlist_pos_size_w, 0.0, 1.0); - E_CONFIG_LIMIT(e_config->winlist_pos_size_h, 0.0, 1.0); - E_CONFIG_LIMIT(e_config->winlist_pos_min_w, 0, 4000); - E_CONFIG_LIMIT(e_config->winlist_pos_min_h, 0, 4000); - E_CONFIG_LIMIT(e_config->winlist_pos_max_w, 8, 4000); - E_CONFIG_LIMIT(e_config->winlist_pos_max_h, 8, 4000); + E_CONFIG_LIMIT(e_config->winlist_mode, 8, 1); + E_CONFIG_LIMIT(e_config->winlist_large_size, 0.0, 1.0); + E_CONFIG_LIMIT(e_config->winlist_list_size, 0.0, 1.0); E_CONFIG_LIMIT(e_config->maximize_policy, E_MAXIMIZE_FULLSCREEN, E_MAXIMIZE_DIRECTION); E_CONFIG_LIMIT(e_config->allow_manip, 0, 1); E_CONFIG_LIMIT(e_config->border_fix_on_shelf_toggle, 0, 1); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index ffdae1eb0..75f20f7ec 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -47,7 +47,7 @@ typedef enum /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 31 +#define E_CONFIG_FILE_GENERATION 32 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION) #define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!! @@ -131,14 +131,9 @@ struct _E_Config int winlist_list_focus_while_selecting; // GUI int winlist_list_raise_while_selecting; // GUI int winlist_list_move_after_select; // GUI - double winlist_pos_align_x; // GUI - double winlist_pos_align_y; // GUI - double winlist_pos_size_w; // GUI - double winlist_pos_size_h; // GUI - int winlist_pos_min_w; // GUI - int winlist_pos_min_h; // GUI - int winlist_pos_max_w; // GUI - int winlist_pos_max_h; // GUI + int winlist_mode; // GUI + double winlist_list_size; // GUI + double winlist_large_size; // GUI int maximize_policy; // GUI int allow_manip; // GUI int border_fix_on_shelf_toggle; // GUI @@ -169,8 +164,7 @@ struct _E_Config int menu_autoscroll_margin; // GUI int menu_autoscroll_cursor_margin; // GUI const char *input_method; // GUI - struct - { + struct { int move; // GUI int resize; // GUI int raise; // GUI diff --git a/src/modules/conf_bindings/e_int_config_keybindings.c b/src/modules/conf_bindings/e_int_config_keybindings.c index e493e4e45..0954887a0 100644 --- a/src/modules/conf_bindings/e_int_config_keybindings.c +++ b/src/modules/conf_bindings/e_int_config_keybindings.c @@ -938,7 +938,6 @@ _grab_key_down_cb(void *data, bi->modifiers = mod; if (bi->key) eina_stringshare_del(bi->key); bi->key = eina_stringshare_add(ev->key); - printf("blub\n"); label = _key_binding_text_get(bi); diff --git a/src/modules/winlist/e_int_config_winlist.c b/src/modules/winlist/e_int_config_winlist.c index ce9ec8ffa..0f570bc35 100644 --- a/src/modules/winlist/e_int_config_winlist.c +++ b/src/modules/winlist/e_int_config_winlist.c @@ -5,8 +5,6 @@ static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdat static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); -static void _width_limits_changed(void *data, Evas_Object *obj EINA_UNUSED); -static void _height_limits_changed(void *data, Evas_Object *obj EINA_UNUSED); struct _E_Config_Dialog_Data { @@ -23,14 +21,14 @@ struct _E_Config_Dialog_Data int jump_desk; int move_after_select; + int mode; + double large_size; + double list_size; + int scroll_animate; double scroll_speed; - double align_x, align_y; - int min_w, min_h, max_w, max_h; - - struct - { + struct { Evas_Object *min_w, *min_h; } gui; }; @@ -64,6 +62,9 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->uncover = e_config->winlist_list_uncover_while_selecting; cfdata->jump_desk = e_config->winlist_list_jump_desk_while_selecting; cfdata->move_after_select = e_config->winlist_list_move_after_select; + cfdata->mode = e_config->winlist_mode; + cfdata->large_size = e_config->winlist_large_size; + cfdata->list_size = e_config->winlist_list_size; cfdata->windows_other_desks = e_config->winlist_list_show_other_desk_windows; @@ -82,13 +83,6 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->scroll_animate = e_config->winlist_scroll_animate; cfdata->scroll_speed = e_config->winlist_scroll_speed; - - cfdata->align_x = e_config->winlist_pos_align_x; - cfdata->align_y = e_config->winlist_pos_align_y; - cfdata->min_w = e_config->winlist_pos_min_w; - cfdata->min_h = e_config->winlist_pos_min_h; - cfdata->max_w = e_config->winlist_pos_max_w; - cfdata->max_h = e_config->winlist_pos_max_h; } static void * @@ -122,6 +116,9 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) DO(list_uncover_while_selecting, uncover); DO(list_jump_desk_while_selecting, jump_desk); DO(list_move_after_select, move_after_select); + DO(mode, mode); + DO(large_size, large_size); + DO(list_size, list_size); DO(warp_while_selecting, warp_while_selecting); DO(warp_at_end, warp_at_end); DO(no_warp_on_direction, no_warp_on_direction); @@ -129,12 +126,6 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) DO(scroll_speed, scroll_speed); DO(list_focus_while_selecting, focus); DO(list_raise_while_selecting, raise); - DO(pos_align_x, align_x); - DO(pos_align_y, align_y); - DO(pos_min_w, min_w); - DO(pos_min_h, min_h); - DO(pos_max_w, max_w); - DO(pos_max_h, max_h); #undef DO e_config_save_queue(); @@ -158,6 +149,9 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd DO(list_uncover_while_selecting, uncover); DO(list_jump_desk_while_selecting, jump_desk); DO(list_move_after_select, move_after_select); + DO(mode, mode); + DO_DBL(large_size, large_size); + DO_DBL(list_size, list_size); DO(warp_while_selecting, warp_while_selecting); DO(warp_at_end, warp_at_end); DO(no_warp_on_direction, no_warp_on_direction); @@ -165,12 +159,6 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd DO_DBL(scroll_speed, scroll_speed); DO(list_focus_while_selecting, focus); DO(list_raise_while_selecting, raise); - DO_DBL(pos_align_x, align_x); - DO_DBL(pos_align_y, align_y); - DO(pos_min_w, min_w); - DO(pos_min_h, min_h); - DO(pos_max_w, max_w); - DO(pos_max_h, max_h); #undef DO return 0; @@ -185,6 +173,19 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale)); ol = e_widget_list_add(evas, 0, 0); + ob = e_widget_check_add(evas, _("Large"), + &(cfdata->mode)); + e_widget_list_object_append(ol, ob, 1, 0, 0.0); + ob = e_widget_label_add(evas, _("Large Mode Size")); + e_widget_list_object_append(ol, ob, 1, 0, 0.0); + ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, + &(cfdata->large_size), NULL, 100); + e_widget_list_object_append(ol, ob, 1, 0, 0.0); + ob = e_widget_label_add(evas, _("List Mode Size")); + e_widget_list_object_append(ol, ob, 1, 0, 0.0); + ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, + &(cfdata->list_size), NULL, 100); + e_widget_list_object_append(ol, ob, 1, 0, 0.0); ob = e_widget_check_add(evas, _("Windows from other desks"), &(cfdata->windows_other_desks)); e_widget_list_object_append(ol, ob, 1, 0, 0.0); @@ -246,102 +247,7 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data e_widget_toolbook_page_append(otb, NULL, _("Animations"), ol, 1, 1, 1, 0, 0.0, 0.0); - ol = e_widget_list_add(evas, 0, 0); - ob = e_widget_label_add(evas, _("Minimum width")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%4.0f"), 0, 4000, 10, 0, NULL, - &(cfdata->min_w), 100); - cfdata->gui.min_w = ob; - e_widget_on_change_hook_set(ob, _width_limits_changed, cfdata); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_label_add(evas, _("Maximum width")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%4.0f"), 0, 4000, 10, 0, NULL, - &(cfdata->max_w), 100); - e_widget_on_change_hook_set(ob, _width_limits_changed, cfdata); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_label_add(evas, _("Minimum height")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%4.0f"), 0, 4000, 10, 0, NULL, - &(cfdata->min_h), 100); - cfdata->gui.min_h = ob; - e_widget_on_change_hook_set(ob, _height_limits_changed, cfdata); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_label_add(evas, _("Maximum height")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%4.0f"), 0, 4000, 10, 0, NULL, - &(cfdata->max_h), 100); - e_widget_on_change_hook_set(ob, _height_limits_changed, cfdata); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - e_widget_toolbook_page_append(otb, NULL, _("Geometry"), ol, - 1, 1, 1, 0, 0.0, 0.0); - - ol = e_widget_list_add(evas, 0, 0); - ob = e_widget_label_add(evas, _("Horizontal alignment")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, - &(cfdata->align_x), NULL, 100); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_label_add(evas, _("Vertical alignment")); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - ob = e_widget_slider_add(evas, 1, 0, _("%1.2f"), 0.0, 1.0, 0.01, 0, - &(cfdata->align_y), NULL, 100); - e_widget_list_object_append(ol, ob, 1, 0, 0.0); - e_widget_toolbook_page_append(otb, NULL, _("Alignment"), ol, - 1, 1, 1, 0, 0.0, 0.0); - e_widget_toolbook_page_show(otb, 0); return otb; -/* - Evas_Object *o, *of, *ob; - - o = e_widget_list_add(evas, 0, 0); - - of = e_widget_framelist_add(evas, _("Display"), 0); - ob = e_widget_check_add(evas, _("From other desks"), &(cfdata->other_desks)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("From other screens"), - &(cfdata->other_screens)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Iconified"), &(cfdata->iconified)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Animations"), &(cfdata->animations)); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - of = e_widget_framelist_add(evas, _("Selecting"), 0); - ob = e_widget_check_add(evas, _("Focus"), &(cfdata->focus)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Raise"), &(cfdata->raise)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Uncover"), &(cfdata->uncover)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Warp mouse"), &(cfdata->warp)); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, _("Jump to desk"), &(cfdata->jump_desk)); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - - return o; - */ } - -static void -_width_limits_changed(void *data, Evas_Object *obj EINA_UNUSED) -{ - E_Config_Dialog_Data *cfdata = data; - - if (cfdata->min_w > cfdata->max_w) - e_widget_slider_value_int_set(cfdata->gui.min_w, cfdata->max_w); -} - -static void -_height_limits_changed(void *data, Evas_Object *obj EINA_UNUSED) -{ - E_Config_Dialog_Data *cfdata = data; - - if (cfdata->min_h > cfdata->max_h) - e_widget_slider_value_int_set(cfdata->gui.min_h, cfdata->max_h); -} - diff --git a/src/modules/winlist/e_mod_main.c b/src/modules/winlist/e_mod_main.c index 7fd255b8c..f0d704e8c 100644 --- a/src/modules/winlist/e_mod_main.c +++ b/src/modules/winlist/e_mod_main.c @@ -40,6 +40,8 @@ e_modapi_init(E_Module *m) _act_winlist->func.go_edge = _e_mod_action_winlist_edge_cb; _act_winlist->func.go_signal = _e_mod_action_winlist_signal_cb; _act_winlist->func.go_acpi = _e_mod_action_winlist_acpi_cb; + e_action_predef_name_set(N_("Window : List"), N_("Show"), + "winlist", "", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Next Window"), "winlist", "next", NULL, 0); e_action_predef_name_set(N_("Window : List"), N_("Previous Window"), @@ -112,7 +114,7 @@ _e_mod_action_winlist_cb_helper(E_Object *obj, const char *params, int modifiers { E_Zone *zone = NULL; E_Winlist_Filter filter = E_WINLIST_FILTER_NONE; - int direction = 0; // -1 for prev, 1 for next; + int direction =-99; // -1 for prev, 1 for next; int udlr = -1; // 0 for up, 1 for down, 2 for left, 3 for right zone = e_zone_current_get(); @@ -139,15 +141,12 @@ _e_mod_action_winlist_cb_helper(E_Object *obj, const char *params, int modifiers udlr = 2; else if (!strcmp(params, "right")) udlr = 3; - else return EINA_FALSE; } - else - direction = 1; e_winlist_modifiers_set(modifiers, type); - if (direction) e_winlist_show(zone, filter); - if (direction == 1) e_winlist_next(); - else if (direction == -1) e_winlist_prev(); - else e_winlist_direction_select(zone, udlr); + e_winlist_show(zone, filter); + if (direction == 1) e_winlist_next(); + else if (direction == -1) e_winlist_prev(); + else if (direction != -99) e_winlist_direction_select(zone, udlr); if ((obj) && (obj->type == E_CLIENT_TYPE)) e_client_next_mouse_action_ignore((void *)obj); return EINA_TRUE; diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index 4533590c9..cff515baa 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -1,6 +1,12 @@ #include "e.h" #include "e_mod_main.h" +// XXX: need to handle zone add/delete/reconfigure geom +// XXX: need to handle client win resize +// XXX: newly added windows while up come up black +// XXX: ARGB windows when scaled down with zoomap have their base colors messed up (black) + + /* local subsystem functions */ typedef struct _E_Winlist_Win E_Winlist_Win; @@ -31,10 +37,6 @@ static Eina_Bool _e_winlist_cb_mouse_wheel(void *data, int type, void *event); static Eina_Bool _e_winlist_cb_mouse_move(void *data, int type, void *event); static Eina_Bool _e_winlist_scroll_timer(void *data); static Eina_Bool _e_winlist_animator(void *data); -#if 0 -static void _e_winlist_cb_item_mouse_in(void *data, Evas *evas, - Evas_Object *obj, void *event_info); -#endif /* local subsystem globals */ static Evas_Object *_winlist = NULL; @@ -43,6 +45,8 @@ static Evas_Object *_bg_object = NULL; static Evas_Object *_list_object = NULL; static Evas_Object *_icon_object = NULL; static Evas_Object *_win_object = NULL; +static Evas_Object *_winlist_bg_object = NULL; +static Evas_Object *_winlist_fg_object = NULL; static Eina_List *_wins = NULL; static Eina_List *_win_selected = NULL; static E_Desk *_last_desk = NULL; @@ -59,6 +63,7 @@ static double _scroll_align_to = 0.0; static double _scroll_align = 0.0; static Ecore_Timer *_scroll_timer = NULL; static Ecore_Animator *_animator = NULL; +static Eina_Bool _mouse_pressed = EINA_FALSE; static Eina_Bool _wmclass_picked(const Eina_List *lst, const char *wmclass) @@ -67,11 +72,10 @@ _wmclass_picked(const Eina_List *lst, const char *wmclass) const char *s; if (!wmclass) return EINA_FALSE; - EINA_LIST_FOREACH(lst, l, s) - if (s == wmclass) - return EINA_TRUE; - + { + if (s == wmclass) return EINA_TRUE; + } return EINA_FALSE; } @@ -95,16 +99,22 @@ e_winlist_shutdown(void) return 1; } +static void +_cb_bgfg_signal_hide_done(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED) +{ + evas_object_del(obj); +} + int e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) { - int x, y, w, h; Evas_Object *o; Eina_List *l, *ll; E_Desk *desk; E_Client *ec; E_Winlist_Win *ww; Eina_List *wmclasses = NULL; + int ok; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); @@ -117,8 +127,8 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) Ecore_X_Window mouse_grab = 0; _input_window = ecore_x_window_input_new(e_comp->root, 0, 0, 1, 1); ecore_x_window_show(_input_window); - if (_activate_type == E_WINLIST_ACTIVATE_TYPE_MOUSE) - mouse_grab = _input_window; + mouse_grab = _input_window; +// if (_activate_type == E_WINLIST_ACTIVATE_TYPE_MOUSE) mouse_grab = _input_window; if (!e_grabinput_get(mouse_grab, 0, _input_window)) { ecore_x_window_free(_input_window); @@ -131,27 +141,12 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) if (e_comp->comp_type != E_PIXMAP_TYPE_X) { Eina_Bool mouse_grab = EINA_FALSE; - if (_activate_type == E_WINLIST_ACTIVATE_TYPE_MOUSE) - mouse_grab = EINA_TRUE; - if (!e_comp_grab_input(mouse_grab, EINA_TRUE)) - return 0; + mouse_grab = EINA_TRUE; +// if (_activate_type == E_WINLIST_ACTIVATE_TYPE_MOUSE) mouse_grab = EINA_TRUE; + if (!e_comp_grab_input(mouse_grab, EINA_TRUE)) return 0; _input_window = e_comp->ee_win; } - w = (double)zone->w * e_config->winlist_pos_size_w; - if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w; - else if (w < e_config->winlist_pos_min_w) - w = e_config->winlist_pos_min_w; - if (w > zone->w) w = zone->w; - x = zone->x + (double)(zone->w - w) * e_config->winlist_pos_align_x; - - h = (double)zone->h * e_config->winlist_pos_size_h; - if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h; - else if (h < e_config->winlist_pos_min_h) - h = e_config->winlist_pos_min_h; - if (h > zone->h) h = zone->h; - y = zone->y + (double)(zone->h - h) * e_config->winlist_pos_align_y; - _winlist_zone = zone; e_client_move_cancel(); e_client_resize_cancel(); @@ -163,18 +158,79 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) #endif evas_event_freeze(e_comp->evas); + + o = edje_object_add(e_comp->evas); + evas_object_layer_set(o, E_LAYER_CLIENT_POPUP); + evas_object_pass_events_set(o, EINA_TRUE); + if (e_config->winlist_mode == 1) + ok = e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/large/bg"); + else + ok = e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/bg"); + if (ok) + { + // nothing need be done here yet + // edje_object_signal_callback_add(o, "e,action,show,done", "e", _cb_bgfg_signal_hide_done, NULL); + edje_object_signal_callback_add(o, "e,action,hide,done", "e", _cb_bgfg_signal_hide_done, NULL); + edje_object_signal_emit(o, "e,state,visible,on", "e"); + evas_object_geometry_set(o, zone->x, zone->y, zone->w, zone->h); + evas_object_show(o); + _winlist_bg_object = o; + // XXX: GGG: ^^^ handle zone resize/move and del. + } + else + { + evas_object_del(o); + _winlist_bg_object = NULL; + } + o = edje_object_add(e_comp->evas); evas_object_pass_events_set(o, EINA_TRUE); + if (e_config->winlist_mode == 1) + { + if (!e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/large")) + e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/main"); + } + else + e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/main"); + if (edje_object_data_get(o, "noshadow")) + evas_object_data_set(o, "noshadow", o); _winlist = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP); evas_object_layer_set(_winlist, E_LAYER_CLIENT_POPUP); - evas_object_move(_winlist, x, y); _bg_object = o; - e_theme_edje_object_set(o, "base/theme/winlist", - "e/widgets/winlist/main"); + + o = edje_object_add(e_comp->evas); + evas_object_layer_set(o, E_LAYER_CLIENT_POPUP); + evas_object_pass_events_set(o, EINA_TRUE); + if (e_config->winlist_mode == 1) + ok = e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/large/fg"); + else + ok = e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/fg"); + if (ok) + { + // nothing need be done here yet + // edje_object_signal_callback_add(o, "e,action,show,done", "e", _cb_bgfg_signal_hide_done, NULL); + edje_object_signal_callback_add(o, "e,action,hide,done", "e", _cb_bgfg_signal_hide_done, NULL); + edje_object_signal_emit(o, "e,state,visible,on", "e"); + evas_object_geometry_set(o, zone->x, zone->y, zone->w, zone->h); + evas_object_show(o); + _winlist_fg_object = o; + // XXX: GGG: ^^^ handle zone resize/move and del. + } + else + { + evas_object_del(o); + _winlist_fg_object = NULL; + } o = elm_box_add(e_comp->elm); _list_object = o; - elm_box_homogeneous_set(o, 1); + if (e_config->winlist_mode == 1) + { + } + else + { + elm_box_homogeneous_set(o, 1); + } e_comp_object_util_del_list_append(_winlist, o); edje_object_part_swallow(_bg_object, "e.swallow.list", o); edje_object_part_text_set(_bg_object, "e.text.title", _("Select a window")); @@ -197,15 +253,12 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) switch (filter) { case E_WINLIST_FILTER_CLASS_WINDOWS: - if (!_last_client) - pick = EINA_FALSE; - else - pick = _last_client->icccm.class == ec->icccm.class; + if (!_last_client) pick = EINA_FALSE; + else pick = _last_client->icccm.class == ec->icccm.class; break; case E_WINLIST_FILTER_CLASSES: pick = (!_wmclass_picked(wmclasses, ec->icccm.class)); - if (pick) - wmclasses = eina_list_append(wmclasses, ec->icccm.class); + if (pick) wmclasses = eina_list_append(wmclasses, ec->icccm.class); break; default: @@ -262,17 +315,22 @@ e_winlist_hide(void) evas_object_hide(_winlist); EINA_LIST_FREE(_wins, ww) { - if ((!ec) || (ww->client != ec)) - e_object_unref(E_OBJECT(ww->client)); + if ((!ec) || (ww->client != ec)) e_object_unref(E_OBJECT(ww->client)); free(ww); } _win_selected = NULL; _icon_object = NULL; _win_object = NULL; + if (_winlist_bg_object) + edje_object_signal_emit(_winlist_bg_object, "e,state,visible,off", "e"); evas_object_del(_winlist); + if (_winlist_fg_object) + edje_object_signal_emit(_winlist_fg_object, "e,state,visible,off", "e"); e_client_focus_track_thaw(); _winlist = NULL; + _winlist_bg_object = NULL; + _winlist_fg_object = NULL; _winlist_zone = NULL; _hold_count = 0; _hold_mod = 0; @@ -293,18 +351,14 @@ e_winlist_hide(void) } } #endif - if (e_comp->comp_type == E_PIXMAP_TYPE_WL) - e_comp_ungrab_input(1, 1); + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) e_comp_ungrab_input(1, 1); _input_window = 0; if (ec) { Eina_Bool set = !ec->lock_focus_out; - if (ec->shaded) - { - if (!ec->lock_user_shade) - e_client_unshade(ec, ec->shade_dir); - } + if ((ec->shaded) && (!ec->lock_user_shade)) + e_client_unshade(ec, ec->shade_dir); if (e_config->winlist_list_move_after_select) { e_client_zone_set(ec, e_zone_current_get()); @@ -319,10 +373,8 @@ e_winlist_hide(void) evas_object_raise(ec->frame); e_client_raise_latest_set(ec); } - if (ec->iconic) - e_client_uniconify(ec); - if (ec->shaded) - e_client_unshade(ec, ec->shade_dir); + if (ec->iconic) e_client_uniconify(ec); + if (ec->shaded) e_client_unshade(ec, ec->shade_dir); if ((e_config->focus_policy != E_FOCUS_CLICK) || (e_config->winlist_warp_at_end) || (e_config->winlist_warp_while_selecting)) @@ -353,10 +405,8 @@ e_winlist_next(void) return; } _e_winlist_deactivate(); - if (!_win_selected) - _win_selected = _wins; - else - _win_selected = _win_selected->next; + if (!_win_selected) _win_selected = _wins; + else _win_selected = _win_selected->next; if (!_win_selected) _win_selected = _wins; _e_winlist_show_active(); _e_winlist_activate(); @@ -377,10 +427,8 @@ e_winlist_prev(void) return; } _e_winlist_deactivate(); - if (!_win_selected) - _win_selected = _wins; - else - _win_selected = _win_selected->prev; + if (!_win_selected) _win_selected = _wins; + else _win_selected = _win_selected->prev; if (!_win_selected) _win_selected = eina_list_last(_wins); _e_winlist_show_active(); _e_winlist_activate(); @@ -416,7 +464,7 @@ point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2) { xx = lx1 + lround(param * c); yy = ly1 + lround(param * d); - } + } dx = x - xx; dy = y - yy; @@ -424,6 +472,84 @@ point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2) return lround(dist); } +void +e_winlist_direction_large_select(int dir) +{ + E_Winlist_Win *ww; + Eina_List *l, *closest = NULL; + Evas_Coord x, y, w, h; + Evas_Coord sx, sy, sw, sh; + int lx1, ly1, lx2, ly2; + int dist, dist2, distmin = -1, dx, dy; + + if (!_win_selected) _win_selected = _wins; + if (!_win_selected) return; + ww = _win_selected->data; + evas_object_geometry_get(ww->bg_object, &sx, &sy, &sw, &sh); + lx1 = sx + (sw / 2); + ly1 = sy + (sh / 2); + switch (dir) + { + case 0: /* up */ + lx2 = lx1; + ly2 = ly1 - 30000; + break; + case 1: /* down */ + lx2 = lx1; + ly2 = ly1 + 30000; + break; + case 2: /* left */ + lx2 = lx1 - 30000; + ly2 = ly1; + break; + case 3: /* right */ + lx2 = lx1 + 30000; + ly2 = ly1; + break; + default: + return; + } + EINA_LIST_FOREACH(_wins, l, ww) + { + if (l == _win_selected) continue; + evas_object_geometry_get(ww->bg_object, &x, &y, &w, &h); + dist = point_line_dist(x + (w / 2), y + (h / 2), lx1, ly1, lx2, ly2); + dx = (x + (w / 2)) - (sx + (sw / 2)); + dy = (y + (h / 2)) - (sy + (sh / 2)); + dist2 = sqrt((dx * dx) + (dy * dy)); + dist += dist2 * 2; + switch (dir) + { + case 0: /* up */ + if (dy > -1) continue; + break; + case 1: /* down */ + if (dy < 1) continue; + break; + case 2: /* left */ + if (dx > -1) continue; + break; + case 3: /* right */ + if (dx < 1) continue; + break; + default: + break; + } + if ((dist < distmin) || (distmin == -1)) + { + distmin = dist; + closest = l; + } + } + if (closest) + { + _e_winlist_deactivate(); + _win_selected = closest; + _e_winlist_show_active(); + _e_winlist_activate(); + } +} + void e_winlist_direction_select(E_Zone *zone, int dir) { @@ -452,8 +578,7 @@ e_winlist_direction_select(E_Zone *zone, int dir) int a = 0, d = 0; if (ec == ec_orig) continue; - if ((!ec->icccm.accepts_focus) && - (!ec->icccm.take_focus)) continue; + if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus)) continue; if (ec->netwm.state.skip_taskbar) continue; if (ec->user_skip_winlist) continue; if (ec->iconic) @@ -578,10 +703,10 @@ e_winlist_modifiers_set(int mod, E_Winlist_Activate_Type type) /* local subsystem functions */ static void -_e_winlist_size_adjust(void) +_e_winlist_size_list_adjust(void) { Evas_Coord mw, mh; - E_Zone *zone; + E_Zone *zone = _winlist_zone; int x, y, w, h; elm_box_recalculate(_list_object); @@ -591,24 +716,140 @@ _e_winlist_size_adjust(void) edje_object_part_swallow(_bg_object, "e.swallow.list", _list_object); zone = _winlist_zone; - w = (double)zone->w * e_config->winlist_pos_size_w; + w = zone->w * e_config->winlist_list_size; if (w < mw) w = mw; - if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w; - else if (w < e_config->winlist_pos_min_w) - w = e_config->winlist_pos_min_w; if (w > zone->w) w = zone->w; - x = zone->x + (double)(zone->w - w) * e_config->winlist_pos_align_x; h = mh; - if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h; - else if (h < e_config->winlist_pos_min_h) - h = e_config->winlist_pos_min_h; if (h > zone->h) h = zone->h; - y = zone->y + (double)(zone->h - h) * e_config->winlist_pos_align_y; + x = zone->x + ((zone->w - w) / 2); + y = zone->y + ((zone->h - h) / 2); evas_object_geometry_set(_winlist, x, y, w, h); } +static int +_e_winlist_large_item_height_set(Evas_Coord h) +{ + E_Winlist_Win *ww; + Eina_List *l, *boxes, *bl; + Evas_Coord mw, mh, lw, lh; + Evas_Object *o, *box; + int rows = 1; + + evas_object_geometry_get(_list_object, NULL, NULL, &lw, &lh); + bl = elm_box_children_get(_list_object); + EINA_LIST_FOREACH(bl, l, o) + { + elm_box_unpack_all(o); + } + bl = elm_box_children_get(_list_object); + if (!bl) return 0; + EINA_LIST_FOREACH(_wins, l, ww) + { +try_again: + mh = h; + if (mh > ww->client->h) + mh = ww->client->h; + if (ww->client->h > 0) + mw = (ww->client->w * mh) / ww->client->h; + else + mw = mh; + evas_object_size_hint_min_set(ww->win_object, mw, mh); + evas_object_size_hint_max_set(ww->win_object, mw, mh); + edje_object_part_unswallow(ww->bg_object, ww->win_object); + edje_object_part_swallow(ww->bg_object, "e.swallow.win", ww->win_object); + edje_object_size_min_calc(ww->bg_object, &mw, &mh); + evas_object_size_hint_min_set(ww->bg_object, mw, mh); + box = bl->data; + elm_box_pack_end(box, ww->bg_object); + evas_smart_objects_calculate(evas_object_evas_get(box)); + evas_object_size_hint_min_get(box, &mw, &mh); + // if box is too big then reflow obj onto next box row + if (mw > lw) + { + boxes = elm_box_children_get(bl->data); + if (!boxes) break; + bl = bl->next; + if (!bl) break; + rows++; + if (eina_list_count(boxes) == 1) continue; + // unpack from prev box as we are going to try with a new row + elm_box_unpack(box, ww->bg_object); + goto try_again; + } + } + return rows; +} + +static void +_e_winlist_size_large_adjust(void) +{ + Evas_Coord mw = 0, mh = 0; + E_Zone *zone = _winlist_zone; + Evas_Coord x, y, w, h, h1, h2, maxw, maxh, prevh; + Eina_Bool expand = EINA_FALSE; + + maxw = zone->w * e_config->winlist_large_size; + maxh = zone->h * e_config->winlist_large_size; + evas_object_resize(_bg_object, maxw, maxh); + evas_smart_objects_calculate(evas_object_evas_get(_bg_object)); + evas_object_geometry_get(_list_object, NULL, NULL, &maxw, &maxh); + if (maxw < 64) maxw = 64; + if (maxh < 64) maxh = 64; + // we will bisect sizes using the interfval h1 -> h2 until h == h2 + // then switch to expand mode where we go up bu 20% in size until + // we get too big + h1 = 0; + h2 = maxh; + h = (h1 + h2) / 2; + for (;;) + { + prevh = h; + // pick midpoint in interval + if (expand) h = ((h * 120) / 100) + 1; + else h = (h1 + h2) / 2; + _e_winlist_large_item_height_set(h); + evas_smart_objects_calculate(evas_object_evas_get(_bg_object)); + evas_object_size_hint_min_get(_list_object, &mw, &mh); + if (expand) + { + if ((mw > maxw) || (mh > maxh) || (h >= maxh)) + { + h = prevh; + _e_winlist_large_item_height_set(h); + break; + } + } + else + { + if ((mw > maxw) || (mh > maxh)) h2 = h; + else h1 = h; + if ((h2 - h1) <= 1) + { + expand = EINA_TRUE; + h1 = h; + h2 = maxh; + } + } + } + evas_smart_objects_calculate(evas_object_evas_get(_bg_object)); + edje_object_size_min_calc(_bg_object, &mw, &mh); + + w = mw; + h = mh; + x = zone->x + ((zone->w - w) / 2); + y = zone->y + ((zone->h - h) / 2); + evas_object_geometry_set(_winlist, x, y, w, h); +} + +static void +_e_winlist_size_adjust(void) +{ + if (e_config->winlist_mode == 1) _e_winlist_size_large_adjust(); + else _e_winlist_size_list_adjust(); +} + static Eina_Bool _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) { @@ -616,8 +857,8 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) Evas_Coord mw, mh; Evas_Object *o; - if ((!ec->icccm.accepts_focus) && - (!ec->icccm.take_focus)) return EINA_FALSE; + if ((!ec->icccm.accepts_focus) && (!ec->icccm.take_focus)) + return EINA_FALSE; if (ec->netwm.state.skip_taskbar) return EINA_FALSE; if (ec->user_skip_winlist) return EINA_FALSE; if (ec->iconic) @@ -633,7 +874,8 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) if (ec->sticky) { if ((ec->zone != zone) && - (!e_config->winlist_list_show_other_screen_windows)) return EINA_FALSE; + (!e_config->winlist_list_show_other_screen_windows)) + return EINA_FALSE; } else { @@ -643,11 +885,10 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) { if (!e_config->winlist_list_show_other_screen_windows) return EINA_FALSE; - if (ec->zone && ec->desk && (ec->desk != e_desk_current_get(ec->zone))) - { - if (!e_config->winlist_list_show_other_desk_windows) - return EINA_FALSE; - } + if ((ec->zone) && (ec->desk) && + (ec->desk != e_desk_current_get(ec->zone)) && + (!e_config->winlist_list_show_other_desk_windows)) + return EINA_FALSE; } else if (!e_config->winlist_list_show_other_desk_windows) return EINA_FALSE; @@ -663,8 +904,13 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) E_FILL(o); e_comp_object_util_del_list_append(_winlist, o); ww->bg_object = o; - e_theme_edje_object_set(o, "base/theme/winlist", - "e/widgets/winlist/item"); + if (e_config->winlist_mode == 1) + { + if (!e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/item_large")) + e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/item"); + } + else + e_theme_edje_object_set(o, "base/theme/winlist", "e/widgets/winlist/item"); edje_object_part_text_set(o, "e.text.label", e_client_util_name_get (e_client_stack_active_adjust(ww->client))); @@ -679,11 +925,21 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) } if (edje_object_part_exists(ww->bg_object, "e.swallow.win")) { - o = e_comp_object_util_mirror_add(ec->frame); + o = e_comp_object_util_frame_mirror_add(ec->frame); ww->win_object = o; e_comp_object_util_del_list_append(_winlist, o); - evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_BOTH, - ec->client.w, ec->client.h); + if (e_config->winlist_mode == 1) + { + mh = e_config->winlist_large_size * zone->h; + if (mh > ec->h) mh = ec->h; + if (ec->h > 0) mw = (ec->w * mh) / ec->h; + else mw = e_config->winlist_large_size; + evas_object_size_hint_min_set(o, mw, mh); + evas_object_size_hint_max_set(o, mw, mh); + } + else + evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_BOTH, + ec->client.w, ec->client.h); edje_object_part_swallow(ww->bg_object, "e.swallow.win", o); evas_object_show(o); } @@ -691,18 +947,32 @@ _e_winlist_client_add(E_Client *ec, E_Zone *zone, E_Desk *desk) edje_object_signal_emit(ww->bg_object, "e,state,shaded", "e"); else if (ec->iconic) edje_object_signal_emit(ww->bg_object, "e,state,iconified", "e"); - else if (ec->desk != desk) - { - if (!((ec->sticky) && (ec->zone == zone))) - edje_object_signal_emit(ww->bg_object, "e,state,invisible", "e"); - } + else if ((ec->desk != desk) && + (!((ec->sticky) && (ec->zone == zone)))) + edje_object_signal_emit(ww->bg_object, "e,state,invisible", "e"); - edje_object_size_min_calc(ww->bg_object, &mw, &mh); - E_WEIGHT(ww->bg_object, 1, 0); - E_FILL(ww->bg_object); - evas_object_size_hint_min_set(ww->bg_object, mw, mh); - evas_object_size_hint_max_set(ww->bg_object, 9999, mh); - elm_box_pack_end(_list_object, ww->bg_object); + if (e_config->winlist_mode == 1) + { + // a hboz per item + Evas_Object *o2 = elm_box_add(e_comp->elm); + elm_box_horizontal_set(o2, EINA_TRUE); + elm_box_pack_end(_list_object, o2); + evas_object_show(o2); + + edje_object_size_min_calc(ww->bg_object, &mw, &mh); + E_WEIGHT(ww->bg_object, 0, 0); + evas_object_size_hint_min_set(ww->bg_object, mw, mh); + elm_box_pack_end(o2, ww->bg_object); + } + else + { + edje_object_size_min_calc(ww->bg_object, &mw, &mh); + E_WEIGHT(ww->bg_object, 1, 0); + E_FILL(ww->bg_object); + evas_object_size_hint_min_set(ww->bg_object, mw, mh); + evas_object_size_hint_max_set(ww->bg_object, 9999, mh); + elm_box_pack_end(_list_object, ww->bg_object); + } e_object_ref(E_OBJECT(ww->client)); return EINA_TRUE; } @@ -760,10 +1030,16 @@ _e_winlist_client_replace(E_Client *ec, E_Client *ec_new) edje_object_part_text_set(ww->bg_object, "e.text.label", e_client_util_name_get(ec_new)); edje_object_size_min_calc(ww->bg_object, &mw, &mh); - E_WEIGHT(ww->bg_object, 1, 0); - E_FILL(ww->bg_object); - evas_object_size_hint_min_set(ww->bg_object, mw, mh); - evas_object_size_hint_max_set(ww->bg_object, 9999, mh); + if (e_config->winlist_mode == 1) + { + } + else + { + E_WEIGHT(ww->bg_object, 1, 0); + E_FILL(ww->bg_object); + evas_object_size_hint_min_set(ww->bg_object, mw, mh); + evas_object_size_hint_max_set(ww->bg_object, 9999, mh); + } return; } } @@ -922,7 +1198,9 @@ _e_winlist_show_active(void) if (!_wins) return; for (i = 0, l = _wins; l; l = l->next, i++) - if (l == _win_selected) break; + { + if (l == _win_selected) break; + } n = eina_list_count(_wins); if (n <= 1) return; @@ -937,8 +1215,14 @@ _e_winlist_show_active(void) } else { - _scroll_align = _scroll_align_to; - elm_box_align_set(_list_object, 0.5, fabs(1.0 - _scroll_align)); + if (e_config->winlist_mode == 1) + { + } + else + { + _scroll_align = _scroll_align_to; + elm_box_align_set(_list_object, 0.5, fabs(1.0 - _scroll_align)); + } } } @@ -1017,14 +1301,20 @@ _e_winlist_cb_key_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event _e_winlist_restore_desktop(); else if (act == E_UTIL_ACTION_DO) { - if (y < 0) - e_winlist_direction_select(_winlist_zone, 0); - else if (y > 0) - e_winlist_direction_select(_winlist_zone, 1); - else if (x < 0) - e_winlist_direction_select(_winlist_zone, 2); - else if (x > 0) - e_winlist_direction_select(_winlist_zone, 3); + if (e_config->winlist_mode == 1) + { + if (y < 0) e_winlist_direction_large_select(0); + else if (y > 0) e_winlist_direction_large_select(1); + else if (x < 0) e_winlist_direction_large_select(2); + else if (x > 0) e_winlist_direction_large_select(3); + } + else + { + if (y < 0) e_winlist_direction_select(_winlist_zone, 0); + else if (y > 0) e_winlist_direction_select(_winlist_zone, 1); + else if (x < 0) e_winlist_direction_select(_winlist_zone, 2); + else if (x > 0) e_winlist_direction_select(_winlist_zone, 3); + } } else if (!strcmp(ev->key, "1")) _e_winlist_activate_nth(0); @@ -1092,7 +1382,7 @@ _e_winlist_cb_key_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; if (!_winlist) return ECORE_CALLBACK_PASS_ON; - if (_hold_mod) + if ((_hold_mod) && (_hold_count > 0)) { #define KEY_CHECK(MOD, NAME) \ if ((_hold_mod & ECORE_EVENT_MODIFIER_##MOD) && (!strcmp(ev->key, NAME))) \ @@ -1148,6 +1438,22 @@ _e_winlist_cb_key_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) return ECORE_CALLBACK_PASS_ON; } +static Eina_List * +_e_winlist_win_at_xy_get(Evas_Coord x, Evas_Coord y) +{ + E_Winlist_Win *ww; + Eina_List *l; + Evas_Coord ox, oy, ow, oh; + + EINA_LIST_FOREACH(_wins, l, ww) + { + evas_object_geometry_get(ww->bg_object, &ox, &oy, &ow, &oh); + if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh))) + return l; + } + return NULL; +} + static Eina_Bool _e_winlist_cb_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { @@ -1157,6 +1463,18 @@ _e_winlist_cb_mouse_down(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; e_bindings_mouse_down_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(_winlist_zone), ev); + if (ev->buttons == 1) + { + Eina_List *l = _e_winlist_win_at_xy_get(ev->x, ev->y); + _mouse_pressed = EINA_TRUE; + if (l) + { + _e_winlist_deactivate(); + _win_selected = l; + _e_winlist_show_active(); + _e_winlist_activate(); + } + } return ECORE_CALLBACK_PASS_ON; } @@ -1164,13 +1482,26 @@ static Eina_Bool _e_winlist_cb_mouse_up(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Event_Mouse_Button *ev; + Eina_Bool was_pressed = EINA_FALSE; ev = event; if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON; if (e_bindings_mouse_up_ecore_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(_winlist_zone), ev)) return ECORE_CALLBACK_RENEW; + if (ev->buttons == 1) + { + if (_mouse_pressed) was_pressed = EINA_TRUE; + _mouse_pressed = EINA_FALSE; + if ((_win_selected) && (was_pressed)) + { + _e_winlist_deactivate(); + e_winlist_hide(); + _hold_count = 0; + return ECORE_CALLBACK_PASS_ON; + } + } if (_activate_type != E_WINLIST_ACTIVATE_TYPE_MOUSE) return ECORE_CALLBACK_RENEW; - if (!--_hold_count) e_winlist_hide(); + if ((!--_hold_count) && (was_pressed)) e_winlist_hide(); return ECORE_CALLBACK_PASS_ON; } @@ -1187,12 +1518,16 @@ _e_winlist_cb_mouse_wheel(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev if (ev->z < 0) /* up */ { for (i = ev->z; i < 0; i++) - e_winlist_prev(); + { + e_winlist_prev(); + } } else if (ev->z > 0) /* down */ { for (i = ev->z; i > 0; i--) - e_winlist_next(); + { + e_winlist_next(); + } } return ECORE_CALLBACK_PASS_ON; } @@ -1243,28 +1578,9 @@ _e_winlist_animator(void *data EINA_UNUSED) _scroll_align = _scroll_align_to; _scroll_to = 0; } + // e_config->winlist_mode elm_box_align_set(_list_object, 0.5, fabs(1.0 - _scroll_align)); } if (!_scroll_to) _animator = NULL; return _scroll_to; } - -#if 0 -static void -_e_winlist_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - E_Winlist_Win *ww; - E_Winlist_Win *lww; - Eina_List *l; - - if (!(ww = data)) return; - if (!_wins) return; - EINA_LIST_FOREACH(_wins, l, lww) - if (lww == ww) break; - _e_winlist_deactivate(); - _win_selected = l; - _e_winlist_show_active(); - _e_winlist_activate(); -} - -#endif