2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #define LOG_TAG "TIZEN_N_EFL_UTIL"
24 #include <Elementary.h>
29 int efl_util_set_notification_window_level (Evas_Object* window, efl_util_notification_level_e level)
31 Ecore_X_Window_Type window_type;
35 return EFL_UTIL_ERROR_INVALID_PARAMETER;
38 if(level < EFL_UTIL_NOTIFICATION_LEVEL_1 || level > EFL_UTIL_NOTIFICATION_LEVEL_2)
40 return EFL_UTIL_ERROR_INVALID_PARAMETER;
43 Ecore_X_Window xwin = elm_win_xwindow_get(window);
45 if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
47 // success to get window type
48 if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION)
50 // given EFL window's type is not notification type.
51 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
56 // fail to get window type
57 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
60 // this api doesn't have return type
61 if(level == EFL_UTIL_NOTIFICATION_LEVEL_1) {
62 utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_LOW);
64 else if(level == EFL_UTIL_NOTIFICATION_LEVEL_2)
66 utilx_set_system_notification_level(ecore_x_display_get(), xwin, UTILX_NOTIFICATION_LEVEL_NORMAL);
69 return EFL_UTIL_ERROR_NONE;
74 int efl_util_get_notification_window_level (Evas_Object* window, efl_util_notification_level_e* level)
76 Ecore_X_Window_Type window_type;
78 Utilx_Notification_Level utilx_level;
82 return EFL_UTIL_ERROR_INVALID_PARAMETER;
86 Ecore_X_Window xwin = elm_win_xwindow_get(window);
88 if(ecore_x_netwm_window_type_get(xwin, &window_type) == EINA_TRUE)
90 // success to get window type
91 if(window_type != ECORE_X_WINDOW_TYPE_NOTIFICATION)
93 // given EFL window's type is not notification type.
94 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
97 utilx_level = utilx_get_system_notification_level (ecore_x_display_get(), xwin);
99 if(utilx_level == UTILX_NOTIFICATION_LEVEL_LOW)
101 *level = EFL_UTIL_NOTIFICATION_LEVEL_1;
103 else if(utilx_level == UTILX_NOTIFICATION_LEVEL_NORMAL)
105 *level = EFL_UTIL_NOTIFICATION_LEVEL_2;
107 else if(utilx_level == UTILX_NOTIFICATION_LEVEL_HIGH)
109 *level = EFL_UTIL_NOTIFICATION_LEVEL_2;
113 return EFL_UTIL_ERROR_INVALID_PARAMETER;
119 // fail to get window type
120 return EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE;
123 return EFL_UTIL_ERROR_NONE;