summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwanglim Lee <gl77.lee@samsung.com>2012-12-05 06:50:27 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-12-05 06:50:27 +0000
commit34c9ea6ae3ce7b8a59f339443d6a20267e772105 (patch)
tree6347aecf5dcae5d5e7a5426b9d583a2e4078008a
parent402d5c2c3397930cec056e9d709ad45c7b024387 (diff)
downloadelementary-34c9ea6ae3ce7b8a59f339443d6a20267e772105.tar.gz
From: Gwanglim Lee <gl77.lee@samsung.com>
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<seojuyung2@gmail.com> 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 <gl77.lee@samsung.com> 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: 80215
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--data/objects/test.edc13
-rw-r--r--src/bin/Makefile.am1
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_config.c536
-rw-r--r--src/lib/elm_authors.h1
-rw-r--r--src/lib/elm_win.c278
-rw-r--r--src/lib/elm_win.h103
10 files changed, 940 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 509c96457..58ad8a568 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -71,3 +71,4 @@ Daniel Zaoui <daniel.zaoui@samsung.com>
Yakov Goldberg <yakov.g@samsung.com>
Murilo Belluzzo <murilo.belluzzo@profusion.mobi>
Ricardo de Almeida Gonzaga <ricardo@profusion.mobi>
+Gwanglim Lee <gl77.lee@samsung.com> <gwanglim@gmail.com>
diff --git a/ChangeLog b/ChangeLog
index 17792a150..749609344 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -753,6 +753,10 @@
* Add elm_app_name_set/get(): Formal application name string.
* Add elm_app_destkop_entry_set/get(): Path to '.desktop' file.
+2012-12-04 Gwanglim Lee
+
+ * Add window profile set/get API in elm_win
+
2012-12-05 Cedric Bail
* Fix uninitialized data path in elm_flip.
diff --git a/NEWS b/NEWS
index 2a162d0cd..de27be8d5 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Additions:
* Add elm_gengrid_nth_item_get
* Add elm_config_selection_unfocused_clear_get and elm_config_selection_unfocused_clear_set
* Add elm_need_edbus() and EDBus.h support with ELM_EDBUS2 macro to integrate edbus (v2). Deprecated elm_need_e_dbus() (e_dbus, v1).
+ * Add window profile set/get API in elm_win
Improvements:
diff --git a/data/objects/test.edc b/data/objects/test.edc
index 191819b48..b7844ba88 100644
--- a/data/objects/test.edc
+++ b/data/objects/test.edc
@@ -695,4 +695,17 @@ collections {
}
}
}
+ group {
+ name: "win_config";
+ parts {
+ part {
+ name: "swallow";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ min: 10 150;
+ }
+ }
+ }
+ }
}
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index bb6b98f4b..a4a442244 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -56,6 +56,7 @@ test_check.c \
test_clock.c \
test_cnp.c \
test_colorselector.c \
+test_config.c \
test_conform.c \
test_conform_indicator.c \
test_ctxpopup.c \
diff --git a/src/bin/test.c b/src/bin/test.c
index dd65bb503..4707c86d0 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -197,6 +197,7 @@ void test_external_slider(void *data, Evas_Object *obj, void *event_info);
void test_external_scroller(void *data, Evas_Object *obj, void *event_info);
void test_external_pbar(void *data, Evas_Object *obj, void *event_info);
void test_external_video(void *data, Evas_Object *obj, void *event_info);
+void test_config(void *data, Evas_Object *obj, void *event_info);
#ifdef HAVE_EMOTION
void test_video(void *data, Evas_Object *obj, void *event_info);
#endif
@@ -727,6 +728,7 @@ add_tests:
ADD_TEST(NULL, "Micellaneous", "Weather", test_weather);
ADD_TEST(NULL, "Micellaneous", "Icon Desktops", test_icon_desktops);
ADD_TEST(NULL, "Micellaneous", "Floating Objects", test_floating);
+ ADD_TEST(NULL, "Micellaneous", "Configuration", test_config);
#undef ADD_TEST
diff --git a/src/bin/test_config.c b/src/bin/test_config.c
new file mode 100644
index 000000000..c9778b293
--- /dev/null
+++ b/src/bin/test_config.c
@@ -0,0 +1,536 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+#ifndef ELM_LIB_QUICKLAUNCH
+
+#ifdef MAX_PROFILES
+# undef MAX_PROFILES
+#endif
+
+#define MAX_PROFILES 20
+
+#ifdef LOG
+# undef LOG
+#endif
+
+#define LOG(m) \
+ do { \
+ lb = elm_label_add(win); \
+ elm_object_text_set(lb, m); \
+ evas_object_size_hint_weight_set(lb, 0.0, 0.0); \
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); \
+ evas_object_show(lb); \
+ } while(0)
+
+typedef struct _Prof_Data Prof_Data;
+typedef struct _App_Data App_Data;
+
+struct _Prof_Data
+{
+ Evas_Object *rdg;
+ Eina_List *cks;
+ const char *profile;
+ const char *available_profiles[MAX_PROFILES];
+ int count;
+};
+
+struct _App_Data
+{
+ Evas_Object *win;
+ Eina_List *profiles;
+ Prof_Data curr;
+ Prof_Data new;
+};
+
+void test_config(void *data, Evas_Object *obj, void *event_info);
+
+static void
+_profile_clear(Prof_Data *pd)
+{
+ if (pd->profile)
+ eina_stringshare_del(pd->profile);
+ pd->profile = NULL;
+}
+
+static void
+_profiles_clear(Prof_Data *pd)
+{
+ int i;
+ for (i = 0; i < MAX_PROFILES; i++)
+ {
+ if (pd->available_profiles[i])
+ eina_stringshare_del(pd->available_profiles[i]);
+ pd->available_profiles[i] = NULL;
+ }
+}
+
+static void
+_profile_update(Evas_Object *win)
+{
+ Evas_Object *lb = evas_object_data_get(win, "lb");
+ char **profiles = NULL;
+ const char *profile;
+ unsigned int i, n = 0;
+ char buf[PATH_MAX];
+
+ profile = elm_win_profile_get(win);
+ snprintf(buf, sizeof(buf),
+ "Profile: <b>%s</b><br/>"
+ "Available profiles: <b>",
+ profile);
+
+ elm_win_available_profiles_get(win, &profiles, &n);
+ if ((profiles) && (n > 0))
+ {
+ for (i = 0; i < n; i++)
+ {
+ if (i >= 1) strncat(buf, ", ", 2);
+ strncat(buf, profiles[i], strlen(profiles[i]) + 1);
+ }
+ strncat(buf, "</b>", 4);
+ }
+ elm_object_text_set(lb, buf);
+}
+
+static void
+_bt_profile_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Evas_Object *rd = elm_radio_selected_object_get(ad->curr.rdg);
+ const char *profile = elm_object_text_get(rd);
+ if (strcmp(profile, "Nothing") != 0)
+ elm_win_profile_set(ad->win, elm_object_text_get(rd));
+ else
+ elm_win_profile_set(ad->win, NULL);
+ _profile_update(ad->win);
+}
+
+static void
+_bt_available_profiles_set(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Eina_List *l = NULL;
+ const char *str;
+ Evas_Object *o;
+ int i = 0;
+
+ _profiles_clear(&ad->curr);
+
+ EINA_LIST_FOREACH(ad->curr.cks, l, o)
+ {
+ if (elm_check_state_get(o))
+ {
+ str = evas_object_data_get(o, "profile");
+ if (str)
+ {
+ ad->curr.available_profiles[i] = eina_stringshare_add(str);
+ i++;
+ }
+ }
+ }
+ ad->curr.count = i;
+
+ elm_win_available_profiles_set(ad->win,
+ ad->curr.available_profiles,
+ ad->curr.count);
+ _profile_update(ad->win);
+}
+
+static void
+_bt_win_add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Evas_Object *rd = elm_radio_selected_object_get(ad->new.rdg);
+ const char *profile = elm_object_text_get(rd);
+ const char *str;
+ Eina_List *l = NULL;
+ Evas_Object *o;
+ int i = 0;
+
+ _profile_clear(&ad->new);
+ _profiles_clear(&ad->new);
+
+ if (strcmp(profile, "Nothing") != 0)
+ ad->new.profile = (char *)eina_stringshare_add(profile);
+
+ EINA_LIST_FOREACH(ad->new.cks, l, o)
+ {
+ if (elm_check_state_get(o))
+ {
+ str = evas_object_data_get(o, "profile");
+ if (str)
+ {
+ ad->new.available_profiles[i] = eina_stringshare_add(str);
+ i++;
+ }
+ }
+ }
+ ad->new.count = i;
+
+ test_config(&(ad->new), NULL, NULL);
+}
+
+static void
+_win_profile_changed_cb(void *data __UNUSED__, Evas_Object *obj, void *event __UNUSED__)
+{
+ _profile_update(obj);
+}
+
+static void
+_win_del_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ App_Data *ad = evas_object_data_get(obj, "ad");
+ Evas_Object *o;
+ char *str;
+
+ elm_config_profile_list_free(ad->profiles);
+ ad->profiles = NULL;
+
+ EINA_LIST_FREE(ad->curr.cks, o)
+ {
+ str = evas_object_data_del(o, "profile");
+ if (str) eina_stringshare_del(str);
+ }
+
+ EINA_LIST_FREE(ad->new.cks, o)
+ {
+ str = evas_object_data_del(o, "profile");
+ if (str) eina_stringshare_del(str);
+ }
+
+ _profile_clear(&ad->curr);
+ _profiles_clear(&ad->curr);
+ _profile_clear(&ad->new);
+ _profiles_clear(&ad->new);
+
+ free(ad);
+}
+
+static Evas_Object *
+_radio_add(Evas_Object *win, Evas_Object *bx)
+{
+ App_Data *ad = evas_object_data_get(win, "ad");
+ Evas_Object *bx2, *rd, *rdg = NULL;
+ Eina_List *l = NULL;
+ const char *str;
+ int i = 0;
+
+ bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0);
+ elm_box_align_set(bx2, 0.0, 0.5);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ rdg = rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, i);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "Nothing");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, rd);
+ evas_object_show(rd);
+ i++;
+
+ EINA_LIST_FOREACH(ad->profiles, l, str)
+ {
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, i);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, str);
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, rd);
+ evas_object_show(rd);
+ i++;
+ }
+
+ return rdg;
+}
+
+static Eina_List *
+_check_add(Evas_Object *win, Evas_Object *bx)
+{
+ App_Data *ad = evas_object_data_get(win, "ad");
+ Evas_Object *bx2, *ck;
+ Eina_List *l = NULL, *ll = NULL;
+ const char *str;
+
+ bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0);
+ elm_box_align_set(bx2, 0.0, 0.5);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ EINA_LIST_FOREACH(ad->profiles, l, str)
+ {
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, str);
+ evas_object_data_set(ck, "profile", eina_stringshare_add(str));
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, ck);
+ evas_object_show(ck);
+
+ ll = eina_list_append(ll, ck);
+ }
+
+ return ll;
+}
+
+static Evas_Object *
+_inlined_add(Evas_Object *parent)
+{
+ Evas_Object *win, *bg, *bx, *lb;
+
+ win = elm_win_add(parent, "inlined", ELM_WIN_INLINED_IMAGE);
+ if (!win) return NULL;
+
+ bg = elm_bg_add(win);
+ elm_bg_color_set(bg, 110, 210, 120);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
+ evas_object_show(bx);
+
+ LOG("ELM_WIN_INLINED_IMAGE");
+ elm_box_pack_end(bx, lb);
+
+ LOG("Profile: <b>N/A</b>");
+ elm_box_pack_end(bx, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ evas_object_move(win, 10, 100);
+ evas_object_resize(win, 150, 70);
+ evas_object_move(elm_win_inlined_image_object_get(win), 10, 100);
+ evas_object_resize(elm_win_inlined_image_object_get(win), 150, 70);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_show(win);
+
+ return win;
+}
+
+static Evas_Object *
+_socket_add(const char *name)
+{
+ Evas_Object *win, *bg, *bx, *lb;
+
+ win = elm_win_add(NULL, "socket image", ELM_WIN_SOCKET_IMAGE);
+ if (!win) return NULL;
+
+ if (elm_win_socket_listen(win, name, 0, EINA_FALSE))
+ {
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ elm_bg_color_set(bg, 80, 110, 205);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
+ evas_object_show(bx);
+
+ LOG("ELM_WIN_SOCKET_IMAGE");
+ elm_box_pack_end(bx, lb);
+
+ LOG("Profile: <b>N/A</b>");
+ elm_box_pack_end(bx, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ _inlined_add(win);
+
+ evas_object_move(win, 0, 0);
+ evas_object_resize(win, 150, 200);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_show(win);
+ }
+ else
+ {
+ evas_object_del(win);
+ win = NULL;
+ }
+
+ return win;
+}
+
+static Evas_Object *
+_plug_add(Evas_Object *win, Evas_Object *bx, const char *name)
+{
+ Evas_Object *plug, *ly;
+ Eina_Bool res = EINA_FALSE;
+ char buf[PATH_MAX];
+
+ plug = elm_plug_add(win);
+ if (plug) res = elm_plug_connect(plug, name, 0, EINA_FALSE);
+
+ if (res)
+ {
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "win_config");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ly);
+
+ evas_object_size_hint_weight_set(plug, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, ly);
+ elm_object_part_content_set(ly, "swallow", plug);
+ evas_object_show(plug);
+ }
+ else
+ {
+ if (plug) evas_object_del(plug);
+ plug = NULL;
+ }
+
+ return plug;
+}
+
+#ifdef FRAME
+# undef FRAME
+#endif
+
+#define FRAME(t) \
+ do { \
+ fr = elm_frame_add(bx); \
+ elm_object_text_set(fr, t); \
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); \
+ evas_object_size_hint_fill_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); \
+ elm_box_pack_end(bx, fr); \
+ evas_object_show(fr); \
+ bx2 = elm_box_add(win); \
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); \
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0); \
+ elm_box_align_set(bx2, 0.0, 0.5); \
+ elm_object_content_set(fr, bx2); \
+ evas_object_show(bx2); \
+ } while(0)
+
+void
+test_config(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ App_Data *ad;
+ Prof_Data *pd = (Prof_Data *)data;
+ Evas_Object *win, *sc, *bx, *fr, *bx2, *lb, *bt;
+ Ecore_Evas *ee;
+ const char *siname = "_TestConfigSocketImage_";
+ char buf[PATH_MAX];
+
+ if (!(ad = calloc(1, sizeof(App_Data)))) return;
+
+ win = elm_win_util_standard_add("config", "Configuration");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_data_set(win, "ad", ad);
+ ad->win = win;
+ ad->profiles = elm_config_profile_list_get();
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, sc);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(sc, bx);
+
+ FRAME("Current window profile");
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
+ snprintf(buf, sizeof(buf),
+ "Virtual desktop window profile support: <b>%s</b>",
+ ecore_evas_window_profile_supported_get(ee) ? "Yes" : "No");
+ LOG(buf);
+ elm_box_pack_end(bx2, lb);
+
+ LOG("Profile: <b>N/A</b><br/>Available profiles:");
+ elm_box_pack_end(bx2, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ LOG("<br/>Window profile");
+ elm_box_pack_end(bx2, lb);
+ ad->curr.rdg = _radio_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Set");
+ evas_object_smart_callback_add(bt, "clicked", _bt_profile_set, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ LOG("Window available profiles");
+ elm_box_pack_end(bx2, lb);
+ ad->curr.cks = _check_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Set");
+ evas_object_smart_callback_add(bt, "clicked", _bt_available_profiles_set, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ FRAME("Socket");
+ if (_socket_add(siname))
+ {
+ LOG("Starting socket image.");
+ elm_box_pack_end(bx2, lb);
+ }
+ else
+ {
+ LOG("Failed to create socket.<br/>"
+ "Please check whether another test configuration window is<br/>"
+ "already running and providing socket image.");
+ elm_box_pack_end(bx2, lb);
+ }
+
+ FRAME("Plug");
+ if (!_plug_add(win, bx2, siname))
+ {
+ LOG("Failed to connect to server.");
+ elm_box_pack_end(bx2, lb);
+ }
+
+ FRAME("Create new window with profile");
+ LOG("Window profile");
+ elm_box_pack_end(bx2, lb);
+ ad->new.rdg = _radio_add(win, bx2);
+
+ LOG("Window available profiles");
+ elm_box_pack_end(bx2, lb);
+ ad->new.cks = _check_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Create");
+ evas_object_smart_callback_add(bt, "clicked", _bt_win_add, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
+
+ if (pd)
+ {
+ if (pd->available_profiles)
+ elm_win_available_profiles_set(win,
+ pd->available_profiles,
+ pd->count);
+ if (pd->profile)
+ elm_win_profile_set(win, pd->profile);
+
+ _profile_update(win);
+ }
+
+ evas_object_show(bx);
+ evas_object_show(sc);
+
+ evas_object_resize(win, 400, 500);
+ evas_object_show(win);
+}
+#endif
diff --git a/src/lib/elm_authors.h b/src/lib/elm_authors.h
index 45db56475..bfb0dbb15 100644
--- a/src/lib/elm_authors.h
+++ b/src/lib/elm_authors.h
@@ -68,6 +68,7 @@
* @author Flavio Ceolin <flavio.ceolin@@profusion.mobi>
* @author Igor Murzov <e-mail@@date.by>
* @author Jiyoun Park <jy0703.park@@samsung.com>
+ * @author Gwanglim Lee <gl77.lee@@samsung.com> <gwanglim@@gmail.com>
*
* Please contact <enlightenment-devel@lists.sourceforge.net> to get in
* contact with the developers and maintainers.
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 372187ff2..46f640226 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -129,6 +129,13 @@ struct _Elm_Win_Smart_Data
const char *icon_name;
const char *role;
+ struct
+ {
+ const char *name;
+ const char **available_list;
+ unsigned int count;
+ } profile;
+
void *trap_data;
double aspect;
@@ -166,6 +173,7 @@ static const char SIG_UNMAXIMIZED[] = "unmaximized";
static const char SIG_IOERR[] = "ioerr";
static const char SIG_INDICATOR_PROP_CHANGED[] = "indicator,prop,changed";
static const char SIG_ROTATION_CHANGED[] = "rotation,changed";
+static const char SIG_PROFILE_CHANGED[] = "profile,changed";
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_DELETE_REQUEST, ""},
@@ -184,6 +192,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_IOERR, ""},
{SIG_INDICATOR_PROP_CHANGED, ""},
{SIG_ROTATION_CHANGED, ""},
+ {SIG_PROFILE_CHANGED, ""},
{NULL, NULL}
};
@@ -824,6 +833,97 @@ _elm_win_focus_out(Ecore_Evas *ee)
}
static void
+_elm_win_available_profiles_del(Elm_Win_Smart_Data *sd)
+{
+ if (!sd->profile.available_list) return;
+
+ unsigned int i;
+ for (i = 0; i < sd->profile.count; i++)
+ if (sd->profile.available_list[i])
+ {
+ eina_stringshare_del(sd->profile.available_list[i]);
+ sd->profile.available_list[i] = NULL;
+ }
+ sd->profile.count = 0;
+ free(sd->profile.available_list);
+ sd->profile.available_list = NULL;
+}
+
+static void
+_elm_win_profile_del(Elm_Win_Smart_Data *sd)
+{
+ if (!sd->profile.name) return;
+ eina_stringshare_del(sd->profile.name);
+ sd->profile.name = NULL;
+}
+
+static Eina_Bool
+_elm_win_profile_set(Elm_Win_Smart_Data *sd, const char *profile)
+{
+ Eina_Bool changed = EINA_FALSE;
+ if (profile)
+ {
+ if (sd->profile.name)
+ {
+ if (strcmp(sd->profile.name, profile) != 0)
+ {
+ eina_stringshare_replace(&(sd->profile.name), profile);
+ changed = EINA_TRUE;
+ }
+ }
+ else
+ {
+ sd->profile.name = eina_stringshare_add(profile);
+ changed = EINA_TRUE;
+ }
+ }
+ else
+ _elm_win_profile_del(sd);
+
+ return changed;
+}
+
+static void
+_elm_win_profile_update(Elm_Win_Smart_Data *sd)
+{
+ if (sd->profile.available_list)
+ {
+ Eina_Bool found = EINA_FALSE;
+ if (sd->profile.name)
+ {
+ unsigned int i;
+ for (i = 0; i < sd->profile.count; i++)
+ {
+ if (!strcmp(sd->profile.name,
+ sd->profile.available_list[i]))
+ {
+ found = EINA_TRUE;
+ break;
+ }
+ }
+ }
+
+ /* If current profile is not present in an available profiles,
+ * change current profile to the 1st element of an array.
+ */
+ if (!found)
+ _elm_win_profile_set(sd, sd->profile.available_list[0]);
+ }
+
+ _elm_config_profile_set(sd->profile.name);
+
+ /* update sub ee */
+ Ecore_Evas *ee2;
+ Eina_List *sub, *l = NULL;
+
+ sub = ecore_evas_sub_ecore_evas_list_get(sd->ee);
+ EINA_LIST_FOREACH(sub, l, ee2)
+ ecore_evas_window_profile_set(ee2, sd->profile.name);
+
+ evas_object_smart_callback_call(sd->obj, SIG_PROFILE_CHANGED, NULL);
+}
+
+static void
_elm_win_state_change(Ecore_Evas *ee)
{
Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
@@ -833,6 +933,8 @@ _elm_win_state_change(Ecore_Evas *ee)
Eina_Bool ch_iconified = EINA_FALSE;
Eina_Bool ch_fullscreen = EINA_FALSE;
Eina_Bool ch_maximized = EINA_FALSE;
+ Eina_Bool ch_profile = EINA_FALSE;
+ const char *profile;
EINA_SAFETY_ON_NULL_RETURN(sd);
@@ -867,6 +969,9 @@ _elm_win_state_change(Ecore_Evas *ee)
ch_maximized = EINA_TRUE;
}
+ profile = ecore_evas_window_profile_get(sd->ee);
+ ch_profile = _elm_win_profile_set(sd, profile);
+
if (sd->withdrawn) _elm_win_count_withdrawn++;
if (sd->iconified) _elm_win_count_iconified++;
_elm_win_state_eval_queue();
@@ -901,6 +1006,10 @@ _elm_win_state_change(Ecore_Evas *ee)
else
evas_object_smart_callback_call(obj, SIG_UNMAXIMIZED, NULL);
}
+ if (ch_profile)
+ {
+ _elm_win_profile_update(sd);
+ }
}
static void
@@ -1368,6 +1477,9 @@ _elm_win_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
if (sd->role) eina_stringshare_del(sd->role);
if (sd->icon) evas_object_del(sd->icon);
+ _elm_win_profile_del(sd);
+ _elm_win_available_profiles_del(sd);
+
/* Don't let callback in the air that point to sd */
ecore_evas_callback_delete_request_set(sd->ee, NULL);
ecore_evas_callback_resize_set(sd->ee, NULL);
@@ -3536,6 +3648,164 @@ _withdrawn_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
}
EAPI void
+elm_win_available_profiles_set(Evas_Object *obj,
+ const char **profiles,
+ unsigned int count)
+{
+ ELM_WIN_CHECK(obj);
+ eo_do((Eo *) obj, elm_obj_win_available_profiles_set(profiles, count));
+}
+
+static void
+_available_profiles_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ const char **profiles = va_arg(*list, const char **);
+ unsigned int count = va_arg(*list, unsigned int);
+ Elm_Win_Smart_Data *sd = _pd;
+ Eina_Bool found = EINA_FALSE;
+
+ _elm_win_available_profiles_del(sd);
+ if ((profiles) && (count >= 1))
+ {
+ sd->profile.available_list = calloc(count, sizeof(char *));
+ if (sd->profile.available_list)
+ {
+ if (!sd->profile.name) found = EINA_TRUE;
+
+ unsigned int i;
+ for (i = 0; i < count; i++)
+ {
+ sd->profile.available_list[i] = eina_stringshare_add(profiles[i]);
+
+ /* check to see if a given array has a current profile of elm_win */
+ if ((sd->profile.name) &&
+ (!strcmp(sd->profile.name, profiles[i])))
+ {
+ found = EINA_TRUE;
+ }
+ }
+ sd->profile.count = count;
+ }
+ }
+
+ if (ecore_evas_window_profile_supported_get(sd->ee))
+ {
+ ecore_evas_window_available_profiles_set(sd->ee,
+ sd->profile.available_list,
+ sd->profile.count);
+
+ /* current profile of elm_win is wrong, change profile */
+ if ((sd->profile.available_list) && (!found))
+ {
+ eina_stringshare_replace(&(sd->profile.name),
+ sd->profile.available_list[0]);
+ ecore_evas_window_profile_set(sd->ee, sd->profile.name);
+ }
+
+ }
+ else
+ {
+ if (sd->profile.available_list)
+ _elm_win_profile_update(sd);
+ }
+}
+
+EAPI Eina_Bool
+elm_win_available_profiles_get(Evas_Object *obj,
+ char ***profiles,
+ unsigned int *count)
+{
+ ELM_WIN_CHECK(obj) EINA_FALSE;
+ Eina_Bool ret = EINA_FALSE;
+ eo_do((Eo *) obj, elm_obj_win_available_profiles_get(&ret, profiles, count));
+ return ret;
+}
+
+static void
+_available_profiles_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ char ***profiles = va_arg(*list, char ***);
+ unsigned int *count = va_arg(*list, unsigned int *);
+ Elm_Win_Smart_Data *sd = _pd;
+ Eina_Bool res;
+
+ if (ecore_evas_window_profile_supported_get(sd->ee))
+ {
+ res = ecore_evas_window_available_profiles_get(sd->ee,
+ profiles,
+ count);
+ }
+ else
+ {
+ if (profiles) *profiles = (char **)sd->profile.available_list;
+ if (count) *count = sd->profile.count;
+ res = EINA_TRUE;
+ }
+ *ret = res;
+}
+
+EAPI void
+elm_win_profile_set(Evas_Object *obj,
+ const char *profile)
+{
+ ELM_WIN_CHECK(obj);
+ eo_do((Eo *) obj, elm_obj_win_profile_set(profile));
+}
+
+static void
+_profile_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ const char *profile = va_arg(*list, const char *);
+ Elm_Win_Smart_Data *sd = _pd;
+
+ /* check to see if a given profile is present in an available profiles */
+ if ((profile) && (sd->profile.available_list))
+ {
+ Eina_Bool found = EINA_FALSE;
+ unsigned int i;
+ for (i = 0; i < sd->profile.count; i++)
+ {
+ if (!strcmp(profile,
+ sd->profile.available_list[i]))
+ {
+ found = EINA_TRUE;
+ break;
+ }
+ }
+ if (!found) return;
+ }
+
+ if (ecore_evas_window_profile_supported_get(sd->ee))
+ {
+ if (!profile) _elm_win_profile_del(sd);
+ ecore_evas_window_profile_set(sd->ee, profile);
+ }
+ else
+ {
+ if (_elm_win_profile_set(sd, profile))
+ _elm_win_profile_update(sd);
+ }
+}
+
+EAPI const char *
+elm_win_profile_get(const Evas_Object *obj)
+{
+ ELM_WIN_CHECK(obj) NULL;
+ const char *ret = NULL;
+ eo_do((Eo *) obj, elm_obj_win_profile_get(&ret));
+ return ret;
+}
+
+static void
+_profile_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ const char **ret = va_arg(*list, const char **);
+ Elm_Win_Smart_Data *sd = _pd;
+ *ret = sd->profile.name;
+}
+
+EAPI void
elm_win_urgent_set(Evas_Object *obj,
Eina_Bool urgent)
{
@@ -4874,6 +5144,10 @@ _class_constructor(Eo_Class *klass)
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICONIFIED_GET), _iconified_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_SET), _withdrawn_set),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET), _withdrawn_get),
+ EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET), _available_profiles_set),
+ EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET), _available_profiles_get),
+ EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_SET), _profile_set),
+ EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_GET), _profile_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_URGENT_SET), _urgent_set),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_URGENT_GET), _urgent_get),
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_SET), _demand_attention_set),
@@ -4967,6 +5241,10 @@ static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICONIFIED_GET, "Get the iconified state of a window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_SET, "Set the withdrawn state of a window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET, "Get the withdrawn state of a window."),
+ EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET, "Set the array of available profiles to a window."),
+ EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET, "Get the array of available profiles of a window."),
+ EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_PROFILE_SET, "Set the profile of a window."),
+ EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_PROFILE_GET, "Get the profile of a window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_URGENT_SET, "Set the urgent state of a window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_URGENT_GET, "Get the urgent state of a window."),
EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_SET, "Set the demand_attention state of a window."),
diff --git a/src/lib/elm_win.h b/src/lib/elm_win.h
index e99b09503..d3b753ef3 100644
--- a/src/lib/elm_win.h
+++ b/src/lib/elm_win.h
@@ -85,6 +85,7 @@
* @li "ioerr": there has been a low-level I/O error with the display system
* @li "indicator,prop,changed": an indicator's property has been changed
* @li "rotation,changed": window rotation has been changed
+ * @li "profile,changed": profile of the window has been changed
*
* Examples:
* @li @ref win_example_01
@@ -133,6 +134,10 @@ enum
ELM_OBJ_WIN_SUB_ID_ICONIFIED_GET,
ELM_OBJ_WIN_SUB_ID_WITHDRAWN_SET,
ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET,
+ ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET,
+ ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET,
+ ELM_OBJ_WIN_SUB_ID_PROFILE_SET,
+ ELM_OBJ_WIN_SUB_ID_PROFILE_GET,
ELM_OBJ_WIN_SUB_ID_URGENT_SET,
ELM_OBJ_WIN_SUB_ID_URGENT_GET,
ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_SET,
@@ -587,6 +592,57 @@ enum
#define elm_obj_win_withdrawn_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET), EO_TYPECHECK(Eina_Bool *, ret)
/**
+ * @def elm_obj_win_available_profiles_set
+ * @since 1.8
+ *
+ * Set the array of available profiles to a window.
+ *
+ * @param[in] profiles
+ * @param[in] count
+ *
+ * @see elm_win_available_profiles_set
+ */
+#define elm_obj_win_available_profiles_set(profiles, count) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET), EO_TYPECHECK(const char **, profiles), EO_TYPECHECK(unsigned int, count)
+
+/**
+ * @def elm_obj_win_available_profiles_get
+ * @since 1.8
+ *
+ * Get the array of available profiles of a window.
+ *
+ * @param[out] ret
+ * @param[out] profiles
+ * @param[out] count
+ *
+ * @see elm_win_available_profiles_get
+ */
+#define elm_obj_win_available_profiles_get(ret, profiles, count) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET), EO_TYPECHECK(Eina_Bool *, ret), EO_TYPECHECK(char ***, profiles), EO_TYPECHECK(unsigned int *, count)
+
+/**
+ * @def elm_obj_win_profile_set
+ * @since 1.8
+ *
+ * Set the profile of a window.
+ *
+ * @param[in] profile
+ *
+ * @see elm_win_profile_set
+ */
+#define elm_obj_win_profile_set(profile) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_SET), EO_TYPECHECK(const char *, profile)
+
+/**
+ * @def elm_obj_win_profile_get
+ * @since 1.8
+ *
+ * Get the profile of a window.
+ *
+ * @param[out] ret
+ *
+ * @see elm_win_profile_get
+ */
+#define elm_obj_win_profile_get(ret) ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_GET), EO_TYPECHECK(const char **, ret)
+
+/**
* @def elm_obj_win_urgent_set
* @since 1.8
*
@@ -1854,6 +1910,53 @@ EAPI void elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool wit
EAPI Eina_Bool elm_win_withdrawn_get(const Evas_Object *obj);
/**
+ * Set the array of available profiles to a window.
+ *
+ * @param obj The window object
+ * @param profiles The string array of available profiles
+ * @param count The number of members in profiles
+ *
+ * @ingroup Win
+ * @since 1.8
+ */
+EAPI void elm_win_available_profiles_set(Evas_Object *obj, const char **profiles, unsigned int count);
+
+/**
+ * Get the array of available profiles of a window.
+ *
+ * @param obj The window object
+ * @param profiles Where to return the string array of available profiles
+ * @param count Where to return the number of members in profiles
+ * @return EINA_TRUE if available profiles exist, EINA_FALSE otherwise
+ *
+ * @ingroup Win
+ * @since 1.8
+ */
+EAPI Eina_Bool elm_win_available_profiles_get(Evas_Object *obj, char ***profiles, unsigned int *count);
+
+/**
+ * Set the profile of a window.
+ *
+ * @param obj The window object
+ * @param profile The string value of a window profile
+ *
+ * @ingroup Win
+ * @since 1.8
+ */
+EAPI void elm_win_profile_set(Evas_Object *obj, const char *profile);
+
+/**
+ * Get the profile of a window.
+ *
+ * @param obj The window object
+ * @return The string value of a window profile, or NULL if none exists
+ *
+ * @ingroup Win
+ * @since 1.8
+ */
+EAPI const char *elm_win_profile_get(const Evas_Object *obj);
+
+/**
* Set the urgent state of a window.
*
* @param obj The window object