From 499b88748b5bdb940189b3a22bd441f11f3c8c4f Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Wed, 5 Dec 2012 06:51:16 +0000 Subject: [PATCH] From: Gwanglim Lee Subject: Re: Re: Re: [E-devel] [RFC] Virtual desktop window profile I've attached 4th patch. May the 4th be with you. ecore patch has been merged with efl and all files are based on r80123. Thanks & Regards, Gwanglim ------- Original Message ------- Sender : Daniel Juyung Seo Date : 2012-12-04 01:55 (GMT+09:00) Title : Re: Re: [E-devel] [RFC] Virtual desktop window profile It looks ok to me. Sorry but can you re-generate the patch according to the recent ecore merge to efl single tree? Daniel Juyung Seo (SeoZ) On Thu, Nov 29, 2012 at 12:29 AM, Gwanglim Lee wrote: Dear Raster and Daniel Juyung Seo, I've attached 3rd patches and test_config according to your reviews. These are based on r79782. [elementary & ecore] 1. "profile,set" -> "profile,changed" - done 2. spaces after EINA_LIST_FOREACH - done 3. variable type - keep 4. author - done 5. removing deprecated marking in patch - done 6. add elm_win_available_profiles_get to test_config for the debugging purpose - done 7. check whether a given profile is present in an available profiles. otherwise window profile will be one of the item in available profiles. - newly added thing to the elm_win 8. merge with EO - done. :( Any comments would be appreciated. SVN revision: 80216 --- config/default/e.src | 2 + config/mobile/e.src | 2 + config/standard/e.src | 2 + src/bin/e_border.c | 247 +++++++++++++++++- src/bin/e_border.h | 9 + src/bin/e_config.c | 30 +++ src/bin/e_config.h | 15 +- src/bin/e_container.c | 30 +++ src/bin/e_container.h | 2 + src/bin/e_desk.c | 166 ++++++++++++ src/bin/e_desk.h | 12 + src/bin/e_main.c | 2 + src/modules/conf_display/e_int_config_desk.c | 39 +++ src/modules/conf_display/e_int_config_desks.c | 19 +- 14 files changed, 566 insertions(+), 11 deletions(-) diff --git a/config/default/e.src b/config/default/e.src index 916efaf00..c9a893e0d 100644 --- a/config/default/e.src +++ b/config/default/e.src @@ -3,6 +3,7 @@ group "E_Config" struct { value "show_splash" int: 0; value "init_default_theme" string: "default.edj"; value "desktop_default_name" string: "%i-%i"; + value "desktop_default_window_profile" string: ""; value "menus_scroll_speed" double: 1000.0; value "menus_fast_mouse_move_threshhold" double: 300.0; value "menus_click_drag_timeout" double: 0.25; @@ -527,6 +528,7 @@ group "E_Config" struct { value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; value "exe_always_single_instance" uchar: 0; + value "use_desktop_window_profile" int: 0; value "powersave.none" double: 0.25; value "powersave.low" double: 5.0; value "powersave.medium" double: 60.0; diff --git a/config/mobile/e.src b/config/mobile/e.src index 5328f09a9..3f6dc6fc1 100644 --- a/config/mobile/e.src +++ b/config/mobile/e.src @@ -3,6 +3,7 @@ group "E_Config" struct { value "show_splash" int: 1; value "init_default_theme" string: "default.edj"; value "desktop_default_name" string: "%i-%i"; + value "desktop_default_window_profile" string: "mobile"; value "menus_scroll_speed" double: 1000.0000000000000000000000000; value "menus_fast_mouse_move_threshhold" double: 300.0000000000000000000000000; value "menus_click_drag_timeout" double: 0.2500000000000000000000000; @@ -1778,4 +1779,5 @@ group "E_Config" struct { value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; value "exe_always_single_instance" uchar: 1; + value "use_desktop_window_profile" int: 0; } diff --git a/config/standard/e.src b/config/standard/e.src index 9a8de572d..dc365dfac 100644 --- a/config/standard/e.src +++ b/config/standard/e.src @@ -3,6 +3,7 @@ group "E_Config" struct { value "show_splash" int: 1; value "init_default_theme" string: "default.edj"; value "desktop_default_name" string: "%i-%i"; + value "desktop_default_window_profile" string: "standard"; value "menus_scroll_speed" double: 1000.0; value "menus_fast_mouse_move_threshhold" double: 300.0; value "menus_click_drag_timeout" double: 0.25; @@ -2021,4 +2022,5 @@ group "E_Config" struct { value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; value "exe_always_single_instance" uchar: 0; + value "use_desktop_window_profile" int: 0; } diff --git a/src/bin/e_border.c b/src/bin/e_border.c index c24661eb3..c15b9190e 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -127,6 +127,9 @@ static Eina_Bool _e_border_cb_grab_replay(void *data, void *event); static void _e_border_cb_drag_finished(E_Drag *drag, int dropped); +static Eina_Bool _e_border_cb_desk_window_profile_change(void *data, + int ev_type, + void *ev); static void _e_border_eval(E_Border *bd); static void _e_border_eval0(E_Border *bd); @@ -339,6 +342,8 @@ e_border_init(void) _e_border_cb_config_icon_theme, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_CONFIG_MODE_CHANGED, _e_border_cb_config_mode, NULL); + E_LIST_HANDLER_APPEND(handlers, E_EVENT_DESK_WINDOW_PROFILE_CHANGE, + _e_border_cb_desk_window_profile_change, NULL); if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL); @@ -662,6 +667,9 @@ e_border_new(E_Container *con, video_parent = EINA_TRUE; else if (atoms[i] == ECORE_X_ATOM_E_VIDEO_POSITION) video_position = EINA_TRUE; + /* loop to check for window profile list atom */ + else if (atoms[i] == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED) + bd->client.e.fetch.profile = 1; } if (video_position && video_parent) { @@ -934,6 +942,18 @@ e_border_desk_set(E_Border *bd, E_OBJECT_CHECK(desk); E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); if (bd->desk == desk) return; + if ((e_config->use_desktop_window_profile) && + (bd->client.e.state.profile.use)) + { + if (bd->client.e.state.profile.wait_for_done) return; + if (strcmp(bd->client.e.state.profile.name, desk->window_profile) != 0) + { + ecore_x_e_window_profile_change_request_send(bd->client.win, + desk->window_profile); + bd->client.e.state.profile.wait_for_done = 1; + return; + } + } ecore_x_window_shadow_tree_flush(); if (bd->fullscreen) { @@ -4812,6 +4832,34 @@ e_border_resize_limit(E_Border *bd, static void _e_border_free(E_Border *bd) { + if (bd->client.e.state.profile.use) + { + if (bd->client.e.state.profile.available_list) + { + int i; + for (i = 0; i < bd->client.e.state.profile.num; i++) + { + if (bd->client.e.state.profile.available_list[i]) + { + eina_stringshare_del(bd->client.e.state.profile.available_list[i]); + bd->client.e.state.profile.available_list[i] = NULL; + } + } + E_FREE(bd->client.e.state.profile.available_list); + bd->client.e.state.profile.available_list = NULL; + } + + bd->client.e.state.profile.num = 0; + + if (bd->client.e.state.profile.name) + { + eina_stringshare_del(bd->client.e.state.profile.name); + bd->client.e.state.profile.name = NULL; + } + + bd->client.e.state.profile.wait_for_done = 0; + bd->client.e.state.profile.use = 0; + } if (bd->client.e.state.video_parent && bd->client.e.state.video_parent_border) { bd->client.e.state.video_parent_border->client.e.state.video_child = @@ -5826,6 +5874,16 @@ _e_border_cb_window_property(void *data __UNUSED__, bd->client.netwm.fetch.state = 1; bd->changed = 1; } + else if (e->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED) + { + bd->client.e.fetch.profile = 1; + bd->changed = 1; + } + else if (e->atom == ECORE_X_ATOM_E_WINDOW_PROFILE_AVAILABLE_LIST) + { + bd->client.e.fetch.profile = 1; + bd->changed = 1; + } return ECORE_CALLBACK_PASS_ON; } @@ -6053,17 +6111,54 @@ _e_border_cb_window_focus_out(void *data __UNUSED__, static Eina_Bool _e_border_cb_client_message(void *data __UNUSED__, int ev_type __UNUSED__, - void *ev __UNUSED__) + void *ev) { - /* - E_Border *bd; - Ecore_X_Event_Client_Message *e; + E_Border *bd; + Ecore_X_Event_Client_Message *e; + char *profile = NULL; - e = ev; - bd = e_border_find_by_client_window(e->win); - if (!bd) return 1; - */ - return 1; + e = (Ecore_X_Event_Client_Message *)ev; + bd = e_border_find_by_client_window(e->win); + if (!bd) return ECORE_CALLBACK_PASS_ON; + + if (e->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE) + { + if (bd->client.e.state.profile.use) + { + profile = ecore_x_atom_name_get(e->data.l[1]); + ecore_x_e_window_profile_change_request_send(bd->client.win, + profile); + bd->client.e.state.profile.wait_for_done = 1; + } + } + else if (e->message_type == ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE_DONE) + { + if ((bd->client.e.state.profile.use) && + (bd->client.e.state.profile.wait_for_done)) + { + E_Container *con = bd->zone->container; + E_Desk *desk = NULL; + + profile = ecore_x_atom_name_get(e->data.l[1]); + if (profile) + { + if (bd->client.e.state.profile.name) + eina_stringshare_del(bd->client.e.state.profile.name); + bd->client.e.state.profile.name = eina_stringshare_add(profile); + } + + bd->client.e.state.profile.wait_for_done = 0; + + desk = e_container_desk_window_profile_get(con, profile); + if ((desk) && (bd->desk != desk)) + e_border_desk_set(bd, desk); + } + } + + if (profile) + free(profile); + + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -6966,6 +7061,27 @@ _e_border_cb_drag_finished(E_Drag *drag, drag_border = NULL; } +static Eina_Bool +_e_border_cb_desk_window_profile_change(void *data __UNUSED__, + int ev_type __UNUSED__, + void *ev) +{ + E_Event_Desk_Window_Profile_Change *e; + Eina_List *l = NULL; + E_Border *bd; + + e = (E_Event_Desk_Window_Profile_Change *)ev; + EINA_LIST_FOREACH(borders, l, bd) + { + if (!e_object_is_del(E_OBJECT(bd))) + { + bd->client.e.fetch.profile = 1; + bd->changed = 1; + } + } + return ECORE_CALLBACK_PASS_ON; +} + static Eina_Bool _e_border_post_move_resize_job(void *data) { @@ -7060,6 +7176,7 @@ _e_border_eval0(E_Border *bd) { int change_urgent = 0; int rem_change = 0; + Eina_Bool need_desk_set = EINA_FALSE; if (e_object_is_del(E_OBJECT(bd))) { @@ -7188,6 +7305,69 @@ _e_border_eval0(E_Border *bd) bd->client.e.fetch.state = 0; rem_change = 1; } + if (bd->client.e.fetch.profile) + { + const char **list = NULL; + int n, i, res; + unsigned int use; + + if (bd->client.e.state.profile.name) + { + eina_stringshare_del(bd->client.e.state.profile.name); + bd->client.e.state.profile.name = NULL; + } + + if (bd->client.e.state.profile.available_list) + { + for (i = 0; i < bd->client.e.state.profile.num; i++) + { + if (bd->client.e.state.profile.available_list[i]) + { + eina_stringshare_del(bd->client.e.state.profile.available_list[i]); + bd->client.e.state.profile.available_list[i] = NULL; + } + } + E_FREE(bd->client.e.state.profile.available_list); + bd->client.e.state.profile.available_list = NULL; + } + bd->client.e.state.profile.num = 0; + + res = ecore_x_window_prop_card32_get(bd->client.win, + ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED, + &use, + 1); + if ((res == 1) && (use == 1)) + { + Ecore_X_Atom val; + res = ecore_x_window_prop_atom_get(bd->client.win, + ECORE_X_ATOM_E_WINDOW_PROFILE_CHANGE, + &val, 1); + if (res == 1) + { + char *name = ecore_x_atom_name_get(val); + if (name) + { + bd->client.e.state.profile.name = eina_stringshare_add(name); + free(name); + } + } + + if (ecore_x_e_window_available_profiles_get(bd->client.win, &list, &n)) + { + bd->client.e.state.profile.available_list = E_NEW(const char *, n); + for (i = 0; i < n; i++) + bd->client.e.state.profile.available_list[i] = eina_stringshare_add(list[i]); + bd->client.e.state.profile.num = n; + } + need_desk_set = EINA_TRUE; + bd->client.e.state.profile.use = 1; + + if (list) + free(list); + } + + bd->client.e.fetch.profile = 0; + } if (bd->client.netwm.fetch.type) { e_hints_window_type_get(bd); @@ -7813,6 +7993,55 @@ _e_border_eval0(E_Border *bd) bd->client.netwm.update.state = 0; } + if ((e_config->use_desktop_window_profile) && (need_desk_set)) + { + if (!(bd->client.e.state.profile.name) && + (bd->client.e.state.profile.num >= 1)) + { + const char *p = NULL; + int i; + for (i = 0; i < bd->client.e.state.profile.num; i++) + { + if (!bd->client.e.state.profile.available_list[i]) + continue; + p = bd->client.e.state.profile.available_list[i]; + if (strcmp(bd->desk->window_profile, p) == 0) + { + bd->client.e.state.profile.name = eina_stringshare_add(bd->desk->window_profile); + break; + } + } + + if (!bd->client.e.state.profile.name) + { + E_Container *con = bd->zone->container; + E_Desk *desk = NULL; + + for (i = 0; i < bd->client.e.state.profile.num; i++) + { + if (!bd->client.e.state.profile.available_list[i]) + continue; + p = bd->client.e.state.profile.available_list[i]; + desk = e_container_desk_window_profile_get(con, p); + if ((desk) && (bd->desk != desk)) + { + bd->client.e.state.profile.name = eina_stringshare_add(p); + break; + } + } + } + } + + if (!bd->client.e.state.profile.name) + { + bd->client.e.state.profile.name = eina_stringshare_add(bd->desk->window_profile); + } + + ecore_x_e_window_profile_change_request_send(bd->client.win, + bd->client.e.state.profile.name); + bd->client.e.state.profile.wait_for_done = 1; + } + if (bd->new_client) { E_Event_Border_Add *ev; diff --git a/src/bin/e_border.h b/src/bin/e_border.h index a89e3305b..f048651dd 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -393,6 +393,14 @@ struct _E_Border Ecore_X_Window video_parent; E_Border *video_parent_border; Eina_List *video_child; + struct + { + const char *name; + const char **available_list; + int num; + unsigned char wait_for_done : 1; + unsigned char use : 1; + } profile; unsigned char centered : 1; unsigned char video : 1; @@ -403,6 +411,7 @@ struct _E_Border unsigned char state : 1; unsigned char video_parent : 1; unsigned char video_position : 1; + unsigned char profile : 1; } fetch; } e; diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 216c1f2c1..5f3b2d568 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -41,6 +41,7 @@ static E_Config_DD *_e_config_path_append_edd = NULL; static E_Config_DD *_e_config_desktop_bg_edd = NULL; static E_Config_DD *_e_config_desklock_bg_edd = NULL; static E_Config_DD *_e_config_desktop_name_edd = NULL; +static E_Config_DD *_e_config_desktop_window_profile_edd = NULL; static E_Config_DD *_e_config_remember_edd = NULL; static E_Config_DD *_e_config_color_class_edd = NULL; static E_Config_DD *_e_config_gadcon_edd = NULL; @@ -274,6 +275,17 @@ e_config_init(void) E_CONFIG_VAL(D, T, desk_y, INT); E_CONFIG_VAL(D, T, name, STR); + _e_config_desktop_window_profile_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Window_Profile", E_Config_Desktop_Window_Profile); +#undef T +#undef D +#define T E_Config_Desktop_Window_Profile +#define D _e_config_desktop_window_profile_edd + E_CONFIG_VAL(D, T, container, INT); + E_CONFIG_VAL(D, T, zone, INT); + E_CONFIG_VAL(D, T, desk_x, INT); + E_CONFIG_VAL(D, T, desk_y, INT); + E_CONFIG_VAL(D, T, profile, STR); + _e_config_path_append_edd = E_CONFIG_DD_NEW("E_Path_Dir", E_Path_Dir); #undef T #undef D @@ -638,8 +650,10 @@ e_config_init(void) E_CONFIG_VAL(D, T, init_default_theme, STR); /**/ E_CONFIG_VAL(D, T, desktop_default_background, STR); /**/ E_CONFIG_VAL(D, T, desktop_default_name, STR); /**/ + E_CONFIG_VAL(D, T, desktop_default_window_profile, STR); /**/ E_CONFIG_LIST(D, T, desktop_backgrounds, _e_config_desktop_bg_edd); /**/ E_CONFIG_LIST(D, T, desktop_names, _e_config_desktop_name_edd); /**/ + E_CONFIG_LIST(D, T, desktop_window_profiles, _e_config_desktop_window_profile_edd); E_CONFIG_VAL(D, T, menus_scroll_speed, DOUBLE); /**/ E_CONFIG_VAL(D, T, menus_fast_mouse_move_threshhold, DOUBLE); /**/ E_CONFIG_VAL(D, T, menus_click_drag_timeout, DOUBLE); /**/ @@ -945,6 +959,8 @@ e_config_init(void) //E_CONFIG_VAL(D, T, xkb.cur_group, INT); E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR); + + E_CONFIG_VAL(D, T, use_desktop_window_profile, INT); e_config_load(); e_config_save_queue(); @@ -970,6 +986,7 @@ e_config_shutdown(void) E_CONFIG_DD_FREE(_e_config_desktop_bg_edd); E_CONFIG_DD_FREE(_e_config_desklock_bg_edd); E_CONFIG_DD_FREE(_e_config_desktop_name_edd); + E_CONFIG_DD_FREE(_e_config_desktop_window_profile_edd); E_CONFIG_DD_FREE(_e_config_remember_edd); E_CONFIG_DD_FREE(_e_config_gadcon_edd); E_CONFIG_DD_FREE(_e_config_gadcon_client_edd); @@ -1259,6 +1276,11 @@ e_config_load(void) e_config->window_activehint_policy = 2; IFCFGEND; + IFCFG(0x0162); + COPYSTR(desktop_default_window_profile); + COPYVAL(use_desktop_window_profile); + IFCFGEND; + e_config->config_version = E_CONFIG_FILE_VERSION; _e_config_free(tcfg); } @@ -2005,9 +2027,16 @@ _e_config_free(E_Config *ecf) E_Config_Env_Var *evr; E_Config_XKB_Layout *cl; E_Config_XKB_Option *op; + E_Config_Desktop_Window_Profile *wp; if (!ecf) return; + EINA_LIST_FREE(ecf->desktop_window_profiles, wp) + { + eina_stringshare_del(wp->profile); + E_FREE(wp); + } + eina_stringshare_del(ecf->xkb.default_model); EINA_LIST_FREE(ecf->xkb.used_layouts, cl) @@ -2148,6 +2177,7 @@ _e_config_free(E_Config *ecf) if (ecf->init_default_theme) eina_stringshare_del(ecf->init_default_theme); if (ecf->desktop_default_background) eina_stringshare_del(ecf->desktop_default_background); if (ecf->desktop_default_name) eina_stringshare_del(ecf->desktop_default_name); + if (ecf->desktop_default_window_profile) eina_stringshare_del(ecf->desktop_default_window_profile); if (ecf->language) eina_stringshare_del(ecf->language); eina_stringshare_del(ecf->desklock_language); eina_stringshare_del(ecf->xkb.selected_layout); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index cfaed6ff1..46c1c0490 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -14,6 +14,7 @@ typedef struct _E_Config_Binding_Acpi E_Config_Binding_Acpi; typedef struct _E_Config_Desktop_Background E_Config_Desktop_Background; typedef struct _E_Config_Desklock_Background E_Config_Desklock_Background; typedef struct _E_Config_Desktop_Name E_Config_Desktop_Name; +typedef struct _E_Config_Desktop_Window_Profile E_Config_Desktop_Window_Profile; typedef struct _E_Config_Gadcon E_Config_Gadcon; typedef struct _E_Config_Gadcon_Client E_Config_Gadcon_Client; typedef struct _E_Config_Shelf E_Config_Shelf; @@ -37,7 +38,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 0x0161 +#define E_CONFIG_FILE_GENERATION 0x0162 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) struct _E_Config @@ -48,7 +49,9 @@ struct _E_Config const char *desktop_default_background; // GUI Eina_List *desktop_backgrounds; // GUI const char *desktop_default_name; + const char *desktop_default_window_profile; Eina_List *desktop_names; // GUI + Eina_List *desktop_window_profiles; // GUI double menus_scroll_speed; // GUI double menus_fast_mouse_move_threshhold; // GUI double menus_click_drag_timeout; // GUI @@ -398,6 +401,7 @@ struct _E_Config } xkb; unsigned char exe_always_single_instance; + int use_desktop_window_profile; // GUI }; struct _E_Config_Desklock_Background @@ -512,6 +516,15 @@ struct _E_Config_Desktop_Name const char *name; }; +struct _E_Config_Desktop_Window_Profile +{ + int container; + int zone; + int desk_x; + int desk_y; + const char *profile; +}; + struct _E_Config_Gadcon { const char *name; diff --git a/src/bin/e_container.c b/src/bin/e_container.c index ca9a4805a..89ab5df06 100644 --- a/src/bin/e_container.c +++ b/src/bin/e_container.c @@ -360,6 +360,36 @@ e_container_zone_id_get(E_Container *con, int id) return NULL; } +EAPI E_Desk * +e_container_desk_window_profile_get(E_Container *con, + const char *profile) +{ + Eina_List *l = NULL; + E_Zone *zone = NULL; + int x, y; + + E_OBJECT_CHECK_RETURN(con, NULL); + E_OBJECT_TYPE_CHECK_RETURN(con, E_CONTAINER_TYPE, NULL); + + EINA_LIST_FOREACH(con->zones, l, zone) + { + for (x = 0; x < zone->desk_x_count; x++) + { + for (y = 0; y < zone->desk_y_count; y++) + { + E_Desk *desk = e_desk_at_xy_get(zone, x, y); + if ((desk->window_profile) && + strcmp(desk->window_profile, profile) == 0) + { + return desk; + } + } + } + } + + return NULL; +} + EAPI E_Container_Shape * e_container_shape_add(E_Container *con) { diff --git a/src/bin/e_container.h b/src/bin/e_container.h index a0ec4abf5..a5a044e7e 100644 --- a/src/bin/e_container.h +++ b/src/bin/e_container.h @@ -125,6 +125,8 @@ EAPI E_Zone *e_container_zone_at_point_get(E_Container *con, int x, int y); EAPI E_Zone *e_container_zone_number_get(E_Container *con, int num); EAPI E_Zone *e_container_zone_id_get(E_Container *con, int id); +EAPI E_Desk *e_container_desk_window_profile_get(E_Container *con, const char *profile); + EAPI E_Container_Shape *e_container_shape_add(E_Container *con); EAPI void e_container_shape_show(E_Container_Shape *es); EAPI void e_container_shape_hide(E_Container_Shape *es); diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index bef1e43a9..f9fc89c74 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -11,18 +11,21 @@ static void _e_desk_event_desk_before_show_free(void *data, void *ev); static void _e_desk_event_desk_after_show_free(void *data, void *ev); static void _e_desk_event_desk_deskshow_free(void *data, void *ev); static void _e_desk_event_desk_name_change_free(void *data, void *ev); +static void _e_desk_event_desk_window_profile_change_free(void *data, void *ev); static void _e_desk_show_begin(E_Desk *desk, int mode, int x, int dy); static void _e_desk_show_end(E_Desk *desk); static Eina_Bool _e_desk_show_animator(void *data); static void _e_desk_hide_begin(E_Desk *desk, int mode, int dx, int dy); static void _e_desk_hide_end(E_Desk *desk); static Eina_Bool _e_desk_hide_animator(void *data); +static void _e_desk_window_profile_change_protocol_set(void); EAPI int E_EVENT_DESK_SHOW = 0; EAPI int E_EVENT_DESK_BEFORE_SHOW = 0; EAPI int E_EVENT_DESK_AFTER_SHOW = 0; EAPI int E_EVENT_DESK_DESKSHOW = 0; EAPI int E_EVENT_DESK_NAME_CHANGE = 0; +EAPI int E_EVENT_DESK_WINDOW_PROFILE_CHANGE = 0; EINTERN int e_desk_init(void) @@ -32,6 +35,7 @@ e_desk_init(void) E_EVENT_DESK_AFTER_SHOW = ecore_event_type_new(); E_EVENT_DESK_DESKSHOW = ecore_event_type_new(); E_EVENT_DESK_NAME_CHANGE = ecore_event_type_new(); + E_EVENT_DESK_WINDOW_PROFILE_CHANGE = ecore_event_type_new(); return 1; } @@ -47,6 +51,7 @@ e_desk_new(E_Zone *zone, int x, int y) E_Desk *desk; Eina_List *l; E_Config_Desktop_Name *cfname; + E_Config_Desktop_Window_Profile *cfprof; char name[40]; int ok = 0; @@ -80,6 +85,27 @@ e_desk_new(E_Zone *zone, int x, int y) desk->name = eina_stringshare_add(name); } + /* Get window profile name for current desktop */ + ok = 0; + EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof) + { + if ((cfprof->container >= 0) && + ((int)zone->container->num != cfprof->container)) continue; + if ((cfprof->zone >= 0) && + ((int)zone->num != cfprof->zone)) continue; + if ((cfprof->desk_x != desk->x) || (cfprof->desk_y != desk->y)) + continue; + desk->window_profile = eina_stringshare_add(cfprof->profile); + ok = 1; + break; + } + + if (!ok) + { + desk->window_profile = eina_stringshare_add + (e_config->desktop_default_window_profile); + } + return desk; } @@ -515,6 +541,124 @@ e_desk_prev(E_Zone *zone) e_desk_show(e_desk_at_xy_get(zone, x, y)); } +EAPI void +e_desk_window_profile_set(E_Desk *desk, + const char *profile) +{ + E_Event_Desk_Window_Profile_Change *ev; + + E_OBJECT_CHECK(desk); + E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); + + eina_stringshare_replace(&desk->window_profile, profile); + + ev = E_NEW(E_Event_Desk_Window_Profile_Change, 1); + ev->desk = desk; + e_object_ref(E_OBJECT(desk)); + ecore_event_add(E_EVENT_DESK_WINDOW_PROFILE_CHANGE, ev, + _e_desk_event_desk_window_profile_change_free, NULL); +} + +EAPI void +e_desk_window_profile_add(int container, + int zone, + int desk_x, + int desk_y, + const char *profile) +{ + E_Config_Desktop_Window_Profile *cfprof; + + e_desk_window_profile_del(container, zone, desk_x, desk_y); + + cfprof = E_NEW(E_Config_Desktop_Window_Profile, 1); + cfprof->container = container; + cfprof->zone = zone; + cfprof->desk_x = desk_x; + cfprof->desk_y = desk_y; + if (profile) cfprof->profile = eina_stringshare_add(profile); + else cfprof->profile = NULL; + e_config->desktop_window_profiles = eina_list_append(e_config->desktop_window_profiles, cfprof); +} + +EAPI void +e_desk_window_profile_del(int container, + int zone, + int desk_x, + int desk_y) +{ + Eina_List *l = NULL; + E_Config_Desktop_Window_Profile *cfprof = NULL; + + EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof) + { + if (!((cfprof->container == container) && + (cfprof->zone == zone) && + (cfprof->desk_x == desk_x) && + (cfprof->desk_y == desk_y))) + continue; + + e_config->desktop_window_profiles = + eina_list_remove_list(e_config->desktop_window_profiles, l); + if (cfprof->profile) eina_stringshare_del(cfprof->profile); + E_FREE(cfprof); + break; + } +} + +EAPI void +e_desk_window_profile_update(void) +{ + Eina_List *m, *c, *z, *l; + E_Manager *man; + E_Container *con; + E_Zone *zone; + E_Desk *desk; + E_Config_Desktop_Window_Profile *cfprof; + int d_x, d_y, ok; + + _e_desk_window_profile_change_protocol_set(); + + if (!(e_config->use_desktop_window_profile)) + return; + + EINA_LIST_FOREACH(e_manager_list(), m, man) + { + EINA_LIST_FOREACH(man->containers, c, con) + { + EINA_LIST_FOREACH(con->zones, z, zone) + { + for (d_x = 0; d_x < zone->desk_x_count; d_x++) + { + for (d_y = 0; d_y < zone->desk_y_count; d_y++) + { + desk = zone->desks[d_x + zone->desk_x_count * d_y]; + ok = 0; + + EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, cfprof) + { + if ((cfprof->container >= 0) && + ((int)con->num != cfprof->container)) continue; + if ((cfprof->zone >= 0) && + ((int)zone->num != cfprof->zone)) continue; + if ((cfprof->desk_x != d_x) || + (cfprof->desk_y != d_y)) continue; + e_desk_window_profile_set(desk, cfprof->profile); + ok = 1; + break; + } + + if (!ok) + { + e_desk_window_profile_set + (desk, e_config->desktop_default_window_profile); + } + } + } + } + } + } +} + static void _e_desk_free(E_Desk *desk) { @@ -575,6 +719,15 @@ _e_desk_event_desk_name_change_free(void *data __UNUSED__, void *event) free(ev); } +static void +_e_desk_event_desk_window_profile_change_free(void *data __UNUSED__, void *event) +{ + E_Event_Desk_Window_Profile_Change *ev; + ev = event; + e_object_unref(E_OBJECT(ev->desk)); + E_FREE(ev); +} + static void _e_desk_show_begin(E_Desk *desk, int mode, int dx, int dy) { @@ -903,3 +1056,16 @@ _e_desk_hide_animator(void *data) return ECORE_CALLBACK_RENEW; } + +static void +_e_desk_window_profile_change_protocol_set(void) +{ + Eina_List *l = NULL; + E_Manager *man; + + EINA_LIST_FOREACH(e_manager_list(), l, man) + { + ecore_x_e_window_profile_supported_set + (man->root, e_config->use_desktop_window_profile); + } +} diff --git a/src/bin/e_desk.h b/src/bin/e_desk.h index 32397c6c6..b4d3a827f 100644 --- a/src/bin/e_desk.h +++ b/src/bin/e_desk.h @@ -5,6 +5,7 @@ typedef struct _E_Event_Desk_Show E_Event_Desk_Show; typedef struct _E_Event_Desk_Before_Show E_Event_Desk_Before_Show; typedef struct _E_Event_Desk_After_Show E_Event_Desk_After_Show; typedef struct _E_Event_Desk_Name_Change E_Event_Desk_Name_Change; +typedef struct _E_Event_Desk_Window_Profile_Change E_Event_Desk_Window_Profile_Change; #else #ifndef E_DESK_H @@ -18,6 +19,7 @@ struct _E_Desk E_Zone *zone; const char *name; + const char *window_profile; int x, y; unsigned char visible : 1; unsigned int deskshow_toggle : 1; @@ -49,6 +51,11 @@ struct _E_Event_Desk_Name_Change E_Desk *desk; }; +struct _E_Event_Desk_Window_Profile_Change +{ + E_Desk *desk; +}; + EINTERN int e_desk_init(void); EINTERN int e_desk_shutdown(void); EAPI E_Desk *e_desk_new(E_Zone *zone, int x, int y); @@ -69,12 +76,17 @@ EAPI void e_desk_row_add(E_Zone *zone); EAPI void e_desk_row_remove(E_Zone *zone); EAPI void e_desk_col_add(E_Zone *zone); EAPI void e_desk_col_remove(E_Zone *zone); +EAPI void e_desk_window_profile_set(E_Desk *desk, const char *profile); +EAPI void e_desk_window_profile_add(int container, int zone, int desk_x, int desk_y, const char *profile); +EAPI void e_desk_window_profile_del(int container, int zone, int desk_x, int desk_y); +EAPI void e_desk_window_profile_update(void); extern EAPI int E_EVENT_DESK_SHOW; extern EAPI int E_EVENT_DESK_BEFORE_SHOW; extern EAPI int E_EVENT_DESK_AFTER_SHOW; extern EAPI int E_EVENT_DESK_DESKSHOW; extern EAPI int E_EVENT_DESK_NAME_CHANGE; +extern EAPI int E_EVENT_DESK_WINDOW_PROFILE_CHANGE; #endif #endif diff --git a/src/bin/e_main.c b/src/bin/e_main.c index b6d79940e..0fd5376a1 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1680,6 +1680,8 @@ _e_main_screens_init(void) free(roots); return 0; } + ecore_x_e_window_profile_supported_set(roots[i], + e_config->use_desktop_window_profile); } free(roots); diff --git a/src/modules/conf_display/e_int_config_desk.c b/src/modules/conf_display/e_int_config_desk.c index cb2f45779..cd4ab6915 100644 --- a/src/modules/conf_display/e_int_config_desk.c +++ b/src/modules/conf_display/e_int_config_desk.c @@ -15,6 +15,7 @@ struct _E_Config_Dialog_Data int desk_y; char *bg; char *name; + char *profile; Evas_Object *preview; Ecore_Event_Handler *hdl; @@ -61,6 +62,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) const char *bg; char name[40]; int ok = 0; + E_Config_Desktop_Window_Profile *prof; bg = e_bg_file_get(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); if (!bg) @@ -88,6 +90,24 @@ _fill_data(E_Config_Dialog_Data *cfdata) snprintf(name, sizeof(name), _(e_config->desktop_default_name), cfdata->desk_x, cfdata->desk_y); cfdata->name = strdup(name); } + + ok = 0; + EINA_LIST_FOREACH(e_config->desktop_window_profiles, l, prof) + { + if (!((prof->container == cfdata->con_num) && + (prof->zone == cfdata->zone_num) && + (prof->desk_x == cfdata->desk_x) && + (prof->desk_y == cfdata->desk_y))) + continue; + + if (prof->profile) + cfdata->profile = strdup(prof->profile); + ok = 1; + break; + } + + if (!ok) + cfdata->profile = strdup(e_config->desktop_default_window_profile); } static void * @@ -110,6 +130,8 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) E_FREE(cfdata->bg); if (cfdata->name) E_FREE(cfdata->name); + if (cfdata->profile) + E_FREE(cfdata->profile); E_FREE(cfdata); } @@ -125,11 +147,20 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) cfdata->name = strdup(name); } + if (!cfdata->profile[0]) + cfdata->profile = strdup(e_config->desktop_default_window_profile); + e_desk_name_del(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); e_desk_name_add(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y, cfdata->name); e_desk_name_update(); + + e_desk_window_profile_del(cfdata->con_num, cfdata->zone_num, + cfdata->desk_x, cfdata->desk_y); + e_desk_window_profile_add(cfdata->con_num, cfdata->zone_num, + cfdata->desk_x, cfdata->desk_y, cfdata->profile); + e_desk_window_profile_update(); e_bg_del(cfdata->con_num, cfdata->zone_num, cfdata->desk_x, cfdata->desk_y); e_bg_add(cfdata->con_num, cfdata->zone_num, @@ -156,6 +187,14 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) ob = e_widget_entry_add(evas, &(cfdata->name), NULL, NULL, NULL); e_widget_frametable_object_append(of, ob, 1, 0, 2, 1, 1, 1, 1, 0); e_widget_list_object_append(o, of, 1, 1, 0.5); + + of = e_widget_frametable_add(evas, _("Desktop Window Profile"), 0); + ob = e_widget_label_add(evas, _("Profile Name:")); + e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 0); + ob = e_widget_entry_add(evas, &(cfdata->profile), NULL, NULL, NULL); + e_widget_entry_readonly_set(ob, !(e_config->use_desktop_window_profile)); + e_widget_frametable_object_append(of, ob, 1, 0, 2, 1, 1, 1, 1, 0); + e_widget_list_object_append(o, of, 1, 1, 0.5); of = e_widget_frametable_add(evas, _("Desktop Wallpaper"), 0); ob = e_widget_preview_add(evas, 240, (240 * zone->h) / zone->w); diff --git a/src/modules/conf_display/e_int_config_desks.c b/src/modules/conf_display/e_int_config_desks.c index 57e0688ac..18ac209b4 100644 --- a/src/modules/conf_display/e_int_config_desks.c +++ b/src/modules/conf_display/e_int_config_desks.c @@ -17,6 +17,7 @@ struct _E_Config_Dialog_Data int y; int edge_flip_dragging; int flip_wrap; + int use_desktop_window_profile; int flip_mode; int flip_interp; double flip_speed; @@ -60,6 +61,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->y = e_config->zone_desks_y_count; cfdata->edge_flip_dragging = e_config->edge_flip_dragging; cfdata->flip_wrap = e_config->desk_flip_wrap; + cfdata->use_desktop_window_profile = e_config->use_desktop_window_profile; cfdata->flip_mode = e_config->desk_flip_animate_mode; cfdata->flip_interp = e_config->desk_flip_animate_interpolation; cfdata->flip_speed = e_config->desk_flip_animate_time; @@ -105,6 +107,12 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) e_config->edge_flip_dragging = cfdata->edge_flip_dragging; e_config->desk_flip_wrap = cfdata->flip_wrap; + if (e_config->use_desktop_window_profile != cfdata->use_desktop_window_profile) + { + e_config->use_desktop_window_profile = cfdata->use_desktop_window_profile; + e_desk_window_profile_update(); + } + e_config_save_queue(); return 1; /* Apply was OK */ } @@ -132,7 +140,8 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda (e_config->desk_flip_animate_interpolation != cfdata->flip_interp) || (e_config->desk_flip_animate_time != cfdata->flip_speed) || (e_config->edge_flip_dragging != cfdata->edge_flip_dragging) || - (e_config->desk_flip_wrap != cfdata->flip_wrap)); + (e_config->desk_flip_wrap != cfdata->flip_wrap) || + (e_config->use_desktop_window_profile != cfdata->use_desktop_window_profile)); } /**--GUI--**/ @@ -177,6 +186,14 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial &(cfdata->flip_wrap)); e_widget_framelist_object_append(of, ob); + e_widget_list_object_append(o, of, 1, 0, 0.5); + + of = e_widget_framelist_add(evas, _("Desktop Window Profile"), 0); + + ob = e_widget_check_add(evas, _("Use desktop window profile"), + &(cfdata->use_desktop_window_profile)); + e_widget_framelist_object_append(of, ob); + e_widget_list_object_append(o, of, 1, 0, 0.5); e_widget_toolbook_page_append(otb, NULL, _("Desktops"), o, 1, 1, 1, 1,