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 <FGrp_CanvasImpl.h>
38 #include "FUi_CoordinateSystemUtils.h"
39 #include "FUi_EcoreEvas.h"
40 #include "FUi_EcoreEvasMgr.h"
41 #include "FUi_Control.h"
43 #include "FUi_UiNotificationEvent.h"
44 #include "FUi_UiEventManager.h"
45 #include "FUi_Window.h"
46 #include "FUiAnim_EflLayer.h"
47 #include "FUiAnim_EflNode.h"
48 #include "FUiAnim_VisualElement.h"
49 #include "FUi_AccessibilityGesture.h"
50 #include "FUi_AccessibilitySystemSettingLoader.h"
51 #include "FUiAnim_RootVisualElement.h"
52 #include "FUiAnim_DisplayManager.h"
53 #include "FUiCtrl_Frame.h"
54 #include "FUiCtrl_FrameImpl.h"
55 #include "FUiCtrl_FormImpl.h"
56 #include "FUi_Clipboard.h"
57 #include "FUi_TouchManager.h"
58 #include "FUi_ControlManager.h"
59 #include "FUi_ActiveWindowEvent.h"
60 #include "FUi_ControlImplManager.h"
61 #include "FUiCtrl_Popup.h"
62 #include "FUiCtrl_ContextMenu.h"
64 using namespace Tizen::Base;
65 using namespace Tizen::Base::Runtime;
66 using namespace Tizen::App;
67 using namespace Tizen::Graphics;
68 using namespace Tizen::Ui;
69 using namespace Tizen::Ui::Animations;
70 using namespace Tizen::Ui::Controls;
72 #define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN"
73 #define ATOM_CBHM_MSG "CBHM_MSG"
74 #define ATOM_CBHM_COUNT_GET "CBHM_cCOUNT"
75 #define ATOM_CBHM_SERIAL_NUMBER "CBHM_SERIAL_NUMBER"
76 #define ATOM_CBHM_ERROR "CBHM_ERROR"
77 #define ATOM_CBHM_ITEM "CBHM_ITEM"
78 #define ATOM_CBHM_SET_ITEM "SET_ITEM"
79 #define ATOM_CBHM_CLIPBOARD_SHOW_ALL "show1"
80 #define ATOM_CBHM_CLIPBOARD_SHOW "show0"
81 #define ATOM_CBHM_CLIPBOARD_HIDE "cbhm_hide"
82 #define ATOM_CBHM_SELECTED_ITEM "CBHM_SELECTED_ITEM"
83 #define ATOM_ROTATE_AUTO "_E_WINDOW_ROTATION_SUPPORTED"
85 namespace Tizen { namespace Ui
87 static _EcoreEvas* _pEvas = null;
93 Ecore_X_Atom __atomRotateRootAngle = 0;
94 Ecore_X_Atom __atomAccessibility = 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 OnAccessibilitySettingMessageReceived(void* pData, int type, void* pEvent)
338 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
339 if (pClientEvent->message_type == __atomAccessibility)
341 if ((Eina_Bool)pClientEvent->data.l[0])
343 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", true);
344 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", true);
345 SysLog(NID_UI, "Accessibility Screen reader is activated.");
350 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", false);
351 _AccessibilitySystemSettingLoader::SetSystemSetting(L"AccessibilityActivationStatus", false);
352 SysLog(NID_UI, "Accessibility Screen reader is deactivated.");
355 return ECORE_CALLBACK_PASS_ON;
359 OnClientMessageReceived(void* pData, int type, void* pEvent)
361 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
362 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
364 _ControlManager* pControlManager = _ControlManager::GetInstance();
365 if (!pControlManager)
367 return ECORE_CALLBACK_RENEW;
370 if (pClientEvent->message_type == __atomRotateRootAngle)
372 int angle = pClientEvent->data.l[0];
374 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
376 pControlManager->OnWindowRotated(angle);
379 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
382 int winCount = pControlManager->GetWindowCount();
383 for (int i = 0; i < winCount; i++)
385 _Window* pWindow = pControlManager->GetWindow(i);
391 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
393 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
402 return ECORE_CALLBACK_RENEW;
407 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
409 SysLog(NID_UI, "Accessibility action : Move next");
410 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
412 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
414 SysLog(NID_UI, "Accessibility action : Move next");
415 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
417 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
419 SysLog(NID_UI, "Accessibility action : Move previous");
420 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
422 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
424 SysLog(NID_UI, "Accessibility action : Move previous");
425 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
427 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
429 SysLog(NID_UI, "Accessibility action : Activate");
430 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
432 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
434 x = (Evas_Coord)pClientEvent->data.l[2];
435 y = (Evas_Coord)pClientEvent->data.l[3];
436 SysLog(NID_UI, "Accessibility action : Read");
437 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
439 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
441 SysLog(NID_UI, "Accessibility action : value increased");
442 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
444 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
446 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
447 x = (Evas_Coord)pClientEvent->data.l[3];
448 y = (Evas_Coord)pClientEvent->data.l[4];
449 if (pClientEvent->data.l[2] == 0)
451 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
453 else if (pClientEvent->data.l[2] == 1)
455 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
457 else if (pClientEvent->data.l[2] == 2)
459 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
462 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
464 SysLog(NID_UI, "Accessibility action : value decreased");
465 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
469 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
471 SysLog(NID_UI, "[Ime Rotation]");
473 _Window* pWindow = pControlManager->GetCurrentFrame();
476 NativeWindowHandle handle = pWindow->GetNativeHandle();
478 if (pClientEvent->win == handle)
480 int angle = pClientEvent->data.l[1];
481 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
483 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
487 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
490 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
492 if (pCurrentFormImpl)
494 pCurrentFormImpl->UpdateOrientation(angle);
498 pFrameImpl->UpdateOrientation(angle);
506 return ECORE_CALLBACK_RENEW;
519 _CLIP_TYPE_SECONDARY,
520 _CLIP_TYPE_CLIPBOARD,
527 Ecore_X_Selection selection;
528 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
529 Eina_Bool (* clear)(void);
530 void (* request)(Ecore_X_Window window, const char* pTarget);
536 _ClipFormat requestedFormat;
537 char* pRetrievedBuffer;
542 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
543 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
544 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
550 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
564 _ATOM_TEXT_HTML_UTF8,
569 _ATOM_TEXT_PLAIN_UTF8,
578 ClipConverter convert;
579 ClipResponseHandler response;
580 ClipNotifyHandler notify;
584 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
585 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
587 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
588 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
589 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
590 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
591 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
592 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
593 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
595 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
596 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
597 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
598 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
599 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
600 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
602 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
604 _Atom __atomList[_ATOM_MAX];
605 _Clip __clipList[_CLIP_TYPE_MAX];
608 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
610 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
612 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
613 Ecore_X_Window window = pE->win;
615 _ClipType clipType = _CLIP_TYPE_SECONDARY;
616 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
618 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
620 return ECORE_CALLBACK_PASS_ON;
624 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
629 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
630 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
631 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
632 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
633 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
635 int index = *((int*) pData);
636 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
639 for (int i = 0; i < _ATOM_MAX; i++)
641 if (__clipList[index].format & __atomList[i].formats)
645 // Make the atom list to be possible to return data.
646 Ecore_X_Atom* pAtoms = null;
649 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
650 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
652 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
654 if (__clipList[index].format & __atomList[i].formats)
655 pAtoms[count++] = __atomList[i].atom;
662 *pType = ECORE_X_ATOM_ATOM;
669 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
671 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
672 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
673 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
675 int index = *((int*) pData);
676 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
677 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
679 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
681 *outData = strdup(__clipList[index].pBuffer);
682 *outSize = strlen(__clipList[index].pBuffer);
689 ConvertClipIntoHtml(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
691 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
692 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
693 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
695 int index = *((int*) pData);
696 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
697 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
699 if (__clipList[index].format & _CLIP_FORMAT_HTML)
701 *outData = strdup(__clipList[index].pBuffer);
702 *outSize = strlen(__clipList[index].pBuffer);
709 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
715 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
717 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
718 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
719 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
721 int index = *((int*) pData);
722 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
723 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
725 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
727 *outData = strdup(__clipList[index].pBuffer);
728 *outSize = strlen(__clipList[index].pBuffer);
735 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
741 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
747 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
753 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
755 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
757 _Clipboard* pClipboard = _Clipboard::GetInstance();
760 bool visible = pClipboard->IsPopupVisible();
764 pClipboard->FireEvent(0, null);
768 return ECORE_CALLBACK_PASS_ON;
772 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
774 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
776 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
779 for (i = 0; i < _CLIP_TYPE_MAX; i++)
781 if (__clipList[i].selection == pE->selection)
787 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
789 _Clip* pClip = __clipList + i;
790 for (i = 0; i < _ATOM_MAX; i++)
792 if (!strcmp(pE->target, __atomList[i].pName))
794 if (__atomList[i].notify)
796 __atomList[i].notify(pClip, pE);
801 return ECORE_CALLBACK_PASS_ON;
805 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
807 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
808 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
810 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
811 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
813 _ControlManager* pControlManager = _ControlManager::GetInstance();
814 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
816 _Window* pWindow = pControlManager->GetClipboardOwner();
817 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
819 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
820 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
822 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
823 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
825 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
826 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
828 Ecore_X_Atom dataType = 0;
829 char* pBuffer = null;
830 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
834 const char* pHtmlAtomName = "text/html;charset=utf-8";
835 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
837 if (dataType == htmlType)
839 pClip->request(window, pHtmlAtomName);
840 return ECORE_CALLBACK_PASS_ON;
844 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
845 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
848 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
850 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
852 if (!(__atomList[j].formats & pClip->requestedFormat))
857 for (i = 0; i < pTargets->data.length; i++)
859 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
861 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
863 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
868 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
874 return ECORE_CALLBACK_PASS_ON;
877 pClip->request(window, __atomList[j].pName);
878 return ECORE_CALLBACK_PASS_ON;
882 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
884 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
885 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
887 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
888 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
890 pClip->bufferLength = (int) pData->length;
892 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
895 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
896 pStr[pClip->bufferLength] = '\0';
900 SysLog(NID_UI, "[Clipboard] pStr is null.");
904 pClip->pRetrievedBuffer = pStr;
906 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
912 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
914 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
915 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
917 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
918 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
920 pClip->bufferLength = (int) pData->length;
922 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
925 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
926 pStr[pClip->bufferLength] = '\0';
930 SysLog(NID_UI, "[Clipboard] pStr is null.");
934 pClip->pRetrievedBuffer = pStr;
936 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
942 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
944 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
945 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
947 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
948 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
950 pClip->bufferLength = (int) pData->length;
952 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
955 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
956 pStr[pClip->bufferLength] = '\0';
960 SysLog(NID_UI, "[Clipboard] pStr is null.");
964 pClip->pRetrievedBuffer = pStr;
966 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
972 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
974 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
975 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
977 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
978 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
980 pClip->bufferLength = (int) pData->length;
982 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
985 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
986 pStr[pClip->bufferLength] = '\0';
990 SysLog(NID_UI, "[Clipboard] pStr is null.");
994 pClip->pRetrievedBuffer = pStr;
996 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
1002 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1004 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1005 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1007 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1008 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1010 pClip->bufferLength = (int) pData->length;
1012 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1015 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1016 pStr[pClip->bufferLength] = '\0';
1020 SysLog(NID_UI, "[Clipboard] pStr is null.");
1024 pClip->pRetrievedBuffer = pStr;
1026 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1032 namespace Tizen { namespace Ui
1036 _EcoreEvas::CreateInstanceN(void)
1038 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1039 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1041 result r = GetLastResult();
1042 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1044 SetLastResult(E_SUCCESS);
1053 _EcoreEvas::_EcoreEvas(void)
1054 : __pWindowVisibilityChanged(null)
1055 , __pWindowPropertyChanged(null)
1056 , __pWindowShown(null)
1057 , __pClientMessageReceived(null)
1058 , __pClearClip(null)
1059 , __pNotifyClip(null)
1060 , __pClipboardClosed(null)
1062 , __pForegroundWindow(null)
1064 , __changeBounds(true)
1065 , __openClipboard(false)
1067 int ret = appcore_unset_rotation_cb();
1068 SysLog(NID_UI, "[Window Manager Rotation] appcore_unset_rotation_cb = %d", ret);
1070 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1071 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1073 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1075 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1076 ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnAccessibilitySettingMessageReceived, NULL);
1077 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1081 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1084 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1085 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1087 result r = InitializeAtomList();
1088 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1090 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1091 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1093 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1094 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1096 SetLastResult(E_SUCCESS);
1101 if (__pWindowVisibilityChanged)
1103 ecore_event_handler_del(__pWindowVisibilityChanged);
1104 __pWindowVisibilityChanged = null;
1109 ecore_event_handler_del(__pWindowShown);
1110 __pWindowShown = null;
1114 _EcoreEvas::~_EcoreEvas(void)
1116 if (__pWindowVisibilityChanged)
1118 ecore_event_handler_del(__pWindowVisibilityChanged);
1119 __pWindowVisibilityChanged = null;
1124 ecore_event_handler_del(__pWindowShown);
1125 __pWindowShown = null;
1128 if (__pClientMessageReceived)
1130 ecore_event_handler_del(__pClientMessageReceived);
1131 __pClientMessageReceived = null;
1134 for (int i = 0; i < _ATOM_MAX; i++)
1136 if (__atomList[i].atom)
1138 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1144 ecore_event_handler_del(__pClearClip);
1145 __pClearClip = null;
1150 ecore_event_handler_del(__pNotifyClip);
1151 __pNotifyClip = null;
1154 if (__pClipboardClosed)
1156 ecore_event_handler_del(__pClipboardClosed);
1157 __pClipboardClosed = null;
1160 if (__pWindowPropertyChanged)
1162 ecore_event_handler_del(__pWindowPropertyChanged);
1163 __pWindowPropertyChanged = null;
1166 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1170 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1172 // Set window bounds according to the rotation
1175 _EflLayer* pLayer = GetEflLayer(window);
1181 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1184 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1185 if (curOrientation == orientation)
1191 bool rotatePartial = true;
1193 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1196 FrameShowMode showMode = pFrame->GetShowMode(false);
1197 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1199 rotatePartial = false;
1203 _Window* pWindow = const_cast<_Window*>(&window);
1204 if (pWindow->IsLayoutChangable() == true)
1206 rotatePartial = false;
1209 Evas_Object* pWinObj = pLayer->GetElmWin();
1210 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1214 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1216 if (rotatePartial == false)
1218 if (rotateEvas == true)
1220 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1223 evas_object_move(pWinObj, 0, 0);
1225 if ((orientation == 0) || (orientation == 180))
1227 evas_object_resize(pWinObj, rootW, rootH);
1231 evas_object_resize(pWinObj, rootH, rootW);
1234 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
1238 if (rotateEvas == true)
1240 ecore_evas_rotation_set(pEcoreEvas, orientation);
1243 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1244 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1247 int winX = winBounds.x;
1248 int winY = winBounds.y;
1253 winX = rootW - winBounds.y - winBounds.height;
1258 winY = rootH - winBounds.x - winBounds.width;
1261 winX = rootW - winBounds.x - winBounds.width;
1262 winY = rootH - winBounds.y - winBounds.height;
1272 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1274 evas_object_move(pWinObj, winX, winY);
1276 if (ret == EINA_FALSE)
1278 evas_object_resize(pWinObj, winBounds.width, winBounds.height);
1279 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);
1283 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1289 _EcoreEvas::GetEflLayer(const _Window& window) const
1291 _RootVisualElement* pRootVisualElement = null;
1293 pRootVisualElement = window.GetRootVisualElement();
1294 if (!pRootVisualElement)
1296 SysLog(NID_UI, "The root visual element is null.");
1300 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1303 SysLog(NID_UI, "The efl layer is null.");
1311 _EcoreEvas::GetFloatingMode(void) const
1313 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1315 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1317 SetLastResult(E_SUCCESS);
1319 return (ret ? true : false);
1322 // [ToDo] Remove API
1324 _EcoreEvas::GetFloatingMode(const _Window& window) const
1326 _EflLayer* pLayer = GetEflLayer(window);
1327 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1329 Evas_Object* pWinObj = pLayer->GetElmWin();
1330 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1332 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1334 SetLastResult(E_SUCCESS);
1336 return (ret ? true : false);
1339 // [ToDo] Remove API
1341 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1345 // [ToDo] Remove API
1347 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1352 _EcoreEvas::GetActiveWindow(void)
1354 Ecore_X_Window* pRoots = null;
1355 Ecore_X_Window activeWin = 0;
1358 pRoots = ecore_x_window_root_list(&num);
1361 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1362 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1376 _EcoreEvas::GetProcessId(unsigned int window)
1379 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1381 if (ret != EINA_TRUE)
1390 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1392 ecore_x_icccm_transient_for_unset(ownee);
1393 ecore_x_icccm_transient_for_set(ownee, owner);
1395 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", ownee, owner);
1399 _EcoreEvas::ActivateWindow(const _Window& window)
1401 _EflLayer* pLayer = GetEflLayer(window);
1402 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1404 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1405 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1407 ecore_evas_activate(pEcoreEvas);
1409 NativeWindowHandle currentWindow = window.GetNativeHandle();
1410 unsigned int activeWindow = GetActiveWindow();
1411 int pid = GetProcessId(activeWindow);
1412 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1414 SetLastResult(E_SUCCESS);
1418 _EcoreEvas::MinimizeWindow(_Window& window)
1420 _EflLayer* pLayer = GetEflLayer(window);
1421 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1423 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1424 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1426 //ecore_evas_lower(pEcoreEvas);
1427 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1429 SetLastResult(E_SUCCESS);
1433 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1437 case _RENDER_BACKEND_SW:
1438 elm_config_preferred_engine_set("software_x11");
1440 case _RENDER_BACKEND_GL:
1441 elm_config_preferred_engine_set("opengl_x11");
1443 case _RENDER_BACKEND_DEFAULT:
1446 elm_config_preferred_engine_set(NULL);
1452 _EcoreEvas::GetRenderBackend(void)
1454 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1456 const char* pEngine = elm_config_preferred_engine_get();
1458 if (pEngine == NULL)
1460 backend = _RENDER_BACKEND_DEFAULT;
1462 else if (strcmp(pEngine, "software_x11") == 0)
1464 backend = _RENDER_BACKEND_SW;
1466 else if (strcmp(pEngine, "opengl_x11") == 0)
1468 backend = _RENDER_BACKEND_GL;
1475 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1477 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1478 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1480 Ecore_X_Atom dataType = 0;
1484 case _CLIP_FORMAT_TEXT:
1485 dataType = ecore_x_atom_get("UTF8_STRING");
1487 case _CLIP_FORMAT_IMAGE:
1488 dataType = ecore_x_atom_get("text/uri");
1490 case _CLIP_FORMAT_HTML:
1491 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1497 _ControlManager* pControlManager = _ControlManager::GetInstance();
1499 _Window* pWindow = pControlManager->GetClipboardOwner();
1505 _EflLayer* pLayer = GetEflLayer(*pWindow);
1511 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1514 SetCbhmItem(window, dataType, (char*)pChar);
1520 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1522 Ecore_X_Atom dataType = 0;
1524 _ControlManager* pControlManager = _ControlManager::GetInstance();
1526 _Window* pWindow = pControlManager->GetClipboardOwner();
1532 _EflLayer* pLayer = GetEflLayer(*pWindow);
1538 GetCbhmItem(index, &dataType, pData);
1540 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1541 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1543 *format = _CLIP_FORMAT_TEXT;
1545 else if (dataType == ecore_x_atom_get("text/uri"))
1547 *format = _CLIP_FORMAT_IMAGE;
1549 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1551 *format = _CLIP_FORMAT_HTML;
1559 // Convert markup to utf8.
1560 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1562 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1563 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1573 _EcoreEvas::GetClipCount(void) const
1575 _ControlManager* pControlManager = _ControlManager::GetInstance();
1577 _Window* pWindow = pControlManager->GetClipboardOwner();
1583 _EflLayer* pLayer = GetEflLayer(*pWindow);
1589 int count = GetCbhmItemCount();
1595 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1597 _ControlManager* pControlManager = _ControlManager::GetInstance();
1599 _Window* pWindow = pControlManager->GetClipboardOwner();
1605 _EflLayer* pLayer = GetEflLayer(*pWindow);
1611 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1614 ecore_x_selection_secondary_set(window, "", 1);
1616 if (_CLIP_FORMAT_IMAGE & clipFormats)
1618 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1622 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1625 __openClipboard = true;
1629 _EcoreEvas::CloseClipboard(void)
1631 _ControlManager* pControlManager = _ControlManager::GetInstance();
1633 _Window* pWindow = pControlManager->GetClipboardOwner();
1639 _EflLayer* pLayer = GetEflLayer(*pWindow);
1645 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1648 __openClipboard = false;
1649 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1653 _EcoreEvas::IsClipboardOpened(void)
1655 return __openClipboard;
1659 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1661 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1662 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1664 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1665 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1667 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1673 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1675 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1676 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1678 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1679 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1681 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1687 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1689 _EflLayer* pLayer = GetEflLayer(window);
1690 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1692 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1693 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1695 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1699 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1703 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1710 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1712 _EflLayer* pLayer = GetEflLayer(window);
1713 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1715 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1716 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1718 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1719 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1721 bool showState = true;
1722 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1726 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1734 // [ToDo] Remove API
1736 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1738 _EflLayer* pLayer = GetEflLayer(window);
1739 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1741 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1742 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1744 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1745 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1753 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1754 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1756 SetLastResult(E_SUCCESS);
1758 return Rectangle(x, y, width, height);
1761 // [ToDo] Remove API
1763 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1765 _EflLayer* pLayer = GetEflLayer(window);
1766 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1768 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1769 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1771 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1773 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1776 case _INDICATOR_OPACITY_UNKNOWN:
1777 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1779 case _INDICATOR_OPACITY_OPAQUE:
1780 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1782 case _INDICATOR_OPACITY_TRANSLUCENT:
1783 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1785 case _INDICATOR_OPACITY_TRANSPARENT:
1786 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1789 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1790 return E_INVALID_ARG;
1793 ecore_x_e_illume_indicator_opacity_set(win, mode);
1798 // [ToDo] Remove API
1800 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1802 _EflLayer* pLayer = GetEflLayer(window);
1803 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1805 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1806 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1808 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1809 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1811 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1814 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1815 opacity = _INDICATOR_OPACITY_UNKNOWN;
1817 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1818 opacity = _INDICATOR_OPACITY_OPAQUE;
1820 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1821 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1823 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1824 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1827 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1828 return _INDICATOR_OPACITY_UNKNOWN;
1831 SetLastResult(E_SUCCESS);
1837 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
1839 _EflLayer* pLayer = GetEflLayer(window);
1840 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1842 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1843 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1845 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1847 Eina_Bool acceptsFocus;
1848 Ecore_X_Window_State_Hint initialState;
1849 Ecore_X_Pixmap iconPixmap;
1850 Ecore_X_Pixmap iconMask;
1851 Ecore_X_Window iconWindow;
1852 Ecore_X_Window windowGroup;
1855 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1856 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
1860 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
1862 _EflLayer* pLayer = GetEflLayer(window);
1863 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1865 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1866 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1868 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1870 Eina_Bool acceptsFocus;
1871 Ecore_X_Window_State_Hint initialState;
1872 Ecore_X_Pixmap iconPixmap;
1873 Ecore_X_Pixmap iconMask;
1874 Ecore_X_Window iconWindow;
1875 Ecore_X_Window windowGroup;
1878 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1880 return (acceptsFocus ? true : false);
1884 _EcoreEvas::SetWindowType(const _Window& window, int winType)
1886 _EflLayer* pLayer = GetEflLayer(window);
1887 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1889 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1890 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1892 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1894 if (winType == _WINDOW_TYPE_SUB)
1896 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
1901 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
1903 _EflLayer* pLayer = GetEflLayer(window);
1904 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1906 Evas_Object* pWinObj = pLayer->GetElmWin();
1907 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1909 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
1914 // [ToDo] Remove API
1916 _EcoreEvas::GetEvas(void) const
1918 SysLog(NID_UI, "Do not use.");
1919 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1925 _EflLayer* pLayer = GetEflLayer(*pWindow);
1931 return pLayer->GetEvas();
1934 // [ToDo] Remove API
1936 _EcoreEvas::GetEcoreEvas(void) const
1938 SysLog(NID_UI, "Do not use.");
1939 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1945 _EflLayer* pLayer = GetEflLayer(*pWindow);
1951 return pLayer->GetEcoreEvas();
1954 // [ToDo] Remove API
1956 _EcoreEvas::GetWindowObject(void) const
1958 SysLog(NID_UI, "Do not use.");
1959 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1965 _EflLayer* pLayer = GetEflLayer(*pWindow);
1971 return pLayer->GetElmWin();
1974 // [ToDo] Remove API
1976 _EcoreEvas::GetXWindow(void) const
1978 SysLog(NID_UI, "Do not use.");
1979 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1985 _EflLayer* pLayer = GetEflLayer(*pWindow);
1991 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1997 _EcoreEvas::AllowSetWindowBounds(bool allow)
1999 __changeBounds = allow;
2003 _EcoreEvas::IsWindowVisible(const _Window& window)
2005 _EflLayer* pLayer = GetEflLayer(window);
2006 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2008 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2009 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2011 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2013 int ret = ecore_x_window_visible_get(win);
2024 // [ToDo] Remove API
2026 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2029 _EflLayer* pLayer = GetEflLayer(window);
2030 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2032 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2033 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2035 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2036 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2038 unsigned int val[3];
2039 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2050 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2054 // [ToDo] Remove API
2056 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2059 _EflLayer* pLayer = GetEflLayer(window);
2060 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2062 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2063 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2065 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2066 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2068 unsigned int val[3];
2069 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2085 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
2087 _EflLayer* pLayer = GetEflLayer(window);
2088 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2090 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2091 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2093 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2094 ecore_x_icccm_transient_for_unset(win);
2096 if (level == _WINDOW_LEVEL_NORMAL)
2098 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2100 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2102 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2103 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2105 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2107 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2108 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2111 SetLastResult(E_SUCCESS);
2115 _EcoreEvas::GetWindowLevel(const _Window& window) const
2117 _EflLayer* pLayer = GetEflLayer(window);
2118 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2120 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2121 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2123 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2125 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2126 ecore_x_netwm_window_type_get(win, &type);
2128 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2129 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2131 winLevel = _WINDOW_LEVEL_NORMAL;
2133 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2135 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2137 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2139 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2141 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2143 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2147 SetLastResult(E_SUCCESS);
2153 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2155 if (__changeBounds == false)
2160 _EflLayer* pLayer = GetEflLayer(window);
2161 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2163 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2164 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2166 Evas_Object* pWinObject = pLayer->GetElmWin();
2167 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2169 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2171 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2173 _Window* pWindow = const_cast<_Window*>(&window);
2175 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2182 _ControlManager* pControlManager = _ControlManager::GetInstance();
2183 if (pControlManager)
2185 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2188 int ownerRotate = GetWindowRotation(*pCurFrame);
2189 if (ownerRotate != rotate)
2197 int winX = winBounds.x;
2198 int winY = winBounds.y;
2202 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2207 winX = rootW - winBounds.y - winBounds.height;
2212 winY = rootH - winBounds.x - winBounds.width;
2215 winX = rootW - winBounds.x - winBounds.width;
2216 winY = rootH - winBounds.y - winBounds.height;
2226 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2228 evas_object_move(pWinObject, winX, winY);
2230 if (ret == EINA_FALSE)
2232 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2233 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);
2237 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2240 SetLastResult(E_SUCCESS);
2244 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2246 if (__changeBounds == false)
2251 _EflLayer* pLayer = GetEflLayer(window);
2252 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2254 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2255 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2257 Evas_Object* pWinObject = pLayer->GetElmWin();
2258 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2260 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2261 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2263 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2265 _Window* pWindow = const_cast<_Window*>(&window);
2267 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2274 _ControlManager* pControlManager = _ControlManager::GetInstance();
2275 if (pControlManager)
2277 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2280 int ownerRotate = GetWindowRotation(*pCurFrame);
2281 if (ownerRotate != rotate)
2289 int winX = winBounds.x;
2290 int winY = winBounds.y;
2294 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2299 winX = rootW - winBounds.y - winBounds.height;
2304 winY = rootH - winBounds.x - winBounds.width;
2307 winX = rootW - winBounds.x - winBounds.width;
2308 winY = rootH - winBounds.y - winBounds.height;
2318 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2320 evas_object_move(pWinObject, winX, winY);
2322 if (ret == EINA_FALSE)
2324 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2325 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);
2329 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2332 SetLastResult(E_SUCCESS);
2336 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2338 _EflLayer* pLayer = GetEflLayer(window);
2339 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2341 Evas_Object* pWinObj = pLayer->GetElmWin();
2342 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2344 pLayer->SetShowState(visibleState);
2346 SetLastResult(E_SUCCESS);
2350 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2352 _Window* pOwnerWindow = owner.GetRootWindow();
2353 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2355 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2356 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2358 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2359 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2361 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2362 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2364 Ecore_X_Window_Type type;
2365 ecore_x_netwm_window_type_get(owneeWin, &type);
2366 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2368 ecore_x_icccm_transient_for_unset(owneeWin);
2369 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2370 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2374 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] Skip to transient_for_set", owneeWin);
2378 // 1. IsLayoutChangable : true
2379 // 2. IsRotationSynchronized : true
2382 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2384 int* rotations = null;
2385 unsigned int count = 0;
2386 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2392 SetWindowAvailabledRotation(ownee, rotations, count);
2397 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2398 if (preferredRoation == true)
2400 int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2401 SetWindowPreferredRotation(ownee, preferredRotation);
2405 SetWindowPreferredRotation(ownee, -1);
2410 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2411 SetWindowPreferredRotation(ownee, ownerRotation);
2414 SetLastResult(E_SUCCESS);
2418 _EcoreEvas::GetWindowRotation(const _Window& window)
2420 _EflLayer* pLayer = GetEflLayer(window);
2426 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2431 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation)
2433 _EflLayer* pLayer = GetEflLayer(window);
2439 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2440 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
2441 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2443 _Window* pWindow = const_cast<_Window*>(&window);
2448 pWindow->SetPreferredRotation(false);
2452 pWindow->SetPreferredRotation(true);
2458 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count)
2460 _EflLayer* pLayer = GetEflLayer(window);
2466 // Skip available_set if there is not change
2468 int* prevRotations = null;
2469 unsigned int prevCount = 0;
2470 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2471 free(prevRotations);
2475 if (prevCount == count)
2481 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2482 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window available rotation(%d).", win, count);
2483 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2487 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2489 _EflLayer* pLayer = GetEflLayer(window);
2495 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2499 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2501 _EflLayer* pLayer = GetEflLayer(window);
2507 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2509 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2510 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);
2511 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2515 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2517 _EflLayer* pLayer = GetEflLayer(window);
2523 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2524 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2526 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2527 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);
2528 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2531 // [ToDo] Remove API
2533 _EcoreEvas::GetFrame(void) const
2535 SysLog(NID_UI, "Do not use.");
2539 // [ToDo] Remove API
2541 _EcoreEvas::GetRootVisualElement(void)const
2543 SysLog(NID_UI, "Do not use.");
2547 // [ToDo] Remove API
2549 _EcoreEvas::SetFrame(const _Control& control)
2551 SysLog(NID_UI, "Do not use.");
2552 __pFrame = const_cast<_Control*>(&control);
2556 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2558 Ecore_X_Window cbhmWin = GetCbhmWindow();
2559 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2560 Ecore_X_Atom atomItemType = 0;
2562 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2565 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2566 if (atomItemType == x_atom_cbhm_error)
2583 *pDataType = atomItemType;
2593 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2595 Eina_Bool acc = elm_config_access_get();
2599 void* _GetEcoreEvasHandle(void)
2601 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2602 if (pEcoreEvasMgr == null)
2607 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2608 if (pUiEcoreEvas == null)
2613 return (void*)pUiEcoreEvas->GetEcoreEvas();
2616 void* _GetEvasHandle(void)
2618 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2619 if (pEcoreEvasMgr == null)
2624 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2625 if (pUiEcoreEvas == null)
2630 return (void*)pUiEcoreEvas->GetEvas();
2634 _EcoreEvas::InitializeAtomList(void)
2636 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2637 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2638 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2639 __atomList[_ATOM_TARGETS].response = RequestClip;
2640 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2641 __atomList[_ATOM_TARGETS].atom = 0;
2643 __atomList[_ATOM_ATOM].pName = "ATOM";
2644 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2645 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2646 __atomList[_ATOM_ATOM].response = RequestClip;
2647 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2648 __atomList[_ATOM_ATOM].atom = 0;
2650 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2651 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2652 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2653 __atomList[_ATOM_XELM].response = null;
2654 __atomList[_ATOM_XELM].notify = NotifyEdje;
2655 __atomList[_ATOM_XELM].atom = 0;
2657 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2658 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2659 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2660 __atomList[_ATOM_TEXT_URI].response = null;
2661 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2662 __atomList[_ATOM_TEXT_URI].atom = 0;
2664 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2665 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2666 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2667 __atomList[_ATOM_TEXT_URILIST].response = null;
2668 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2669 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2671 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2672 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2673 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2674 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2675 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2676 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2678 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2679 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2680 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2681 __atomList[_ATOM_IMAGE_PNG].response = null;
2682 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2683 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2685 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2686 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2687 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2688 __atomList[_ATOM_IMAGE_JPEG].response = null;
2689 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2690 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2692 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2693 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2694 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2695 __atomList[_ATOM_IMAGE_BMP].response = null;
2696 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2697 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2699 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2700 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2701 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2702 __atomList[_ATOM_IMAGE_GIF].response = null;
2703 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2704 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2706 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2707 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2708 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2709 __atomList[_ATOM_IMAGE_TIFF].response = null;
2710 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2711 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2713 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2714 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2715 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2716 __atomList[_ATOM_IMAGE_SVG].response = null;
2717 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2718 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2720 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2721 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2722 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2723 __atomList[_ATOM_IMAGE_XPM].response = null;
2724 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2725 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2727 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2728 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2729 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2730 __atomList[_ATOM_IMAGE_TGA].response = null;
2731 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2732 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2734 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2735 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2736 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2737 __atomList[_ATOM_IMAGE_PPM].response = null;
2738 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2739 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2741 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2742 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2743 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2744 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2745 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2746 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2748 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2749 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2750 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2751 __atomList[_ATOM_TEXT_HTML].response = null;
2752 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2753 __atomList[_ATOM_TEXT_HTML].atom = 0;
2755 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2756 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2757 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2758 __atomList[_ATOM_STRING_UTF8].response = null;
2759 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2760 __atomList[_ATOM_STRING_UTF8].atom = 0;
2762 __atomList[_ATOM_STRING].pName = "STRING";
2763 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2764 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2765 __atomList[_ATOM_STRING].response = null;
2766 __atomList[_ATOM_STRING].notify = NotifyText;
2767 __atomList[_ATOM_STRING].atom = 0;
2769 __atomList[_ATOM_TEXT].pName = "TEXT";
2770 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2771 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2772 __atomList[_ATOM_TEXT].response = null;
2773 __atomList[_ATOM_TEXT].notify = null;
2774 __atomList[_ATOM_TEXT].atom = 0;
2776 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2777 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2778 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2779 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2780 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2781 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2783 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2784 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2785 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2786 __atomList[_ATOM_TEXT_PLAIN].response = null;
2787 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2788 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2790 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2791 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2792 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2793 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2794 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2795 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2796 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2797 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2798 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
2800 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
2801 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
2802 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
2803 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
2804 __clipList[_CLIP_TYPE_SECONDARY].active = false;
2805 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
2806 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
2807 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
2808 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
2810 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
2811 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
2812 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
2813 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
2814 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
2815 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
2816 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
2817 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
2818 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
2820 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
2821 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
2822 __clipList[_CLIP_TYPE_XDND].active = false;
2823 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
2824 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
2825 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
2826 __clipList[_CLIP_TYPE_XDND].completed = false;
2828 for (int i = 0; i < _ATOM_MAX; i++)
2830 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
2831 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
2833 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
2836 result r = E_SUCCESS;
2838 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
2839 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2841 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
2842 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2844 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
2845 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2847 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
2848 __atomAccessibility = ecore_x_atom_get("_E_MOD_ACC_SCR_READER_");
2853 for (int i = 0; i < _ATOM_MAX; i++)
2855 if (__atomList[i].atom)
2857 ecore_x_selection_converter_atom_del(__atomList[i].atom);
2863 ecore_event_handler_del(__pClearClip);
2864 __pClearClip = null;
2869 ecore_event_handler_del(__pNotifyClip);
2870 __pNotifyClip = null;
2873 if (__pClipboardClosed)
2875 ecore_event_handler_del(__pClipboardClosed);
2876 __pClipboardClosed = null;
2883 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
2885 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
2886 (_CLIP_FORMAT_MARKUP & clipFormat) ||
2887 (_CLIP_FORMAT_IMAGE & clipFormat) ||
2888 (_CLIP_FORMAT_VCARD & clipFormat) ||
2889 (_CLIP_FORMAT_HTML & clipFormat));
2893 _EcoreEvas::GetCbhmWindow(void) const
2895 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
2896 Ecore_X_Window cbhmWin = 0;
2898 unsigned char* pBuf = NULL;
2900 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
2904 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
2916 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
2918 Ecore_X_Window cbhmWin = GetCbhmWindow();
2919 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
2921 if (!cbhmWin || !atomCbhmMsg)
2926 XClientMessageEvent m;
2927 memset(&m, 0, sizeof(m));
2928 m.type = ClientMessage;
2929 m.display = (Display*)ecore_x_display_get();
2931 m.message_type = atomCbhmMsg;
2933 snprintf(m.data.b, 20, "%s", pMsg);
2935 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
2946 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
2948 Ecore_X_Window cbhmWin = GetCbhmWindow();
2949 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
2952 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
2955 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
2964 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
2966 unsigned char* pData = null;
2985 long unsigned int numRet = 0;
2986 long unsigned int bytes = 0;
2990 unsigned char* pPropRet = null;
2991 Ecore_X_Atom typeRet;
2993 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
2994 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3006 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3015 for (i = 0; i < numRet; i++)
3016 (pData)[i] = pPropRet[i];
3019 for (i = 0; i < numRet; i++)
3020 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3023 for (i = 0; i < numRet; i++)
3024 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3040 *pDataType = typeRet;
3047 _EcoreEvas::GetCbhmItemCount(void) const
3052 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3053 Ecore_X_Window cbhmWin = GetCbhmWindow();
3055 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3067 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3076 *(int*)pDataType = 0;
3079 Ecore_X_Window cbhmWin = GetCbhmWindow();
3083 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3084 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3085 Ecore_X_Atom atomItemType = 0;
3087 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3101 *pDataType = atomItemType;
3104 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3105 if (atomItemType == x_atom_cbhm_error)
3123 // [ToDo] Remove API
3125 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3127 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3130 // [ToDo] Remove API
3132 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3134 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3137 // [ToDo] Remove API
3138 _OSP_EXPORT_ unsigned int
3139 _GetActiveWindow(void)
3141 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3144 // [ToDo] Remove API
3146 _GetProcessId(unsigned int window)
3148 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);