From 64745c3b9f992f706eb0599e9d1105e6d41df3d8 Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 19 Jun 2012 14:47:36 +0900 Subject: [PATCH] [ecore_evas][ecore_x] Added per-window profile to support multi-head display. Change-Id: I2f136dfac9bd4464728d3993b840d9a05c0214e1 --- src/lib/ecore_evas/Ecore_Evas.h | 20 +++++ src/lib/ecore_evas/ecore_evas.c | 25 ++++++ src/lib/ecore_evas/ecore_evas_buffer.c | 1 + src/lib/ecore_evas/ecore_evas_cocoa.c | 1 + src/lib/ecore_evas/ecore_evas_directfb.c | 1 + src/lib/ecore_evas/ecore_evas_ews.c | 1 + src/lib/ecore_evas/ecore_evas_extn.c | 1 + src/lib/ecore_evas/ecore_evas_fb.c | 1 + src/lib/ecore_evas/ecore_evas_private.h | 2 + src/lib/ecore_evas/ecore_evas_psl1ght.c | 1 + src/lib/ecore_evas/ecore_evas_sdl.c | 1 + src/lib/ecore_evas/ecore_evas_wayland_egl.c | 1 + src/lib/ecore_evas/ecore_evas_wayland_shm.c | 1 + src/lib/ecore_evas/ecore_evas_win32.c | 1 + src/lib/ecore_evas/ecore_evas_wince.c | 1 + src/lib/ecore_evas/ecore_evas_x.c | 36 +++++++++ src/lib/ecore_x/Ecore_X.h | 51 ++++++++++++ src/lib/ecore_x/Ecore_X_Atoms.h | 4 + src/lib/ecore_x/ecore_x_atoms_decl.h | 4 + src/lib/ecore_x/xcb/ecore_xcb_atoms.c | 5 +- src/lib/ecore_x/xcb/ecore_xcb_e.c | 118 ++++++++++++++++++++++++++++ src/lib/ecore_x/xlib/ecore_x_atoms.c | 5 +- src/lib/ecore_x/xlib/ecore_x_e.c | 118 ++++++++++++++++++++++++++++ 23 files changed, 398 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 3e96e5e..a2ea00d 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -660,6 +660,26 @@ EAPI void ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on); */ EAPI Eina_Bool ecore_evas_maximized_get(const Ecore_Evas *ee); /** + * @brief Set Ecore_Evas's window profile list. + * + * @param ee The Ecore_Evas + * @param profiles The profile name list + * @param num_profiles The number of profile names + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.3.0 + */ +EAPI void ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles, unsigned int num_profiles); +/** + * @brief Get Ecore_Evas's window profile name. + * + * @param ee The Ecore_Evas + * @return The profile name + * + * @since 1.3.0 + */ +EAPI const char *ecore_evas_profile_get(const Ecore_Evas *ee); +/** * @brief Move an Ecore_Evas. * * @param ee The Ecore_Evas to move diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 14bbd9b..02b37c2 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -1918,6 +1918,31 @@ ecore_evas_maximized_get(const Ecore_Evas *ee) } EAPI void +ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles, unsigned int num_profiles) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_profiles_set"); + return; + } + IFC(ee, fn_profiles_set) (ee, profiles, num_profiles); + IFE; +} + +EAPI const char * +ecore_evas_profile_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_profile_get"); + return NULL; + } + return ee->prop.profile; +} + +EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index 9067adf..105021b 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -515,6 +515,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, _ecore_evas_buffer_alpha_set, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c index 0947b11..016e19e 100644 --- a/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -463,6 +463,7 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, NULL, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index ed24355..a4a2eaa 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -489,6 +489,7 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = NULL, /* ignore events */ NULL, /* alpha */ NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c index ec02472..98d1654 100644 --- a/src/lib/ecore_evas/ecore_evas_ews.c +++ b/src/lib/ecore_evas/ecore_evas_ews.c @@ -683,6 +683,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = _ecore_evas_ews_ignore_events_set, _ecore_evas_ews_alpha_set, _ecore_evas_ews_transparent_set, + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_extn.c b/src/lib/ecore_evas/ecore_evas_extn.c index 032484a..d80eca7 100644 --- a/src/lib/ecore_evas/ecore_evas_extn.c +++ b/src/lib/ecore_evas/ecore_evas_extn.c @@ -2003,6 +2003,7 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = NULL, _ecore_evas_extn_socket_alpha_set, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index 33212c0..48da7ea 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -551,6 +551,7 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, NULL, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index c084e2e..e478ad2 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -177,6 +177,7 @@ struct _Ecore_Evas_Engine_Func void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore); void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); + void (*fn_profiles_set) (Ecore_Evas *ee, const char **profiles, int num_profiles); void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group); void (*fn_aspect_set) (Ecore_Evas *ee, double aspect); @@ -330,6 +331,7 @@ struct _Ecore_Evas char *title; char *name; char *clas; + char *profile; struct { int w, h; } min, diff --git a/src/lib/ecore_evas/ecore_evas_psl1ght.c b/src/lib/ecore_evas/ecore_evas_psl1ght.c index 038654a..02c6a69 100644 --- a/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -395,6 +395,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, NULL, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_sdl.c b/src/lib/ecore_evas/ecore_evas_sdl.c index d2503fe..1ca6f2b 100644 --- a/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/src/lib/ecore_evas/ecore_evas_sdl.c @@ -431,6 +431,7 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, NULL, NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index f4e5010..6237e59 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -143,6 +143,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = _ecore_evas_wl_ignore_events_set, _ecore_evas_wl_alpha_set, _ecore_evas_wl_transparent_set, + NULL, // func profiles set NULL, NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c index a0167be..bc2f4e2 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -146,6 +146,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = _ecore_evas_wl_ignore_events_set, _ecore_evas_wl_alpha_set, _ecore_evas_wl_transparent_set, + NULL, // func profiles set NULL, NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index 86eb9dc..fdea053 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -995,6 +995,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, /* _ecore_evas_x_ignore_events_set */ NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_wince.c b/src/lib/ecore_evas/ecore_evas_wince.c index fecf26b..2bbd1bd 100644 --- a/src/lib/ecore_evas/ecore_evas_wince.c +++ b/src/lib/ecore_evas/ecore_evas_wince.c @@ -772,6 +772,7 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, /* _ecore_evas_x_ignore_events_set */ NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent + NULL, // profiles_set NULL, NULL, diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index 9e89968..636b8e8 100644 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -730,6 +730,34 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, break; } } + else if (e->atom == ECORE_X_ATOM_E_PROFILE) + { + char *p = ecore_x_e_window_profile_get(e->win); + if ((p) && (ee->prop.profile)) + { + if (strcmp(p, ee->prop.profile) != 0) + { + free(ee->prop.profile); + ee->prop.profile = strdup(p); + state_change = 1; + } + } + else if ((!p) && (ee->prop.profile)) + { + free(ee->prop.profile); + ee->prop.profile = NULL; + state_change = 1; + } + else if ((p) && (!ee->prop.profile)) + { + ee->prop.profile = strdup(p); + state_change = 1; + } + + if (p) + free(p); + } + if (state_change) { if (ee->func.fn_state_change) ee->func.fn_state_change(ee); @@ -2743,6 +2771,13 @@ _ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) } static void +_ecore_evas_x_profiles_set(Ecore_Evas *ee, const char **plist, int n) +{ + /* Ecore_Evas's profile will be updated when WM sets the E_PROFILE. */ + ecore_x_e_window_profile_list_set(ee->prop.window, plist, n); +} + +static void _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) { if (ee->prop.avoid_damage == on) return; @@ -2989,6 +3024,7 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func = _ecore_evas_x_ignore_events_set, _ecore_evas_x_alpha_set, _ecore_evas_x_transparent_set, + _ecore_evas_x_profiles_set, _ecore_evas_x_window_group_set, _ecore_evas_x_aspect_set, diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index 965519f..45f8f9f 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -2589,6 +2589,57 @@ EAPI void EAPI Ecore_X_Pixmap ecore_x_e_comp_pixmap_get(Ecore_X_Window win); +/** + * @brief Set the window profile list. + * + * @param win The window + * @param profiles The profile name list + * @param num_profiles The number of profile names + * + * @since 1.3.0 + */ +EAPI void +ecore_x_e_window_profile_list_set(Ecore_X_Window win, + const char **profiles, + unsigned int num_profiles); + +/** + * @brief Get the window profile list. + * + * @param win The window + * @param[out] profiles Returns the profile name list + * @param[out] ret_num Returns the number of profile names + * + * @since 1.3.0 + */ +EAPI Eina_Bool +ecore_x_e_window_profile_list_get(Ecore_X_Window win, + const char ***profiles, + int *ret_num); + +/** + * @brief Set the window profile. + * + * @param win The window + * @param profile The profile name + * + * @since 1.3.0 + */ +EAPI void +ecore_x_e_window_profile_set(Ecore_X_Window win, + const char *profile); + +/** + * @brief Get the window profile. + * + * @param win The window + * @return The profile name + * + * @since 1.3.0 + */ +EAPI char * +ecore_x_e_window_profile_get(Ecore_X_Window win); + EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter); EAPI Eina_Bool diff --git a/src/lib/ecore_x/Ecore_X_Atoms.h b/src/lib/ecore_x/Ecore_X_Atoms.h index 341df32..c5461c4 100644 --- a/src/lib/ecore_x/Ecore_X_Atoms.h +++ b/src/lib/ecore_x/Ecore_X_Atoms.h @@ -269,6 +269,10 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_POSITION; +/* currently elementary and E specific extension */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_PROFILE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_PROFILE_LIST; + /* for sliding window */ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_STATE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY; diff --git a/src/lib/ecore_x/ecore_x_atoms_decl.h b/src/lib/ecore_x/ecore_x_atoms_decl.h index 3cb090f..a2b8676 100644 --- a/src/lib/ecore_x/ecore_x_atoms_decl.h +++ b/src/lib/ecore_x/ecore_x_atoms_decl.h @@ -304,3 +304,7 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY = 0; /* for SDB(Samsung Debug Bridge) */ EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_CONNECT = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT = 0; + +/* currently elementary and E specific extension */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE_LIST = 0; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c b/src/lib/ecore_x/xcb/ecore_xcb_atoms.c index 6d18b7c..82abe0d 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_atoms.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_atoms.c @@ -277,7 +277,10 @@ static Xcb_Atom atoms[] = { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP }, { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP }, { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT }, - { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION } + { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }, + + { "_E_PROFILE", &ECORE_X_ATOM_E_PROFILE }, + { "_E_PROFILE_LIST", &ECORE_X_ATOM_E_PROFILE_LIST } }; void diff --git a/src/lib/ecore_x/xcb/ecore_xcb_e.c b/src/lib/ecore_x/xcb/ecore_xcb_e.c index d9c58d7..68de828 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_e.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_e.c @@ -126,6 +126,124 @@ ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) } EAPI void +ecore_x_e_window_profile_list_set(Ecore_X_Window win, + const char **profiles, + unsigned int num_profiles) +{ + Ecore_X_Atom *atoms; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + return; + + if (!num_profiles) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_PROFILE_LIST); + else + { + atoms = alloca(num_profiles * sizeof(Ecore_X_Atom)); + ecore_x_atoms_get(profiles, num_profiles, atoms); + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_E_PROFILE_LIST, + XA_ATOM, 32, (void *)atoms, + num_profiles); + } +} + +EAPI Eina_Bool +ecore_x_e_window_profile_list_get(Ecore_X_Window win, + const char ***profiles, + int *ret_num) +{ + unsigned char *data = NULL; + Ecore_X_Atom *atoms; + int num, i; + + if (ret_num) + *ret_num = 0; + + if (profiles) + *profiles = NULL; + + if (!win) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_E_PROFILE_LIST, + XA_ATOM, 32, &data, &num)) + return EINA_FALSE; + + if (ret_num) + *ret_num = num; + + if (profiles) + { + (*profiles) = calloc(num, sizeof(char *)); + if (!(*profiles)) + { + if (ret_num) + *ret_num = 0; + + if (data) + free(data); + + return EINA_FALSE; + } + + atoms = (Ecore_X_Atom *)data; + for (i = 0; i < num; i++) + (*profiles)[i] = ecore_x_atom_name_get(atoms[i]); + } + + if (data) + free(data); + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_window_profile_set(Ecore_X_Window win, + const char *profile) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + return; + + if (!profile) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_PROFILE); + else + { + atom = ecore_x_atom_get(profile); + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_E_PROFILE, + XA_ATOM, 32, (void *)&atom, 1); + } +} + +EAPI char * +ecore_x_e_window_profile_get(Ecore_X_Window win) +{ + Ecore_X_Atom *atom = NULL; + unsigned char *data; + char *profile = NULL; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_E_PROFILE, + XA_ATOM, 32, &data, &num)) + return NULL; + + if (data) + atom = (Ecore_X_Atom *)data; + + if (atom) + profile = ecore_x_atom_name_get(atom[0]); + + return profile; +} + +EAPI void ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled) { diff --git a/src/lib/ecore_x/xlib/ecore_x_atoms.c b/src/lib/ecore_x/xlib/ecore_x_atoms.c index 2b8a33d..1580a01 100644 --- a/src/lib/ecore_x/xlib/ecore_x_atoms.c +++ b/src/lib/ecore_x/xlib/ecore_x_atoms.c @@ -298,7 +298,10 @@ _ecore_x_atoms_init(void) { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP }, { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP }, { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT }, - { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION } + { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }, + + { "_E_PROFILE", &ECORE_X_ATOM_E_PROFILE }, + { "_E_PROFILE_LIST", &ECORE_X_ATOM_E_PROFILE_LIST } /* SLP additions after the comma */ , diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/xlib/ecore_x_e.c index 310bd93..17449a0 100644 --- a/src/lib/ecore_x/xlib/ecore_x_e.c +++ b/src/lib/ecore_x/xlib/ecore_x_e.c @@ -1023,6 +1023,124 @@ ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, } EAPI void +ecore_x_e_window_profile_list_set(Ecore_X_Window win, + const char **profiles, + unsigned int num_profiles) +{ + Ecore_X_Atom *atoms; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + return; + + if (!num_profiles) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_PROFILE_LIST); + else + { + atoms = alloca(num_profiles * sizeof(Ecore_X_Atom)); + ecore_x_atoms_get(profiles, num_profiles, atoms); + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_E_PROFILE_LIST, + XA_ATOM, 32, (void *)atoms, + num_profiles); + } +} + +EAPI Eina_Bool +ecore_x_e_window_profile_list_get(Ecore_X_Window win, + const char ***profiles, + int *ret_num) +{ + unsigned char *data; + Ecore_X_Atom *atoms; + int num, i; + + if (ret_num) + *ret_num = 0; + + if (profiles) + *profiles = NULL; + + if (!win) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_E_PROFILE_LIST, + XA_ATOM, 32, &data, &num)) + return EINA_FALSE; + + if (ret_num) + *ret_num = num; + + if (profiles) + { + (*profiles) = calloc(num, sizeof(char *)); + if (!(*profiles)) + { + if (ret_num) + *ret_num = 0; + + if (data) + free(data); + + return EINA_FALSE; + } + + atoms = (Ecore_X_Atom *)data; + for (i = 0; i < num; i++) + (*profiles)[i] = ecore_x_atom_name_get(atoms[i]); + } + + if (data) + XFree(data); + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_window_profile_set(Ecore_X_Window win, + const char *profile) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + return; + + if (!profile) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_PROFILE); + else + { + atom = ecore_x_atom_get(profile); + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_E_PROFILE, + XA_ATOM, 32, (void *)&atom, 1); + } +} + +EAPI char * +ecore_x_e_window_profile_get(Ecore_X_Window win) +{ + Ecore_X_Atom *atom = NULL; + unsigned char *data; + char *profile = NULL; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_E_PROFILE, + XA_ATOM, 32, &data, &num)) + return NULL; + + if (data) + atom = (Ecore_X_Atom *)data; + + if (atom) + profile = ecore_x_atom_name_get(atom[0]); + + return profile; +} + +EAPI void ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, Eina_Bool enabled) { -- 2.7.4