From da5943abc559b11c68166052716a45a66314b6f3 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 22 Jul 2005 10:28:11 +0000 Subject: [PATCH] 1. id3 album cover loader patches 2. i reduced list note memory usage by 20% - shoudl work better with malloc as ti is now a power of 2 as well 3. optimised evas internals to make use of event freezes to make e17'sw menu popups a LOT snappier 4. fixed using last member of list nodes - bad - shoudl use api as this is private stuff really 5. added config profile stuff to e17 u can literally maintain multiple config profiles and choose which one at any time etc. SVN revision: 15864 --- TODO | 3 +- src/bin/e_config.c | 150 +++++++++++++++++++++++++++++++++- src/bin/e_config.h | 12 ++- src/bin/e_container.c | 6 +- src/bin/e_hints.c | 4 +- src/bin/e_ipc_handlers.h | 38 +++++++++ src/bin/e_ipc_handlers_list.h | 3 + src/bin/e_main.c | 8 ++ src/bin/e_menu.c | 2 +- src/bin/e_test.c | 38 ++++++++- 10 files changed, 249 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 837b0abfd..3a672057f 100644 --- a/TODO +++ b/TODO @@ -37,13 +37,14 @@ Some of the things (in very short form) that need to be done to E17... ESSENTIAL FEATURES ------------------------------------------------------------------------------- +* support xrandr to change res from e itself (and save it etc.) * emit signal to submenu entries if they have a submenu shown for them or not * add window placement options like place at pointer * shaded windows should not allow border changes by the user * if a border is borderless it should not be allowed to be shaded (padl/r/t/b is 0) * add fullscreen support (e16 xvidmode or xrandr style) -* implement thses maximise/fullscreen modes: +* implement thees maximise/fullscreen modes: Which of these should be different modes, and which should be options for a mode? i think they all should be distinct actions of their own bound to a key, button etc. which one of these the maximize button on a window diff --git a/src/bin/e_config.c b/src/bin/e_config.c index f965dc690..e2f70be60 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -18,6 +18,7 @@ static int _e_config_cb_timer(void *data); /* local subsystem globals */ static Ecore_Job *_e_config_save_job = NULL; +static char *_e_config_profile = NULL; static E_Config_DD *_e_config_edd = NULL; static E_Config_DD *_e_config_module_edd = NULL; @@ -34,6 +35,40 @@ static E_Config_DD *_e_config_remember_edd = NULL; int e_config_init(void) { + _e_config_profile = getenv("CONF_PROFILE"); + if (!_e_config_profile) + { + Eet_File *ef; + char buf[4096]; + char *homedir; + + homedir = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/config/profile.cfg", + homedir); + ef = eet_open(buf, EET_FILE_MODE_READ); + E_FREE(homedir); + if (ef) + { + char *data; + int data_len = 0; + + data = eet_read(ef, "config", &data_len); + if ((data) && (data_len > 0)) + { + _e_config_profile = malloc(data_len + 1); + if (_e_config_profile) + { + memcpy(_e_config_profile, data, data_len); + _e_config_profile[data_len] = 0; + } + free(data); + } + eet_close(ef); + } + else + _e_config_profile = strdup("default"); + } + else _e_config_profile = strdup(_e_config_profile); _e_config_desktop_bg_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Background", E_Config_Desktop_Background); #undef T #undef D @@ -898,6 +933,7 @@ e_config_init(void) int e_config_shutdown(void) { + IF_FREE(_e_config_profile); E_CONFIG_DD_FREE(_e_config_edd); E_CONFIG_DD_FREE(_e_config_module_edd); E_CONFIG_DD_FREE(_e_config_font_default_edd); @@ -940,6 +976,90 @@ e_config_save_queue(void) _e_config_save_job = ecore_job_add(_e_config_save_cb, NULL); } +char * +e_config_profile_get(void) +{ + return _e_config_profile; +} + +void e_config_profile_set(char *prof) +{ + IF_FREE(_e_config_profile); + _e_config_profile = strdup(prof); +} + +Evas_List * +e_config_profile_list(void) +{ + Ecore_List *files; + char buf[4096]; + char *homedir; + Evas_List *flist = NULL; + + homedir = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/config/", homedir); + files = ecore_file_ls(buf); + if (files) + { + char *file; + + ecore_list_goto_first(files); + while ((file = ecore_list_current(files))) + { + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, file); + if (ecore_file_is_dir(buf)) + flist = evas_list_append(flist, strdup(file)); + ecore_list_next(files); + } + ecore_list_destroy(files); + } + E_FREE(homedir); + return flist; +} + +void +e_config_profile_add(char *prof) +{ + char buf[4096]; + char *homedir; + + homedir = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", + homedir, prof); + ecore_file_mkpath(buf); + E_FREE(homedir); +} + +void +e_config_profile_del(char *prof) +{ + Ecore_List *files; + char buf[4096]; + char *homedir; + + homedir = e_user_homedir_get(); + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof); + files = ecore_file_ls(buf); + if (files) + { + char *file; + + ecore_list_goto_first(files); + while ((file = ecore_list_current(files))) + { + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s", + homedir, prof, file); + ecore_file_unlink(buf); + ecore_list_next(files); + } + ecore_list_destroy(files); + } + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof); + ecore_file_rmdir(buf); + E_FREE(homedir); +} + + void * e_config_domain_load(char *domain, E_Config_DD *edd) { @@ -949,9 +1069,16 @@ e_config_domain_load(char *domain, E_Config_DD *edd) void *data = NULL; homedir = e_user_homedir_get(); - snprintf(buf, sizeof(buf), "%s/.e/e/config/%s.cfg", homedir, domain); - E_FREE(homedir); + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s.cfg", + homedir, _e_config_profile, domain); ef = eet_open(buf, EET_FILE_MODE_READ); + if (!ef) + { + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s.cfg", + homedir, "default", domain); + ef = eet_open(buf, EET_FILE_MODE_READ); + } + E_FREE(homedir); if (ef) { data = eet_data_read(ef, edd, "config"); @@ -970,7 +1097,20 @@ e_config_domain_save(char *domain, E_Config_DD *edd, void *data) /* FIXME: check for other sessions fo E runing */ homedir = e_user_homedir_get(); - snprintf(buf, sizeof(buf), "%s/.e/e/config/%s.cfg", homedir, domain); + snprintf(buf, sizeof(buf), "%s/.e/e/config/profile.cfg", + homedir); + ef = eet_open(buf, EET_FILE_MODE_WRITE); + if (ef) + { + ok = eet_write(ef, "config", _e_config_profile, + strlen(_e_config_profile), 0); + eet_close(ef); + } + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", + homedir, _e_config_profile); + ecore_file_mkpath(buf); + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/%s.cfg", + homedir, _e_config_profile, domain); E_FREE(homedir); ef = eet_open(buf, EET_FILE_MODE_WRITE); if (ef) @@ -1163,6 +1303,10 @@ _e_config_free(void) E_FREE(e_config->desktop_default_background); E_FREE(e_config->language); + E_FREE(e_config->transition_start); + E_FREE(e_config->transition_desk); + E_FREE(e_config->transition_change); + /* FIXME: free e_config->remembers */ E_FREE(e_config); } } diff --git a/src/bin/e_config.h b/src/bin/e_config.h index b22a3575e..63bf1d88a 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -185,13 +185,19 @@ struct _E_Config_Desktop_Background EAPI int e_config_init(void); EAPI int e_config_shutdown(void); -EAPI void *e_config_domain_load(char *domain, E_Config_DD *edd); -EAPI int e_config_domain_save(char *domain, E_Config_DD *edd, void *data); - EAPI int e_config_save(void); EAPI void e_config_save_flush(void); EAPI void e_config_save_queue(void); +EAPI char *e_config_profile_get(void); +EAPI void e_config_profile_set(char *prof); +EAPI Evas_List *e_config_profile_list(void); +EAPI void e_config_profile_add(char *prof); +EAPI void e_config_profile_del(char *prof); + +EAPI void *e_config_domain_load(char *domain, E_Config_DD *edd); +EAPI int e_config_domain_save(char *domain, E_Config_DD *edd, void *data); + EAPI E_Config_Binding_Mouse *e_config_binding_mouse_match(E_Config_Binding_Mouse *eb_in); EAPI E_Config_Binding_Key *e_config_binding_key_match(E_Config_Binding_Key *eb_in); diff --git a/src/bin/e_container.c b/src/bin/e_container.c index c0c7ed99e..1451da1cd 100644 --- a/src/bin/e_container.c +++ b/src/bin/e_container.c @@ -764,12 +764,12 @@ e_container_border_list_last(E_Container *con) e_object_ref(E_OBJECT(con)); list->layer = 6; if (list->container->layers[list->layer].clients) - list->clients = list->container->layers[list->layer].clients->last; + list->clients = evas_list_last(list->container->layers[list->layer].clients); while ((list->layer > 0) && (!list->clients)) { list->layer--; if (list->container->layers[list->layer].clients) - list->clients = list->container->layers[list->layer].clients->last; + list->clients = evas_list_last(list->container->layers[list->layer].clients); } return list; } @@ -803,7 +803,7 @@ e_container_border_list_prev(E_Border_List *list) { list->layer--; if (list->container->layers[list->layer].clients) - list->clients = list->container->layers[list->layer].clients->last; + list->clients = evas_list_last(list->container->layers[list->layer].clients); } return bd; } diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index aaebf554b..a382c3ea8 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -32,8 +32,8 @@ e_hints_init(void) * depending on what wm it thinks there is... so if we pretend to be Kwin... * it tries to use kde preferences, if found. */ -/* I have disabled tyhis now by pretending to be E16 with e16 comms. this - * means java plays nice and uses our FRAMe property.. but we had to do other +/* I have disabled this now by pretending to be E16 with e16 comms. this + * means java plays nice and uses our FRAME property.. but we had to do other * evil stuff as java EXPECTS all this at REPARENT time... i've deferred * reparenting... i hate java! */ diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h index 156df4377..eac43dc72 100644 --- a/src/bin/e_ipc_handlers.h +++ b/src/bin/e_ipc_handlers.h @@ -4381,6 +4381,44 @@ break; /****************************************************************************/ +/****************************************************************************/ +#define HDL E_IPC_OP_PROFILE_SET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-default-profile-set", 1, "Set the default configuration profile to OPT1", 0, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_STRING(params[0], HDL); +#elif (TYPE == E_WM_IN) + STRING(s, HDL); + e_config_profile_set(s); + SAVE; + END_STRING(s); +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_PROFILE_GET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-default-profile-get", 0, "Get the default configuration profile", 1, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_NULL(HDL); +#elif (TYPE == E_WM_IN) + SEND_STRING(e_config_profile_get(), E_IPC_OP_PROFILE_GET_REPLY, HDL); +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_PROFILE_GET_REPLY +#if (TYPE == E_REMOTE_OPTIONS) +#elif (TYPE == E_REMOTE_OUT) +#elif (TYPE == E_WM_IN) +#elif (TYPE == E_REMOTE_IN) + STRING(s, HDL); + printf("REPLY: \"%s\"\n", s); + END_STRING(s); +#endif +#undef HDL #if 0 } diff --git a/src/bin/e_ipc_handlers_list.h b/src/bin/e_ipc_handlers_list.h index 6a5ab54d8..96daa9603 100644 --- a/src/bin/e_ipc_handlers_list.h +++ b/src/bin/e_ipc_handlers_list.h @@ -215,3 +215,6 @@ #define E_IPC_OP_FOCUS_REVERT_ON_HIDE_OR_CLOSE_SET 215 #define E_IPC_OP_FOCUS_REVERT_ON_HIDE_OR_CLOSE_GET 216 #define E_IPC_OP_FOCUS_REVERT_ON_HIDE_OR_CLOSE_GET_REPLY 217 +#define E_IPC_OP_PROFILE_SET 218 +#define E_IPC_OP_PROFILE_GET 219 +#define E_IPC_OP_PROFILE_GET_REPLY 220 diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 0dccde448..0076f016f 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -157,6 +157,12 @@ main(int argc, char **argv) good = 1; evil = 1; } + else if ((!strcmp(argv[i], "-profile")) && (i < (argc - 1))) + { + i++; + + e_util_env_set("CONF_PROFILE", argv[i]); + } else if ((!strcmp(argv[i], "-h")) || (!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "--help"))) @@ -173,6 +179,8 @@ main(int argc, char **argv) "\t\treplace the real xinerama screens, if any. This can\n" "\t\tbe used to simulate xinerama.\n" "\t\tEG: -fake-xinerama-screen 800x600+0+0 -fake-xinerama-screen 800x600+800+0\n" + "\t-profile CONF_PROFILE\n" + "\t\tUse the configuration profile CONF_PROFILE instead of the the user delected default ot just \"default\".\n" "\t-good\n" "\t\tBe good.\n" "\t-evil\n" diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c index 1b3f4c5af..66b71bc21 100644 --- a/src/bin/e_menu.c +++ b/src/bin/e_menu.c @@ -1776,7 +1776,7 @@ _e_menu_item_activate_previous(void) } else { - ll = m->items->last; + ll = evas_list_last(m->items); mi = ll->data; while ((mi->separator) && (ll->prev)) { diff --git a/src/bin/e_test.c b/src/bin/e_test.c index 19c9613b6..02bfe2623 100644 --- a/src/bin/e_test.c +++ b/src/bin/e_test.c @@ -182,7 +182,7 @@ _e_test_timer(void *data) { e_menu_deactivate(m); e_object_del(E_OBJECT(m)); - ecore_timer_add(0.2, _e_test_timer, NULL); + ecore_timer_add(0.05, _e_test_timer, NULL); return 0; } managers = e_manager_list(); @@ -195,7 +195,7 @@ _e_test_timer(void *data) e_menu_activate_mouse(m, e_container_zone_number_get(e_container_current_get(man), 0), 0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN); - ecore_timer_add(0.2, _e_test_timer, m); + ecore_timer_add(0.05, _e_test_timer, m); return 0; } return 0; @@ -248,6 +248,40 @@ _e_test_internal(E_Container *con) win->data = o; } +#elif 0 +static int +_e_test_timer(void *data) +{ + E_Menu *m; + static int y = 0; + + m = data; + ecore_x_pointer_warp(m->evas_win, 20, y); + y += 10; + if (y > m->cur.h) y = 0; + return 1; +} + +static void +_e_test_internal(E_Container *con) +{ + E_Menu *m; + Evas_List *managers, *l; + + managers = e_manager_list(); + for (l = managers; l; l = l->next) + { + E_Manager *man; + + man = l->data; + m = e_int_menus_main_new(); + e_menu_activate_mouse(m, + e_container_zone_number_get(e_container_current_get(man), 0), + 0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN); + ecore_timer_add(0.02, _e_test_timer, m); + } +} +#elif 0 #else static void _e_test_internal(E_Container *con)