change APIs synchronously( *set_notification_window_level/*set_window_screen_mode ) 42/56342/8 accepted/tizen/mobile/20160125.225137 accepted/tizen/mobile/20160125.225234 accepted/tizen/tv/20160125.225153 accepted/tizen/tv/20160125.225252 accepted/tizen/wearable/20160125.225214 accepted/tizen/wearable/20160125.225307 submit/tizen/20160125.121533 submit/tizen/20160125.121950
authorJu Yeon Lee <juyeonne.lee@samsung.com>
Wed, 6 Jan 2016 13:21:50 +0000 (22:21 +0900)
committerJu Yeon Lee <juyeonne.lee@samsung.com>
Tue, 19 Jan 2016 02:43:16 +0000 (11:43 +0900)
below APIs are deprecated since tizen 3.0 (wayland backend only)
 efl_util_set_notification_window_level_error_cb
 efl_util_unset_notification_window_level_error_cb
 efl_util_set_window_screen_mode_error_cb
 efl_util_unset_window_screen_mode_error_cb

Change-Id: I1631827dc6cb8906a33e43e51fb6906785372215

include/efl_util.h
packaging/capi-ui-efl-util.spec
src/efl_util.c

index ee94bf0..2568825 100644 (file)
@@ -87,7 +87,7 @@ typedef enum
 } efl_util_screen_mode_e;
 
 /**
- * @brief Sets the priority level for the specified notification window, asynchronously.
+ * @brief Sets the priority level for the specified notification window.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel public
  * @privilege %http://tizen.org/privilege/window.priority.set
@@ -98,11 +98,12 @@ typedef enum
  * @retval #EFL_UTIL_ERROR_NONE Successful
  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
+ * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Unprevilige access
  */
 API int efl_util_set_notification_window_level(Evas_Object *window, efl_util_notification_level_e level);
 
 /**
- * @brief Gets the priority level for the specified notification window, asynchronously.
+ * @brief Gets the priority level for the specified notification window.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  *
  * @remarks This API can be used for a notification type window only.
@@ -116,6 +117,7 @@ API int efl_util_set_notification_window_level(Evas_Object *window, efl_util_not
 API int efl_util_get_notification_window_level(Evas_Object *window, efl_util_notification_level_e *level);
 
 /**
+ * @deprecated Deprecated since_tizen 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
  * @param[in] window The EFL window
@@ -127,7 +129,9 @@ API int efl_util_get_notification_window_level(Evas_Object *window, efl_util_not
 typedef void (*efl_util_notification_window_level_error_cb)(Evas_Object *window, int error_code, void *user_data);
 
 /**
+ * @deprecated Deprecated since_tizen 3.0
  * @brief Registers a callback function to be invoked when an error which set the notification level occurs.
+ * @details An application can check error by the return value of efl_util_set_notification_window_level.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in] window The EFL window
  * @param[in] callback The callback function to register
@@ -143,7 +147,9 @@ typedef void (*efl_util_notification_window_level_error_cb)(Evas_Object *window,
 API int efl_util_set_notification_window_level_error_cb(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data);
 
 /**
+ * @deprecated Deprecated since_tizen 3.0
  * @brief Unregisters the callback function.
+ * @details An application can check error by the return value of efl_util_set_notification_window_level.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in] window The EFL window
  * @return @c 0 on success, otherwise a negative error value
@@ -186,6 +192,7 @@ API int efl_util_set_window_opaque_state(Evas_Object *window, int opaque);
  * @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_PERMISSION_DENIED Unprevilige access
  */
 API int efl_util_set_window_screen_mode(Evas_Object *window, efl_util_screen_mode_e mode);
 
@@ -201,6 +208,7 @@ API int efl_util_set_window_screen_mode(Evas_Object *window, efl_util_screen_mod
 API int efl_util_get_window_screen_mode(Evas_Object *window, efl_util_screen_mode_e *mode);
 
 /**
+ * @deprecated Deprecated since_tizen 3.0
  * @brief Called when an error occurs for setting window's screen mode
  * @since_tizen 2.4
  * @param[in] window The EFL window
@@ -212,7 +220,9 @@ API int efl_util_get_window_screen_mode(Evas_Object *window, efl_util_screen_mod
 typedef void (*efl_util_window_screen_mode_error_cb)(Evas_Object *window, int error_code, void *user_data);
 
 /**
+ * @deprecated Deprecated since_tizen 3.0
  * @brief Registers a callback function to be invoked when an error which set the screen mode.
+ * @details An application can check error by the return value of efl_util_set_window_screen_mode.
  * @since_tizen 2.4
  * @param[in] window The EFL window
  * @param[in] callback The callback function to register
@@ -228,7 +238,9 @@ typedef void (*efl_util_window_screen_mode_error_cb)(Evas_Object *window, int er
 API int efl_util_set_window_screen_mode_error_cb(Evas_Object *window, efl_util_window_screen_mode_error_cb callback, void *user_data);
 
 /**
+ * @deprecated Deprecated since_tizen 3.0
  * @brief Unregisters the callback function.
+ * @details An application can check error by the return value of efl_util_set_window_screen_mode.
  * @since_tizen 2.4
  * @param[in] window The EFL window
  * @return @c 0 on success, otherwise a negative error value
index 9908ba9..cf62b67 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       capi-ui-efl-util
 Summary:    An EFL utility library in Tizen C API
-Version:    0.1.6
+Version:    0.1.7
 Release:    1
 Group:      Graphics & UI Framework/API
 License:    Apache-2.0
index ede9b21..9860db6 100644 (file)
@@ -69,6 +69,7 @@ typedef struct _Efl_Util_Wl_Surface_Lv_Info
    void *surface; /* wl_surface */
    int level;
    Eina_Bool wait_for_done;
+   uint32_t state;
 } Efl_Util_Wl_Surface_Lv_Info;
 
 typedef struct _Efl_Util_Wl_Surface_Scr_Mode_Info
@@ -76,6 +77,7 @@ typedef struct _Efl_Util_Wl_Surface_Scr_Mode_Info
    void *surface; /* wl_surface */
    unsigned int mode;
    Eina_Bool wait_for_done;
+   uint32_t state;
 } Efl_Util_Wl_Surface_Scr_Mode_Info;
 
 typedef struct _Efl_Util_Wl_Output_Info
@@ -544,6 +546,7 @@ _cb_wl_tz_policy_notification_done(void *data,
      {
         lv_info->level = level;
         lv_info->wait_for_done = EINA_FALSE;
+        lv_info->state = state;
      }
 
    if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
@@ -578,6 +581,7 @@ _cb_wl_tz_policy_scr_mode_done(void *data,
      {
         scr_mode_info->mode = mode;
         scr_mode_info->wait_for_done = EINA_FALSE;
+        scr_mode_info->state = state;
      }
 
    if (state != TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED) return;
@@ -671,7 +675,7 @@ efl_util_set_notification_window_level(Evas_Object *window,
         lv_info->surface = surface;
         lv_info->level = (int)level;
         lv_info->wait_for_done = EINA_TRUE;
-
+        lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
         eina_hash_add(_eflutil.wl.policy.hash_noti_lv,
                       &surface,
                       lv_info);
@@ -680,11 +684,35 @@ efl_util_set_notification_window_level(Evas_Object *window,
      {
         lv_info->level = (int)level;
         lv_info->wait_for_done = EINA_TRUE;
+        lv_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
      }
 
    tizen_policy_set_notification_level(_eflutil.wl.policy.proto,
                                        surface, (int)level);
 
+   if (lv_info->wait_for_done)
+     {
+        int count = 0;
+        while (lv_info->wait_for_done && (count < 3))
+          {
+             ecore_wl_flush();
+             wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+             count++;
+          }
+
+        if (lv_info->wait_for_done)
+          {
+             return EFL_UTIL_ERROR_INVALID_PARAMETER;
+          }
+        else
+          {
+             if (lv_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
+               {
+                  return EFL_UTIL_ERROR_PERMISSION_DENIED;
+               }
+          }
+     }
+
    return EFL_UTIL_ERROR_NONE;
 #endif /* end of WAYLAND */
 }
@@ -980,6 +1008,7 @@ efl_util_set_window_screen_mode(Evas_Object *window,
              scr_mode_info->surface = surface;
              scr_mode_info->mode = (unsigned int)mode;
              scr_mode_info->wait_for_done = EINA_TRUE;
+             scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
 
              eina_hash_add(_eflutil.wl.policy.hash_scr_mode,
                            &surface,
@@ -989,10 +1018,33 @@ efl_util_set_window_screen_mode(Evas_Object *window,
           {
              scr_mode_info->mode = (unsigned int)mode;
              scr_mode_info->wait_for_done = EINA_TRUE;
+             scr_mode_info->state = TIZEN_POLICY_ERROR_STATE_NONE;
           }
 
         tizen_policy_set_window_screen_mode(_eflutil.wl.policy.proto,
                                             surface, (unsigned int)mode);
+        if (scr_mode_info->wait_for_done)
+          {
+             int count = 0;
+             while (scr_mode_info->wait_for_done && (count < 3))
+               {
+                  ecore_wl_flush();
+                  wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+                  count++;
+               }
+
+             if (scr_mode_info->wait_for_done)
+               {
+                  return EFL_UTIL_ERROR_INVALID_PARAMETER;
+               }
+             else
+               {
+                  if (scr_mode_info->state == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
+                    {
+                       return EFL_UTIL_ERROR_PERMISSION_DENIED;
+                    }
+               }
+          }
 
         return EFL_UTIL_ERROR_NONE;
      }