diff options
-rwxr-xr-x | CMakeLists.txt | 17 | ||||
-rwxr-xr-x | capi-ui-efl-util.pc.in | 2 | ||||
-rw-r--r-- | config.h.in | 9 | ||||
-rwxr-xr-x | include/efl_util.h | 224 | ||||
-rwxr-xr-x | src/efl_util.c | 325 |
5 files changed, 512 insertions, 65 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a624985..2a5c456 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "dlog utilX elementary capi-base-common") +# required dependencies +SET(dependents "dlog elementary capi-base-common") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${dependents}) @@ -18,6 +19,13 @@ FOREACH(flag ${${fw_name}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) +# optional +SET(ECORE_X "ecore-x utilX") +pkg_check_modules(ECORE_X ${ECORE_X}) +FOREACH(flag ${${ECORE_X}_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") @@ -60,6 +68,13 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc @ONLY ) + +CONFIGURE_FILE( + config.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h + @ONLY +) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) IF(UNIX) diff --git a/capi-ui-efl-util.pc.in b/capi-ui-efl-util.pc.in index b9737af..603d747 100755 --- a/capi-ui-efl-util.pc.in +++ b/capi-ui-efl-util.pc.in @@ -9,7 +9,7 @@ includedir=/usr/include/ui Name: @PC_NAME@ Description: @PACKAGE_DESCRIPTION@ Version: @VERSION@ -Requires: @PC_REQUIRED@ +Requires: @ECORE_X@ @PC_REQUIRED@ Libs: -L${libdir} @PC_LDFLAGS@ Cflags: -I${includedir} @PC_CFLAGS@ diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..cbc4efd --- /dev/null +++ b/config.h.in @@ -0,0 +1,9 @@ +#ifndef _CONFIG_H_H_ +#define _CONFIG_H_H_ + +#define ECORE_X_FOUND @ECORE_X_FOUND@ + +// use the cmake @ECORE_WAYLAND_FOUND@ when wayland supported +#define ECORE_WAYLAND_FOUND 0 + +#endif /* _CONFIG.H_H_ */ diff --git a/include/efl_util.h b/include/efl_util.h index 9c8d7ad..309df42 100755 --- a/include/efl_util.h +++ b/include/efl_util.h @@ -30,6 +30,128 @@ extern "C" { * @{ */ +// Duplicated from utilX.h, should be moved to somewhere common in the future + +#ifndef KEY_VOLUMEUP +#define KEY_VOLUMEUP "XF86AudioRaiseVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */ +#endif + +#ifndef KEY_VOLUMEDOWN +#define KEY_VOLUMEDOWN "XF86AudioLowerVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */ +#endif + +#ifndef KEY_CAMERA +#define KEY_CAMERA "XF86WebCam" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */ +#endif + +#ifndef KEY_CONFIG +#define KEY_CONFIG "XF86Pictures" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */ +#endif + +#ifndef KEY_POWER +#define KEY_POWER "XF86PowerOff" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */ +#endif + +#ifndef KEY_PAUSE +#define KEY_PAUSE "XF86Standby" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */ +#endif + +#ifndef KEY_CANCEL +#define KEY_CANCEL "Cancel" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */ +#endif + +// Earjack/BT Headset/Multimedia keys +#ifndef KEY_PLAYCD +#define KEY_PLAYCD "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */ +#endif + +#ifndef KEY_STOPCD +#define KEY_STOPCD "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */ +#endif + +#ifndef KEY_PAUSECD +#define KEY_PAUSECD "XF86AudioPause" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */ +#endif + +#ifndef KEY_NEXTSONG +#define KEY_NEXTSONG "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */ +#endif + +#ifndef KEY_PREVIOUSSONG +#define KEY_PREVIOUSSONG "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */ +#endif + +#ifndef KEY_REWIND +#define KEY_REWIND "XF86AudioRewind" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */ +#endif + +#ifndef KEY_FASTFORWARD +#define KEY_FASTFORWARD "XF86AudioForward" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */ +#endif + +#ifndef KEY_MEDIA +#define KEY_MEDIA "XF86AudioMedia" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */ +#endif + +// 3-Touch key +#ifndef KEY_SEND +#define KEY_SEND "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */ +#endif + +#ifndef KEY_SELECT +#define KEY_SELECT "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */ +#endif + +#ifndef KEY_END +#define KEY_END "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */ +#endif + +// Renamed 3-Touch key +#ifndef KEY_MENU +#define KEY_MENU "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */ +#endif + +#ifndef KEY_HOME +#define KEY_HOME "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */ +#endif + +#ifndef KEY_BACK +#define KEY_BACK "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */ +#endif + +#ifndef OR_EXCLUSIVE_GRAB +#define OR_EXCLUSIVE_GRAB 0xf00000 /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack but the grab is overridable by the other client window */ +#endif + +#ifndef EXCLUSIVE_GRAB +#define EXCLUSIVE_GRAB 0x0f0000 /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack */ +#endif + +#ifndef TOP_POSITION_GRAB +#define TOP_POSITION_GRAB 0x00f000 /**< this means that the client window will get the grabbed-key only when on the top of the grabbing-window stack */ +#endif + +#ifndef SHARED_GRAB +#define SHARED_GRAB 0x000f00 /**< this means that the client window will get the grabbed-key together with the other client window(s) */ +#endif + +#ifndef GRAB_MODE_MASK +#define GRAB_MODE_MASK 0xffff00 /**< this mask will be used for getting the key-grab mode of a client window */ +#endif + +typedef enum _Efl_Util_Window_Type +{ + EFL_UTIL_WINDOW_TYPE_NORMAL = 8, /**< ecore_x compatible, ECORE_X_WINDOW_TYPE_NORMAL */ + EFL_UTIL_WINDOW_TYPE_NOTIFICATION = 12, /**< ecore_x compatible, ECORE_X_WINDOW_TYPE_NOTIFICATION */ +} Efl_Util_Window_Type; + +typedef enum _Efl_Util_Notification_Level +{ + EFL_UTIL_NOTIFICATION_LEVEL_LOW, /**< low level notification */ + EFL_UTIL_NOTIFICATION_LEVEL_NORMAL, /**< normal level notification*/ + EFL_UTIL_NOTIFICATION_LEVEL_HIGH, /**< high level notification */ + EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN +} Efl_Util_Notification_Level; /** * @brief Enumerations of error code for EFL UTIL @@ -41,6 +163,12 @@ typedef enum EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_APPLICATION_CLASS | 0x08 /**< Not supported window type */ } efl_util_error_e; +// TODO: are we going to have more states than on/off shouldn't we move it to a bool in the API's +typedef enum _Efl_Util_Opaque_State +{ + EFL_UTIL_OPAQUE_STATE_OFF = 0, /**< Transparent state */ + EFL_UTIL_OPAQUE_STATE_ON = 1, /**< Opaque state */ +} Efl_Util_Opaque_State; /** * @brief Enumeration of notification window's priority level @@ -52,7 +180,31 @@ typedef enum EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default*/ } efl_util_notification_level_e; +typedef enum _Efl_Util_Effect_Type +{ + EFL_UTIL_EFFECT_TYPE_MAP, /**< Effect for Window's Map Notify Event */ + EFL_UTIL_EFFECT_TYPE_UNMAP, /**< Effect for Window's UnMap Notify Event */ + EFL_UTIL_EFFECT_TYPE_RAISEABOVE, /**< Effect for Window's Configure Notify ( RaiseAbove case ) Event */ + EFL_UTIL_EFFECT_TYPE_ROTATION, /**< Effect for Window's Rotation Property Change Notify Event ( X Property: ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE ) */ + EFL_UTIL_EFFECT_TYPE_FOCUSIN, /**< Effect for Window's FocusIn Event ( E17's Event: E_EVENT_BORDER_FOCUS_IN ) */ + EFL_UTIL_EFFECT_TYPE_FOCUSOUT /**< Effect for Window's FocusOut Event ( E17's Event : E_EVENT_BORDER_FOCUS_OUT ) */ +} Efl_Util_Effect_Type; +typedef enum _Efl_Util_Effect_Style +{ + EFL_UTIL_EFFECT_STYLE_DEFAULT, /**< Default Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_NONE, /**< None of Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM0, /**< Custom0 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM1, /**< Custom1 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM2, /**< Custom2 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM3, /**< Custom3 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM4, /**< Custom4 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM5, /**< Custom5 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM6, /**< Custom6 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM7, /**< Custom7 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM8, /**< Custom8 Effect Style for Effect Type */ + EFL_UTIL_EFFECT_STYLE_CUSTOM9 /**< Custom9 Effect Style for Effect Type */ +} Efl_Util_Effect_Style; /** * @brief Sets the priority level for the specified notification window, asynchronously. @@ -81,10 +233,80 @@ int efl_util_set_notification_window_level (Evas_Object *window, efl_util_notifi */ int efl_util_get_notification_window_level (Evas_Object *window, efl_util_notification_level_e* level); +/** + * @brief Grabs a key specfied by key_name for obj in grab_mode. + * + * @param obj The Evas_Object representing the window to set the key grab to. + * @param key The key of interest. + * @param grab_mode EXCLUSIVE_GRAB, TOP_POSITION_GRAB, SHARED_GRAB, EXCLUSIVE_GRAB + * + * @return 0 on Success, fail othrewise. + * @see efl_util_ungrab_key() + */ +int efl_util_grab_key (Evas_Object *obj, const char* key, int grab_mode); + +/** + * @brief Ungrabs a key specfied by key_name for win + * + * @param obj The Evas_Object representing the window to ungrab the key. + * @param key The key of interest. + * + * @return 0 on Success, fail otherwise. + * @see efl_util_grab_key() + */ +int efl_util_ungrab_key (Evas_Object *obj, const char* key); + +/** + * @brief Sets the priority level for the specified notification window + * + * @param obj The Evas_Object representing the window to set the notification level. + * @param level The notification level. + * + * @see Efl_Util_Notification_Level + */ +void efl_util_set_system_notification_level (Evas_Object *obj, Efl_Util_Notification_Level level); + +/** + * @brief Gets the priority level for the specified notification window. + * + * @param obj The Evas_Object representing the window to get the system notification level + * set to. + * + * @return current notication level (EFL_UTIL_NOTIFICATION_LEVEL_LOW, + * EFL_UTIL_NOTIFICATION_LEVEL_NORMAL, EFL_UTIL_NOTIFICATION_LEVEL_HIGH) + */ +Efl_Util_Notification_Level efl_util_get_system_notification_level (Evas_Object *obj); + +/** + * @brief Set the functional type of window by sending _NET_WM_WINDOW_TYPE property to window. + * + * @param obj The Evas_Object representing the window to set the net_wm to. + * @param type The type to be set. + */ +void efl_util_netwm_window_type_set(Evas_Object *obj, Efl_Util_Window_Type type); + +/** + * @brief Sets a window's effect style with effect type. + * + * @param win The window to set the style to. + * @param type type Specifies the window's effect type ( ex. EFL_UTIL_EFFECT_TYPE_MAP, EFL_UTIL_EFFECT_TYPE_UNMAP, etc ) + * @param style Specifies the window's effect style ( ex. EFL_UTIL_EFFECT_STYLE_DEFAULT, EFL_UTIL_EFFECT_STYLE_NONE, EFL_UTIL_EFFECT_STYLE_CUSTOM0, etc ) + */ +void efl_util_set_window_effect_style(Evas_Object *win, Efl_Util_Effect_Type type, Efl_Util_Effect_Style style); + /** - * @} + * @brief Sets the window's opaque state + * + * @param win The window to set the opaque state to. + * @param state The state (EFL_UTIL_OPAQUE_STATE_ON, EFL_UTIL_OPAQUE_STATE_OFF). + * + * @return 0 on failure */ +int efl_util_set_window_opaque_state (Evas_Object *win, Efl_Util_Opaque_State state); +/** + * @} + */ #ifdef __cplusplus } diff --git a/src/efl_util.c b/src/efl_util.c index 3d16890..b7f5f4f 100755 --- a/src/efl_util.c +++ b/src/efl_util.c @@ -18,107 +18,308 @@ #define LOG_TAG "TIZEN_N_EFL_UTIL" #include <efl_util.h> +#include <config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <Elementary.h> + +#if ECORE_X_FOUND #include <Ecore_X.h> #include <utilX.h> - +#endif int efl_util_set_notification_window_level (Evas_Object* window, efl_util_notification_level_e level) { - Ecore_X_Window_Type window_type; - - if(window == NULL) + EINA_SAFETY_ON_NULL_RETURN_VAL(window, EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(level >= EFL_UTIL_NOTIFICATION_LEVEL_1 && + level <= EFL_UTIL_NOTIFICATION_LEVEL_2, + EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE); + +#if ECORE_X_FOUND + Ecore_X_Window xwin = elm_win_xwindow_get(window); + if (xwin) { - return EFL_UTIL_ERROR_INVALID_PARAMETER; - } + Ecore_X_Window_Type window_type; + if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE) + { + // success to get window type + if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION) + { + // given EFL window's type is not notification type. + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; + } + } + else + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; - if(level < EFL_UTIL_NOTIFICATION_LEVEL_1 || level > EFL_UTIL_NOTIFICATION_LEVEL_2) + utilx_set_system_notification_level(ecore_x_display_get(), xwin, + level); + return EFL_UTIL_ERROR_NONE; + } +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(window); + if (wl_win) { - return EFL_UTIL_ERROR_INVALID_PARAMETER; - } + printf("not implemented for wayland yet\n"); + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; + } +#endif + + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; +} + + + +int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notification_level_e* level) +{ + Ecore_X_Window_Type window_type; + Utilx_Notification_Level utilx_level; - Ecore_X_Window xwin = elm_win_xwindow_get(window); + EINA_SAFETY_ON_NULL_RETURN_VAL(window, + EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE); - if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE) +#if ECORE_X_FOUND + Ecore_X_Window xwin = elm_win_xwindow_get(window); + if (xwin) { - // success to get window type - if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION) + if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE) { - // given EFL window's type is not notification type. + // success to get window type + if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION) + { + // given EFL window's type is not notification type. + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; + } + + utilx_level = utilx_get_system_notification_level (ecore_x_display_get(), xwin); + + if(utilx_level == UTILX_NOTIFICATION_LEVEL_LOW) + { + *level = EFL_UTIL_NOTIFICATION_LEVEL_1; + } + else if(utilx_level == UTILX_NOTIFICATION_LEVEL_NORMAL) + { + *level = EFL_UTIL_NOTIFICATION_LEVEL_2; + } + else if(utilx_level == UTILX_NOTIFICATION_LEVEL_HIGH) + { + *level = EFL_UTIL_NOTIFICATION_LEVEL_2; + } + else + { + return EFL_UTIL_ERROR_INVALID_PARAMETER; + } + + } + else + { + // fail to get window type return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; } + + return EFL_UTIL_ERROR_NONE; } - else +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(window); + if (wl_win) { - // fail to get window type + printf("not implemented for wayland yet\n"); return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; + } +#endif + return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; +} + +int efl_util_grab_key (Evas_Object *obj, const char* key, int grab_mode) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0); + +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; + + x_win = elm_win_xwindow_get(obj); + if (x_win) + { + x_disp = ecore_x_display_get(); + return utilx_grab_key(x_disp, x_win, key, grab_mode); } - - // this api doesn't have return type - if(level == EFL_UTIL_NOTIFICATION_LEVEL_1) { - utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_LOW); + +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(obj); + if (wl_win) + { + printf("not implemented for wayland yet\n"); + return 0; } - else if(level == EFL_UTIL_NOTIFICATION_LEVEL_2) +#endif + + return 0; +} + +int efl_util_ungrab_key (Evas_Object *obj, const char* key) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0); + +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; + + x_win = elm_win_xwindow_get(obj); + if (x_win) { - utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_NORMAL); + x_disp = ecore_x_display_get(); + return utilx_ungrab_key (x_disp, x_win, key); } - - return EFL_UTIL_ERROR_NONE; +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(obj); + if (wl_win) + { + printf("not implemented for wayland yet\n"); + return 0; + } +#endif + + return 0; } +void efl_util_set_system_notification_level (Evas_Object *obj, Efl_Util_Notification_Level level) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_FALSE_RETURN(level >= EFL_UTIL_NOTIFICATION_LEVEL_LOW && + level <= EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN); +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; -int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notification_level_e* level) + x_win = elm_win_xwindow_get(obj); + if (x_win) + { + x_disp = ecore_x_display_get(); + utilx_set_system_notification_level(x_disp, x_win, level); + return; + } +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(obj); + if (wl_win) + { + printf("not implemented for wayland yet\n"); + } +#endif +} + +Efl_Util_Notification_Level efl_util_get_system_notification_level (Evas_Object *obj) { - Ecore_X_Window_Type window_type; + EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN); - Utilx_Notification_Level utilx_level; - - if(window == NULL) +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; + + x_win = elm_win_xwindow_get(obj); + if (x_win) { - return EFL_UTIL_ERROR_INVALID_PARAMETER; + x_disp = ecore_x_display_get(); + return utilx_get_system_notification_level(x_disp, x_win); } +#endif - Ecore_X_Window xwin = elm_win_xwindow_get(window); +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(obj); + if (wl_win) + { + printf("not implemented for wayland yet\n"); + return EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN; + } +#endif + + return EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN; +} - if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE) +void efl_util_netwm_window_type_set(Evas_Object *obj, Efl_Util_Window_Type type) +{ + EINA_SAFETY_ON_NULL_RETURN(obj); + EINA_SAFETY_ON_FALSE_RETURN(type == EFL_UTIL_WINDOW_TYPE_NORMAL || + type == EFL_UTIL_WINDOW_TYPE_NOTIFICATION); + +#if ECORE_X_FOUND + Ecore_X_Window x_win; + + x_win = elm_win_xwindow_get(obj); + if (x_win) { - // success to get window type - if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION) - { - // given EFL window's type is not notification type. - return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; - } - - utilx_level = utilx_get_system_notification_level (ecore_x_display_get(), xwin); + ecore_x_netwm_window_type_set(x_win, type); + return; + } - if(utilx_level == UTILX_NOTIFICATION_LEVEL_LOW) - { - *level = EFL_UTIL_NOTIFICATION_LEVEL_1; - } - else if(utilx_level == UTILX_NOTIFICATION_LEVEL_NORMAL) - { - *level = EFL_UTIL_NOTIFICATION_LEVEL_2; - } - else if(utilx_level == UTILX_NOTIFICATION_LEVEL_HIGH) - { - *level = EFL_UTIL_NOTIFICATION_LEVEL_2; - } - else - { - return EFL_UTIL_ERROR_INVALID_PARAMETER; - } - +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(obj); + if (wl_win) + printf("not implemented for wayland yet\n"); +#endif +} + +void efl_util_set_window_effect_style(Evas_Object *win, Efl_Util_Effect_Type type, Efl_Util_Effect_Style style) +{ + + EINA_SAFETY_ON_NULL_RETURN(win); + +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; + + x_win = elm_win_xwindow_get(win); + if (x_win) + { + x_disp = ecore_x_display_get(); + utilx_set_window_effect_style(x_disp, x_win, type, style); + return; } - else +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(win); + if (wl_win) + printf("not implemented for wayland yet\n"); +#endif +} + +int efl_util_set_window_opaque_state (Evas_Object *win, Efl_Util_Opaque_State state) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0); + +#if ECORE_X_FOUND + Ecore_X_Window x_win; + Ecore_X_Display *x_disp; + + x_win = elm_win_xwindow_get(win); + if (x_win) { - // fail to get window type - return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE; + x_disp = ecore_x_display_get(); + return utilx_set_window_opaque_state(x_disp, x_win, state); } - - return EFL_UTIL_ERROR_NONE; +#endif + +#if ECORE_WAYLAND_FOUND + Ecore_Wl_Window wl_win = elm_win_wl_window_get(win); + if (wl_win) + printf("not implemented for wayland yet\n"); +#endif + + return 0; } |