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;
96 int __clipboardHeight = 0;
99 OnWindowStateChanged(Ecore_Evas* pEcoreEvas)
101 _ControlManager* pControlManager = _ControlManager::GetInstance();
102 if (!pControlManager)
107 Ecore_X_Window targetWin = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
109 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] OnWindowStateChanged is called.", targetWin);
111 int winCount = pControlManager->GetWindowCount();
112 for (int i = 0; i < winCount; i++)
114 _Window* pWindow = pControlManager->GetWindow(i);
120 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
122 if (win == targetWin)
124 pWindow->OnWindowStateChanged();
132 OnWindowPropertyChanged(void* pData, int type, void* pEvent)
134 Ecore_X_Event_Window_Property* pEv = (Ecore_X_Event_Window_Property*)pEvent;
137 return ECORE_CALLBACK_PASS_ON;
140 Ecore_X_Window targetWin = pEv->win;
143 return ECORE_CALLBACK_PASS_ON;
146 if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
148 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
149 Ecore_X_Illume_Clipboard_State clipboardState = ecore_x_e_illume_clipboard_state_get(zone);
151 if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
157 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
159 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
161 if (__clipboardHeight == 0)
163 SysLog(NID_UI, "[Clipboard] Clipboard is opened. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
164 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_OPENED, clipboardDim.width, clipboardDim.height);
165 __clipboardHeight = clipboardDim.height;
169 // SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
170 // _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
173 else if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
175 SysLog(NID_UI, "[Clipboard] Clipboard is closed.");
176 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_CLOSED, 0, 0);
177 __clipboardHeight = 0;
178 _Clipboard::GetInstance()->HidePopup();
181 else if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
183 // Only after opening Clipboard
184 if (__clipboardHeight != 0)
186 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
192 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
194 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
196 if (clipboardDim.height != 0)
198 SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
199 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
203 else if (pEv->atom == ECORE_X_ATOM_WM_STATE)
205 _ControlManager* pControlManager = _ControlManager::GetInstance();
206 if (!pControlManager)
208 return ECORE_CALLBACK_PASS_ON;
211 int winCount = pControlManager->GetWindowCount();
213 for (int i = 0; i < winCount; i++)
215 _Window* pWindow = pControlManager->GetWindow(i);
221 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
222 if (win != targetWin)
227 if (pWindow->IsOrientationRoot() == true)
229 _Frame* pFrame = static_cast<_Frame*>(pWindow);
231 Ecore_X_Window_State_Hint state = ecore_x_icccm_state_get(targetWin);
234 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
237 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
238 pFrame->OnFrameMinimized();
240 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
241 pFrame->OnFrameRestored();
252 return ECORE_CALLBACK_PASS_ON;
256 OnWindowVisibilityChanged(void* pData, int type, void* pEvent)
258 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
259 SysTryReturn(NID_UI, pEvent, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
261 Ecore_X_Event_Window_Visibility_Change* pE = (Ecore_X_Event_Window_Visibility_Change*) pEvent;
262 _ControlManager* pControlManager = _ControlManager::GetInstance();
264 int count = pControlManager->GetWindowCount();
266 _Window* pWindow = null;
269 for (int i = 0; i < count; i++)
271 pWindow = pControlManager->GetWindow(i);
274 NativeWindowHandle handle = pWindow->GetNativeHandle();
275 if (handle == pE->win)
283 Tizen::Base::Collection::ArrayList* pArgs = null;
284 String* pType = null;
285 Integer* pObscured = null;
289 const _Control* pDestination = pWindow;
291 pArgs = new (std::nothrow) Tizen::Base::Collection::ArrayList;
292 SysTryReturn(NID_UI, pArgs, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
294 result r = pArgs->Construct();
295 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
297 pType = new (std::nothrow) String(L"VisibilityEvent");
298 r = pArgs->Add(*pType);
299 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
301 pObscured = new (std::nothrow) Integer(pE->fully_obscured);
302 r = pArgs->Add(*pObscured);
303 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
305 _UiNotificationEvent event(pDestination->GetHandle(), pArgs);
307 r = _UiEventManager::GetInstance()->SendEvent(event);
310 return ECORE_CALLBACK_RENEW;
313 pArgs->RemoveAll(true);
330 OnWindowShown(void* pData, int type, void* pEvent)
332 return ECORE_CALLBACK_PASS_ON;
336 OnClientMessageReceived(void* pData, int type, void* pEvent)
338 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
339 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
341 _ControlManager* pControlManager = _ControlManager::GetInstance();
342 if (!pControlManager)
344 return ECORE_CALLBACK_RENEW;
347 if (pClientEvent->message_type == __atomRotateRootAngle)
349 int angle = pClientEvent->data.l[0];
351 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
353 pControlManager->OnWindowRotated(angle);
356 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
359 int winCount = pControlManager->GetWindowCount();
360 for (int i = 0; i < winCount; i++)
362 _Window* pWindow = pControlManager->GetWindow(i);
368 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
370 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
379 return ECORE_CALLBACK_RENEW;
384 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
386 SysLog(NID_UI, "Accessibility action : Move next");
387 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
389 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
391 SysLog(NID_UI, "Accessibility action : Move next");
392 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
394 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
396 SysLog(NID_UI, "Accessibility action : Move previous");
397 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
399 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
401 SysLog(NID_UI, "Accessibility action : Move previous");
402 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
404 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
406 SysLog(NID_UI, "Accessibility action : Activate");
407 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
409 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
411 x = (Evas_Coord)pClientEvent->data.l[2];
412 y = (Evas_Coord)pClientEvent->data.l[3];
413 SysLog(NID_UI, "Accessibility action : Read");
414 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
416 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
418 SysLog(NID_UI, "Accessibility action : value increased");
419 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
421 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
423 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
424 x = (Evas_Coord)pClientEvent->data.l[3];
425 y = (Evas_Coord)pClientEvent->data.l[4];
426 if (pClientEvent->data.l[2] == 0)
428 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
430 else if (pClientEvent->data.l[2] == 1)
432 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
434 else if (pClientEvent->data.l[2] == 2)
436 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
439 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
441 SysLog(NID_UI, "Accessibility action : value decreased");
442 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
446 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
448 SysLog(NID_UI, "[Ime Rotation]");
450 _Window* pWindow = pControlManager->GetCurrentFrame();
453 NativeWindowHandle handle = pWindow->GetNativeHandle();
455 if (pClientEvent->win == handle)
457 int angle = pClientEvent->data.l[1];
458 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
460 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
464 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
467 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
469 if (pCurrentFormImpl)
471 pCurrentFormImpl->UpdateOrientation(angle);
475 pFrameImpl->UpdateOrientation(angle);
483 return ECORE_CALLBACK_RENEW;
496 _CLIP_TYPE_SECONDARY,
497 _CLIP_TYPE_CLIPBOARD,
504 Ecore_X_Selection selection;
505 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
506 Eina_Bool (* clear)(void);
507 void (* request)(Ecore_X_Window window, const char* pTarget);
513 _ClipFormat requestedFormat;
514 char* pRetrievedBuffer;
519 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
520 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
521 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
527 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
541 _ATOM_TEXT_HTML_UTF8,
546 _ATOM_TEXT_PLAIN_UTF8,
555 ClipConverter convert;
556 ClipResponseHandler response;
557 ClipNotifyHandler notify;
561 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
562 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
564 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
565 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
566 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
567 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
568 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
569 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
570 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
572 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
573 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
574 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
575 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
576 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
577 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
579 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
581 _Atom __atomList[_ATOM_MAX];
582 _Clip __clipList[_CLIP_TYPE_MAX];
585 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
587 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
589 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
590 Ecore_X_Window window = pE->win;
592 _ClipType clipType = _CLIP_TYPE_SECONDARY;
593 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
595 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
597 return ECORE_CALLBACK_PASS_ON;
601 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
606 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
607 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
608 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
609 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
610 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
612 int index = *((int*) pData);
613 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
616 for (int i = 0; i < _ATOM_MAX; i++)
618 if (__clipList[index].format & __atomList[i].formats)
622 // Make the atom list to be possible to return data.
623 Ecore_X_Atom* pAtoms = null;
626 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
627 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
629 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
631 if (__clipList[index].format & __atomList[i].formats)
632 pAtoms[count++] = __atomList[i].atom;
639 *pType = ECORE_X_ATOM_ATOM;
646 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
648 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
649 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
650 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
652 int index = *((int*) pData);
653 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
654 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
656 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
658 *outData = strdup(__clipList[index].pBuffer);
659 *outSize = strlen(__clipList[index].pBuffer);
666 ConvertClipIntoHtml(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
668 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
669 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
670 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
672 int index = *((int*) pData);
673 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
674 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
676 if (__clipList[index].format & _CLIP_FORMAT_HTML)
678 *outData = strdup(__clipList[index].pBuffer);
679 *outSize = strlen(__clipList[index].pBuffer);
686 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
692 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
694 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
695 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
696 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
698 int index = *((int*) pData);
699 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
700 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
702 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
704 *outData = strdup(__clipList[index].pBuffer);
705 *outSize = strlen(__clipList[index].pBuffer);
712 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
718 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
724 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
730 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
732 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
734 _Clipboard* pClipboard = _Clipboard::GetInstance();
737 bool visible = pClipboard->IsPopupVisible();
741 pClipboard->FireEvent(0, null);
745 return ECORE_CALLBACK_PASS_ON;
749 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
751 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
753 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
756 for (i = 0; i < _CLIP_TYPE_MAX; i++)
758 if (__clipList[i].selection == pE->selection)
764 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
766 _Clip* pClip = __clipList + i;
767 for (i = 0; i < _ATOM_MAX; i++)
769 if (!strcmp(pE->target, __atomList[i].pName))
771 if (__atomList[i].notify)
773 __atomList[i].notify(pClip, pE);
778 return ECORE_CALLBACK_PASS_ON;
782 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
784 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
785 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
787 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
788 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
790 _ControlManager* pControlManager = _ControlManager::GetInstance();
791 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
793 _Window* pWindow = pControlManager->GetClipboardOwner();
794 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
796 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
797 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
799 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
800 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
802 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
803 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
805 Ecore_X_Atom dataType = 0;
806 char* pBuffer = null;
807 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
811 const char* pHtmlAtomName = "text/html;charset=utf-8";
812 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
814 if (dataType == htmlType)
816 pClip->request(window, pHtmlAtomName);
817 return ECORE_CALLBACK_PASS_ON;
821 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
822 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
825 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
827 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
829 if (!(__atomList[j].formats & pClip->requestedFormat))
834 for (i = 0; i < pTargets->data.length; i++)
836 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
838 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
840 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
845 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
851 return ECORE_CALLBACK_PASS_ON;
854 pClip->request(window, __atomList[j].pName);
855 return ECORE_CALLBACK_PASS_ON;
859 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
861 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
862 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
864 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
865 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
867 pClip->bufferLength = (int) pData->length;
869 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
872 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
873 pStr[pClip->bufferLength] = '\0';
877 SysLog(NID_UI, "[Clipboard] pStr is null.");
881 pClip->pRetrievedBuffer = pStr;
883 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
889 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
891 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
892 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
894 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
895 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
897 pClip->bufferLength = (int) pData->length;
899 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
902 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
903 pStr[pClip->bufferLength] = '\0';
907 SysLog(NID_UI, "[Clipboard] pStr is null.");
911 pClip->pRetrievedBuffer = pStr;
913 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
919 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
921 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
922 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
924 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
925 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
927 pClip->bufferLength = (int) pData->length;
929 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
932 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
933 pStr[pClip->bufferLength] = '\0';
937 SysLog(NID_UI, "[Clipboard] pStr is null.");
941 pClip->pRetrievedBuffer = pStr;
943 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
949 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
951 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
952 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
954 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
955 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
957 pClip->bufferLength = (int) pData->length;
959 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
962 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
963 pStr[pClip->bufferLength] = '\0';
967 SysLog(NID_UI, "[Clipboard] pStr is null.");
971 pClip->pRetrievedBuffer = pStr;
973 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
979 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
981 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
982 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
984 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
985 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
987 pClip->bufferLength = (int) pData->length;
989 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
992 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
993 pStr[pClip->bufferLength] = '\0';
997 SysLog(NID_UI, "[Clipboard] pStr is null.");
1001 pClip->pRetrievedBuffer = pStr;
1003 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1009 namespace Tizen { namespace Ui
1013 _EcoreEvas::CreateInstanceN(void)
1015 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1016 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1018 result r = GetLastResult();
1019 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1021 SetLastResult(E_SUCCESS);
1030 _EcoreEvas::_EcoreEvas(void)
1031 : __pWindowVisibilityChanged(null)
1032 , __pWindowPropertyChanged(null)
1033 , __pWindowShown(null)
1034 , __pClientMessageReceived(null)
1035 , __pClearClip(null)
1036 , __pNotifyClip(null)
1037 , __pClipboardClosed(null)
1039 , __pForegroundWindow(null)
1041 , __changeBounds(true)
1042 , __openClipboard(false)
1044 int ret = appcore_unset_rotation_cb();
1045 SysLog(NID_UI, "[Window Manager Rotation] appcore_unset_rotation_cb = %d", ret);
1047 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1048 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1050 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1052 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1053 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1057 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1060 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1061 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1063 result r = InitializeAtomList();
1064 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1066 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1067 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1069 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1070 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1072 SetLastResult(E_SUCCESS);
1077 if (__pWindowVisibilityChanged)
1079 ecore_event_handler_del(__pWindowVisibilityChanged);
1080 __pWindowVisibilityChanged = null;
1085 ecore_event_handler_del(__pWindowShown);
1086 __pWindowShown = null;
1090 _EcoreEvas::~_EcoreEvas(void)
1092 if (__pWindowVisibilityChanged)
1094 ecore_event_handler_del(__pWindowVisibilityChanged);
1095 __pWindowVisibilityChanged = null;
1100 ecore_event_handler_del(__pWindowShown);
1101 __pWindowShown = null;
1104 if (__pClientMessageReceived)
1106 ecore_event_handler_del(__pClientMessageReceived);
1107 __pClientMessageReceived = null;
1110 for (int i = 0; i < _ATOM_MAX; i++)
1112 if (__atomList[i].atom)
1114 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1120 ecore_event_handler_del(__pClearClip);
1121 __pClearClip = null;
1126 ecore_event_handler_del(__pNotifyClip);
1127 __pNotifyClip = null;
1130 if (__pClipboardClosed)
1132 ecore_event_handler_del(__pClipboardClosed);
1133 __pClipboardClosed = null;
1136 if (__pWindowPropertyChanged)
1138 ecore_event_handler_del(__pWindowPropertyChanged);
1139 __pWindowPropertyChanged = null;
1142 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1146 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1148 // Set window bounds according to the rotation
1151 _EflLayer* pLayer = GetEflLayer(window);
1157 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1160 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1161 if (curOrientation == orientation)
1167 bool rotatePartial = true;
1169 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1172 FrameShowMode showMode = pFrame->GetShowMode(false);
1173 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1175 rotatePartial = false;
1179 _Window* pWindow = const_cast<_Window*>(&window);
1180 if (pWindow->IsLayoutChangable() == true)
1182 rotatePartial = false;
1185 Evas_Object* pWinObj = pLayer->GetElmWin();
1186 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1190 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1192 if (rotatePartial == false)
1194 if (rotateEvas == true)
1196 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1199 evas_object_move(pWinObj, 0, 0);
1201 if ((orientation == 0) || (orientation == 180))
1203 evas_object_resize(pWinObj, rootW, rootH);
1207 evas_object_resize(pWinObj, rootH, rootW);
1210 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
1214 if (rotateEvas == true)
1216 ecore_evas_rotation_set(pEcoreEvas, orientation);
1219 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1220 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1223 int winX = winBounds.x;
1224 int winY = winBounds.y;
1229 winX = rootW - winBounds.y - winBounds.height;
1234 winY = rootH - winBounds.x - winBounds.width;
1237 winX = rootW - winBounds.x - winBounds.width;
1238 winY = rootH - winBounds.y - winBounds.height;
1248 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1250 evas_object_move(pWinObj, winX, winY);
1252 if (ret == EINA_FALSE)
1254 evas_object_resize(pWinObj, winBounds.width, winBounds.height);
1255 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);
1259 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1265 _EcoreEvas::GetEflLayer(const _Window& window) const
1267 _RootVisualElement* pRootVisualElement = null;
1269 pRootVisualElement = window.GetRootVisualElement();
1270 if (!pRootVisualElement)
1272 SysLog(NID_UI, "The root visual element is null.");
1276 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1279 SysLog(NID_UI, "The efl layer is null.");
1287 _EcoreEvas::GetFloatingMode(void) const
1289 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1291 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1293 SetLastResult(E_SUCCESS);
1295 return (ret ? true : false);
1298 // [ToDo] Remove API
1300 _EcoreEvas::GetFloatingMode(const _Window& window) const
1302 _EflLayer* pLayer = GetEflLayer(window);
1303 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1305 Evas_Object* pWinObj = pLayer->GetElmWin();
1306 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1308 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1310 SetLastResult(E_SUCCESS);
1312 return (ret ? true : false);
1315 // [ToDo] Remove API
1317 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1321 // [ToDo] Remove API
1323 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1328 _EcoreEvas::GetActiveWindow(void)
1330 Ecore_X_Window* pRoots = null;
1331 Ecore_X_Window activeWin = 0;
1334 pRoots = ecore_x_window_root_list(&num);
1337 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1338 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1352 _EcoreEvas::GetProcessId(unsigned int window)
1355 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1357 if (ret != EINA_TRUE)
1366 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1368 ecore_x_icccm_transient_for_unset(ownee);
1369 ecore_x_icccm_transient_for_set(ownee, owner);
1371 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", ownee, owner);
1375 _EcoreEvas::ActivateWindow(const _Window& window)
1377 _EflLayer* pLayer = GetEflLayer(window);
1378 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1380 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1381 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1383 ecore_evas_activate(pEcoreEvas);
1385 NativeWindowHandle currentWindow = window.GetNativeHandle();
1386 unsigned int activeWindow = GetActiveWindow();
1387 int pid = GetProcessId(activeWindow);
1388 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1390 SetLastResult(E_SUCCESS);
1394 _EcoreEvas::MinimizeWindow(_Window& window)
1396 _EflLayer* pLayer = GetEflLayer(window);
1397 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1399 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1400 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1402 //ecore_evas_lower(pEcoreEvas);
1403 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1405 SetLastResult(E_SUCCESS);
1409 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1413 case _RENDER_BACKEND_SW:
1414 elm_config_preferred_engine_set("software_x11");
1416 case _RENDER_BACKEND_GL:
1417 elm_config_preferred_engine_set("opengl_x11");
1419 case _RENDER_BACKEND_DEFAULT:
1422 elm_config_preferred_engine_set(NULL);
1428 _EcoreEvas::GetRenderBackend(void)
1430 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1432 const char* pEngine = elm_config_preferred_engine_get();
1434 if (pEngine == NULL)
1436 backend = _RENDER_BACKEND_DEFAULT;
1438 else if (strcmp(pEngine, "software_x11") == 0)
1440 backend = _RENDER_BACKEND_SW;
1442 else if (strcmp(pEngine, "opengl_x11") == 0)
1444 backend = _RENDER_BACKEND_GL;
1451 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1453 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1454 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1456 Ecore_X_Atom dataType = 0;
1460 case _CLIP_FORMAT_TEXT:
1461 dataType = ecore_x_atom_get("UTF8_STRING");
1463 case _CLIP_FORMAT_IMAGE:
1464 dataType = ecore_x_atom_get("text/uri");
1466 case _CLIP_FORMAT_HTML:
1467 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1473 _ControlManager* pControlManager = _ControlManager::GetInstance();
1475 _Window* pWindow = pControlManager->GetClipboardOwner();
1481 _EflLayer* pLayer = GetEflLayer(*pWindow);
1487 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1490 SetCbhmItem(window, dataType, (char*)pChar);
1496 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1498 Ecore_X_Atom dataType = 0;
1500 _ControlManager* pControlManager = _ControlManager::GetInstance();
1502 _Window* pWindow = pControlManager->GetClipboardOwner();
1508 _EflLayer* pLayer = GetEflLayer(*pWindow);
1514 GetCbhmItem(index, &dataType, pData);
1516 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1517 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1519 *format = _CLIP_FORMAT_TEXT;
1521 else if (dataType == ecore_x_atom_get("text/uri"))
1523 *format = _CLIP_FORMAT_IMAGE;
1525 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1527 *format = _CLIP_FORMAT_HTML;
1535 // Convert markup to utf8.
1536 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1538 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1539 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1549 _EcoreEvas::GetClipCount(void) const
1551 _ControlManager* pControlManager = _ControlManager::GetInstance();
1553 _Window* pWindow = pControlManager->GetClipboardOwner();
1559 _EflLayer* pLayer = GetEflLayer(*pWindow);
1565 int count = GetCbhmItemCount();
1571 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1573 _ControlManager* pControlManager = _ControlManager::GetInstance();
1575 _Window* pWindow = pControlManager->GetClipboardOwner();
1581 _EflLayer* pLayer = GetEflLayer(*pWindow);
1587 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1590 ecore_x_selection_secondary_set(window, "", 1);
1592 if (_CLIP_FORMAT_IMAGE & clipFormats)
1594 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1598 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1601 __openClipboard = true;
1605 _EcoreEvas::CloseClipboard(void)
1607 _ControlManager* pControlManager = _ControlManager::GetInstance();
1609 _Window* pWindow = pControlManager->GetClipboardOwner();
1615 _EflLayer* pLayer = GetEflLayer(*pWindow);
1621 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1624 __openClipboard = false;
1625 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1629 _EcoreEvas::IsClipboardOpened(void)
1631 return __openClipboard;
1635 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1637 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1638 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1640 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1641 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1643 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1649 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1651 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1652 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1654 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1655 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1657 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1663 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1665 _EflLayer* pLayer = GetEflLayer(window);
1666 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1668 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1669 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1671 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1675 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1679 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1686 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1688 _EflLayer* pLayer = GetEflLayer(window);
1689 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1691 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1692 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1694 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1695 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1697 bool showState = true;
1698 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1702 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1710 // [ToDo] Remove API
1712 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1714 _EflLayer* pLayer = GetEflLayer(window);
1715 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1717 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1718 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1720 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1721 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1729 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1730 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1732 SetLastResult(E_SUCCESS);
1734 return Rectangle(x, y, width, height);
1737 // [ToDo] Remove API
1739 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1741 _EflLayer* pLayer = GetEflLayer(window);
1742 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1744 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1745 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1747 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1749 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1752 case _INDICATOR_OPACITY_UNKNOWN:
1753 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1755 case _INDICATOR_OPACITY_OPAQUE:
1756 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1758 case _INDICATOR_OPACITY_TRANSLUCENT:
1759 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1761 case _INDICATOR_OPACITY_TRANSPARENT:
1762 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1765 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1766 return E_INVALID_ARG;
1769 ecore_x_e_illume_indicator_opacity_set(win, mode);
1774 // [ToDo] Remove API
1776 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1778 _EflLayer* pLayer = GetEflLayer(window);
1779 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1781 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1782 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1784 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1785 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1787 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1790 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1791 opacity = _INDICATOR_OPACITY_UNKNOWN;
1793 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1794 opacity = _INDICATOR_OPACITY_OPAQUE;
1796 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1797 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1799 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1800 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1803 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1804 return _INDICATOR_OPACITY_UNKNOWN;
1807 SetLastResult(E_SUCCESS);
1813 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
1815 _EflLayer* pLayer = GetEflLayer(window);
1816 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1818 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1819 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1821 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1823 Eina_Bool acceptsFocus;
1824 Ecore_X_Window_State_Hint initialState;
1825 Ecore_X_Pixmap iconPixmap;
1826 Ecore_X_Pixmap iconMask;
1827 Ecore_X_Window iconWindow;
1828 Ecore_X_Window windowGroup;
1831 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1832 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
1836 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
1838 _EflLayer* pLayer = GetEflLayer(window);
1839 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1841 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1842 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1844 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1846 Eina_Bool acceptsFocus;
1847 Ecore_X_Window_State_Hint initialState;
1848 Ecore_X_Pixmap iconPixmap;
1849 Ecore_X_Pixmap iconMask;
1850 Ecore_X_Window iconWindow;
1851 Ecore_X_Window windowGroup;
1854 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1856 return (acceptsFocus ? true : false);
1860 _EcoreEvas::SetWindowName(const _Window& window, const Tizen::Base::String& name)
1862 _EflLayer* pLayer = GetEflLayer(window);
1863 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1865 Evas_Object* pWinObj = pLayer->GetElmWin();
1866 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1868 const char* windowName = _StringConverter::CopyToCharArrayN(name);
1871 elm_win_title_set(pWinObj, windowName);
1873 delete[] windowName;
1878 _EcoreEvas::SetWindowType(const _Window& window, int winType)
1880 _EflLayer* pLayer = GetEflLayer(window);
1881 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1883 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1884 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1886 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1888 if (winType == _WINDOW_TYPE_SUB)
1890 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
1895 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
1897 _EflLayer* pLayer = GetEflLayer(window);
1898 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1900 Evas_Object* pWinObj = pLayer->GetElmWin();
1901 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1903 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
1908 // [ToDo] Remove API
1910 _EcoreEvas::GetEvas(void) const
1912 SysLog(NID_UI, "Do not use.");
1913 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1919 _EflLayer* pLayer = GetEflLayer(*pWindow);
1925 return pLayer->GetEvas();
1928 // [ToDo] Remove API
1930 _EcoreEvas::GetEcoreEvas(void) const
1932 SysLog(NID_UI, "Do not use.");
1933 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1939 _EflLayer* pLayer = GetEflLayer(*pWindow);
1945 return pLayer->GetEcoreEvas();
1948 // [ToDo] Remove API
1950 _EcoreEvas::GetWindowObject(void) const
1952 SysLog(NID_UI, "Do not use.");
1953 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1959 _EflLayer* pLayer = GetEflLayer(*pWindow);
1965 return pLayer->GetElmWin();
1968 // [ToDo] Remove API
1970 _EcoreEvas::GetXWindow(void) const
1972 SysLog(NID_UI, "Do not use.");
1973 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1979 _EflLayer* pLayer = GetEflLayer(*pWindow);
1985 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1991 _EcoreEvas::AllowSetWindowBounds(bool allow)
1993 __changeBounds = allow;
1997 _EcoreEvas::IsWindowVisible(const _Window& window)
1999 _EflLayer* pLayer = GetEflLayer(window);
2000 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2002 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2003 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2005 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2007 int ret = ecore_x_window_visible_get(win);
2018 // [ToDo] Remove API
2020 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2023 _EflLayer* pLayer = GetEflLayer(window);
2024 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2026 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2027 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2029 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2030 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2032 unsigned int val[3];
2033 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2044 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2048 // [ToDo] Remove API
2050 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2053 _EflLayer* pLayer = GetEflLayer(window);
2054 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2056 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2057 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2059 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2060 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2062 unsigned int val[3];
2063 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2079 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
2081 _EflLayer* pLayer = GetEflLayer(window);
2082 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2084 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2085 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2087 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2088 ecore_x_icccm_transient_for_unset(win);
2090 if (level == _WINDOW_LEVEL_NORMAL)
2092 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2094 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2096 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2097 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2099 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2101 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2102 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2105 SetLastResult(E_SUCCESS);
2109 _EcoreEvas::GetWindowLevel(const _Window& window) const
2111 _EflLayer* pLayer = GetEflLayer(window);
2112 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2114 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2115 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2117 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2119 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2120 ecore_x_netwm_window_type_get(win, &type);
2122 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2123 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2125 winLevel = _WINDOW_LEVEL_NORMAL;
2127 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2129 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2131 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2133 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2135 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2137 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2141 SetLastResult(E_SUCCESS);
2147 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2149 if (__changeBounds == false)
2154 _EflLayer* pLayer = GetEflLayer(window);
2155 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2157 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2158 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2160 Evas_Object* pWinObject = pLayer->GetElmWin();
2161 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2163 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2165 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2167 _Window* pWindow = const_cast<_Window*>(&window);
2169 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2176 _ControlManager* pControlManager = _ControlManager::GetInstance();
2177 if (pControlManager)
2179 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2182 int ownerRotate = GetWindowRotation(*pCurFrame);
2183 if (ownerRotate != rotate)
2191 int winX = winBounds.x;
2192 int winY = winBounds.y;
2196 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2201 winX = rootW - winBounds.y - winBounds.height;
2206 winY = rootH - winBounds.x - winBounds.width;
2209 winX = rootW - winBounds.x - winBounds.width;
2210 winY = rootH - winBounds.y - winBounds.height;
2220 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2222 evas_object_move(pWinObject, winX, winY);
2224 if (ret == EINA_FALSE)
2226 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2227 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);
2231 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2234 SetLastResult(E_SUCCESS);
2238 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2240 if (__changeBounds == false)
2245 _EflLayer* pLayer = GetEflLayer(window);
2246 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2248 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2249 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2251 Evas_Object* pWinObject = pLayer->GetElmWin();
2252 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2254 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2255 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2257 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2259 _Window* pWindow = const_cast<_Window*>(&window);
2261 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2268 _ControlManager* pControlManager = _ControlManager::GetInstance();
2269 if (pControlManager)
2271 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2274 int ownerRotate = GetWindowRotation(*pCurFrame);
2275 if (ownerRotate != rotate)
2283 int winX = winBounds.x;
2284 int winY = winBounds.y;
2288 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2293 winX = rootW - winBounds.y - winBounds.height;
2298 winY = rootH - winBounds.x - winBounds.width;
2301 winX = rootW - winBounds.x - winBounds.width;
2302 winY = rootH - winBounds.y - winBounds.height;
2312 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2314 evas_object_move(pWinObject, winX, winY);
2316 if (ret == EINA_FALSE)
2318 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2319 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);
2323 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2326 SetLastResult(E_SUCCESS);
2330 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2332 _EflLayer* pLayer = GetEflLayer(window);
2333 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2335 Evas_Object* pWinObj = pLayer->GetElmWin();
2336 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2338 pLayer->SetShowState(visibleState);
2340 SetLastResult(E_SUCCESS);
2344 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2346 _Window* pOwnerWindow = owner.GetRootWindow();
2347 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2349 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2350 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2352 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2353 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2355 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2356 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2358 Ecore_X_Window_Type type;
2359 ecore_x_netwm_window_type_get(owneeWin, &type);
2360 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2362 ecore_x_icccm_transient_for_unset(owneeWin);
2363 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2364 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2368 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] Skip to transient_for_set", owneeWin);
2372 // 1. IsLayoutChangable : true
2373 // 2. IsRotationSynchronized : true
2376 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2378 int* rotations = null;
2379 unsigned int count = 0;
2380 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2386 SetWindowAvailabledRotation(ownee, rotations, count);
2391 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2392 if (preferredRoation == true)
2394 int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2395 SetWindowPreferredRotation(ownee, preferredRotation);
2399 SetWindowPreferredRotation(ownee, -1);
2404 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2405 SetWindowPreferredRotation(ownee, ownerRotation);
2408 SetLastResult(E_SUCCESS);
2412 _EcoreEvas::GetWindowRotation(const _Window& window)
2414 _EflLayer* pLayer = GetEflLayer(window);
2420 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2425 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation, bool force)
2427 _EflLayer* pLayer = GetEflLayer(window);
2433 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2437 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2439 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
2440 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2442 _Window* pWindow = const_cast<_Window*>(&window);
2447 pWindow->SetPreferredRotation(false);
2451 pWindow->SetPreferredRotation(true);
2457 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count, bool force)
2459 _EflLayer* pLayer = GetEflLayer(window);
2465 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2467 // Skip available_set if there is not change
2470 int* prevRotations = null;
2471 unsigned int prevCount = 0;
2472 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2473 free(prevRotations);
2477 if (prevCount == count)
2485 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2488 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window available rotation(%d).", win, count);
2489 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2493 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2495 _EflLayer* pLayer = GetEflLayer(window);
2501 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2505 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2507 _EflLayer* pLayer = GetEflLayer(window);
2513 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2515 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2516 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);
2517 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2521 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2523 _EflLayer* pLayer = GetEflLayer(window);
2529 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2530 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2532 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2533 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);
2534 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2537 // [ToDo] Remove API
2539 _EcoreEvas::GetFrame(void) const
2541 SysLog(NID_UI, "Do not use.");
2545 // [ToDo] Remove API
2547 _EcoreEvas::GetRootVisualElement(void)const
2549 SysLog(NID_UI, "Do not use.");
2553 // [ToDo] Remove API
2555 _EcoreEvas::SetFrame(const _Control& control)
2557 SysLog(NID_UI, "Do not use.");
2558 __pFrame = const_cast<_Control*>(&control);
2562 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2564 Ecore_X_Window cbhmWin = GetCbhmWindow();
2565 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2566 Ecore_X_Atom atomItemType = 0;
2568 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2571 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2572 if (atomItemType == x_atom_cbhm_error)
2589 *pDataType = atomItemType;
2599 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2601 Eina_Bool acc = elm_config_access_get();
2605 void* _GetEcoreEvasHandle(void)
2607 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2608 if (pEcoreEvasMgr == null)
2613 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2614 if (pUiEcoreEvas == null)
2619 return (void*)pUiEcoreEvas->GetEcoreEvas();
2622 void* _GetEvasHandle(void)
2624 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2625 if (pEcoreEvasMgr == null)
2630 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2631 if (pUiEcoreEvas == null)
2636 return (void*)pUiEcoreEvas->GetEvas();
2640 _EcoreEvas::InitializeAtomList(void)
2642 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2643 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2644 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2645 __atomList[_ATOM_TARGETS].response = RequestClip;
2646 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2647 __atomList[_ATOM_TARGETS].atom = 0;
2649 __atomList[_ATOM_ATOM].pName = "ATOM";
2650 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2651 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2652 __atomList[_ATOM_ATOM].response = RequestClip;
2653 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2654 __atomList[_ATOM_ATOM].atom = 0;
2656 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2657 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2658 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2659 __atomList[_ATOM_XELM].response = null;
2660 __atomList[_ATOM_XELM].notify = NotifyEdje;
2661 __atomList[_ATOM_XELM].atom = 0;
2663 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2664 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2665 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2666 __atomList[_ATOM_TEXT_URI].response = null;
2667 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2668 __atomList[_ATOM_TEXT_URI].atom = 0;
2670 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2671 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2672 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2673 __atomList[_ATOM_TEXT_URILIST].response = null;
2674 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2675 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2677 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2678 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2679 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2680 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2681 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2682 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2684 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2685 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2686 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2687 __atomList[_ATOM_IMAGE_PNG].response = null;
2688 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2689 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2691 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2692 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2693 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2694 __atomList[_ATOM_IMAGE_JPEG].response = null;
2695 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2696 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2698 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2699 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2700 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2701 __atomList[_ATOM_IMAGE_BMP].response = null;
2702 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2703 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2705 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2706 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2707 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2708 __atomList[_ATOM_IMAGE_GIF].response = null;
2709 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2710 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2712 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2713 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2714 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2715 __atomList[_ATOM_IMAGE_TIFF].response = null;
2716 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2717 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2719 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2720 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2721 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2722 __atomList[_ATOM_IMAGE_SVG].response = null;
2723 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2724 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2726 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2727 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2728 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2729 __atomList[_ATOM_IMAGE_XPM].response = null;
2730 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2731 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2733 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2734 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2735 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2736 __atomList[_ATOM_IMAGE_TGA].response = null;
2737 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2738 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2740 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2741 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2742 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2743 __atomList[_ATOM_IMAGE_PPM].response = null;
2744 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2745 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2747 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2748 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2749 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2750 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2751 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2752 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2754 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2755 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2756 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2757 __atomList[_ATOM_TEXT_HTML].response = null;
2758 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2759 __atomList[_ATOM_TEXT_HTML].atom = 0;
2761 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2762 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2763 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2764 __atomList[_ATOM_STRING_UTF8].response = null;
2765 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2766 __atomList[_ATOM_STRING_UTF8].atom = 0;
2768 __atomList[_ATOM_STRING].pName = "STRING";
2769 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2770 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2771 __atomList[_ATOM_STRING].response = null;
2772 __atomList[_ATOM_STRING].notify = NotifyText;
2773 __atomList[_ATOM_STRING].atom = 0;
2775 __atomList[_ATOM_TEXT].pName = "TEXT";
2776 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2777 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2778 __atomList[_ATOM_TEXT].response = null;
2779 __atomList[_ATOM_TEXT].notify = null;
2780 __atomList[_ATOM_TEXT].atom = 0;
2782 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2783 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2784 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2785 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2786 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2787 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2789 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2790 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2791 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2792 __atomList[_ATOM_TEXT_PLAIN].response = null;
2793 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2794 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2796 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2797 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2798 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2799 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2800 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2801 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2802 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2803 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2804 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
2806 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
2807 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
2808 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
2809 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
2810 __clipList[_CLIP_TYPE_SECONDARY].active = false;
2811 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
2812 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
2813 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
2814 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
2816 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
2817 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
2818 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
2819 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
2820 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
2821 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
2822 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
2823 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
2824 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
2826 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
2827 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
2828 __clipList[_CLIP_TYPE_XDND].active = false;
2829 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
2830 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
2831 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
2832 __clipList[_CLIP_TYPE_XDND].completed = false;
2834 for (int i = 0; i < _ATOM_MAX; i++)
2836 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
2837 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
2839 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
2842 result r = E_SUCCESS;
2844 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
2845 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2847 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
2848 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2850 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
2851 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2853 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
2858 for (int i = 0; i < _ATOM_MAX; i++)
2860 if (__atomList[i].atom)
2862 ecore_x_selection_converter_atom_del(__atomList[i].atom);
2868 ecore_event_handler_del(__pClearClip);
2869 __pClearClip = null;
2874 ecore_event_handler_del(__pNotifyClip);
2875 __pNotifyClip = null;
2878 if (__pClipboardClosed)
2880 ecore_event_handler_del(__pClipboardClosed);
2881 __pClipboardClosed = null;
2888 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
2890 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
2891 (_CLIP_FORMAT_MARKUP & clipFormat) ||
2892 (_CLIP_FORMAT_IMAGE & clipFormat) ||
2893 (_CLIP_FORMAT_VCARD & clipFormat) ||
2894 (_CLIP_FORMAT_HTML & clipFormat));
2898 _EcoreEvas::GetCbhmWindow(void) const
2900 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
2901 Ecore_X_Window cbhmWin = 0;
2903 unsigned char* pBuf = NULL;
2905 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
2909 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
2921 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
2923 Ecore_X_Window cbhmWin = GetCbhmWindow();
2924 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
2926 if (!cbhmWin || !atomCbhmMsg)
2931 XClientMessageEvent m;
2932 memset(&m, 0, sizeof(m));
2933 m.type = ClientMessage;
2934 m.display = (Display*)ecore_x_display_get();
2936 m.message_type = atomCbhmMsg;
2938 snprintf(m.data.b, 20, "%s", pMsg);
2940 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
2951 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
2953 Ecore_X_Window cbhmWin = GetCbhmWindow();
2954 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
2957 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
2960 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
2969 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
2971 unsigned char* pData = null;
2990 long unsigned int numRet = 0;
2991 long unsigned int bytes = 0;
2995 unsigned char* pPropRet = null;
2996 Ecore_X_Atom typeRet;
2998 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
2999 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3011 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3020 for (i = 0; i < numRet; i++)
3021 (pData)[i] = pPropRet[i];
3024 for (i = 0; i < numRet; i++)
3025 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3028 for (i = 0; i < numRet; i++)
3029 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3045 *pDataType = typeRet;
3052 _EcoreEvas::GetCbhmItemCount(void) const
3057 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3058 Ecore_X_Window cbhmWin = GetCbhmWindow();
3060 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3072 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3081 *(int*)pDataType = 0;
3084 Ecore_X_Window cbhmWin = GetCbhmWindow();
3088 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3089 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3090 Ecore_X_Atom atomItemType = 0;
3092 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3106 *pDataType = atomItemType;
3109 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3110 if (atomItemType == x_atom_cbhm_error)
3128 // [ToDo] Remove API
3130 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3132 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3135 // [ToDo] Remove API
3137 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3139 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3142 // [ToDo] Remove API
3143 _OSP_EXPORT_ unsigned int
3144 _GetActiveWindow(void)
3146 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3149 // [ToDo] Remove API
3151 _GetProcessId(unsigned int window)
3153 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);