From 43a5794c8865aaa3b81e1e7c0592feac7946fc52 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 5 Oct 2007 06:05:16 +0000 Subject: [PATCH] buttom patch from lok and seb's shelf bug fix. SVN revision: 31974 --- TODO | 10 +++--- data/themes/default_button.edc | 54 +++++++++++++++++++++++++------- src/bin/e_config.c | 33 ++++++++------------ src/bin/e_config.h | 5 +-- src/bin/e_gadcon.c | 9 +++--- src/bin/e_gadcon.h | 4 +-- src/bin/e_int_shelf_config.c | 11 +++---- src/bin/e_shelf.c | 15 +++++---- src/bin/e_widget_button.c | 56 +++++++++++++++++++++++++++++----- 9 files changed, 130 insertions(+), 67 deletions(-) diff --git a/TODO b/TODO index efed27ec4..4e1a726ed 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,11 @@ Some of the things (in very short form) that need to be done to E17... BUGS / FIXES ------------------------------------------------------------------------------- +* when VLC goes full screen nothing happens, the main window stays + in place and the fullscreen window is invisible... Restart E and the + fullscreen window with the movie appears in the background + this does happens randomly with kmplayer / gmplayer but everytime with + VLC * screen res change with shaded windows that are bigger than the screen (eg you go from 1600x1200 ro 800x600 and some windows are "temporarily resized" down doesn't work right. shaded windows get resizes to widthx1 and unshaded @@ -23,9 +28,6 @@ Some of the things (in very short form) that need to be done to E17... trap on the region the shelf would normally be in. also need a way to lock the gadcon and thus gadcon asks shelf to lock in (stay visible) for things like popping up menus, popups etc. -* shelves seem to get confused with their contents if you have 3 shelves over - 2 screens/zones - when you go back to 1 screen form 2, one of the shelves - gts the contents from the now non-existant shelf. * gkrellm options to "dont show in pager or taskber" only work if gkrellem is moved to one monitor and back again - doesn't seem to work on e boot/start if it is started at e start time @@ -33,8 +35,6 @@ Some of the things (in very short form) that need to be done to E17... instead of in a straight line * exebuf on other zones doesn't allow mouse to work properly (only zone/screen 0 works properly) -* Need global unique identifier for gadcons, so that their config will move - with them from one shelf to another. ]]] [[[ diff --git a/data/themes/default_button.edc b/data/themes/default_button.edc index 98225d122..3703a2726 100644 --- a/data/themes/default_button.edc +++ b/data/themes/default_button.edc @@ -78,7 +78,7 @@ group { } } description { - state: "visible" 0.0; + state: "combo" 0.0; inherit: "default" 0.0; aspect: 1.0 1.0; aspect_preference: VERTICAL; @@ -94,6 +94,23 @@ group { to: "button_image"; } } + description { + state: "icon" 0.0; + inherit: "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + align: 0.5 0.5; + rel1 { + relative: 0.0 0.0; + offset: 8 8; + to: "button_image"; + } + rel2 { + relative: 1.0 1.0; + offset: -9 -9; + to: "button_image"; + } + } } part { name: "e.text.label"; @@ -117,7 +134,7 @@ group { color3: 255 255 255 128; color_class: "button_text"; text { - text: "OK"; + text: ""; font: "Edje-Vera"; size: 10; min: 1 1; @@ -132,6 +149,11 @@ group { color3: 255 255 255 64; color_class: "button_text_disabled"; } + description { + state: "icon" 0.0; + inherit: "default" 0.0; + visible: 0; + } } part { name: "glint_clip"; @@ -330,18 +352,28 @@ group { action: SIGNAL_EMIT "e,action,click" ""; } program { - name: "icon_visible"; - signal: "e,action,show,icon"; - source: "e"; - action: STATE_SET "visible" 0.0; - target: "e.swallow.icon"; - } - program { - name: "icon_invisible"; - signal: "e,action,hide,icon"; + name: "text_state"; + signal: "e,state,text"; source: "e"; action: STATE_SET "default" 0.0; target: "e.swallow.icon"; + target: "e.text.label"; + } + program { + name: "icon_state"; + signal: "e,state,icon"; + source: "e"; + action: STATE_SET "icon" 0.0; + target: "e.swallow.icon"; + target: "e.text.label"; + } + program { + name: "combo_state"; + signal: "e,state,combo"; + source: "e"; + action: STATE_SET "combo" 0.0; + target: "e.swallow.icon"; + target: "e.text.label"; } program { name: "button_in"; diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 37ec1c39a..0401a6a32 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -107,7 +107,7 @@ e_config_init(void) #define T E_Config_Gadcon #define D _e_config_gadcon_edd E_CONFIG_VAL(D, T, name, STR); - E_CONFIG_VAL(D, T, id, STR); + E_CONFIG_VAL(D, T, id, INT); E_CONFIG_LIST(D, T, clients, _e_config_gadcon_client_edd); _e_config_shelf_desk_edd = E_CONFIG_DD_NEW("E_Config_Shelf_Desk", E_Config_Shelf_Desk); @@ -124,6 +124,7 @@ e_config_init(void) #define T E_Config_Shelf #define D _e_config_shelf_edd E_CONFIG_VAL(D, T, name, STR); + E_CONFIG_VAL(D, T, id, INT); E_CONFIG_VAL(D, T, container, INT); E_CONFIG_VAL(D, T, zone, INT); E_CONFIG_VAL(D, T, layer, INT); @@ -1231,10 +1232,12 @@ e_config_init(void) e_config->gadcons = NULL; { E_Config_Shelf *cf_es; + int id = 0; #define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide, _autohide_show_action, _hide_timeout, _hide_duration, _desk_show_mode, _desk_list) \ cf_es = E_NEW(E_Config_Shelf, 1); \ cf_es->name = evas_stringshare_add(_name); \ + cf_es->id = ++id; \ cf_es->container = _con; \ cf_es->zone = _zone; \ cf_es->popup = _pop; \ @@ -1252,20 +1255,9 @@ e_config_init(void) cf_es->desk_show_mode = _desk_show_mode; \ cf_es->desk_list = evas_list_append(cf_es->desk_list, cf_es); \ e_config->shelves = evas_list_append(e_config->shelves, cf_es) - /* shelves for 4 zones on head 0 by default */ CFG_SHELF("shelf", 0, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, 1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL); - CFG_SHELF("shelf", 0, 1, - 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL); - CFG_SHELF("shelf", 0, 2, - 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL); - CFG_SHELF("shelf", 0, 3, - 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL); - /* shelves for heada 1, 2, and 3 by default */ CFG_SHELF("shelf", 1, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, 1, 0, "default", 40, 0, 0, 0, 1.0, 1.0, 0, NULL); @@ -1346,16 +1338,17 @@ e_config_init(void) e_config->desklock_custom_desklock_cmd = NULL; IFCFGEND; - IFCFG(0x0107); /* the version # where this value(s) was introduced */ + IFCFG(0x0121); { - E_Config_Gadcon *cf_gc; + E_Config_Gadcon *cf_gc; E_Config_Gadcon_Client *cf_gcc; + int id = 0; e_config->gadcons = NULL; -#define CFG_GADCON(_name, _id) \ +#define CFG_GADCON(_name) \ cf_gc = E_NEW(E_Config_Gadcon, 1);\ cf_gc->name = evas_stringshare_add(_name); \ - cf_gc->id = evas_stringshare_add(_id); \ + cf_gc->id = ++id; \ e_config->gadcons = evas_list_append(e_config->gadcons, cf_gc) #define CFG_GADCON_CLIENT(_name, _res, _size, _pos, _style, _autoscr, _resizable) \ cf_gcc = E_NEW(E_Config_Gadcon_Client, 1); \ @@ -1373,7 +1366,7 @@ e_config_init(void) cf_gc->clients = evas_list_append(cf_gc->clients, cf_gcc) /* the default shelf on the default head/zone */ - CFG_GADCON("shelf", "0"); + CFG_GADCON("shelf"); CFG_GADCON_CLIENT("start", 800, 32, 0, NULL, 0, 0); CFG_GADCON_CLIENT("pager", 800, 120, @@ -1391,19 +1384,19 @@ e_config_init(void) CFG_GADCON_CLIENT("clock", 800, 32, 800 - 32, NULL, 0, 0); /* additional shelves for up to 3 more heads by default */ - CFG_GADCON("shelf", "1"); + CFG_GADCON("shelf"); CFG_GADCON_CLIENT("pager", 800, 120, 0, NULL, 0, 0); CFG_GADCON_CLIENT("ibox", 800, 32, 800 - 32, NULL, 0, 0); - CFG_GADCON("shelf", "2"); + CFG_GADCON("shelf"); CFG_GADCON_CLIENT("pager", 800, 120, 0, NULL, 0, 0); CFG_GADCON_CLIENT("ibox", 800, 32, 800 - 32, NULL, 0, 0); - CFG_GADCON("shelf", "3"); + CFG_GADCON("shelf"); CFG_GADCON_CLIENT("pager", 800, 120, 0, NULL, 0, 0); CFG_GADCON_CLIENT("ibox", 800, 32, diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 4ed254789..0e3c6a2fe 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -33,7 +33,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme; /* 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 0x0120 +#define E_CONFIG_FILE_GENERATION 0x0121 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_EVAS_ENGINE_DEFAULT 0 @@ -356,7 +356,7 @@ struct _E_Config_Desktop_Name struct _E_Config_Gadcon { const char *name; - const char *id; + int id; Evas_List *clients; }; @@ -378,6 +378,7 @@ struct _E_Config_Gadcon_Client struct _E_Config_Shelf { const char *name; + int id; int container, zone; int layer; unsigned char popup; diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 560367433..981bbced3 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -237,7 +237,7 @@ e_gadcon_provider_list(void) } EAPI E_Gadcon * -e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char *swallow_name) +e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, char *swallow_name) { E_Gadcon *gc; Evas_List *l; @@ -248,7 +248,7 @@ e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char if (!gc) return NULL; gc->name = evas_stringshare_add(name); - gc->id = evas_stringshare_add(id); + gc->id = id; gc->layout_policy = E_GADCON_LAYOUT_POLICY_PANEL; gc->edje.o_parent = obj; @@ -282,7 +282,7 @@ e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char cf_gc = l->data; if ((!strcmp(cf_gc->name, gc->name)) && - (!strcmp(cf_gc->id, gc->id))) + (cf_gc->id == gc->id)) { gc->cf = cf_gc; break; @@ -292,7 +292,7 @@ e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char { gc->cf = E_NEW(E_Config_Gadcon, 1); gc->cf->name = evas_stringshare_add(gc->name); - gc->cf->id = evas_stringshare_add(gc->id); + gc->cf->id = gc->id; e_config->gadcons = evas_list_append(e_config->gadcons, gc->cf); e_config_save_queue(); } @@ -1332,7 +1332,6 @@ _e_gadcon_free(E_Gadcon *gc) gadcons = evas_list_remove(gadcons, gc); if (gc->o_container) evas_object_del(gc->o_container); evas_stringshare_del(gc->name); - evas_stringshare_del(gc->id); evas_stringshare_del(gc->edje.swallow_name); if (gc->config_dialog) e_object_del(E_OBJECT(gc->config_dialog)); if (gc->drop_handler) e_drop_handler_del(gc->drop_handler); diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index ba187ef83..3b9f0fa3a 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -50,7 +50,7 @@ struct _E_Gadcon E_Object e_obj_inherit; const char *name; - const char *id; + int id; E_Gadcon_Layout_Policy layout_policy; @@ -171,7 +171,7 @@ EAPI int e_gadcon_shutdown(void); EAPI void e_gadcon_provider_register(const E_Gadcon_Client_Class *cc); EAPI void e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc); EAPI Evas_List *e_gadcon_provider_list(void); -EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, const char *id, Evas_Object *obj, char *swallow_name); +EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, char *swallow_name); EAPI void e_gadcon_swallowed_min_size_set(E_Gadcon *gc, Evas_Coord w, Evas_Coord h); EAPI void e_gadcon_min_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data); EAPI void e_gadcon_size_request_callback_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h), void *data); diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c index 35da7ab66..08a49bb3c 100644 --- a/src/bin/e_int_shelf_config.c +++ b/src/bin/e_int_shelf_config.c @@ -224,7 +224,6 @@ static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { E_Zone *zone; - int id; switch (cfdata->mode) { @@ -276,13 +275,13 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) cfdata->size = cfdata->basic_size; zone = cfdata->es->zone; - id = cfdata->es->id; cfdata->es->config_dialog = NULL; e_object_del(E_OBJECT(cfdata->es)); cfdata->es = e_shelf_zone_new(zone, cfdata->escfg->name, cfdata->escfg->style, cfdata->escfg->popup, - cfdata->escfg->layer, id); + cfdata->escfg->layer, + cfdata->escfg->id); cfdata->es->cfg = cfdata->escfg; cfdata->es->fit_along = cfdata->escfg->fit_along; cfdata->es->fit_size = cfdata->escfg->fit_size; @@ -300,7 +299,7 @@ static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { E_Zone *zone; - int id, idx; + int idx; int restart = 0; /* Only change style is we need to */ @@ -430,14 +429,14 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) if (restart) { zone = cfdata->es->zone; - id = cfdata->es->id; cfdata->es->config_dialog = NULL; e_object_del(E_OBJECT(cfdata->es)); cfdata->es = e_shelf_zone_new(zone, cfdata->escfg->name, cfdata->escfg->style, cfdata->escfg->popup, - cfdata->escfg->layer, id); + cfdata->escfg->layer, + cfdata->escfg->id); cfdata->es->cfg = cfdata->escfg; cfdata->es->fit_along = cfdata->escfg->fit_along; cfdata->es->fit_size = cfdata->escfg->fit_size; diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index c7017c084..16df34542 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -54,6 +54,7 @@ EAPI void e_shelf_config_init(void) { Evas_List *l; + int id = 0; while (shelves) { @@ -69,13 +70,15 @@ e_shelf_config_init(void) E_Zone *zone; cf_es = l->data; + if (cf_es->id <= 0) cf_es->id = id + 1; zone = e_util_container_zone_number_get(cf_es->container, cf_es->zone); + id = cf_es->id; if (zone) { E_Shelf *es; - + es = e_shelf_zone_new(zone, cf_es->name, cf_es->style, - cf_es->popup, cf_es->layer, -1); + cf_es->popup, cf_es->layer, cf_es->id); if (es) { if (!cf_es->hide_timeout) cf_es->hide_timeout = 1.0; @@ -132,6 +135,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i es = E_OBJECT_ALLOC(E_Shelf, E_SHELF_TYPE, _e_shelf_free); if (!es) return NULL; + es->id = id; es->x = 0; es->y = 0; @@ -192,13 +196,8 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i evas_object_layer_set(es->o_event, layer); evas_object_layer_set(es->o_base, layer); } - if (id < 0) - es->id = evas_list_count(shelves); - else - es->id = id; - snprintf(buf, sizeof(buf), "%i", es->id); - es->gadcon = e_gadcon_swallowed_new(es->name, buf, es->o_base, "e.swallow.content"); + es->gadcon = e_gadcon_swallowed_new(es->name, es->id, es->o_base, "e.swallow.content"); e_gadcon_min_size_request_callback_set(es->gadcon, _e_shelf_gadcon_min_size_request, es); diff --git a/src/bin/e_widget_button.c b/src/bin/e_widget_button.c index 5f230533c..595584687 100644 --- a/src/bin/e_widget_button.c +++ b/src/bin/e_widget_button.c @@ -3,6 +3,13 @@ */ #include "e.h" +typedef enum _E_Widget_Button_Type E_Widget_Button_Type; +enum _E_Widget_Button_Type +{ + E_WIDGET_BUTTON_TEXT = 1 << 0, + E_WIDGET_BUTTON_ICON = 1 << 1 +}; + typedef struct _E_Widget_Data E_Widget_Data; struct _E_Widget_Data { @@ -11,6 +18,7 @@ struct _E_Widget_Data void (*func) (void *data, void *data2); void *data; void *data2; + E_Widget_Button_Type type; }; static void _e_wid_del_hook(Evas_Object *obj); @@ -19,6 +27,7 @@ static void _e_wid_activate_hook(Evas_Object *obj); static void _e_wid_disable_hook(Evas_Object *obj); static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source); static void _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_wid_button_state_send(E_Widget_Data *wd); /* local subsystem functions */ /* externally accessible functions */ @@ -46,7 +55,11 @@ e_widget_button_add(Evas *evas, const char *label, const char *icon, void (*func e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/button"); edje_object_signal_callback_add(o, "e,action,click", "", _e_wid_signal_cb1, obj); - edje_object_part_text_set(o, "e.text.label", label); + if (label && label[0] != 0) + { + edje_object_part_text_set(o, "e.text.label", label); + wd->type |= E_WIDGET_BUTTON_TEXT; + } evas_object_show(o); e_widget_sub_object_add(obj, o); @@ -59,12 +72,12 @@ e_widget_button_add(Evas *evas, const char *label, const char *icon, void (*func wd->o_icon = o; e_util_edje_icon_set(o, icon); edje_object_part_swallow(wd->o_button, "e.swallow.icon", o); - edje_object_signal_emit(wd->o_button, "e,action,show,icon", "e"); - edje_object_message_signal_process(wd->o_button); evas_object_show(o); e_widget_sub_object_add(obj, o); + wd->type |= E_WIDGET_BUTTON_ICON; } - + + _e_wid_button_state_send(wd); edje_object_size_min_calc(wd->o_button, &mw, &mh); e_widget_min_size_set(obj, mw, mh); @@ -78,6 +91,11 @@ e_widget_button_label_set(Evas_Object *obj, const char *label) wd = e_widget_data_get(obj); edje_object_part_text_set(wd->o_button, "e.text.label", label); + if (label && label[0] != 0) + wd->type |= E_WIDGET_BUTTON_TEXT; + else + wd->type = ~(wd->type & E_WIDGET_BUTTON_TEXT); + _e_wid_button_state_send(wd); } EAPI void @@ -90,8 +108,6 @@ e_widget_button_icon_set(Evas_Object *obj, Evas_Object *icon) { e_widget_sub_object_del(obj, wd->o_icon); evas_object_hide(wd->o_icon); - edje_object_signal_emit(wd->o_button, "e,action,hide,icon", "e"); - edje_object_message_signal_process(wd->o_button); edje_object_part_unswallow(wd->o_button, wd->o_icon); evas_object_del(wd->o_icon); wd->o_icon = NULL; @@ -100,12 +116,14 @@ e_widget_button_icon_set(Evas_Object *obj, Evas_Object *icon) { wd->o_icon = icon; edje_object_part_swallow(wd->o_button, "e.swallow.icon", icon); - edje_object_signal_emit(wd->o_button, "e,action,show,icon", "e"); - edje_object_message_signal_process(wd->o_button); evas_object_pass_events_set(icon, 1); evas_object_show(icon); e_widget_sub_object_add(obj, icon); + wd->type |= E_WIDGET_BUTTON_ICON; } + else + wd->type = ~(wd->type & E_WIDGET_BUTTON_ICON); + _e_wid_button_state_send(wd); } static void @@ -173,3 +191,25 @@ _e_wid_focus_steal(void *data, Evas *e, Evas_Object *obj, void *event_info) { e_widget_focus_steal(data); } + +static void +_e_wid_button_state_send(E_Widget_Data *wd) +{ + if (!wd || !wd->o_button) return; + if (wd->type & E_WIDGET_BUTTON_TEXT) + { + if (wd->type & E_WIDGET_BUTTON_ICON) + { + edje_object_signal_emit(wd->o_button, "e,state,combo", "e"); + } + else + { + edje_object_signal_emit(wd->o_button, "e,state,text", "e"); + } + } + else if (wd->type & E_WIDGET_BUTTON_ICON) + { + edje_object_signal_emit(wd->o_button, "e,state,icon", "e"); + } + edje_object_message_signal_process(wd->o_button); +}