*/
typedef enum
{
- EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level */
- EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default */
- EFL_UTIL_NOTIFICATION_LEVEL_3, /**< The highest notification level */
+ EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level. (Deprecated since 2.4. Use EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT instead.) */
+ EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default. (Deprecated since 2.4. Use EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM instead.) */
+ EFL_UTIL_NOTIFICATION_LEVEL_3, /**< The highest notification level. (Deprecated since 2.4. 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: 2.4) */
+ EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT = 10, /**< Default notification level. (@b Since: 2.4) */
+ EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM = 20, /**< Higher notification level than default. (@b Since: 2.4) */
+ EFL_UTIL_NOTIFICATION_LEVEL_HIGH = 30, /**< Higher notification level than medium. (@b Since: 2.4) */
+ EFL_UTIL_NOTIFICATION_LEVEL_TOP = 40 /**< The highest notification level. (@b Since: 2.4) */
} efl_util_notification_level_e;
/**
typedef struct _Surface_Level
{
struct wl_surface *surface;
- uint32_t level;
+ int32_t level;
+ Eina_Bool wait_set_level_done;
} Surface_Level;
static void _cb_handle_registry_global(void *data, struct wl_registry *registry, unsigned int name, const char *interface, unsigned int version);
static void _cb_handle_registry_global_remove(void *data, struct wl_registry *registry, unsigned int name);
-static void _notification_set_level_done(void *data, struct tizen_notification *tizen_notification, struct wl_surface *surface, uint32_t level, uint32_t error_state);
+static void _notification_set_level_done(void *data, struct tizen_notification *tizen_notification, struct wl_surface *surface, int32_t level, uint32_t error_state);
static notification_error_cb_info *_notification_error_cb_info_find_by_wl_surface(struct wl_surface *surface);
static const struct wl_registry_listener _registry_listener =
_notification_set_level_done(void *data,
struct tizen_notification *tizen_notification,
struct wl_surface *surface,
- uint32_t level,
+ int32_t level,
uint32_t error_state)
{
Surface_Level *sl;
notification_error_cb_info *cb_info = NULL;
efl_util_error_e error_cb_state = EFL_UTIL_ERROR_NONE;
- if (error_state == TIZEN_NOTIFICATION_ERROR_STATE_NONE)
+ if (hash_surface_levels)
{
- if (hash_surface_levels)
+ sl = eina_hash_find(hash_surface_levels, &surface);
+ if (sl)
{
- sl = eina_hash_find(hash_surface_levels, &surface);
- if (!sl)
- {
- sl = calloc(1, sizeof(Surface_Level));
- if (sl)
- {
- sl->surface = surface;
- sl->level = level;
- eina_hash_add(hash_surface_levels, &surface, sl);
- }
- }
- else
- {
- sl->level = level;
- }
+ sl->level = level;
+ sl->wait_set_level_done = EINA_FALSE;
}
}
case TIZEN_NOTIFICATION_ERROR_STATE_NONE:
error_cb_state = EFL_UTIL_ERROR_NONE;
break;
- case TIZEN_NOTIFICATION_ERROR_STATE_INVALID_PARAMETER:
- error_cb_state = EFL_UTIL_ERROR_INVALID_PARAMETER;
- break;
- case TIZEN_NOTIFICATION_ERROR_STATE_OUT_OF_MEMORY:
- error_cb_state = EFL_UTIL_ERROR_OUT_OF_MEMORY;
- break;
case TIZEN_NOTIFICATION_ERROR_STATE_PERMISSION_DENIED:
- error_cb_state = EFL_UTIL_ERROR_PERMISSION_DENIED;
- break;
- case EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE:
default:
- error_cb_state = TIZEN_NOTIFICATION_ERROR_STATE_NOT_SUPPORTED_WINDOW_TYPE;
+ error_cb_state = EFL_UTIL_ERROR_PERMISSION_DENIED;
break;
}
if (cb_info->err_cb)
if (wl_win)
{
_efl_util_wl_init();
+
+ if (hash_surface_levels)
+ {
+ Surface_Level *sl;
+ struct wl_surface *surface = ecore_wl_window_surface_get(wl_win);
+ sl = eina_hash_find(hash_surface_levels, &surface);
+ if (!sl)
+ {
+ sl = calloc(1, sizeof(Surface_Level));
+ if (sl)
+ {
+ sl->surface = surface;
+ sl->level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ sl->wait_set_level_done = EINA_TRUE;
+ eina_hash_add(hash_surface_levels, &surface, sl);
+ }
+ }
+ else
+ {
+ sl->wait_set_level_done = EINA_TRUE;
+ }
+ }
+
//Add notification window type check
tizen_notification_set_level(_tizen_notification,
ecore_wl_window_surface_get(wl_win),
{
Surface_Level *sl;
struct wl_surface *surface = ecore_wl_window_surface_get(wl_win);
+
sl = eina_hash_find(hash_surface_levels, &surface);
if (sl)
{
+ if (sl->wait_set_level_done)
+ {
+ if (ecore_wl_window_shell_surface_get(wl_win) ||
+ ecore_wl_window_xdg_surface_get(wl_win))
+ {
+ while (sl->wait_set_level_done)
+ {
+ ecore_wl_flush();
+ wl_display_dispatch(ecore_wl_display_get());
+ }
+ }
+ else
+ {
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ return EFL_UTIL_ERROR_INVALID_PARAMETER;
+ }
+ }
+
switch (sl->level)
{
case TIZEN_NOTIFICATION_LEVEL_1:
case TIZEN_NOTIFICATION_LEVEL_3:
*level = EFL_UTIL_NOTIFICATION_LEVEL_3;
break;
+ case TIZEN_NOTIFICATION_LEVEL_NONE:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_NONE;
+ break;
+ case TIZEN_NOTIFICATION_LEVEL_DEFAULT:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ break;
+ case TIZEN_NOTIFICATION_LEVEL_MEDIUM:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM;
+ break;
+ case TIZEN_NOTIFICATION_LEVEL_HIGH:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_HIGH;
+ break;
+ case TIZEN_NOTIFICATION_LEVEL_TOP:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_TOP;
default:
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
return EFL_UTIL_ERROR_INVALID_PARAMETER;
}
return EFL_UTIL_ERROR_NONE;
}
+ else
+ {
+ *level = EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT;
+ }
}
#endif
return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
TIZEN_NOTIFICATION_LEVEL_1 = 0,
TIZEN_NOTIFICATION_LEVEL_2 = 1,
TIZEN_NOTIFICATION_LEVEL_3 = 2,
+ TIZEN_NOTIFICATION_LEVEL_NONE = -1,
+ TIZEN_NOTIFICATION_LEVEL_DEFAULT = 10,
+ TIZEN_NOTIFICATION_LEVEL_MEDIUM = 20,
+ TIZEN_NOTIFICATION_LEVEL_HIGH = 30,
+ TIZEN_NOTIFICATION_LEVEL_TOP = 40,
};
#endif /* TIZEN_NOTIFICATION_LEVEL_ENUM */
#define TIZEN_NOTIFICATION_ERROR_STATE_ENUM
enum tizen_notification_error_state {
TIZEN_NOTIFICATION_ERROR_STATE_NONE = 0,
- TIZEN_NOTIFICATION_ERROR_STATE_INVALID_PARAMETER = 1,
- TIZEN_NOTIFICATION_ERROR_STATE_OUT_OF_MEMORY = 2,
- TIZEN_NOTIFICATION_ERROR_STATE_PERMISSION_DENIED = 3,
- TIZEN_NOTIFICATION_ERROR_STATE_NOT_SUPPORTED_WINDOW_TYPE = 4,
+ TIZEN_NOTIFICATION_ERROR_STATE_PERMISSION_DENIED = 1,
};
#endif /* TIZEN_NOTIFICATION_ERROR_STATE_ENUM */
void (*done)(void *data,
struct tizen_notification *tizen_notification,
struct wl_surface *surface,
- uint32_t level,
+ int32_t level,
uint32_t error_state);
};
}
static inline void
-tizen_notification_set_level(struct tizen_notification *tizen_notification, struct wl_surface *surface, uint32_t level)
+tizen_notification_set_level(struct tizen_notification *tizen_notification, struct wl_surface *surface, int32_t level)
{
wl_proxy_marshal((struct wl_proxy *) tizen_notification,
TIZEN_NOTIFICATION_SET_LEVEL, surface, level);