#undef LOG_TAG
#endif
+/* Determine Tizen profile at runtime */
+#include <system_info.h>
+typedef enum {
+ TIZEN_PROFILE_UNKNOWN = 0,
+ TIZEN_PROFILE_MOBILE = 0x1,
+ TIZEN_PROFILE_WEARABLE = 0x2,
+ TIZEN_PROFILE_TV = 0x4,
+ TIZEN_PROFILE_IVI = 0x8,
+ TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+static tizen_profile_t _get_tizen_profile()
+{
+ char *profileName;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = TIZEN_PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
+static inline tizen_profile_t get_tizen_profile()
+{
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+ return _get_tizen_profile();
+}
+
+
#define LOG_TAG "TIZEN_N_EFL_UTIL"
NULL, NULL,
{ NULL, NULL, NULL }, /* tizen_policy protocol */
{ NULL, NULL, NULL, NULL, NULL, 0 }, /* screenshooter protocol */
- { NULL, -1 } /* tizen_input_device_manager protocol */
+ { NULL, -1 }, /* tizen_input_device_manager protocol */
+ { NULL, NULL } /* display_policy protocol */
},
{
{ NULL, 0 }, /* handler for notification level */
return EFL_UTIL_ERROR_INVALID_PARAMETER;
}
-#ifndef TIZEN_WEARABLE
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.");
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.");
return EFL_UTIL_ERROR_NONE;
}
-#endif
API int
efl_util_set_window_brightness(Evas_Object *window, int brightness)
struct _efl_util_inputgen_h
{
unsigned int init_type;
+ char name[32];
};
static void
return NULL;
}
+API efl_util_inputgen_h
+efl_util_input_initialize_generator_with_name(unsigned int dev_type, const char *name)
+{
+ int ret = EFL_UTIL_ERROR_NONE;
+ efl_util_inputgen_h inputgen_h = NULL;
+ unsigned int clas = 0x0;
+
+ if (!dev_type ||
+ dev_type & ~(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN
+ | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD
+ | EFL_UTIL_INPUT_DEVTYPE_POINTER))
+ {
+ set_last_result(EFL_UTIL_ERROR_NO_SUCH_DEVICE);
+ goto out;
+ }
+
+ inputgen_h = (efl_util_inputgen_h)calloc(1, sizeof(struct _efl_util_inputgen_h));
+ if (!inputgen_h)
+ {
+ set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
+ goto out;
+ }
+
+ inputgen_h->init_type |= dev_type;
+ strncpy(inputgen_h->name, name, 31);
+
+ ret = _wl_init();
+ if (ret == (int)EINA_FALSE)
+ {
+ set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
+ goto out;
+ }
+
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN;
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD;
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_POINTER)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE;
+
+ while (!_eflutil.wl.devmgr.devicemgr)
+ wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+
+ tizen_input_device_manager_init_generator_with_name(_eflutil.wl.devmgr.devicemgr, clas, inputgen_h->name);
+
+ while (_eflutil.wl.devmgr.request_notified == -1)
+ wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+
+ ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
+ _eflutil.wl.devmgr.request_notified = -1;
+
+ set_last_result(ret);
+ if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
+ goto out;
+
+ return inputgen_h;
+
+out:
+ if (inputgen_h)
+ {
+ free(inputgen_h);
+ inputgen_h = NULL;
+ }
+ return NULL;
+}
+
+
API int
efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
{