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"
64 #include "FUiAnim_DisplayContextImpl.h"
65 #include "FUiAnimDisplayContext.h"
67 using namespace Tizen::Base;
68 using namespace Tizen::Base::Runtime;
69 using namespace Tizen::App;
70 using namespace Tizen::Graphics;
71 using namespace Tizen::Ui;
72 using namespace Tizen::Ui::Animations;
73 using namespace Tizen::Ui::Controls;
75 #define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN"
76 #define ATOM_CBHM_MSG "CBHM_MSG"
77 #define ATOM_CBHM_COUNT_GET "CBHM_cCOUNT"
78 #define ATOM_CBHM_SERIAL_NUMBER "CBHM_SERIAL_NUMBER"
79 #define ATOM_CBHM_ERROR "CBHM_ERROR"
80 #define ATOM_CBHM_ITEM "CBHM_ITEM"
81 #define ATOM_CBHM_SET_ITEM "SET_ITEM"
82 #define ATOM_CBHM_CLIPBOARD_SHOW_ALL "show1"
83 #define ATOM_CBHM_CLIPBOARD_SHOW "show0"
84 #define ATOM_CBHM_CLIPBOARD_HIDE "cbhm_hide"
85 #define ATOM_CBHM_SELECTED_ITEM "CBHM_SELECTED_ITEM"
86 #define ATOM_ROTATE_AUTO "_E_WINDOW_ROTATION_SUPPORTED"
88 namespace Tizen { namespace Ui
90 static _EcoreEvas* _pEvas = null;
96 Ecore_X_Atom __atomRotateRootAngle = 0;
98 int __clipboardHeight = 0;
101 OnWindowStateChanged(Ecore_Evas* pEcoreEvas)
103 _ControlManager* pControlManager = _ControlManager::GetInstance();
104 if (!pControlManager)
109 Ecore_X_Window targetWin = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
111 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] OnWindowStateChanged is called.", targetWin);
113 int winCount = pControlManager->GetWindowCount();
114 for (int i = 0; i < winCount; i++)
116 _Window* pWindow = pControlManager->GetWindow(i);
122 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
124 if (win == targetWin)
126 pWindow->OnWindowStateChanged();
134 OnWindowPropertyChanged(void* pData, int type, void* pEvent)
136 Ecore_X_Event_Window_Property* pEv = (Ecore_X_Event_Window_Property*)pEvent;
139 return ECORE_CALLBACK_PASS_ON;
142 Ecore_X_Window targetWin = pEv->win;
145 return ECORE_CALLBACK_PASS_ON;
148 if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
150 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
151 Ecore_X_Illume_Clipboard_State clipboardState = ecore_x_e_illume_clipboard_state_get(zone);
153 if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
159 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
161 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
163 if (__clipboardHeight == 0)
165 SysLog(NID_UI, "[Clipboard] Clipboard is opened. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
166 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_OPENED, clipboardDim.width, clipboardDim.height);
167 __clipboardHeight = clipboardDim.height;
171 // SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
172 // _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
175 else if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
177 SysLog(NID_UI, "[Clipboard] Clipboard is closed.");
178 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_CLOSED, 0, 0);
179 __clipboardHeight = 0;
180 _Clipboard::GetInstance()->HidePopup();
183 else if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
185 // Only after opening Clipboard
186 if (__clipboardHeight != 0)
188 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
194 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
196 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
198 if (clipboardDim.height != 0)
200 SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
201 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
205 else if (pEv->atom == ECORE_X_ATOM_WM_STATE)
207 _ControlManager* pControlManager = _ControlManager::GetInstance();
208 if (!pControlManager)
210 return ECORE_CALLBACK_PASS_ON;
213 int winCount = pControlManager->GetWindowCount();
215 for (int i = 0; i < winCount; i++)
217 _Window* pWindow = pControlManager->GetWindow(i);
223 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
224 if (win != targetWin)
229 if (pWindow->IsOrientationRoot() == true)
231 _Frame* pFrame = static_cast<_Frame*>(pWindow);
232 _DisplayContextImpl* pContext = _DisplayContextImpl::GetInstance(*pFrame->GetDisplayContext());
233 _EflLayer* pLayer = static_cast<_EflLayer*>(pContext->GetNativeLayer());
236 Ecore_X_Window_State_Hint state = ecore_x_icccm_state_get(targetWin);
239 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
240 pLayer->SetRenderNeeded(false);
243 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
244 pLayer->SetRenderNeeded(false);
245 pFrame->OnFrameMinimized();
247 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
248 pLayer->SetRenderNeeded(true);
249 pFrame->OnFrameRestored();
260 return ECORE_CALLBACK_PASS_ON;
264 OnWindowVisibilityChanged(void* pData, int type, void* pEvent)
266 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
267 SysTryReturn(NID_UI, pEvent, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
269 Ecore_X_Event_Window_Visibility_Change* pE = (Ecore_X_Event_Window_Visibility_Change*) pEvent;
270 _ControlManager* pControlManager = _ControlManager::GetInstance();
272 int count = pControlManager->GetWindowCount();
274 _Window* pWindow = null;
277 for (int i = 0; i < count; i++)
279 pWindow = pControlManager->GetWindow(i);
282 NativeWindowHandle handle = pWindow->GetNativeHandle();
283 if (handle == pE->win)
291 Tizen::Base::Collection::ArrayList* pArgs = null;
292 String* pType = null;
293 Integer* pObscured = null;
297 const _Control* pDestination = pWindow;
299 pArgs = new (std::nothrow) Tizen::Base::Collection::ArrayList;
300 SysTryReturn(NID_UI, pArgs, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
302 result r = pArgs->Construct();
303 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
305 pType = new (std::nothrow) String(L"VisibilityEvent");
306 r = pArgs->Add(*pType);
307 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
309 pObscured = new (std::nothrow) Integer(pE->fully_obscured);
310 r = pArgs->Add(*pObscured);
311 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
313 _UiNotificationEvent event(pDestination->GetHandle(), pArgs);
315 r = _UiEventManager::GetInstance()->SendEvent(event);
318 return ECORE_CALLBACK_RENEW;
321 pArgs->RemoveAll(true);
338 OnWindowShown(void* pData, int type, void* pEvent)
340 return ECORE_CALLBACK_PASS_ON;
344 OnClientMessageReceived(void* pData, int type, void* pEvent)
346 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
347 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
349 _ControlManager* pControlManager = _ControlManager::GetInstance();
350 if (!pControlManager)
352 return ECORE_CALLBACK_RENEW;
355 if (pClientEvent->message_type == __atomRotateRootAngle)
357 int angle = pClientEvent->data.l[0];
359 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
361 pControlManager->OnWindowRotated(angle);
364 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
367 int winCount = pControlManager->GetWindowCount();
368 for (int i = 0; i < winCount; i++)
370 _Window* pWindow = pControlManager->GetWindow(i);
376 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
378 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
387 return ECORE_CALLBACK_RENEW;
392 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
394 SysLog(NID_UI, "Accessibility action : Move next");
395 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
397 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
399 SysLog(NID_UI, "Accessibility action : Move next");
400 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
402 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
404 SysLog(NID_UI, "Accessibility action : Move previous");
405 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
407 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
409 SysLog(NID_UI, "Accessibility action : Move previous");
410 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
412 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
414 SysLog(NID_UI, "Accessibility action : Activate");
415 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
417 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
419 x = (Evas_Coord)pClientEvent->data.l[2];
420 y = (Evas_Coord)pClientEvent->data.l[3];
421 SysLog(NID_UI, "Accessibility action : Read");
422 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
424 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
426 SysLog(NID_UI, "Accessibility action : value increased");
427 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
429 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
431 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
432 x = (Evas_Coord)pClientEvent->data.l[3];
433 y = (Evas_Coord)pClientEvent->data.l[4];
434 if (pClientEvent->data.l[2] == 0)
436 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
438 else if (pClientEvent->data.l[2] == 1)
440 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
442 else if (pClientEvent->data.l[2] == 2)
444 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
447 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
449 SysLog(NID_UI, "Accessibility action : value decreased");
450 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
454 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
456 SysLog(NID_UI, "[Ime Rotation]");
458 _Window* pWindow = pControlManager->GetCurrentFrame();
461 NativeWindowHandle handle = pWindow->GetNativeHandle();
463 if (pClientEvent->win == handle)
465 int angle = pClientEvent->data.l[1];
466 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
468 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
472 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
475 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
477 if (pCurrentFormImpl)
479 pCurrentFormImpl->UpdateOrientation(angle);
483 pFrameImpl->UpdateOrientation(angle);
491 return ECORE_CALLBACK_RENEW;
504 _CLIP_TYPE_SECONDARY,
505 _CLIP_TYPE_CLIPBOARD,
512 Ecore_X_Selection selection;
513 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
514 Eina_Bool (* clear)(void);
515 void (* request)(Ecore_X_Window window, const char* pTarget);
521 _ClipFormat requestedFormat;
522 char* pRetrievedBuffer;
527 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
528 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
529 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
535 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
549 _ATOM_TEXT_HTML_UTF8,
554 _ATOM_TEXT_PLAIN_UTF8,
563 ClipConverter convert;
564 ClipResponseHandler response;
565 ClipNotifyHandler notify;
569 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
570 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
572 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
573 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
574 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
575 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
576 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
577 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
578 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
580 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
581 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
582 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
583 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
584 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
585 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
587 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
589 _Atom __atomList[_ATOM_MAX];
590 _Clip __clipList[_CLIP_TYPE_MAX];
593 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
595 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
597 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
598 Ecore_X_Window window = pE->win;
600 _ClipType clipType = _CLIP_TYPE_SECONDARY;
601 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
603 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
605 return ECORE_CALLBACK_PASS_ON;
609 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
614 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
615 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
616 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
617 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
618 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
620 int index = *((int*) pData);
621 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
624 for (int i = 0; i < _ATOM_MAX; i++)
626 if (__clipList[index].format & __atomList[i].formats)
630 // Make the atom list to be possible to return data.
631 Ecore_X_Atom* pAtoms = null;
634 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
635 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
637 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
639 if (__clipList[index].format & __atomList[i].formats)
640 pAtoms[count++] = __atomList[i].atom;
647 *pType = ECORE_X_ATOM_ATOM;
654 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
656 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
657 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
658 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
660 int index = *((int*) pData);
661 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
662 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
664 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
666 *outData = strdup(__clipList[index].pBuffer);
667 *outSize = strlen(__clipList[index].pBuffer);
674 ConvertClipIntoHtml(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
676 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
677 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
678 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
680 int index = *((int*) pData);
681 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
682 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
684 if (__clipList[index].format & _CLIP_FORMAT_HTML)
686 *outData = strdup(__clipList[index].pBuffer);
687 *outSize = strlen(__clipList[index].pBuffer);
694 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
700 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
702 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
703 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
704 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
706 int index = *((int*) pData);
707 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
708 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
710 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
712 *outData = strdup(__clipList[index].pBuffer);
713 *outSize = strlen(__clipList[index].pBuffer);
720 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
726 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
732 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
738 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
740 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
742 _Clipboard* pClipboard = _Clipboard::GetInstance();
745 bool visible = pClipboard->IsPopupVisible();
749 pClipboard->FireEvent(0, null);
753 return ECORE_CALLBACK_PASS_ON;
757 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
759 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
761 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
764 for (i = 0; i < _CLIP_TYPE_MAX; i++)
766 if (__clipList[i].selection == pE->selection)
772 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
774 _Clip* pClip = __clipList + i;
775 for (i = 0; i < _ATOM_MAX; i++)
777 if (!strcmp(pE->target, __atomList[i].pName))
779 if (__atomList[i].notify)
781 __atomList[i].notify(pClip, pE);
786 return ECORE_CALLBACK_PASS_ON;
790 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
792 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
793 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
795 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
796 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
798 _ControlManager* pControlManager = _ControlManager::GetInstance();
799 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
801 _Window* pWindow = pControlManager->GetClipboardOwner();
802 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
804 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
805 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
807 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
808 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
810 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
811 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
813 Ecore_X_Atom dataType = 0;
814 char* pBuffer = null;
815 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
819 const char* pHtmlAtomName = "text/html;charset=utf-8";
820 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
822 if (dataType == htmlType)
824 pClip->request(window, pHtmlAtomName);
825 return ECORE_CALLBACK_PASS_ON;
829 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
830 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
833 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
835 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
837 if (!(__atomList[j].formats & pClip->requestedFormat))
842 for (i = 0; i < pTargets->data.length; i++)
844 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
846 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
848 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
853 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
859 return ECORE_CALLBACK_PASS_ON;
862 pClip->request(window, __atomList[j].pName);
863 return ECORE_CALLBACK_PASS_ON;
867 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
869 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
870 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
872 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
873 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
875 pClip->bufferLength = (int) pData->length;
877 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
880 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
881 pStr[pClip->bufferLength] = '\0';
885 SysLog(NID_UI, "[Clipboard] pStr is null.");
889 pClip->pRetrievedBuffer = pStr;
891 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
897 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
899 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
900 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
902 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
903 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
905 pClip->bufferLength = (int) pData->length;
907 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
910 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
911 pStr[pClip->bufferLength] = '\0';
915 SysLog(NID_UI, "[Clipboard] pStr is null.");
919 pClip->pRetrievedBuffer = pStr;
921 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
927 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
929 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
930 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
932 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
933 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
935 pClip->bufferLength = (int) pData->length;
937 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
940 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
941 pStr[pClip->bufferLength] = '\0';
945 SysLog(NID_UI, "[Clipboard] pStr is null.");
949 pClip->pRetrievedBuffer = pStr;
951 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
957 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
959 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
960 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
962 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
963 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
965 pClip->bufferLength = (int) pData->length;
967 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
970 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
971 pStr[pClip->bufferLength] = '\0';
975 SysLog(NID_UI, "[Clipboard] pStr is null.");
979 pClip->pRetrievedBuffer = pStr;
981 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
987 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
989 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
990 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
992 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
993 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
995 pClip->bufferLength = (int) pData->length;
997 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1000 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1001 pStr[pClip->bufferLength] = '\0';
1005 SysLog(NID_UI, "[Clipboard] pStr is null.");
1009 pClip->pRetrievedBuffer = pStr;
1011 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1017 namespace Tizen { namespace Ui
1021 _EcoreEvas::CreateInstanceN(void)
1023 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1024 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1026 result r = GetLastResult();
1027 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1029 SetLastResult(E_SUCCESS);
1038 _EcoreEvas::_EcoreEvas(void)
1039 : __pWindowVisibilityChanged(null)
1040 , __pWindowPropertyChanged(null)
1041 , __pWindowShown(null)
1042 , __pClientMessageReceived(null)
1043 , __pClearClip(null)
1044 , __pNotifyClip(null)
1045 , __pClipboardClosed(null)
1047 , __pForegroundWindow(null)
1049 , __changeBounds(true)
1050 , __openClipboard(false)
1052 int ret = appcore_unset_rotation_cb();
1053 SysLog(NID_UI, "[Window Manager Rotation] appcore_unset_rotation_cb = %d", ret);
1055 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1056 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1058 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1060 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1061 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1065 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1068 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1069 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1071 result r = InitializeAtomList();
1072 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1074 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1075 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1077 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1078 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1080 SetLastResult(E_SUCCESS);
1085 if (__pWindowVisibilityChanged)
1087 ecore_event_handler_del(__pWindowVisibilityChanged);
1088 __pWindowVisibilityChanged = null;
1093 ecore_event_handler_del(__pWindowShown);
1094 __pWindowShown = null;
1098 _EcoreEvas::~_EcoreEvas(void)
1100 if (__pWindowVisibilityChanged)
1102 ecore_event_handler_del(__pWindowVisibilityChanged);
1103 __pWindowVisibilityChanged = null;
1108 ecore_event_handler_del(__pWindowShown);
1109 __pWindowShown = null;
1112 if (__pClientMessageReceived)
1114 ecore_event_handler_del(__pClientMessageReceived);
1115 __pClientMessageReceived = null;
1118 for (int i = 0; i < _ATOM_MAX; i++)
1120 if (__atomList[i].atom)
1122 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1128 ecore_event_handler_del(__pClearClip);
1129 __pClearClip = null;
1134 ecore_event_handler_del(__pNotifyClip);
1135 __pNotifyClip = null;
1138 if (__pClipboardClosed)
1140 ecore_event_handler_del(__pClipboardClosed);
1141 __pClipboardClosed = null;
1144 if (__pWindowPropertyChanged)
1146 ecore_event_handler_del(__pWindowPropertyChanged);
1147 __pWindowPropertyChanged = null;
1150 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1154 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1156 // Set window bounds according to the rotation
1159 _EflLayer* pLayer = GetEflLayer(window);
1165 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1168 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1169 if (curOrientation == orientation)
1175 bool rotatePartial = true;
1177 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1180 FrameShowMode showMode = pFrame->GetShowMode(false);
1181 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1183 rotatePartial = false;
1187 _Window* pWindow = const_cast<_Window*>(&window);
1188 if (pWindow->IsLayoutChangable() == true)
1190 rotatePartial = false;
1193 Evas_Object* pWinObj = pLayer->GetElmWin();
1194 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1198 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1200 if (rotatePartial == false)
1202 if (rotateEvas == true)
1204 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1207 evas_object_move(pWinObj, 0, 0);
1209 if ((orientation == 0) || (orientation == 180))
1211 evas_object_resize(pWinObj, rootW, rootH);
1215 evas_object_resize(pWinObj, rootH, rootW);
1218 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
1222 if (rotateEvas == true)
1224 ecore_evas_rotation_set(pEcoreEvas, orientation);
1227 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1228 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1231 int winX = winBounds.x;
1232 int winY = winBounds.y;
1237 winX = rootW - winBounds.y - winBounds.height;
1242 winY = rootH - winBounds.x - winBounds.width;
1245 winX = rootW - winBounds.x - winBounds.width;
1246 winY = rootH - winBounds.y - winBounds.height;
1256 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1258 evas_object_move(pWinObj, winX, winY);
1260 if (ret == EINA_FALSE)
1262 evas_object_resize(pWinObj, winBounds.width, winBounds.height);
1263 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);
1267 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1273 _EcoreEvas::GetEflLayer(const _Window& window) const
1275 _RootVisualElement* pRootVisualElement = null;
1277 pRootVisualElement = window.GetRootVisualElement();
1278 if (!pRootVisualElement)
1280 SysLog(NID_UI, "The root visual element is null.");
1284 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1287 SysLog(NID_UI, "The efl layer is null.");
1295 _EcoreEvas::GetFloatingMode(void) const
1297 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1299 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1301 SetLastResult(E_SUCCESS);
1303 return (ret ? true : false);
1306 // [ToDo] Remove API
1308 _EcoreEvas::GetFloatingMode(const _Window& window) const
1310 _EflLayer* pLayer = GetEflLayer(window);
1311 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1313 Evas_Object* pWinObj = pLayer->GetElmWin();
1314 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1316 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1318 SetLastResult(E_SUCCESS);
1320 return (ret ? true : false);
1323 // [ToDo] Remove API
1325 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1329 // [ToDo] Remove API
1331 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1336 _EcoreEvas::GetActiveWindow(void)
1338 Ecore_X_Window* pRoots = null;
1339 Ecore_X_Window activeWin = 0;
1342 pRoots = ecore_x_window_root_list(&num);
1345 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1346 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1360 _EcoreEvas::GetProcessId(unsigned int window)
1363 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1365 if (ret != EINA_TRUE)
1374 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1376 ecore_x_icccm_transient_for_unset(ownee);
1377 ecore_x_icccm_transient_for_set(ownee, owner);
1379 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", ownee, owner);
1383 _EcoreEvas::ActivateWindow(const _Window& window)
1385 _EflLayer* pLayer = GetEflLayer(window);
1386 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1388 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1389 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1391 ecore_evas_activate(pEcoreEvas);
1393 NativeWindowHandle currentWindow = window.GetNativeHandle();
1394 unsigned int activeWindow = GetActiveWindow();
1395 int pid = GetProcessId(activeWindow);
1396 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1398 SetLastResult(E_SUCCESS);
1402 _EcoreEvas::MinimizeWindow(_Window& window)
1404 _EflLayer* pLayer = GetEflLayer(window);
1405 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1407 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1408 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1410 //ecore_evas_lower(pEcoreEvas);
1411 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1413 SetLastResult(E_SUCCESS);
1417 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1421 case _RENDER_BACKEND_SW:
1422 elm_config_preferred_engine_set("software_x11");
1424 case _RENDER_BACKEND_GL:
1425 elm_config_preferred_engine_set("opengl_x11");
1427 case _RENDER_BACKEND_DEFAULT:
1430 elm_config_preferred_engine_set(NULL);
1436 _EcoreEvas::GetRenderBackend(void)
1438 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1440 const char* pEngine = elm_config_preferred_engine_get();
1442 if (pEngine == NULL)
1444 backend = _RENDER_BACKEND_DEFAULT;
1446 else if (strcmp(pEngine, "software_x11") == 0)
1448 backend = _RENDER_BACKEND_SW;
1450 else if (strcmp(pEngine, "opengl_x11") == 0)
1452 backend = _RENDER_BACKEND_GL;
1459 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1461 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1462 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1464 Ecore_X_Atom dataType = 0;
1468 case _CLIP_FORMAT_TEXT:
1469 dataType = ecore_x_atom_get("UTF8_STRING");
1471 case _CLIP_FORMAT_IMAGE:
1472 dataType = ecore_x_atom_get("text/uri");
1474 case _CLIP_FORMAT_HTML:
1475 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1481 _ControlManager* pControlManager = _ControlManager::GetInstance();
1483 _Window* pWindow = pControlManager->GetClipboardOwner();
1489 _EflLayer* pLayer = GetEflLayer(*pWindow);
1495 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1498 SetCbhmItem(window, dataType, (char*)pChar);
1504 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1506 Ecore_X_Atom dataType = 0;
1508 _ControlManager* pControlManager = _ControlManager::GetInstance();
1510 _Window* pWindow = pControlManager->GetClipboardOwner();
1516 _EflLayer* pLayer = GetEflLayer(*pWindow);
1522 GetCbhmItem(index, &dataType, pData);
1524 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1525 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1527 *format = _CLIP_FORMAT_TEXT;
1529 else if (dataType == ecore_x_atom_get("text/uri"))
1531 *format = _CLIP_FORMAT_IMAGE;
1533 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1535 *format = _CLIP_FORMAT_HTML;
1543 // Convert markup to utf8.
1544 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1546 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1547 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1557 _EcoreEvas::GetClipCount(void) const
1559 _ControlManager* pControlManager = _ControlManager::GetInstance();
1561 _Window* pWindow = pControlManager->GetClipboardOwner();
1567 _EflLayer* pLayer = GetEflLayer(*pWindow);
1573 int count = GetCbhmItemCount();
1579 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1581 _ControlManager* pControlManager = _ControlManager::GetInstance();
1583 _Window* pWindow = pControlManager->GetClipboardOwner();
1589 _EflLayer* pLayer = GetEflLayer(*pWindow);
1595 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1598 ecore_x_selection_secondary_set(window, "", 1);
1600 if (_CLIP_FORMAT_IMAGE & clipFormats)
1602 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1606 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1609 __openClipboard = true;
1613 _EcoreEvas::CloseClipboard(void)
1615 _ControlManager* pControlManager = _ControlManager::GetInstance();
1617 _Window* pWindow = pControlManager->GetClipboardOwner();
1623 _EflLayer* pLayer = GetEflLayer(*pWindow);
1629 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1632 __openClipboard = false;
1633 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1637 _EcoreEvas::IsClipboardOpened(void)
1639 return __openClipboard;
1643 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1645 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1646 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1648 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1649 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1651 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1657 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1659 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1660 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1662 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1663 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1665 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1671 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1673 _EflLayer* pLayer = GetEflLayer(window);
1674 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1676 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1677 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1679 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1683 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1687 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1694 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1696 _EflLayer* pLayer = GetEflLayer(window);
1697 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1699 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1700 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1702 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1703 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1705 bool showState = true;
1706 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1710 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1718 // [ToDo] Remove API
1720 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1722 _EflLayer* pLayer = GetEflLayer(window);
1723 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1725 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1726 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1728 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1729 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1737 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1738 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1740 SetLastResult(E_SUCCESS);
1742 return Rectangle(x, y, width, height);
1745 // [ToDo] Remove API
1747 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1749 _EflLayer* pLayer = GetEflLayer(window);
1750 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1752 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1753 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1755 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1757 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1760 case _INDICATOR_OPACITY_UNKNOWN:
1761 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1763 case _INDICATOR_OPACITY_OPAQUE:
1764 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1766 case _INDICATOR_OPACITY_TRANSLUCENT:
1767 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1769 case _INDICATOR_OPACITY_TRANSPARENT:
1770 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1773 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1774 return E_INVALID_ARG;
1777 ecore_x_e_illume_indicator_opacity_set(win, mode);
1782 // [ToDo] Remove API
1784 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1786 _EflLayer* pLayer = GetEflLayer(window);
1787 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1789 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1790 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1792 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1793 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1795 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1798 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1799 opacity = _INDICATOR_OPACITY_UNKNOWN;
1801 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1802 opacity = _INDICATOR_OPACITY_OPAQUE;
1804 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1805 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1807 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1808 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1811 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1812 return _INDICATOR_OPACITY_UNKNOWN;
1815 SetLastResult(E_SUCCESS);
1821 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
1823 _EflLayer* pLayer = GetEflLayer(window);
1824 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1826 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1827 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1829 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1831 Eina_Bool acceptsFocus;
1832 Ecore_X_Window_State_Hint initialState;
1833 Ecore_X_Pixmap iconPixmap;
1834 Ecore_X_Pixmap iconMask;
1835 Ecore_X_Window iconWindow;
1836 Ecore_X_Window windowGroup;
1839 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1840 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
1844 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
1846 _EflLayer* pLayer = GetEflLayer(window);
1847 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1849 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1850 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1852 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1854 Eina_Bool acceptsFocus;
1855 Ecore_X_Window_State_Hint initialState;
1856 Ecore_X_Pixmap iconPixmap;
1857 Ecore_X_Pixmap iconMask;
1858 Ecore_X_Window iconWindow;
1859 Ecore_X_Window windowGroup;
1862 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1864 return (acceptsFocus ? true : false);
1868 _EcoreEvas::SetWindowName(const _Window& window, const Tizen::Base::String& name)
1870 _EflLayer* pLayer = GetEflLayer(window);
1871 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1873 Evas_Object* pWinObj = pLayer->GetElmWin();
1874 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1876 const char* windowName = _StringConverter::CopyToCharArrayN(name);
1879 elm_win_title_set(pWinObj, windowName);
1881 delete[] windowName;
1886 _EcoreEvas::SetWindowType(const _Window& window, int winType)
1888 _EflLayer* pLayer = GetEflLayer(window);
1889 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1891 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1892 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1894 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1896 if (winType == _WINDOW_TYPE_SUB)
1898 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
1903 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
1905 _EflLayer* pLayer = GetEflLayer(window);
1906 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1908 Evas_Object* pWinObj = pLayer->GetElmWin();
1909 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1911 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
1916 // [ToDo] Remove API
1918 _EcoreEvas::GetEvas(void) const
1920 SysLog(NID_UI, "Do not use.");
1921 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1927 _EflLayer* pLayer = GetEflLayer(*pWindow);
1933 return pLayer->GetEvas();
1936 // [ToDo] Remove API
1938 _EcoreEvas::GetEcoreEvas(void) const
1940 SysLog(NID_UI, "Do not use.");
1941 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1947 _EflLayer* pLayer = GetEflLayer(*pWindow);
1953 return pLayer->GetEcoreEvas();
1956 // [ToDo] Remove API
1958 _EcoreEvas::GetWindowObject(void) const
1960 SysLog(NID_UI, "Do not use.");
1961 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1967 _EflLayer* pLayer = GetEflLayer(*pWindow);
1973 return pLayer->GetElmWin();
1976 // [ToDo] Remove API
1978 _EcoreEvas::GetXWindow(void) const
1980 SysLog(NID_UI, "Do not use.");
1981 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1987 _EflLayer* pLayer = GetEflLayer(*pWindow);
1993 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1999 _EcoreEvas::AllowSetWindowBounds(bool allow)
2001 __changeBounds = allow;
2005 _EcoreEvas::IsWindowVisible(const _Window& window)
2007 _EflLayer* pLayer = GetEflLayer(window);
2008 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2010 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2011 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2013 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2015 int ret = ecore_x_window_visible_get(win);
2026 // [ToDo] Remove API
2028 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2031 _EflLayer* pLayer = GetEflLayer(window);
2032 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2034 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2035 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2037 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2038 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2040 unsigned int val[3];
2041 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2052 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2056 // [ToDo] Remove API
2058 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2061 _EflLayer* pLayer = GetEflLayer(window);
2062 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2064 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2065 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2067 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2068 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2070 unsigned int val[3];
2071 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2087 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
2089 _EflLayer* pLayer = GetEflLayer(window);
2090 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2092 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2093 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2095 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2096 ecore_x_icccm_transient_for_unset(win);
2098 if (level == _WINDOW_LEVEL_NORMAL)
2100 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2102 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2104 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2105 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2107 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2109 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2110 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2113 SetLastResult(E_SUCCESS);
2117 _EcoreEvas::GetWindowLevel(const _Window& window) const
2119 _EflLayer* pLayer = GetEflLayer(window);
2120 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2122 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2123 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2125 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2127 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2128 ecore_x_netwm_window_type_get(win, &type);
2130 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2131 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2133 winLevel = _WINDOW_LEVEL_NORMAL;
2135 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2137 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2139 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2141 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2143 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2145 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2149 SetLastResult(E_SUCCESS);
2155 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2157 if (__changeBounds == false)
2162 _EflLayer* pLayer = GetEflLayer(window);
2163 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2165 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2166 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2168 Evas_Object* pWinObject = pLayer->GetElmWin();
2169 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2171 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2173 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2175 _Window* pWindow = const_cast<_Window*>(&window);
2177 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2184 _ControlManager* pControlManager = _ControlManager::GetInstance();
2185 if (pControlManager)
2187 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2190 int ownerRotate = GetWindowRotation(*pCurFrame);
2191 if (ownerRotate != rotate)
2199 int winX = winBounds.x;
2200 int winY = winBounds.y;
2204 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2209 winX = rootW - winBounds.y - winBounds.height;
2214 winY = rootH - winBounds.x - winBounds.width;
2217 winX = rootW - winBounds.x - winBounds.width;
2218 winY = rootH - winBounds.y - winBounds.height;
2228 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2230 evas_object_move(pWinObject, winX, winY);
2232 if (ret == EINA_FALSE)
2234 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2235 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);
2239 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2242 SetLastResult(E_SUCCESS);
2246 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2248 if (__changeBounds == false)
2253 _EflLayer* pLayer = GetEflLayer(window);
2254 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2256 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2257 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2259 Evas_Object* pWinObject = pLayer->GetElmWin();
2260 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2262 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2263 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2265 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2267 _Window* pWindow = const_cast<_Window*>(&window);
2269 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2276 _ControlManager* pControlManager = _ControlManager::GetInstance();
2277 if (pControlManager)
2279 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2282 int ownerRotate = GetWindowRotation(*pCurFrame);
2283 if (ownerRotate != rotate)
2291 int winX = winBounds.x;
2292 int winY = winBounds.y;
2296 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2301 winX = rootW - winBounds.y - winBounds.height;
2306 winY = rootH - winBounds.x - winBounds.width;
2309 winX = rootW - winBounds.x - winBounds.width;
2310 winY = rootH - winBounds.y - winBounds.height;
2320 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2322 evas_object_move(pWinObject, winX, winY);
2324 if (ret == EINA_FALSE)
2326 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2327 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);
2331 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2334 SetLastResult(E_SUCCESS);
2338 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2340 _EflLayer* pLayer = GetEflLayer(window);
2341 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2343 Evas_Object* pWinObj = pLayer->GetElmWin();
2344 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2346 pLayer->SetShowState(visibleState);
2348 SetLastResult(E_SUCCESS);
2352 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2354 _Window* pOwnerWindow = owner.GetRootWindow();
2355 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2357 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2358 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2360 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2361 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2363 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2364 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2366 Ecore_X_Window_Type type;
2367 ecore_x_netwm_window_type_get(owneeWin, &type);
2368 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2370 ecore_x_icccm_transient_for_unset(owneeWin);
2371 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2372 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2376 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] Skip to transient_for_set", owneeWin);
2380 // 1. IsLayoutChangable : true
2381 // 2. IsRotationSynchronized : true
2384 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2386 int* rotations = null;
2387 unsigned int count = 0;
2388 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2394 SetWindowAvailabledRotation(ownee, rotations, count);
2399 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2400 if (preferredRoation == true)
2402 int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2403 SetWindowPreferredRotation(ownee, preferredRotation);
2407 SetWindowPreferredRotation(ownee, -1);
2412 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2413 SetWindowPreferredRotation(ownee, ownerRotation);
2416 SetLastResult(E_SUCCESS);
2420 _EcoreEvas::GetWindowRotation(const _Window& window)
2422 _EflLayer* pLayer = GetEflLayer(window);
2428 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2433 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation, bool force)
2435 _EflLayer* pLayer = GetEflLayer(window);
2441 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2445 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2447 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
2448 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2450 _Window* pWindow = const_cast<_Window*>(&window);
2455 pWindow->SetPreferredRotation(false);
2459 pWindow->SetPreferredRotation(true);
2465 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count, bool force)
2467 _EflLayer* pLayer = GetEflLayer(window);
2473 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2475 // Skip available_set if there is not change
2478 int* prevRotations = null;
2479 unsigned int prevCount = 0;
2480 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2481 free(prevRotations);
2485 if (prevCount == count)
2493 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2496 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window available rotation(%d).", win, count);
2497 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2501 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2503 _EflLayer* pLayer = GetEflLayer(window);
2509 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2513 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2515 _EflLayer* pLayer = GetEflLayer(window);
2521 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2523 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2524 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);
2525 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2529 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2531 _EflLayer* pLayer = GetEflLayer(window);
2537 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2538 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2540 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2541 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);
2542 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2545 // [ToDo] Remove API
2547 _EcoreEvas::GetFrame(void) const
2549 SysLog(NID_UI, "Do not use.");
2553 // [ToDo] Remove API
2555 _EcoreEvas::GetRootVisualElement(void)const
2557 SysLog(NID_UI, "Do not use.");
2561 // [ToDo] Remove API
2563 _EcoreEvas::SetFrame(const _Control& control)
2565 SysLog(NID_UI, "Do not use.");
2566 __pFrame = const_cast<_Control*>(&control);
2570 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2572 Ecore_X_Window cbhmWin = GetCbhmWindow();
2573 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2574 Ecore_X_Atom atomItemType = 0;
2576 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2579 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2580 if (atomItemType == x_atom_cbhm_error)
2597 *pDataType = atomItemType;
2607 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2609 Eina_Bool acc = elm_config_access_get();
2613 void* _GetEcoreEvasHandle(void)
2615 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2616 if (pEcoreEvasMgr == null)
2621 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2622 if (pUiEcoreEvas == null)
2627 return (void*)pUiEcoreEvas->GetEcoreEvas();
2630 void* _GetEvasHandle(void)
2632 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2633 if (pEcoreEvasMgr == null)
2638 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2639 if (pUiEcoreEvas == null)
2644 return (void*)pUiEcoreEvas->GetEvas();
2648 _EcoreEvas::InitializeAtomList(void)
2650 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2651 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2652 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2653 __atomList[_ATOM_TARGETS].response = RequestClip;
2654 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2655 __atomList[_ATOM_TARGETS].atom = 0;
2657 __atomList[_ATOM_ATOM].pName = "ATOM";
2658 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2659 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2660 __atomList[_ATOM_ATOM].response = RequestClip;
2661 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2662 __atomList[_ATOM_ATOM].atom = 0;
2664 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2665 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2666 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2667 __atomList[_ATOM_XELM].response = null;
2668 __atomList[_ATOM_XELM].notify = NotifyEdje;
2669 __atomList[_ATOM_XELM].atom = 0;
2671 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2672 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2673 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2674 __atomList[_ATOM_TEXT_URI].response = null;
2675 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2676 __atomList[_ATOM_TEXT_URI].atom = 0;
2678 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2679 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2680 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2681 __atomList[_ATOM_TEXT_URILIST].response = null;
2682 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2683 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2685 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2686 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2687 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2688 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2689 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2690 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2692 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2693 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2694 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2695 __atomList[_ATOM_IMAGE_PNG].response = null;
2696 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2697 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2699 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2700 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2701 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2702 __atomList[_ATOM_IMAGE_JPEG].response = null;
2703 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2704 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2706 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2707 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2708 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2709 __atomList[_ATOM_IMAGE_BMP].response = null;
2710 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2711 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2713 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2714 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2715 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2716 __atomList[_ATOM_IMAGE_GIF].response = null;
2717 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2718 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2720 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2721 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2722 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2723 __atomList[_ATOM_IMAGE_TIFF].response = null;
2724 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2725 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2727 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2728 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2729 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2730 __atomList[_ATOM_IMAGE_SVG].response = null;
2731 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2732 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2734 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2735 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2736 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2737 __atomList[_ATOM_IMAGE_XPM].response = null;
2738 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2739 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2741 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2742 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2743 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2744 __atomList[_ATOM_IMAGE_TGA].response = null;
2745 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2746 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2748 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2749 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2750 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2751 __atomList[_ATOM_IMAGE_PPM].response = null;
2752 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2753 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2755 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2756 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2757 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2758 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2759 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2760 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2762 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2763 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2764 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2765 __atomList[_ATOM_TEXT_HTML].response = null;
2766 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2767 __atomList[_ATOM_TEXT_HTML].atom = 0;
2769 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2770 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2771 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2772 __atomList[_ATOM_STRING_UTF8].response = null;
2773 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2774 __atomList[_ATOM_STRING_UTF8].atom = 0;
2776 __atomList[_ATOM_STRING].pName = "STRING";
2777 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2778 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2779 __atomList[_ATOM_STRING].response = null;
2780 __atomList[_ATOM_STRING].notify = NotifyText;
2781 __atomList[_ATOM_STRING].atom = 0;
2783 __atomList[_ATOM_TEXT].pName = "TEXT";
2784 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2785 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2786 __atomList[_ATOM_TEXT].response = null;
2787 __atomList[_ATOM_TEXT].notify = null;
2788 __atomList[_ATOM_TEXT].atom = 0;
2790 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2791 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2792 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2793 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2794 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2795 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2797 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2798 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2799 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2800 __atomList[_ATOM_TEXT_PLAIN].response = null;
2801 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2802 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2804 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2805 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2806 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2807 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2808 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2809 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2810 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2811 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2812 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
2814 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
2815 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
2816 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
2817 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
2818 __clipList[_CLIP_TYPE_SECONDARY].active = false;
2819 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
2820 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
2821 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
2822 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
2824 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
2825 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
2826 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
2827 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
2828 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
2829 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
2830 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
2831 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
2832 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
2834 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
2835 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
2836 __clipList[_CLIP_TYPE_XDND].active = false;
2837 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
2838 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
2839 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
2840 __clipList[_CLIP_TYPE_XDND].completed = false;
2842 for (int i = 0; i < _ATOM_MAX; i++)
2844 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
2845 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
2847 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
2850 result r = E_SUCCESS;
2852 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
2853 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2855 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
2856 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2858 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
2859 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2861 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
2866 for (int i = 0; i < _ATOM_MAX; i++)
2868 if (__atomList[i].atom)
2870 ecore_x_selection_converter_atom_del(__atomList[i].atom);
2876 ecore_event_handler_del(__pClearClip);
2877 __pClearClip = null;
2882 ecore_event_handler_del(__pNotifyClip);
2883 __pNotifyClip = null;
2886 if (__pClipboardClosed)
2888 ecore_event_handler_del(__pClipboardClosed);
2889 __pClipboardClosed = null;
2896 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
2898 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
2899 (_CLIP_FORMAT_MARKUP & clipFormat) ||
2900 (_CLIP_FORMAT_IMAGE & clipFormat) ||
2901 (_CLIP_FORMAT_VCARD & clipFormat) ||
2902 (_CLIP_FORMAT_HTML & clipFormat));
2906 _EcoreEvas::GetCbhmWindow(void) const
2908 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
2909 Ecore_X_Window cbhmWin = 0;
2911 unsigned char* pBuf = NULL;
2913 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
2917 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
2929 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
2931 Ecore_X_Window cbhmWin = GetCbhmWindow();
2932 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
2934 if (!cbhmWin || !atomCbhmMsg)
2939 XClientMessageEvent m;
2940 memset(&m, 0, sizeof(m));
2941 m.type = ClientMessage;
2942 m.display = (Display*)ecore_x_display_get();
2944 m.message_type = atomCbhmMsg;
2946 snprintf(m.data.b, 20, "%s", pMsg);
2948 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
2959 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
2961 Ecore_X_Window cbhmWin = GetCbhmWindow();
2962 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
2965 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
2968 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
2977 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
2979 unsigned char* pData = null;
2998 long unsigned int numRet = 0;
2999 long unsigned int bytes = 0;
3003 unsigned char* pPropRet = null;
3004 Ecore_X_Atom typeRet;
3006 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
3007 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3019 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3028 for (i = 0; i < numRet; i++)
3029 (pData)[i] = pPropRet[i];
3032 for (i = 0; i < numRet; i++)
3033 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3036 for (i = 0; i < numRet; i++)
3037 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3053 *pDataType = typeRet;
3060 _EcoreEvas::GetCbhmItemCount(void) const
3065 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3066 Ecore_X_Window cbhmWin = GetCbhmWindow();
3068 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3080 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3089 *(int*)pDataType = 0;
3092 Ecore_X_Window cbhmWin = GetCbhmWindow();
3096 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3097 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3098 Ecore_X_Atom atomItemType = 0;
3100 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3114 *pDataType = atomItemType;
3117 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3118 if (atomItemType == x_atom_cbhm_error)
3136 // [ToDo] Remove API
3138 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3140 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3143 // [ToDo] Remove API
3145 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3147 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3150 // [ToDo] Remove API
3151 _OSP_EXPORT_ unsigned int
3152 _GetActiveWindow(void)
3154 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3157 // [ToDo] Remove API
3159 _GetProcessId(unsigned int window)
3161 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);