From 0b79ec09e37f111c2deba3604379bd34d49743d7 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 2 May 2019 14:41:56 +0900 Subject: [PATCH] screenshot: add permission denied error return Change-Id: If3f3477b9e085584ed767780649f6f6b2ef2814b Signed-off-by: Junkyeong Kim --- include/efl_util.h.in | 3 +++ include/efl_util_screenshot_extension.h | 2 ++ src/efl_util.c | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/efl_util.h.in b/include/efl_util.h.in index b248cb6..202ce02 100644 --- a/include/efl_util.h.in +++ b/include/efl_util.h.in @@ -429,6 +429,7 @@ typedef struct _efl_util_screenshot_h * efl_util_screenshot_h; * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure * @exception #EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL Initialization failure + * @exception #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenshot * @see efl_util_screenshot_deinitialize() */ API efl_util_screenshot_h efl_util_screenshot_initialize(int width, int height); @@ -447,6 +448,7 @@ API efl_util_screenshot_h efl_util_screenshot_initialize(int width, int height); * @exception #EFL_UTIL_ERROR_NONE Successful * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter * @exception #EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL Execution failure + * @exception #EFL_UTIL_ERROR_PERMISSION_DENIED No permission for screenshot * @see efl_util_screenshot_initialize() * @see efl_util_screenshot_deinitialize() */ @@ -462,6 +464,7 @@ API tbm_surface_h efl_util_screenshot_take_tbm_surface(efl_util_screenshot_h scr * @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 No permission for screenshot * @see efl_util_screenshot_initialize() */ API int efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot); diff --git a/include/efl_util_screenshot_extension.h b/include/efl_util_screenshot_extension.h index 6a150aa..9860bb8 100644 --- a/include/efl_util_screenshot_extension.h +++ b/include/efl_util_screenshot_extension.h @@ -49,6 +49,7 @@ extern "C" { * @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 No permission for screenshot * @see efl_util_screenshot_get_auto_rotation() */ API int efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, int set); @@ -64,6 +65,7 @@ API int efl_util_screenshot_set_auto_rotation(efl_util_screenshot_h screenshot, * @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 No permission for screenshot * @see efl_util_screenshot_set_auto_rotation() */ API int efl_util_screenshot_get_auto_rotation(efl_util_screenshot_h screenshot, int *set); diff --git a/src/efl_util.c b/src/efl_util.c index c1a2f38..46d35dc 100644 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -2005,7 +2005,10 @@ fail_init: _screenshot_mutex_unlock(); efl_util_screenshot_deinitialize(screenshot); } - set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL); + if (_eflutil.wl.shot.noti == 0) + set_last_result(EFL_UTIL_ERROR_PERMISSION_DENIED); + else + set_last_result(EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL); return NULL; /* LCOV_EXCL_STOP */ } -- 2.7.4