*/
typedef enum
{
- EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level. (Deprecated since $TZ_CFG_VER_24_OR_30$. Use EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT instead.) */
- EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default. (Deprecated since $TZ_CFG_VER_24_OR_30$. Use EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM instead.) */
- EFL_UTIL_NOTIFICATION_LEVEL_3, /**< The highest notification level. (Deprecated since $TZ_CFG_VER_24_OR_30$. Use EFL_UTIL_NOTIFICATION_LEVEL_TOP instead.) */
EFL_UTIL_NOTIFICATION_LEVEL_NONE = -1, /**< No (reset) notification level. This value makes the window place in normal layer. (@b Since: $TZ_CFG_VER_24_OR_30$) */
EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT = 10, /**< Default notification level. (@b Since: $TZ_CFG_VER_24_OR_30$) */
EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM = 20, /**< Higher notification level than default. (@b Since: $TZ_CFG_VER_24_OR_30$) */
API int efl_util_get_notification_window_level(Evas_Object *window, efl_util_notification_level_e *level);
/**
- * @deprecated Deprecated since 3.0.
- * @brief Called when an error occurs for setting notification window level
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks An application can check error by the return value of efl_util_set_notification_window_level since 3.0.
- * @param[in] window The EFL window
- * @param[in] error_code The error code (#EFL_UTIL_ERROR_PERMISSION_DENIED)
- * @param[in] user_data The user data passed from the callback registration function
- * @see efl_util_set_notification_window_level_error_cb()
- * @see efl_util_unset_notification_window_level_error_cb()
- */
-typedef void (*efl_util_notification_window_level_error_cb)(Evas_Object *window, int error_code, void *user_data);
-
-/**
- * @deprecated Deprecated since 3.0. Use the return value of efl_util_set_notification_window_level() instead.
- * @brief Registers a callback function to be invoked when an error which set the notification level occurs.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks An application can check error by the return value of efl_util_set_notification_window_level since 3.0.
- * @param[in] window The EFL window
- * @param[in] callback The callback function to register
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success, otherwise a negative error value
- * @retval #EFL_UTIL_ERROR_NONE Successful
- * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- * @post efl_util_notification_window_level_error_cb() will be invoked.
- * @see efl_util_unset_notification_window_level_error_cb()
- * @see efl_util_notification_window_level_error_cb()
- */
-API int efl_util_set_notification_window_level_error_cb(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data) TIZEN_DEPRECATED_API;
-
-/**
- * @deprecated Deprecated since 3.0. Use the return value of efl_util_set_notification_window_level() instead.
- * @brief Unregisters the callback function.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks An application can check error by the return value of efl_util_set_notification_window_level since 3.0.
- * @param[in] window The EFL window
- * @return @c 0 on success, otherwise a negative error value
- * @retval #EFL_UTIL_ERROR_NONE Successful
- * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see efl_util_set_notification_window_level_error_cb()
- */
-API int efl_util_unset_notification_window_level_error_cb(Evas_Object *window) TIZEN_DEPRECATED_API;
-
-/**
* @brief Sets the alpha window's visual state to opaque state
* @details This API sets the alpha window's visual state to opaque state.
* If the alpha window sets the visual state to the opaque,
API int efl_util_get_window_screen_mode(Evas_Object *window, efl_util_screen_mode_e *mode);
/**
- * @deprecated Deprecated since 3.0.
- * @brief Called when an error occurs for setting window's screen mode
- * @since_tizen 2.4
- * @remarks An application can check error by the return value of efl_util_set_window_screen_mode since 3.0.
- * @param[in] window The EFL window
- * @param[in] error_code The error code (#EFL_UTIL_ERROR_PERMISSION_DENIED)
- * @param[in] user_data The user data passed from the callback registration function
- * @see efl_util_set_window_screen_mode_error_cb()
- * @see efl_util_unset_window_screen_mode_error_cb()
- */
-typedef void (*efl_util_window_screen_mode_error_cb)(Evas_Object *window, int error_code, void *user_data);
-
-/**
- * @deprecated Deprecated since 3.0. Use the return value of efl_util_set_window_screen_mode() instead.
- * @brief Registers a callback function to be invoked when an error which set the screen mode.
- * @since_tizen 2.4
- * @remarks An application can check error by the return value of efl_util_set_window_screen_mode since 3.0.
- * @param[in] window The EFL window
- * @param[in] callback The callback function to register
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success, otherwise a negative error value
- * @retval #EFL_UTIL_ERROR_NONE Successful
- * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Out of memory
- * @post efl_util_window_screen_mode_error_cb() will be invoked.
- * @see efl_util_unset_window_screen_mode_error_cb()
- * @see efl_util_window_screen_mode_error_cb()
- */
-API int efl_util_set_window_screen_mode_error_cb(Evas_Object *window, efl_util_window_screen_mode_error_cb callback, void *user_data) TIZEN_DEPRECATED_API;
-
-/**
- * @deprecated Deprecated since 3.0. Use the return value of efl_util_set_window_screen_mode() instead.
- * @brief Unregisters the callback function.
- * @since_tizen 2.4
- * @remarks An application can check error by the return value of efl_util_set_window_screen_mode since 3.0.
- * @param[in] window The EFL window
- * @return @c 0 on success, otherwise a negative error value
- * @retval #EFL_UTIL_ERROR_NONE Successful
- * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
- * @see efl_util_set_window_screen_mode_error_cb()
- */
-API int efl_util_unset_window_screen_mode_error_cb(Evas_Object *window) TIZEN_DEPRECATED_API;
-
-/**
* @brief Sets the user's preferred brightness of the specified window.
* @details This API is useful when the application need to change the brightness of the screen when it is appeared on the screen.
* If the application sets the brightness 0 to 100 to its window and the application window is shown wholly or partially,
#define LOG_TAG "TIZEN_N_EFL_UTIL"
-
-/* callback handler index */
-#define CBH_NOTI_LEV 0
-#define CBH_SCR_MODE 1
-#define CBH_MAX 2
-
-typedef void (*Efl_Util_Cb)(Evas_Object *, int, void *);
-
-typedef struct _Efl_Util_Callback_Info
-{
- Evas_Object *win;
- Efl_Util_Cb cb;
- void *data;
-} Efl_Util_Callback_Info;
-
typedef struct _Efl_Util_Wl_Surface_Lv_Info
{
void *surface; /* wl_surface */
int event_init;
} gesture;
} wl;
-
- struct
- {
- Eina_List *info_list; /* list of callback info */
- unsigned int atom; /* x11 atom */
- } cb_handler[CBH_MAX];
} Efl_Util_Data;
static Efl_Util_Data _eflutil =
{ 0, NULL, NULL }, /* display_policy protocol */
{ NULL, -1, EINA_FALSE } /* tizen_gesture protocol */
},
- {
- { NULL, 0 }, /* handler for notification level */
- { NULL, 0 } /* handler for screen mode */
- },
};
-static Eina_Bool _cb_info_add(Evas_Object *win, Efl_Util_Cb cb, void *data, int idx);
-static Eina_Bool _cb_info_del_by_win(Evas_Object *win, int idx);
-static Eina_List *_cb_info_list_get(int idx);
-static Efl_Util_Callback_Info *_cb_info_find_by_win(Evas_Object *win, int idx);
static Eina_Bool _wl_init(void);
static void _cb_wl_reg_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
static void _cb_wl_reg_global_remove(void *data, struct wl_registry *reg, unsigned int name);
static void _cb_wl_reg_screenshooter_global(void *data, struct wl_registry *reg, unsigned int name, const char *interface, unsigned int version);
static void _cb_wl_reg_screenshooter_global_remove(void *data, struct wl_registry *reg, unsigned int name);
-static Efl_Util_Callback_Info *_cb_info_find_by_wlsurf(void *wlsurf, int idx);
static void _cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t is_conformant);
static void _cb_wl_tz_policy_conformant_area(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, uint32_t conformant_part, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h);
static void _cb_wl_tz_policy_notification_done(void *data, struct tizen_policy *tizen_policy, struct wl_surface *surface, int32_t level, uint32_t state);
};
static Eina_Bool
-_cb_info_add(Evas_Object *win,
- Efl_Util_Cb cb,
- void *data,
- int idx)
-{
- Efl_Util_Callback_Info *info;
-
- info = _cb_info_find_by_win(win, idx);
- if (info)
- {
- _eflutil.cb_handler[idx].info_list
- = eina_list_remove(_eflutil.cb_handler[idx].info_list,
- info);
- free(info);
- }
-
- info = (Efl_Util_Callback_Info *)calloc(1, sizeof(Efl_Util_Callback_Info));
- if (!info) return EINA_FALSE;
-
- info->win = win;
- info->cb = cb;
- info->data = data;
-
- _eflutil.cb_handler[idx].info_list
- = eina_list_append(_eflutil.cb_handler[idx].info_list,
- info);
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_cb_info_del_by_win(Evas_Object *win,
- int idx)
-{
- Efl_Util_Callback_Info *info;
-
- info = _cb_info_find_by_win(win, idx);
- if (!info) return EINA_FALSE;
-
- _eflutil.cb_handler[idx].info_list
- = eina_list_remove(_eflutil.cb_handler[idx].info_list,
- info);
- free(info);
-
- return EINA_TRUE;
-}
-
-static Eina_List *
-_cb_info_list_get(int idx)
-{
- return _eflutil.cb_handler[idx].info_list;
-}
-
-static Efl_Util_Callback_Info *
-_cb_info_find_by_win(Evas_Object *win,
- int idx)
-{
- Eina_List *l, *ll;
- Efl_Util_Callback_Info *info;
-
- l = _cb_info_list_get(idx);
- EINA_LIST_FOREACH(l, ll, info)
- {
- if (info->win == win) return info;
- }
-
- return NULL;
-}
-
-static Eina_Bool
_wl_init(void)
{
struct wl_display *display_wrapper = NULL;
{
}
-static Efl_Util_Callback_Info *
-_cb_info_find_by_wlsurf(void *wlsurf,
- int idx)
-{
- Eina_List *l, *ll;
- Efl_Util_Callback_Info *info;
- Ecore_Wl2_Window *wlwin2 = NULL;
- void *wlsurf2 = NULL;
-
- l = _cb_info_list_get(idx);
- EINA_LIST_FOREACH(l, ll, info)
- {
- wlwin2 = (Ecore_Wl2_Window *)elm_win_wl_window_get(info->win);
- wlsurf2 = ecore_wl2_window_surface_get(wlwin2);
- if (wlsurf== wlsurf2) return info;
- }
-
- return NULL;
-}
-
static void
_cb_wl_tz_policy_conformant(void *data, struct tizen_policy *tizen_policy,
struct wl_surface *surface, uint32_t is_conformant)
uint32_t state)
{
Efl_Util_Wl_Surface_Lv_Info *lv_info;
- Efl_Util_Callback_Info *cb_info;
lv_info = eina_hash_find(_eflutil.wl.policy.hash_noti_lv, &surface);
if (lv_info)
lv_info->wait_for_done = EINA_FALSE;
lv_info->state = state;
}
-
- if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
-
- cb_info = _cb_info_find_by_wlsurf((void *)surface, CBH_NOTI_LEV);
- if (!cb_info) return;
- if (!cb_info->cb) return;
-
- cb_info->cb(cb_info->win,
- EFL_UTIL_ERROR_PERMISSION_DENIED,
- cb_info->data);
}
/* LCOV_EXCL_START */
uint32_t mode,
uint32_t state)
{
-
Efl_Util_Wl_Surface_Scr_Mode_Info *scr_mode_info;
- Efl_Util_Callback_Info *cb_info;
scr_mode_info = eina_hash_find(_eflutil.wl.policy.hash_scr_mode, &surface);
if (scr_mode_info)
scr_mode_info->wait_for_done = EINA_FALSE;
scr_mode_info->state = state;
}
-
- if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
-
- cb_info = _cb_info_find_by_wlsurf((void *)surface, CBH_SCR_MODE);
- if (!cb_info) return;
- if (!cb_info->cb) return;
-
- cb_info->cb(cb_info->win,
- EFL_UTIL_ERROR_PERMISSION_DENIED,
- cb_info->data);
}
/* LCOV_EXCL_START */
(level <= EFL_UTIL_NOTIFICATION_LEVEL_TOP),
EFL_UTIL_ERROR_INVALID_PARAMETER);
- if (level == EFL_UTIL_NOTIFICATION_LEVEL_1)
- {
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: EFL_UTIL_NOTIFICATION_LEVEL_1 is deprecated and will be removed from next release. Use EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT instead.");
- }
- else if (level == EFL_UTIL_NOTIFICATION_LEVEL_2)
- {
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: EFL_UTIL_NOTIFICATION_LEVEL_2 is deprecated and will be removed from next release. Use EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM instead.");
- }
- else if (level == EFL_UTIL_NOTIFICATION_LEVEL_3)
- {
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: EFL_UTIL_NOTIFICATION_LEVEL_3 is deprecated and will be removed from next release. Use EFL_UTIL_NOTIFICATION_LEVEL_TOP instead.");
- }
-
Elm_Win_Type type;
Ecore_Wl2_Window *wlwin;
struct wl_surface *surface;
switch (lv_info->level)
{
- case TIZEN_POLICY_LEVEL_1: *level = EFL_UTIL_NOTIFICATION_LEVEL_1; break;
- case TIZEN_POLICY_LEVEL_2: *level = EFL_UTIL_NOTIFICATION_LEVEL_2; break;
- case TIZEN_POLICY_LEVEL_3: *level = EFL_UTIL_NOTIFICATION_LEVEL_3; break;
case TIZEN_POLICY_LEVEL_NONE: *level = EFL_UTIL_NOTIFICATION_LEVEL_NONE; break;
case TIZEN_POLICY_LEVEL_DEFAULT: *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT; break;
case TIZEN_POLICY_LEVEL_MEDIUM: *level = EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM; break;
}
API int
-efl_util_set_notification_window_level_error_cb(Evas_Object *window,
- efl_util_notification_window_level_error_cb callback,
- void *user_data)
-{
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: efl_util_set_notification_window_level_error_cb() is deprecated and will be removed from next release. Use the return value of efl_util_set_notification_window_level() instead.");
-
- Eina_Bool ret = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
- EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EFL_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = _cb_info_add(window,
- (Efl_Util_Cb)callback,
- user_data,
- CBH_NOTI_LEV);
- if (!ret) return EFL_UTIL_ERROR_OUT_OF_MEMORY;
-
- return EFL_UTIL_ERROR_NONE;
-}
-
-API int
-efl_util_unset_notification_window_level_error_cb(Evas_Object *window)
-{
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: efl_util_unset_notification_window_level_error_cb() is deprecated and will be removed from next release. Use the return value of efl_util_set_notification_window_level() instead.");
-
- Eina_Bool ret = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = _cb_info_del_by_win(window, CBH_NOTI_LEV);
- if (!ret) return EFL_UTIL_ERROR_INVALID_PARAMETER;
-
- return EFL_UTIL_ERROR_NONE;
-}
-
-API int
efl_util_set_window_opaque_state(Evas_Object *window,
int opaque)
{
}
API int
-efl_util_set_window_screen_mode_error_cb(Evas_Object *window,
- efl_util_window_screen_mode_error_cb callback,
- void *user_data)
-{
- /* Wearable device cannot use this. */
- if (get_tizen_profile() == TIZEN_PROFILE_WEARABLE)
- return EFL_UTIL_ERROR_NO_SUCH_DEVICE;
-
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: efl_util_set_window_screen_mode_error_cb() is deprecated and will be removed from next release. Use the return value of efl_util_set_window_screen_mode() instead.");
-
- Eina_Bool ret = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
- EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EFL_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = _cb_info_add(window,
- (Efl_Util_Cb)callback,
- user_data,
- CBH_SCR_MODE);
- if (!ret) return EFL_UTIL_ERROR_OUT_OF_MEMORY;
-
- return EFL_UTIL_ERROR_NONE;
-}
-
-API int
-efl_util_unset_window_screen_mode_error_cb(Evas_Object *window)
-{
- /* Wearable device cannot use this. */
- if (get_tizen_profile() == TIZEN_PROFILE_WEARABLE)
- return EFL_UTIL_ERROR_NO_SUCH_DEVICE;
-
- dlog_print(DLOG_WARN, LOG_TAG,
- "DEPRECATION WARNING: efl_util_unset_window_screen_mode_error_cb() is deprecated and will be removed from next release. Use the return value of efl_util_set_window_screen_mode() instead.");
-
- Eina_Bool ret = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_INVALID_PARAMETER);
-
- ret = _cb_info_del_by_win(window, CBH_SCR_MODE);
- if (!ret) return EFL_UTIL_ERROR_INVALID_PARAMETER;
-
- return EFL_UTIL_ERROR_NONE;
-}
-
-API int
efl_util_set_window_brightness(Evas_Object *window, int brightness)
{
Ecore_Wl2_Window *wlwin;