2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUi_EcoreEvas.cpp
20 * @brief This is the implementation file for the _EcoreEvas class.
24 #include <appcore-common.h>
25 #include <runtime_info.h>
27 #include <X11/Xatom.h>
29 #include <Elementary.h>
30 #include <FGrpRectangle.h>
31 #include <FGrpFloatRectangle.h>
32 #include <FBaseInteger.h>
33 #include <FBaseErrors.h>
34 #include <FBaseSysLog.h>
35 #include <FBaseRtThread.h>
36 #include <FApp_IActiveWindowEventListener.h>
37 #include <FBase_StringConverter.h>
38 #include <FGrp_CanvasImpl.h>
39 #include "FUi_CoordinateSystemUtils.h"
40 #include "FUi_EcoreEvas.h"
41 #include "FUi_EcoreEvasMgr.h"
42 #include "FUi_Control.h"
44 #include "FUi_UiNotificationEvent.h"
45 #include "FUi_UiEventManager.h"
46 #include "FUi_Window.h"
47 #include "FUiAnim_EflLayer.h"
48 #include "FUiAnim_EflNode.h"
49 #include "FUiAnim_VisualElement.h"
50 #include "FUi_AccessibilityGesture.h"
51 #include "FUi_AccessibilitySystemSettingLoader.h"
52 #include "FUiAnim_RootVisualElement.h"
53 #include "FUiAnim_DisplayManager.h"
54 #include "FUiCtrl_Frame.h"
55 #include "FUiCtrl_FrameImpl.h"
56 #include "FUiCtrl_FormImpl.h"
57 #include "FUi_Clipboard.h"
58 #include "FUi_TouchManager.h"
59 #include "FUi_ControlManager.h"
60 #include "FUi_ActiveWindowEvent.h"
61 #include "FUi_ControlImplManager.h"
62 #include "FUiCtrl_Popup.h"
63 #include "FUiCtrl_ContextMenu.h"
65 using namespace Tizen::Base;
66 using namespace Tizen::Base::Runtime;
67 using namespace Tizen::App;
68 using namespace Tizen::Graphics;
69 using namespace Tizen::Ui;
70 using namespace Tizen::Ui::Animations;
71 using namespace Tizen::Ui::Controls;
73 #define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN"
74 #define ATOM_CBHM_MSG "CBHM_MSG"
75 #define ATOM_CBHM_COUNT_GET "CBHM_cCOUNT"
76 #define ATOM_CBHM_SERIAL_NUMBER "CBHM_SERIAL_NUMBER"
77 #define ATOM_CBHM_ERROR "CBHM_ERROR"
78 #define ATOM_CBHM_ITEM "CBHM_ITEM"
79 #define ATOM_CBHM_SET_ITEM "SET_ITEM"
80 #define ATOM_CBHM_CLIPBOARD_SHOW_ALL "show1"
81 #define ATOM_CBHM_CLIPBOARD_SHOW "show0"
82 #define ATOM_CBHM_CLIPBOARD_HIDE "cbhm_hide"
83 #define ATOM_CBHM_SELECTED_ITEM "CBHM_SELECTED_ITEM"
84 #define ATOM_ROTATE_AUTO "_E_WINDOW_ROTATION_SUPPORTED"
86 namespace Tizen { namespace Ui
88 static _EcoreEvas* _pEvas = null;
94 Ecore_X_Atom __atomRotateRootAngle = 0;
95 Ecore_X_Atom __atomAccessibility = 0;
97 int __clipboardHeight = 0;
100 OnWindowStateChanged(Ecore_Evas* pEcoreEvas)
102 _ControlManager* pControlManager = _ControlManager::GetInstance();
103 if (!pControlManager)
108 Ecore_X_Window targetWin = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
110 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] OnWindowStateChanged is called.", targetWin);
112 int winCount = pControlManager->GetWindowCount();
113 for (int i = 0; i < winCount; i++)
115 _Window* pWindow = pControlManager->GetWindow(i);
121 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
123 if (win == targetWin)
125 pWindow->OnWindowStateChanged();
133 OnWindowPropertyChanged(void* pData, int type, void* pEvent)
135 Ecore_X_Event_Window_Property* pEv = (Ecore_X_Event_Window_Property*)pEvent;
138 return ECORE_CALLBACK_PASS_ON;
141 Ecore_X_Window targetWin = pEv->win;
144 return ECORE_CALLBACK_PASS_ON;
147 if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
149 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
150 Ecore_X_Illume_Clipboard_State clipboardState = ecore_x_e_illume_clipboard_state_get(zone);
152 if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
158 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
160 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
162 if (__clipboardHeight == 0)
164 SysLog(NID_UI, "[Clipboard] Clipboard is opened. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
165 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_OPENED, clipboardDim.width, clipboardDim.height);
166 __clipboardHeight = clipboardDim.height;
170 // SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
171 // _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
174 else if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
176 SysLog(NID_UI, "[Clipboard] Clipboard is closed.");
177 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_CLOSED, 0, 0);
178 __clipboardHeight = 0;
179 _Clipboard::GetInstance()->HidePopup();
182 else if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
184 // Only after opening Clipboard
185 if (__clipboardHeight != 0)
187 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
193 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
195 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
197 if (clipboardDim.height != 0)
199 SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
200 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
204 else if (pEv->atom == ECORE_X_ATOM_WM_STATE)
206 _ControlManager* pControlManager = _ControlManager::GetInstance();
207 if (!pControlManager)
209 return ECORE_CALLBACK_PASS_ON;
212 int winCount = pControlManager->GetWindowCount();
214 for (int i = 0; i < winCount; i++)
216 _Window* pWindow = pControlManager->GetWindow(i);
222 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
223 if (win != targetWin)
228 if (pWindow->IsOrientationRoot() == true)
230 _Frame* pFrame = static_cast<_Frame*>(pWindow);
232 Ecore_X_Window_State_Hint state = ecore_x_icccm_state_get(targetWin);
235 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
238 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
239 pFrame->OnFrameMinimized();
241 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
242 pFrame->OnFrameRestored();
253 return ECORE_CALLBACK_PASS_ON;
257 OnWindowVisibilityChanged(void* pData, int type, void* pEvent)
259 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
260 SysTryReturn(NID_UI, pEvent, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
262 Ecore_X_Event_Window_Visibility_Change* pE = (Ecore_X_Event_Window_Visibility_Change*) pEvent;
263 _ControlManager* pControlManager = _ControlManager::GetInstance();
265 int count = pControlManager->GetWindowCount();
267 _Window* pWindow = null;
270 for (int i = 0; i < count; i++)
272 pWindow = pControlManager->GetWindow(i);
275 NativeWindowHandle handle = pWindow->GetNativeHandle();
276 if (handle == pE->win)
284 Tizen::Base::Collection::ArrayList* pArgs = null;
285 String* pType = null;
286 Integer* pObscured = null;
290 const _Control* pDestination = pWindow;
292 pArgs = new (std::nothrow) Tizen::Base::Collection::ArrayList;
293 SysTryReturn(NID_UI, pArgs, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
295 result r = pArgs->Construct();
296 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
298 pType = new (std::nothrow) String(L"VisibilityEvent");
299 r = pArgs->Add(*pType);
300 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
302 pObscured = new (std::nothrow) Integer(pE->fully_obscured);
303 r = pArgs->Add(*pObscured);
304 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
306 _UiNotificationEvent event(pDestination->GetHandle(), pArgs);
308 r = _UiEventManager::GetInstance()->SendEvent(event);
311 return ECORE_CALLBACK_RENEW;
314 pArgs->RemoveAll(true);
331 OnWindowShown(void* pData, int type, void* pEvent)
333 return ECORE_CALLBACK_PASS_ON;
337 OnAccessibilitySettingMessageReceived(void* pData, int type, void* pEvent)
339 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
340 if (pClientEvent->message_type == __atomAccessibility)
342 if ((Eina_Bool)pClientEvent->data.l[0])
344 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", true);
345 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", true);
346 SysLog(NID_UI, "Accessibility Screen reader is activated.");
351 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", false);
352 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", false);
353 SysLog(NID_UI, "Accessibility Screen reader is deactivated.");
356 return ECORE_CALLBACK_PASS_ON;
360 OnClientMessageReceived(void* pData, int type, void* pEvent)
362 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
363 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
365 _ControlManager* pControlManager = _ControlManager::GetInstance();
366 if (!pControlManager)
368 return ECORE_CALLBACK_RENEW;
371 if (pClientEvent->message_type == __atomRotateRootAngle)
373 int angle = pClientEvent->data.l[0];
375 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
377 pControlManager->OnWindowRotated(angle);
380 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
383 int winCount = pControlManager->GetWindowCount();
384 for (int i = 0; i < winCount; i++)
386 _Window* pWindow = pControlManager->GetWindow(i);
392 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
394 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
403 return ECORE_CALLBACK_RENEW;
408 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
410 SysLog(NID_UI, "Accessibility action : Move next");
411 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
413 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
415 SysLog(NID_UI, "Accessibility action : Move next");
416 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
418 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
420 SysLog(NID_UI, "Accessibility action : Move previous");
421 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
423 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
425 SysLog(NID_UI, "Accessibility action : Move previous");
426 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
428 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
430 SysLog(NID_UI, "Accessibility action : Activate");
431 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
433 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
435 x = (Evas_Coord)pClientEvent->data.l[2];
436 y = (Evas_Coord)pClientEvent->data.l[3];
437 SysLog(NID_UI, "Accessibility action : Read");
438 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
440 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
442 SysLog(NID_UI, "Accessibility action : value increased");
443 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
445 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
447 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
448 x = (Evas_Coord)pClientEvent->data.l[3];
449 y = (Evas_Coord)pClientEvent->data.l[4];
450 if (pClientEvent->data.l[2] == 0)
452 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
454 else if (pClientEvent->data.l[2] == 1)
456 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
458 else if (pClientEvent->data.l[2] == 2)
460 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
463 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
465 SysLog(NID_UI, "Accessibility action : value decreased");
466 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
470 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
472 SysLog(NID_UI, "[Ime Rotation]");
474 _Window* pWindow = pControlManager->GetCurrentFrame();
477 NativeWindowHandle handle = pWindow->GetNativeHandle();
479 if (pClientEvent->win == handle)
481 int angle = pClientEvent->data.l[1];
482 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
484 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
488 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
491 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
493 if (pCurrentFormImpl)
495 pCurrentFormImpl->UpdateOrientation(angle);
499 pFrameImpl->UpdateOrientation(angle);
507 return ECORE_CALLBACK_RENEW;
520 _CLIP_TYPE_SECONDARY,
521 _CLIP_TYPE_CLIPBOARD,
528 Ecore_X_Selection selection;
529 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
530 Eina_Bool (* clear)(void);
531 void (* request)(Ecore_X_Window window, const char* pTarget);
537 _ClipFormat requestedFormat;
538 char* pRetrievedBuffer;
543 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
544 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
545 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
551 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
565 _ATOM_TEXT_HTML_UTF8,
570 _ATOM_TEXT_PLAIN_UTF8,
579 ClipConverter convert;
580 ClipResponseHandler response;
581 ClipNotifyHandler notify;
585 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
586 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
588 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
589 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
590 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
591 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
592 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
593 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
594 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
596 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
597 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
598 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
599 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
600 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
601 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
603 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
605 _Atom __atomList[_ATOM_MAX];
606 _Clip __clipList[_CLIP_TYPE_MAX];
609 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
611 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
613 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
614 Ecore_X_Window window = pE->win;
616 _ClipType clipType = _CLIP_TYPE_SECONDARY;
617 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
619 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
621 return ECORE_CALLBACK_PASS_ON;
625 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
630 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
631 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
632 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
633 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
634 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
636 int index = *((int*) pData);
637 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
640 for (int i = 0; i < _ATOM_MAX; i++)
642 if (__clipList[index].format & __atomList[i].formats)
646 // Make the atom list to be possible to return data.
647 Ecore_X_Atom* pAtoms = null;
650 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
651 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
653 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
655 if (__clipList[index].format & __atomList[i].formats)
656 pAtoms[count++] = __atomList[i].atom;
663 *pType = ECORE_X_ATOM_ATOM;
670 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
672 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
673 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
674 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
676 int index = *((int*) pData);
677 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
678 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
680 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
682 *outData = strdup(__clipList[index].pBuffer);
683 *outSize = strlen(__clipList[index].pBuffer);
690 ConvertClipIntoHtml(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
692 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
693 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
694 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
696 int index = *((int*) pData);
697 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
698 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
700 if (__clipList[index].format & _CLIP_FORMAT_HTML)
702 *outData = strdup(__clipList[index].pBuffer);
703 *outSize = strlen(__clipList[index].pBuffer);
710 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
716 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
718 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
719 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
720 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
722 int index = *((int*) pData);
723 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
724 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
726 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
728 *outData = strdup(__clipList[index].pBuffer);
729 *outSize = strlen(__clipList[index].pBuffer);
736 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
742 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
748 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
754 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
756 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
758 _Clipboard* pClipboard = _Clipboard::GetInstance();
761 bool visible = pClipboard->IsPopupVisible();
765 pClipboard->FireEvent(0, null);
769 return ECORE_CALLBACK_PASS_ON;
773 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
775 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
777 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
780 for (i = 0; i < _CLIP_TYPE_MAX; i++)
782 if (__clipList[i].selection == pE->selection)
788 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
790 _Clip* pClip = __clipList + i;
791 for (i = 0; i < _ATOM_MAX; i++)
793 if (!strcmp(pE->target, __atomList[i].pName))
795 if (__atomList[i].notify)
797 __atomList[i].notify(pClip, pE);
802 return ECORE_CALLBACK_PASS_ON;
806 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
808 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
809 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
811 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
812 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
814 _ControlManager* pControlManager = _ControlManager::GetInstance();
815 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
817 _Window* pWindow = pControlManager->GetClipboardOwner();
818 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
820 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
821 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
823 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
824 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
826 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
827 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
829 Ecore_X_Atom dataType = 0;
830 char* pBuffer = null;
831 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
835 const char* pHtmlAtomName = "text/html;charset=utf-8";
836 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
838 if (dataType == htmlType)
840 pClip->request(window, pHtmlAtomName);
841 return ECORE_CALLBACK_PASS_ON;
845 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
846 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
849 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
851 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
853 if (!(__atomList[j].formats & pClip->requestedFormat))
858 for (i = 0; i < pTargets->data.length; i++)
860 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
862 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
864 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
869 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
875 return ECORE_CALLBACK_PASS_ON;
878 pClip->request(window, __atomList[j].pName);
879 return ECORE_CALLBACK_PASS_ON;
883 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
885 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
886 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
888 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
889 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
891 pClip->bufferLength = (int) pData->length;
893 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
896 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
897 pStr[pClip->bufferLength] = '\0';
901 SysLog(NID_UI, "[Clipboard] pStr is null.");
905 pClip->pRetrievedBuffer = pStr;
907 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
913 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
915 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
916 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
918 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
919 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
921 pClip->bufferLength = (int) pData->length;
923 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
926 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
927 pStr[pClip->bufferLength] = '\0';
931 SysLog(NID_UI, "[Clipboard] pStr is null.");
935 pClip->pRetrievedBuffer = pStr;
937 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
943 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
945 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
946 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
948 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
949 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
951 pClip->bufferLength = (int) pData->length;
953 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
956 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
957 pStr[pClip->bufferLength] = '\0';
961 SysLog(NID_UI, "[Clipboard] pStr is null.");
965 pClip->pRetrievedBuffer = pStr;
967 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
973 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
975 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
976 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
978 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
979 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
981 pClip->bufferLength = (int) pData->length;
983 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
986 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
987 pStr[pClip->bufferLength] = '\0';
991 SysLog(NID_UI, "[Clipboard] pStr is null.");
995 pClip->pRetrievedBuffer = pStr;
997 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
1003 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1005 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1006 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1008 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1009 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1011 pClip->bufferLength = (int) pData->length;
1013 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1016 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1017 pStr[pClip->bufferLength] = '\0';
1021 SysLog(NID_UI, "[Clipboard] pStr is null.");
1025 pClip->pRetrievedBuffer = pStr;
1027 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1033 namespace Tizen { namespace Ui
1037 _EcoreEvas::CreateInstanceN(void)
1039 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1040 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1042 result r = GetLastResult();
1043 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1045 SetLastResult(E_SUCCESS);
1054 _EcoreEvas::_EcoreEvas(void)
1055 : __pWindowVisibilityChanged(null)
1056 , __pWindowPropertyChanged(null)
1057 , __pWindowShown(null)
1058 , __pClientMessageReceived(null)
1059 , __pClearClip(null)
1060 , __pNotifyClip(null)
1061 , __pClipboardClosed(null)
1063 , __pForegroundWindow(null)
1065 , __changeBounds(true)
1066 , __openClipboard(false)
1068 int ret = appcore_unset_rotation_cb();
1069 SysLog(NID_UI, "[Window Manager Rotation] appcore_unset_rotation_cb = %d", ret);
1071 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1072 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1074 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1076 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1077 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnAccessibilitySettingMessageReceived, NULL);
1078 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1082 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1085 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1086 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1088 result r = InitializeAtomList();
1089 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1091 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1092 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1094 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1095 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1097 SetLastResult(E_SUCCESS);
1102 if (__pWindowVisibilityChanged)
1104 ecore_event_handler_del(__pWindowVisibilityChanged);
1105 __pWindowVisibilityChanged = null;
1110 ecore_event_handler_del(__pWindowShown);
1111 __pWindowShown = null;
1115 _EcoreEvas::~_EcoreEvas(void)
1117 if (__pWindowVisibilityChanged)
1119 ecore_event_handler_del(__pWindowVisibilityChanged);
1120 __pWindowVisibilityChanged = null;
1125 ecore_event_handler_del(__pWindowShown);
1126 __pWindowShown = null;
1129 if (__pClientMessageReceived)
1131 ecore_event_handler_del(__pClientMessageReceived);
1132 __pClientMessageReceived = null;
1135 for (int i = 0; i < _ATOM_MAX; i++)
1137 if (__atomList[i].atom)
1139 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1145 ecore_event_handler_del(__pClearClip);
1146 __pClearClip = null;
1151 ecore_event_handler_del(__pNotifyClip);
1152 __pNotifyClip = null;
1155 if (__pClipboardClosed)
1157 ecore_event_handler_del(__pClipboardClosed);
1158 __pClipboardClosed = null;
1161 if (__pWindowPropertyChanged)
1163 ecore_event_handler_del(__pWindowPropertyChanged);
1164 __pWindowPropertyChanged = null;
1167 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1171 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1173 // Set window bounds according to the rotation
1176 _EflLayer* pLayer = GetEflLayer(window);
1182 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1185 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1186 if (curOrientation == orientation)
1192 bool rotatePartial = true;
1194 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1197 FrameShowMode showMode = pFrame->GetShowMode(false);
1198 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1200 rotatePartial = false;
1204 _Window* pWindow = const_cast<_Window*>(&window);
1205 if (pWindow->IsLayoutChangable() == true)
1207 rotatePartial = false;
1210 Evas_Object* pWinObj = pLayer->GetElmWin();
1211 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1215 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1217 if (rotatePartial == false)
1219 if (rotateEvas == true)
1221 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1224 evas_object_move(pWinObj, 0, 0);
1226 if ((orientation == 0) || (orientation == 180))
1228 evas_object_resize(pWinObj, rootW, rootH);
1232 evas_object_resize(pWinObj, rootH, rootW);
1235 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
1239 if (rotateEvas == true)
1241 ecore_evas_rotation_set(pEcoreEvas, orientation);
1244 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1245 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1248 int winX = winBounds.x;
1249 int winY = winBounds.y;
1254 winX = rootW - winBounds.y - winBounds.height;
1259 winY = rootH - winBounds.x - winBounds.width;
1262 winX = rootW - winBounds.x - winBounds.width;
1263 winY = rootH - winBounds.y - winBounds.height;
1273 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1275 evas_object_move(pWinObj, winX, winY);
1277 if (ret == EINA_FALSE)
1279 evas_object_resize(pWinObj, winBounds.width, winBounds.height);
1280 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d, %d, %d).", win, orientation, winX, winY, winBounds.width, winBounds.height);
1284 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1290 _EcoreEvas::GetEflLayer(const _Window& window) const
1292 _RootVisualElement* pRootVisualElement = null;
1294 pRootVisualElement = window.GetRootVisualElement();
1295 if (!pRootVisualElement)
1297 SysLog(NID_UI, "The root visual element is null.");
1301 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1304 SysLog(NID_UI, "The efl layer is null.");
1312 _EcoreEvas::GetFloatingMode(void) const
1314 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1316 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1318 SetLastResult(E_SUCCESS);
1320 return (ret ? true : false);
1323 // [ToDo] Remove API
1325 _EcoreEvas::GetFloatingMode(const _Window& window) const
1327 _EflLayer* pLayer = GetEflLayer(window);
1328 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1330 Evas_Object* pWinObj = pLayer->GetElmWin();
1331 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1333 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1335 SetLastResult(E_SUCCESS);
1337 return (ret ? true : false);
1340 // [ToDo] Remove API
1342 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1346 // [ToDo] Remove API
1348 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1353 _EcoreEvas::GetActiveWindow(void)
1355 Ecore_X_Window* pRoots = null;
1356 Ecore_X_Window activeWin = 0;
1359 pRoots = ecore_x_window_root_list(&num);
1362 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1363 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1377 _EcoreEvas::GetProcessId(unsigned int window)
1380 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1382 if (ret != EINA_TRUE)
1391 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1393 ecore_x_icccm_transient_for_unset(ownee);
1394 ecore_x_icccm_transient_for_set(ownee, owner);
1396 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", ownee, owner);
1400 _EcoreEvas::ActivateWindow(const _Window& window)
1402 _EflLayer* pLayer = GetEflLayer(window);
1403 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1405 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1406 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1408 ecore_evas_activate(pEcoreEvas);
1410 NativeWindowHandle currentWindow = window.GetNativeHandle();
1411 unsigned int activeWindow = GetActiveWindow();
1412 int pid = GetProcessId(activeWindow);
1413 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1415 SetLastResult(E_SUCCESS);
1419 _EcoreEvas::MinimizeWindow(_Window& window)
1421 _EflLayer* pLayer = GetEflLayer(window);
1422 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1424 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1425 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1427 //ecore_evas_lower(pEcoreEvas);
1428 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1430 SetLastResult(E_SUCCESS);
1434 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1438 case _RENDER_BACKEND_SW:
1439 elm_config_preferred_engine_set("software_x11");
1441 case _RENDER_BACKEND_GL:
1442 elm_config_preferred_engine_set("opengl_x11");
1444 case _RENDER_BACKEND_DEFAULT:
1447 elm_config_preferred_engine_set(NULL);
1453 _EcoreEvas::GetRenderBackend(void)
1455 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1457 const char* pEngine = elm_config_preferred_engine_get();
1459 if (pEngine == NULL)
1461 backend = _RENDER_BACKEND_DEFAULT;
1463 else if (strcmp(pEngine, "software_x11") == 0)
1465 backend = _RENDER_BACKEND_SW;
1467 else if (strcmp(pEngine, "opengl_x11") == 0)
1469 backend = _RENDER_BACKEND_GL;
1476 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1478 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1479 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1481 Ecore_X_Atom dataType = 0;
1485 case _CLIP_FORMAT_TEXT:
1486 dataType = ecore_x_atom_get("UTF8_STRING");
1488 case _CLIP_FORMAT_IMAGE:
1489 dataType = ecore_x_atom_get("text/uri");
1491 case _CLIP_FORMAT_HTML:
1492 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1498 _ControlManager* pControlManager = _ControlManager::GetInstance();
1500 _Window* pWindow = pControlManager->GetClipboardOwner();
1506 _EflLayer* pLayer = GetEflLayer(*pWindow);
1512 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1515 SetCbhmItem(window, dataType, (char*)pChar);
1521 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1523 Ecore_X_Atom dataType = 0;
1525 _ControlManager* pControlManager = _ControlManager::GetInstance();
1527 _Window* pWindow = pControlManager->GetClipboardOwner();
1533 _EflLayer* pLayer = GetEflLayer(*pWindow);
1539 GetCbhmItem(index, &dataType, pData);
1541 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1542 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1544 *format = _CLIP_FORMAT_TEXT;
1546 else if (dataType == ecore_x_atom_get("text/uri"))
1548 *format = _CLIP_FORMAT_IMAGE;
1550 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1552 *format = _CLIP_FORMAT_HTML;
1560 // Convert markup to utf8.
1561 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1563 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1564 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1574 _EcoreEvas::GetClipCount(void) const
1576 _ControlManager* pControlManager = _ControlManager::GetInstance();
1578 _Window* pWindow = pControlManager->GetClipboardOwner();
1584 _EflLayer* pLayer = GetEflLayer(*pWindow);
1590 int count = GetCbhmItemCount();
1596 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1598 _ControlManager* pControlManager = _ControlManager::GetInstance();
1600 _Window* pWindow = pControlManager->GetClipboardOwner();
1606 _EflLayer* pLayer = GetEflLayer(*pWindow);
1612 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1615 ecore_x_selection_secondary_set(window, "", 1);
1617 if (_CLIP_FORMAT_IMAGE & clipFormats)
1619 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1623 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1626 __openClipboard = true;
1630 _EcoreEvas::CloseClipboard(void)
1632 _ControlManager* pControlManager = _ControlManager::GetInstance();
1634 _Window* pWindow = pControlManager->GetClipboardOwner();
1640 _EflLayer* pLayer = GetEflLayer(*pWindow);
1646 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1649 __openClipboard = false;
1650 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1654 _EcoreEvas::IsClipboardOpened(void)
1656 return __openClipboard;
1660 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1662 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1663 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1665 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1666 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1668 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1674 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1676 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1677 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1679 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1680 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1682 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1688 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1690 _EflLayer* pLayer = GetEflLayer(window);
1691 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1693 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1694 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1696 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1700 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1704 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1711 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1713 _EflLayer* pLayer = GetEflLayer(window);
1714 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1716 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1717 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1719 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1720 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1722 bool showState = true;
1723 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1727 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1735 // [ToDo] Remove API
1737 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1739 _EflLayer* pLayer = GetEflLayer(window);
1740 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1742 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1743 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1745 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1746 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1754 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1755 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1757 SetLastResult(E_SUCCESS);
1759 return Rectangle(x, y, width, height);
1762 // [ToDo] Remove API
1764 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1766 _EflLayer* pLayer = GetEflLayer(window);
1767 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1769 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1770 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1772 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1774 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1777 case _INDICATOR_OPACITY_UNKNOWN:
1778 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1780 case _INDICATOR_OPACITY_OPAQUE:
1781 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1783 case _INDICATOR_OPACITY_TRANSLUCENT:
1784 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1786 case _INDICATOR_OPACITY_TRANSPARENT:
1787 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1790 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1791 return E_INVALID_ARG;
1794 ecore_x_e_illume_indicator_opacity_set(win, mode);
1799 // [ToDo] Remove API
1801 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1803 _EflLayer* pLayer = GetEflLayer(window);
1804 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1806 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1807 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1809 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1810 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1812 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1815 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1816 opacity = _INDICATOR_OPACITY_UNKNOWN;
1818 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1819 opacity = _INDICATOR_OPACITY_OPAQUE;
1821 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1822 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1824 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1825 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1828 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1829 return _INDICATOR_OPACITY_UNKNOWN;
1832 SetLastResult(E_SUCCESS);
1838 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
1840 _EflLayer* pLayer = GetEflLayer(window);
1841 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1843 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1844 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1846 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1848 Eina_Bool acceptsFocus;
1849 Ecore_X_Window_State_Hint initialState;
1850 Ecore_X_Pixmap iconPixmap;
1851 Ecore_X_Pixmap iconMask;
1852 Ecore_X_Window iconWindow;
1853 Ecore_X_Window windowGroup;
1856 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1857 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
1861 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
1863 _EflLayer* pLayer = GetEflLayer(window);
1864 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1866 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1867 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1869 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1871 Eina_Bool acceptsFocus;
1872 Ecore_X_Window_State_Hint initialState;
1873 Ecore_X_Pixmap iconPixmap;
1874 Ecore_X_Pixmap iconMask;
1875 Ecore_X_Window iconWindow;
1876 Ecore_X_Window windowGroup;
1879 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1881 return (acceptsFocus ? true : false);
1885 _EcoreEvas::SetWindowName(const _Window& window, const Tizen::Base::String& name)
1887 _EflLayer* pLayer = GetEflLayer(window);
1888 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1890 Evas_Object* pWinObj = pLayer->GetElmWin();
1891 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1893 const char* windowName = _StringConverter::CopyToCharArrayN(name);
1896 elm_win_title_set(pWinObj, windowName);
1898 delete[] windowName;
1903 _EcoreEvas::SetWindowType(const _Window& window, int winType)
1905 _EflLayer* pLayer = GetEflLayer(window);
1906 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1908 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1909 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1911 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1913 if (winType == _WINDOW_TYPE_SUB)
1915 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
1920 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
1922 _EflLayer* pLayer = GetEflLayer(window);
1923 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1925 Evas_Object* pWinObj = pLayer->GetElmWin();
1926 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1928 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
1933 // [ToDo] Remove API
1935 _EcoreEvas::GetEvas(void) const
1937 SysLog(NID_UI, "Do not use.");
1938 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1944 _EflLayer* pLayer = GetEflLayer(*pWindow);
1950 return pLayer->GetEvas();
1953 // [ToDo] Remove API
1955 _EcoreEvas::GetEcoreEvas(void) const
1957 SysLog(NID_UI, "Do not use.");
1958 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1964 _EflLayer* pLayer = GetEflLayer(*pWindow);
1970 return pLayer->GetEcoreEvas();
1973 // [ToDo] Remove API
1975 _EcoreEvas::GetWindowObject(void) const
1977 SysLog(NID_UI, "Do not use.");
1978 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1984 _EflLayer* pLayer = GetEflLayer(*pWindow);
1990 return pLayer->GetElmWin();
1993 // [ToDo] Remove API
1995 _EcoreEvas::GetXWindow(void) const
1997 SysLog(NID_UI, "Do not use.");
1998 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2004 _EflLayer* pLayer = GetEflLayer(*pWindow);
2010 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2016 _EcoreEvas::AllowSetWindowBounds(bool allow)
2018 __changeBounds = allow;
2022 _EcoreEvas::IsWindowVisible(const _Window& window)
2024 _EflLayer* pLayer = GetEflLayer(window);
2025 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2027 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2028 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2030 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2032 int ret = ecore_x_window_visible_get(win);
2043 // [ToDo] Remove API
2045 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2048 _EflLayer* pLayer = GetEflLayer(window);
2049 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2051 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2052 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2054 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2055 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2057 unsigned int val[3];
2058 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2069 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2073 // [ToDo] Remove API
2075 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2078 _EflLayer* pLayer = GetEflLayer(window);
2079 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2081 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2082 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2084 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2085 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2087 unsigned int val[3];
2088 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2104 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
2106 _EflLayer* pLayer = GetEflLayer(window);
2107 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2109 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2110 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2112 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2113 ecore_x_icccm_transient_for_unset(win);
2115 if (level == _WINDOW_LEVEL_NORMAL)
2117 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2119 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2121 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2122 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2124 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2126 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2127 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2130 SetLastResult(E_SUCCESS);
2134 _EcoreEvas::GetWindowLevel(const _Window& window) const
2136 _EflLayer* pLayer = GetEflLayer(window);
2137 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2139 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2140 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2142 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2144 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2145 ecore_x_netwm_window_type_get(win, &type);
2147 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2148 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2150 winLevel = _WINDOW_LEVEL_NORMAL;
2152 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2154 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2156 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2158 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2160 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2162 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2166 SetLastResult(E_SUCCESS);
2172 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2174 if (__changeBounds == false)
2179 _EflLayer* pLayer = GetEflLayer(window);
2180 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2182 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2183 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2185 Evas_Object* pWinObject = pLayer->GetElmWin();
2186 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2188 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2190 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2192 _Window* pWindow = const_cast<_Window*>(&window);
2194 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2201 _ControlManager* pControlManager = _ControlManager::GetInstance();
2202 if (pControlManager)
2204 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2207 int ownerRotate = GetWindowRotation(*pCurFrame);
2208 if (ownerRotate != rotate)
2216 int winX = winBounds.x;
2217 int winY = winBounds.y;
2221 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2226 winX = rootW - winBounds.y - winBounds.height;
2231 winY = rootH - winBounds.x - winBounds.width;
2234 winX = rootW - winBounds.x - winBounds.width;
2235 winY = rootH - winBounds.y - winBounds.height;
2245 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2247 evas_object_move(pWinObject, winX, winY);
2249 if (ret == EINA_FALSE)
2251 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2252 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d, %d, %d).", win, rotate, winX, winY, winBounds.width, winBounds.height);
2256 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2259 SetLastResult(E_SUCCESS);
2263 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2265 if (__changeBounds == false)
2270 _EflLayer* pLayer = GetEflLayer(window);
2271 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2273 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2274 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2276 Evas_Object* pWinObject = pLayer->GetElmWin();
2277 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2279 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2280 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2282 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2284 _Window* pWindow = const_cast<_Window*>(&window);
2286 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2293 _ControlManager* pControlManager = _ControlManager::GetInstance();
2294 if (pControlManager)
2296 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2299 int ownerRotate = GetWindowRotation(*pCurFrame);
2300 if (ownerRotate != rotate)
2308 int winX = winBounds.x;
2309 int winY = winBounds.y;
2313 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2318 winX = rootW - winBounds.y - winBounds.height;
2323 winY = rootH - winBounds.x - winBounds.width;
2326 winX = rootW - winBounds.x - winBounds.width;
2327 winY = rootH - winBounds.y - winBounds.height;
2337 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2339 evas_object_move(pWinObject, winX, winY);
2341 if (ret == EINA_FALSE)
2343 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2344 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d, %d, %d).", win, rotate, winX, winY, winBounds.width, winBounds.height);
2348 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2351 SetLastResult(E_SUCCESS);
2355 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2357 _EflLayer* pLayer = GetEflLayer(window);
2358 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2360 Evas_Object* pWinObj = pLayer->GetElmWin();
2361 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2363 pLayer->SetShowState(visibleState);
2365 SetLastResult(E_SUCCESS);
2369 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2371 _Window* pOwnerWindow = owner.GetRootWindow();
2372 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2374 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2375 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2377 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2378 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2380 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2381 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2383 Ecore_X_Window_Type type;
2384 ecore_x_netwm_window_type_get(owneeWin, &type);
2385 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2387 ecore_x_icccm_transient_for_unset(owneeWin);
2388 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2389 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2393 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] Skip to transient_for_set", owneeWin);
2397 // 1. IsLayoutChangable : true
2398 // 2. IsRotationSynchronized : true
2401 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2403 int* rotations = null;
2404 unsigned int count = 0;
2405 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2411 SetWindowAvailabledRotation(ownee, rotations, count);
2416 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2417 if (preferredRoation == true)
2419 int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2420 SetWindowPreferredRotation(ownee, preferredRotation);
2424 SetWindowPreferredRotation(ownee, -1);
2429 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2430 SetWindowPreferredRotation(ownee, ownerRotation);
2433 SetLastResult(E_SUCCESS);
2437 _EcoreEvas::GetWindowRotation(const _Window& window)
2439 _EflLayer* pLayer = GetEflLayer(window);
2445 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2450 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation)
2452 _EflLayer* pLayer = GetEflLayer(window);
2458 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2459 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
2460 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2462 _Window* pWindow = const_cast<_Window*>(&window);
2467 pWindow->SetPreferredRotation(false);
2471 pWindow->SetPreferredRotation(true);
2477 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count)
2479 _EflLayer* pLayer = GetEflLayer(window);
2485 // Skip available_set if there is not change
2487 int* prevRotations = null;
2488 unsigned int prevCount = 0;
2489 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2490 free(prevRotations);
2494 if (prevCount == count)
2500 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2501 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window available rotation(%d).", win, count);
2502 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2506 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2508 _EflLayer* pLayer = GetEflLayer(window);
2514 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2518 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2520 _EflLayer* pLayer = GetEflLayer(window);
2526 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2528 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2529 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set rotation bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2530 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2534 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2536 _EflLayer* pLayer = GetEflLayer(window);
2542 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2543 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2545 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2546 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set rotation bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2547 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2550 // [ToDo] Remove API
2552 _EcoreEvas::GetFrame(void) const
2554 SysLog(NID_UI, "Do not use.");
2558 // [ToDo] Remove API
2560 _EcoreEvas::GetRootVisualElement(void)const
2562 SysLog(NID_UI, "Do not use.");
2566 // [ToDo] Remove API
2568 _EcoreEvas::SetFrame(const _Control& control)
2570 SysLog(NID_UI, "Do not use.");
2571 __pFrame = const_cast<_Control*>(&control);
2575 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2577 Ecore_X_Window cbhmWin = GetCbhmWindow();
2578 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2579 Ecore_X_Atom atomItemType = 0;
2581 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2584 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2585 if (atomItemType == x_atom_cbhm_error)
2602 *pDataType = atomItemType;
2612 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2614 Eina_Bool acc = elm_config_access_get();
2618 void* _GetEcoreEvasHandle(void)
2620 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2621 if (pEcoreEvasMgr == null)
2626 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2627 if (pUiEcoreEvas == null)
2632 return (void*)pUiEcoreEvas->GetEcoreEvas();
2635 void* _GetEvasHandle(void)
2637 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2638 if (pEcoreEvasMgr == null)
2643 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2644 if (pUiEcoreEvas == null)
2649 return (void*)pUiEcoreEvas->GetEvas();
2653 _EcoreEvas::InitializeAtomList(void)
2655 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2656 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2657 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2658 __atomList[_ATOM_TARGETS].response = RequestClip;
2659 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2660 __atomList[_ATOM_TARGETS].atom = 0;
2662 __atomList[_ATOM_ATOM].pName = "ATOM";
2663 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2664 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2665 __atomList[_ATOM_ATOM].response = RequestClip;
2666 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2667 __atomList[_ATOM_ATOM].atom = 0;
2669 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2670 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2671 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2672 __atomList[_ATOM_XELM].response = null;
2673 __atomList[_ATOM_XELM].notify = NotifyEdje;
2674 __atomList[_ATOM_XELM].atom = 0;
2676 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2677 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2678 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2679 __atomList[_ATOM_TEXT_URI].response = null;
2680 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2681 __atomList[_ATOM_TEXT_URI].atom = 0;
2683 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2684 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2685 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2686 __atomList[_ATOM_TEXT_URILIST].response = null;
2687 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2688 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2690 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2691 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2692 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2693 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2694 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2695 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2697 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2698 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2699 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2700 __atomList[_ATOM_IMAGE_PNG].response = null;
2701 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2702 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2704 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2705 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2706 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2707 __atomList[_ATOM_IMAGE_JPEG].response = null;
2708 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2709 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2711 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2712 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2713 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2714 __atomList[_ATOM_IMAGE_BMP].response = null;
2715 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2716 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2718 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2719 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2720 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2721 __atomList[_ATOM_IMAGE_GIF].response = null;
2722 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2723 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2725 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2726 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2727 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2728 __atomList[_ATOM_IMAGE_TIFF].response = null;
2729 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2730 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2732 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2733 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2734 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2735 __atomList[_ATOM_IMAGE_SVG].response = null;
2736 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2737 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2739 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2740 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2741 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2742 __atomList[_ATOM_IMAGE_XPM].response = null;
2743 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2744 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2746 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2747 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2748 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2749 __atomList[_ATOM_IMAGE_TGA].response = null;
2750 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2751 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2753 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2754 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2755 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2756 __atomList[_ATOM_IMAGE_PPM].response = null;
2757 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2758 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2760 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2761 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2762 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2763 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2764 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2765 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2767 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2768 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2769 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2770 __atomList[_ATOM_TEXT_HTML].response = null;
2771 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2772 __atomList[_ATOM_TEXT_HTML].atom = 0;
2774 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2775 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2776 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2777 __atomList[_ATOM_STRING_UTF8].response = null;
2778 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2779 __atomList[_ATOM_STRING_UTF8].atom = 0;
2781 __atomList[_ATOM_STRING].pName = "STRING";
2782 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2783 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2784 __atomList[_ATOM_STRING].response = null;
2785 __atomList[_ATOM_STRING].notify = NotifyText;
2786 __atomList[_ATOM_STRING].atom = 0;
2788 __atomList[_ATOM_TEXT].pName = "TEXT";
2789 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2790 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2791 __atomList[_ATOM_TEXT].response = null;
2792 __atomList[_ATOM_TEXT].notify = null;
2793 __atomList[_ATOM_TEXT].atom = 0;
2795 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2796 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2797 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2798 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2799 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2800 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2802 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2803 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2804 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2805 __atomList[_ATOM_TEXT_PLAIN].response = null;
2806 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2807 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2809 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2810 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2811 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2812 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2813 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2814 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2815 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2816 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2817 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
2819 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
2820 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
2821 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
2822 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
2823 __clipList[_CLIP_TYPE_SECONDARY].active = false;
2824 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
2825 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
2826 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
2827 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
2829 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
2830 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
2831 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
2832 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
2833 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
2834 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
2835 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
2836 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
2837 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
2839 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
2840 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
2841 __clipList[_CLIP_TYPE_XDND].active = false;
2842 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
2843 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
2844 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
2845 __clipList[_CLIP_TYPE_XDND].completed = false;
2847 for (int i = 0; i < _ATOM_MAX; i++)
2849 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
2850 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
2852 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
2855 result r = E_SUCCESS;
2857 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
2858 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2860 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
2861 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2863 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
2864 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2866 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
2867 __atomAccessibility = ecore_x_atom_get("_E_MOD_ACC_SCR_READER_");
2872 for (int i = 0; i < _ATOM_MAX; i++)
2874 if (__atomList[i].atom)
2876 ecore_x_selection_converter_atom_del(__atomList[i].atom);
2882 ecore_event_handler_del(__pClearClip);
2883 __pClearClip = null;
2888 ecore_event_handler_del(__pNotifyClip);
2889 __pNotifyClip = null;
2892 if (__pClipboardClosed)
2894 ecore_event_handler_del(__pClipboardClosed);
2895 __pClipboardClosed = null;
2902 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
2904 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
2905 (_CLIP_FORMAT_MARKUP & clipFormat) ||
2906 (_CLIP_FORMAT_IMAGE & clipFormat) ||
2907 (_CLIP_FORMAT_VCARD & clipFormat) ||
2908 (_CLIP_FORMAT_HTML & clipFormat));
2912 _EcoreEvas::GetCbhmWindow(void) const
2914 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
2915 Ecore_X_Window cbhmWin = 0;
2917 unsigned char* pBuf = NULL;
2919 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
2923 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
2935 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
2937 Ecore_X_Window cbhmWin = GetCbhmWindow();
2938 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
2940 if (!cbhmWin || !atomCbhmMsg)
2945 XClientMessageEvent m;
2946 memset(&m, 0, sizeof(m));
2947 m.type = ClientMessage;
2948 m.display = (Display*)ecore_x_display_get();
2950 m.message_type = atomCbhmMsg;
2952 snprintf(m.data.b, 20, "%s", pMsg);
2954 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
2965 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
2967 Ecore_X_Window cbhmWin = GetCbhmWindow();
2968 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
2971 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
2974 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
2983 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
2985 unsigned char* pData = null;
3004 long unsigned int numRet = 0;
3005 long unsigned int bytes = 0;
3009 unsigned char* pPropRet = null;
3010 Ecore_X_Atom typeRet;
3012 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
3013 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3025 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3034 for (i = 0; i < numRet; i++)
3035 (pData)[i] = pPropRet[i];
3038 for (i = 0; i < numRet; i++)
3039 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3042 for (i = 0; i < numRet; i++)
3043 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3059 *pDataType = typeRet;
3066 _EcoreEvas::GetCbhmItemCount(void) const
3071 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3072 Ecore_X_Window cbhmWin = GetCbhmWindow();
3074 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3086 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3095 *(int*)pDataType = 0;
3098 Ecore_X_Window cbhmWin = GetCbhmWindow();
3102 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3103 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3104 Ecore_X_Atom atomItemType = 0;
3106 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3120 *pDataType = atomItemType;
3123 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3124 if (atomItemType == x_atom_cbhm_error)
3142 // [ToDo] Remove API
3144 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3146 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3149 // [ToDo] Remove API
3151 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3153 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3156 // [ToDo] Remove API
3157 _OSP_EXPORT_ unsigned int
3158 _GetActiveWindow(void)
3160 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3163 // [ToDo] Remove API
3165 _GetProcessId(unsigned int window)
3167 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);