From: Yunhee Seo Date: Fri, 21 Mar 2025 05:38:51 +0000 (+0900) Subject: touchscreen: Add device_touchscreen_set_off_bind_with_display() X-Git-Tag: accepted/tizen/7.0/unified/20250324.150514^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=669b70a062dad5f92d53560712035219e30e85ff;p=platform%2Fcore%2Fapi%2Fdevice.git touchscreen: Add device_touchscreen_set_off_bind_with_display() Supports touchscreen off operation policy as setter. Combines touchscreen off operation with display off operation. If sets touchscreen off mode value as true, When the display state goes to off, touchscreen will be disabled(off state). That means touchscreen always follows display off operation. If touchscreen off mode value is set as false, Then touchscreen will ignore display off state independently. Change-Id: Ie5e5c600faf80f92cd5f14d11a9ec90a518293c4 Signed-off-by: Yunhee Seo --- diff --git a/include/touchscreen-internal.h b/include/touchscreen-internal.h index ceff76b..b8655db 100644 --- a/include/touchscreen-internal.h +++ b/include/touchscreen-internal.h @@ -114,4 +114,39 @@ int device_touchscreen_enable(touchscreen_pending_cb cb); */ int device_touchscreen_disable(touchscreen_pending_cb cb); +/** + * @brief Combines the touchscreen off operation with the display off operation. + * @details This sets the option that follows the display off operation. + * If the @a mode is true, the touchscreen will be turned off when the display is turned off. + * If the @a mode is false, the touchscreen ignores off operation when the display is turned off. + * After this set operation, the touchscreen off operation policy will be applied. + * @since_tizen 7.0 + * @privilege %http://tizen.org/privilege/display + * @param[in] mode The value to set the touchscreen off operation policy. + * @return 0 on success, otherwise a negative error value. + * @retval #DEVICE_ERROR_NONE Successful + * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied + * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed + * @code + * #include + * ... + * int main(void) + * { + * int ret = 0; + * // This sets the touchscreen off operation policy to follow the display off operation. + * ret = device_touchscreen_set_off_bind_with_display(true); + * ... + * // This sets the touchscreen off operation policy to ignore the display off operation. + * ret = device_touchscreen_set_off_bind_with_display(false); + * ... + * return 0; + * } + * ... + * @endcode + * @see device_touchscreen_enable() + * @see device_touchscreen_disable() + */ +int device_touchscreen_set_off_bind_with_display(bool mode); + #endif diff --git a/src/touchscreen-internal.c b/src/touchscreen-internal.c index f5eabfc..8718ae4 100644 --- a/src/touchscreen-internal.c +++ b/src/touchscreen-internal.c @@ -21,6 +21,7 @@ #define METHOD_TOUCHSCREEN_ENABLE "Enable" #define METHOD_TOUCHSCREEN_DISABLE "Disable" +#define METHOD_TOUCHSCREEN_SET_OFF_MODE "StayTouchScreenOff" //LCOV_EXCL_START Not tested API int device_touchscreen_enable(dbus_pending_cb cb) @@ -47,3 +48,17 @@ int device_touchscreen_disable(dbus_pending_cb cb) return errno_to_device_error(ret_dbus); } //LCOV_EXCL_STOP + +int device_touchscreen_set_off_bind_with_display(bool mode) +{ + int ret = 0; + + ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME, + DEVICED_PATH_DISPLAY, + DEVICED_INTERFACE_DISPLAY, + METHOD_TOUCHSCREEN_SET_OFF_MODE, + g_variant_new("(i)", (int)mode), + NULL); + + return errno_to_device_error(ret); +} \ No newline at end of file