2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUi_EcoreEvas.cpp
20 * @brief This is the implementation file for the _EcoreEvas class.
24 #include <appcore-common.h>
25 #include <runtime_info.h>
27 #include <X11/Xatom.h>
29 #include <Elementary.h>
30 #include <FGrpRectangle.h>
31 #include <FGrpFloatRectangle.h>
32 #include <FBaseInteger.h>
33 #include <FBaseErrors.h>
34 #include <FBaseSysLog.h>
35 #include <FBaseRtThread.h>
36 #include <FApp_IActiveWindowEventListener.h>
37 #include <FBase_StringConverter.h>
38 #include <FGrp_CanvasImpl.h>
39 #include "FUi_CoordinateSystemUtils.h"
40 #include "FUi_EcoreEvas.h"
41 #include "FUi_EcoreEvasMgr.h"
42 #include "FUi_Control.h"
44 #include "FUi_UiNotificationEvent.h"
45 #include "FUi_UiEventManager.h"
46 #include "FUi_Window.h"
47 #include "FUiAnim_EflLayer.h"
48 #include "FUiAnim_EflNode.h"
49 #include "FUiAnim_VisualElement.h"
50 #include "FUi_AccessibilityGesture.h"
51 #include "FUi_AccessibilitySystemSettingLoader.h"
52 #include "FUiAnim_RootVisualElement.h"
53 #include "FUiAnim_DisplayManager.h"
54 #include "FUiCtrl_Frame.h"
55 #include "FUiCtrl_FrameImpl.h"
56 #include "FUiCtrl_FormImpl.h"
57 #include "FUi_Clipboard.h"
58 #include "FUi_TouchManager.h"
59 #include "FUi_ControlManager.h"
60 #include "FUi_ActiveWindowEvent.h"
61 #include "FUi_ControlImplManager.h"
62 #include "FUiCtrl_Popup.h"
63 #include "FUiCtrl_ContextMenu.h"
64 #include "FUiAnim_DisplayContextImpl.h"
65 #include "FUiAnimDisplayContext.h"
67 using namespace Tizen::Base;
68 using namespace Tizen::Base::Runtime;
69 using namespace Tizen::App;
70 using namespace Tizen::Graphics;
71 using namespace Tizen::Ui;
72 using namespace Tizen::Ui::Animations;
73 using namespace Tizen::Ui::Controls;
75 #define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN"
76 #define ATOM_CBHM_MSG "CBHM_MSG"
77 #define ATOM_CBHM_COUNT_GET "CBHM_cCOUNT"
78 #define ATOM_CBHM_SERIAL_NUMBER "CBHM_SERIAL_NUMBER"
79 #define ATOM_CBHM_ERROR "CBHM_ERROR"
80 #define ATOM_CBHM_ITEM "CBHM_ITEM"
81 #define ATOM_CBHM_SET_ITEM "SET_ITEM"
82 #define ATOM_CBHM_CLIPBOARD_SHOW_ALL "show1"
83 #define ATOM_CBHM_CLIPBOARD_SHOW "show0"
84 #define ATOM_CBHM_CLIPBOARD_HIDE "cbhm_hide"
85 #define ATOM_CBHM_SELECTED_ITEM "CBHM_SELECTED_ITEM"
86 #define ATOM_ROTATE_AUTO "_E_WINDOW_ROTATION_SUPPORTED"
88 namespace Tizen { namespace Ui
90 static _EcoreEvas* _pEvas = null;
96 Ecore_X_Atom __atomRotateRootAngle = 0;
98 int __clipboardHeight = 0;
101 OnWindowStateChanged(Ecore_Evas* pEcoreEvas)
103 _ControlManager* pControlManager = _ControlManager::GetInstance();
104 if (!pControlManager)
109 Ecore_X_Window targetWin = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
111 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] OnWindowStateChanged is called.", targetWin);
113 int winCount = pControlManager->GetWindowCount();
114 for (int i = 0; i < winCount; i++)
116 _Window* pWindow = pControlManager->GetWindow(i);
122 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
124 if (win == targetWin)
126 pWindow->OnWindowStateChanged();
134 OnWindowPropertyChanged(void* pData, int type, void* pEvent)
136 Ecore_X_Event_Window_Property* pEv = (Ecore_X_Event_Window_Property*)pEvent;
139 return ECORE_CALLBACK_PASS_ON;
142 Ecore_X_Window targetWin = pEv->win;
145 return ECORE_CALLBACK_PASS_ON;
148 if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
150 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
151 Ecore_X_Illume_Clipboard_State clipboardState = ecore_x_e_illume_clipboard_state_get(zone);
153 if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
159 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
161 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
163 if (__clipboardHeight == 0)
165 SysLog(NID_UI, "[Clipboard] Clipboard is opened. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
166 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_OPENED, clipboardDim.width, clipboardDim.height);
167 __clipboardHeight = clipboardDim.height;
171 // SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
172 // _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
175 else if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
177 SysLog(NID_UI, "[Clipboard] Clipboard is closed.");
178 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_CLOSED, 0, 0);
179 __clipboardHeight = 0;
180 _Clipboard::GetInstance()->HidePopup();
183 else if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
185 // Only after opening Clipboard
186 if (__clipboardHeight != 0)
188 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
194 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
196 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
198 if (clipboardDim.height != 0)
200 SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
201 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
205 else if (pEv->atom == ECORE_X_ATOM_WM_STATE)
207 _ControlManager* pControlManager = _ControlManager::GetInstance();
208 if (!pControlManager)
210 return ECORE_CALLBACK_PASS_ON;
213 int winCount = pControlManager->GetWindowCount();
215 for (int i = 0; i < winCount; i++)
217 _Window* pWindow = pControlManager->GetWindow(i);
223 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
224 if (win != targetWin)
229 if (pWindow->IsOrientationRoot() == true)
231 _Frame* pFrame = static_cast<_Frame*>(pWindow);
232 _DisplayContextImpl* pContext = _DisplayContextImpl::GetInstance(*pFrame->GetDisplayContext());
233 _EflLayer* pLayer = static_cast<_EflLayer*>(pContext->GetNativeLayer());
236 Ecore_X_Window_State_Hint state = ecore_x_icccm_state_get(targetWin);
239 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
240 pLayer->SetRenderNeeded(false);
243 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
244 pLayer->SetRenderNeeded(false);
245 pFrame->OnFrameMinimized();
247 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
248 pLayer->SetRenderNeeded(true);
249 pFrame->OnFrameRestored();
260 return ECORE_CALLBACK_PASS_ON;
264 OnWindowVisibilityChanged(void* pData, int type, void* pEvent)
266 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
267 SysTryReturn(NID_UI, pEvent, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
269 Ecore_X_Event_Window_Visibility_Change* pE = (Ecore_X_Event_Window_Visibility_Change*) pEvent;
270 _ControlManager* pControlManager = _ControlManager::GetInstance();
272 int count = pControlManager->GetWindowCount();
274 _Window* pWindow = null;
277 for (int i = 0; i < count; i++)
279 pWindow = pControlManager->GetWindow(i);
282 NativeWindowHandle handle = pWindow->GetNativeHandle();
283 if (handle == pE->win)
291 Tizen::Base::Collection::ArrayList* pArgs = null;
292 String* pType = null;
293 Integer* pObscured = null;
297 const _Control* pDestination = pWindow;
299 pArgs = new (std::nothrow) Tizen::Base::Collection::ArrayList;
300 SysTryReturn(NID_UI, pArgs, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
302 result r = pArgs->Construct();
303 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
305 pType = new (std::nothrow) String(L"VisibilityEvent");
306 r = pArgs->Add(*pType);
307 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
309 pObscured = new (std::nothrow) Integer(pE->fully_obscured);
310 r = pArgs->Add(*pObscured);
311 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
313 _UiNotificationEvent event(pDestination->GetHandle(), pArgs);
315 r = _UiEventManager::GetInstance()->SendEvent(event);
318 return ECORE_CALLBACK_RENEW;
321 pArgs->RemoveAll(true);
338 OnWindowShown(void* pData, int type, void* pEvent)
340 return ECORE_CALLBACK_PASS_ON;
344 OnClientMessageReceived(void* pData, int type, void* pEvent)
346 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
347 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
349 _ControlManager* pControlManager = _ControlManager::GetInstance();
350 if (!pControlManager)
352 return ECORE_CALLBACK_RENEW;
355 if (pClientEvent->message_type == __atomRotateRootAngle)
357 int angle = pClientEvent->data.l[0];
359 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
361 pControlManager->OnWindowRotated(angle);
364 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
367 int winCount = pControlManager->GetWindowCount();
368 for (int i = 0; i < winCount; i++)
370 _Window* pWindow = pControlManager->GetWindow(i);
376 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
378 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
387 return ECORE_CALLBACK_RENEW;
392 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
394 SysLog(NID_UI, "Accessibility action : Move next");
395 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
397 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
399 SysLog(NID_UI, "Accessibility action : Move next");
400 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
402 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
404 SysLog(NID_UI, "Accessibility action : Move previous");
405 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
407 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
409 SysLog(NID_UI, "Accessibility action : Move previous");
410 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
412 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
414 SysLog(NID_UI, "Accessibility action : Activate");
415 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
417 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
419 x = (Evas_Coord)pClientEvent->data.l[2];
420 y = (Evas_Coord)pClientEvent->data.l[3];
421 SysLog(NID_UI, "Accessibility action : Read");
422 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
424 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
426 SysLog(NID_UI, "Accessibility action : value increased");
427 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
429 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
431 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
432 x = (Evas_Coord)pClientEvent->data.l[3];
433 y = (Evas_Coord)pClientEvent->data.l[4];
434 if (pClientEvent->data.l[2] == 0)
436 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
438 else if (pClientEvent->data.l[2] == 1)
440 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
442 else if (pClientEvent->data.l[2] == 2)
444 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
447 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL)
449 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
450 x = (Evas_Coord)pClientEvent->data.l[3];
451 y = (Evas_Coord)pClientEvent->data.l[4];
452 if (pClientEvent->data.l[2] == 0)
454 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
456 else if (pClientEvent->data.l[2] == 1)
458 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
460 else if (pClientEvent->data.l[2] == 2)
462 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
465 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
467 SysLog(NID_UI, "Accessibility action : value decreased");
468 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
472 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
474 SysLog(NID_UI, "[Ime Rotation]");
476 _Window* pWindow = pControlManager->GetCurrentFrame();
479 NativeWindowHandle handle = pWindow->GetNativeHandle();
481 if (pClientEvent->win == handle)
483 int angle = pClientEvent->data.l[1];
484 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
486 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
490 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
493 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
495 if (pCurrentFormImpl)
497 pCurrentFormImpl->UpdateOrientation(angle);
501 pFrameImpl->UpdateOrientation(angle);
509 return ECORE_CALLBACK_RENEW;
522 _CLIP_TYPE_SECONDARY,
523 _CLIP_TYPE_CLIPBOARD,
530 Ecore_X_Selection selection;
531 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
532 Eina_Bool (* clear)(void);
533 void (* request)(Ecore_X_Window window, const char* pTarget);
539 _ClipFormat requestedFormat;
540 char* pRetrievedBuffer;
545 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
546 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
547 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
553 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
567 _ATOM_TEXT_HTML_UTF8,
572 _ATOM_TEXT_PLAIN_UTF8,
581 ClipConverter convert;
582 ClipResponseHandler response;
583 ClipNotifyHandler notify;
587 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
588 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
590 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
591 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
592 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
593 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
594 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
595 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
596 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
598 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
599 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
600 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
601 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
602 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
603 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
605 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
607 _Atom __atomList[_ATOM_MAX];
608 _Clip __clipList[_CLIP_TYPE_MAX];
611 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
613 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
615 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
616 Ecore_X_Window window = pE->win;
618 _ClipType clipType = _CLIP_TYPE_SECONDARY;
619 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
621 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
623 return ECORE_CALLBACK_PASS_ON;
627 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
632 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
633 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
634 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
635 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
636 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
638 int index = *((int*) pData);
639 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
642 for (int i = 0; i < _ATOM_MAX; i++)
644 if (__clipList[index].format & __atomList[i].formats)
648 // Make the atom list to be possible to return data.
649 Ecore_X_Atom* pAtoms = null;
652 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
653 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
655 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
657 if (__clipList[index].format & __atomList[i].formats)
658 pAtoms[count++] = __atomList[i].atom;
665 *pType = ECORE_X_ATOM_ATOM;
672 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
674 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
675 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
676 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
678 int index = *((int*) pData);
679 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
680 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
682 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
684 *outData = strdup(__clipList[index].pBuffer);
685 *outSize = strlen(__clipList[index].pBuffer);
692 ConvertClipIntoHtml(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_HTML)
704 *outData = strdup(__clipList[index].pBuffer);
705 *outSize = strlen(__clipList[index].pBuffer);
712 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
718 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
720 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
721 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
722 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
724 int index = *((int*) pData);
725 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
726 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
728 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
730 *outData = strdup(__clipList[index].pBuffer);
731 *outSize = strlen(__clipList[index].pBuffer);
738 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
744 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
750 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
756 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
758 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
760 _Clipboard* pClipboard = _Clipboard::GetInstance();
763 bool visible = pClipboard->IsPopupVisible();
767 pClipboard->FireEvent(0, null);
771 return ECORE_CALLBACK_PASS_ON;
775 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
777 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
779 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
782 for (i = 0; i < _CLIP_TYPE_MAX; i++)
784 if (__clipList[i].selection == pE->selection)
790 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
792 _Clip* pClip = __clipList + i;
793 for (i = 0; i < _ATOM_MAX; i++)
795 if (!strcmp(pE->target, __atomList[i].pName))
797 if (__atomList[i].notify)
799 __atomList[i].notify(pClip, pE);
804 return ECORE_CALLBACK_PASS_ON;
808 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
810 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
811 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
813 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
814 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
816 _ControlManager* pControlManager = _ControlManager::GetInstance();
817 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
819 _Window* pWindow = pControlManager->GetClipboardOwner();
820 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
822 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
823 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
825 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
826 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
828 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
829 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
831 Ecore_X_Atom dataType = 0;
832 char* pBuffer = null;
833 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
837 const char* pHtmlAtomName = "text/html;charset=utf-8";
838 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
840 if (dataType == htmlType)
842 pClip->request(window, pHtmlAtomName);
843 return ECORE_CALLBACK_PASS_ON;
847 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
848 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
851 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
853 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
855 if (!(__atomList[j].formats & pClip->requestedFormat))
860 for (i = 0; i < pTargets->data.length; i++)
862 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
864 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
866 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
871 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
877 return ECORE_CALLBACK_PASS_ON;
880 pClip->request(window, __atomList[j].pName);
881 return ECORE_CALLBACK_PASS_ON;
885 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
887 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
888 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
890 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
891 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
893 pClip->bufferLength = (int) pData->length;
895 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
898 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
899 pStr[pClip->bufferLength] = '\0';
903 SysLog(NID_UI, "[Clipboard] pStr is null.");
907 pClip->pRetrievedBuffer = pStr;
909 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
915 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
917 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
918 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
920 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
921 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
923 pClip->bufferLength = (int) pData->length;
925 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
928 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
929 pStr[pClip->bufferLength] = '\0';
933 SysLog(NID_UI, "[Clipboard] pStr is null.");
937 pClip->pRetrievedBuffer = pStr;
939 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
945 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
947 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
948 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
950 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
951 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
953 pClip->bufferLength = (int) pData->length;
955 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
958 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
959 pStr[pClip->bufferLength] = '\0';
963 SysLog(NID_UI, "[Clipboard] pStr is null.");
967 pClip->pRetrievedBuffer = pStr;
969 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
975 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
977 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
978 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
980 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
981 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
983 pClip->bufferLength = (int) pData->length;
985 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
988 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
989 pStr[pClip->bufferLength] = '\0';
993 SysLog(NID_UI, "[Clipboard] pStr is null.");
997 pClip->pRetrievedBuffer = pStr;
999 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
1005 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1007 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1008 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1010 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1011 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1013 pClip->bufferLength = (int) pData->length;
1015 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1018 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1019 pStr[pClip->bufferLength] = '\0';
1023 SysLog(NID_UI, "[Clipboard] pStr is null.");
1027 pClip->pRetrievedBuffer = pStr;
1029 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1035 namespace Tizen { namespace Ui
1039 _EcoreEvas::CreateInstanceN(void)
1041 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1042 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1044 result r = GetLastResult();
1045 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1047 SetLastResult(E_SUCCESS);
1056 _EcoreEvas::_EcoreEvas(void)
1057 : __pWindowVisibilityChanged(null)
1058 , __pWindowPropertyChanged(null)
1059 , __pWindowShown(null)
1060 , __pClientMessageReceived(null)
1061 , __pClearClip(null)
1062 , __pNotifyClip(null)
1063 , __pClipboardClosed(null)
1065 , __pForegroundWindow(null)
1067 , __changeBounds(true)
1068 , __openClipboard(false)
1070 int ret = appcore_unset_rotation_cb();
1071 SysLog(NID_UI, "[Window Manager Rotation] appcore_unset_rotation_cb = %d", ret);
1073 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1074 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1076 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1078 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1079 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1083 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1086 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1087 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1089 result r = InitializeAtomList();
1090 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1092 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1093 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1095 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1096 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1098 SetLastResult(E_SUCCESS);
1103 if (__pWindowVisibilityChanged)
1105 ecore_event_handler_del(__pWindowVisibilityChanged);
1106 __pWindowVisibilityChanged = null;
1111 ecore_event_handler_del(__pWindowShown);
1112 __pWindowShown = null;
1116 _EcoreEvas::~_EcoreEvas(void)
1118 if (__pWindowVisibilityChanged)
1120 ecore_event_handler_del(__pWindowVisibilityChanged);
1121 __pWindowVisibilityChanged = null;
1126 ecore_event_handler_del(__pWindowShown);
1127 __pWindowShown = null;
1130 if (__pClientMessageReceived)
1132 ecore_event_handler_del(__pClientMessageReceived);
1133 __pClientMessageReceived = null;
1136 for (int i = 0; i < _ATOM_MAX; i++)
1138 if (__atomList[i].atom)
1140 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1146 ecore_event_handler_del(__pClearClip);
1147 __pClearClip = null;
1152 ecore_event_handler_del(__pNotifyClip);
1153 __pNotifyClip = null;
1156 if (__pClipboardClosed)
1158 ecore_event_handler_del(__pClipboardClosed);
1159 __pClipboardClosed = null;
1162 if (__pWindowPropertyChanged)
1164 ecore_event_handler_del(__pWindowPropertyChanged);
1165 __pWindowPropertyChanged = null;
1168 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1172 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1174 // Set window bounds according to the rotation
1177 _EflLayer* pLayer = GetEflLayer(window);
1183 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1186 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1187 if (curOrientation == orientation)
1193 bool rotatePartial = true;
1195 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1198 FrameShowMode showMode = pFrame->GetShowMode(false);
1199 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1201 rotatePartial = false;
1205 _Window* pWindow = const_cast<_Window*>(&window);
1206 if (pWindow->IsLayoutChangable() == true)
1208 rotatePartial = false;
1211 Evas_Object* pWinObj = pLayer->GetElmWin();
1212 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1216 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1218 if (rotatePartial == false)
1220 if (rotateEvas == true)
1222 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1225 evas_object_move(pWinObj, 0, 0);
1227 if ((orientation == 0) || (orientation == 180))
1229 evas_object_resize(pWinObj, rootW, rootH);
1233 evas_object_resize(pWinObj, rootH, rootW);
1236 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
1240 if (rotateEvas == true)
1242 ecore_evas_rotation_set(pEcoreEvas, orientation);
1245 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1246 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1249 int winX = winBounds.x;
1250 int winY = winBounds.y;
1255 winX = rootW - winBounds.y - winBounds.height;
1260 winY = rootH - winBounds.x - winBounds.width;
1263 winX = rootW - winBounds.x - winBounds.width;
1264 winY = rootH - winBounds.y - winBounds.height;
1274 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1276 evas_object_move(pWinObj, winX, winY);
1278 if (ret == EINA_FALSE)
1280 evas_object_resize(pWinObj, winBounds.width, winBounds.height);
1281 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);
1285 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1291 _EcoreEvas::GetEflLayer(const _Window& window) const
1293 _RootVisualElement* pRootVisualElement = null;
1295 pRootVisualElement = window.GetRootVisualElement();
1296 if (!pRootVisualElement)
1298 SysLog(NID_UI, "The root visual element is null.");
1302 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1305 SysLog(NID_UI, "The efl layer is null.");
1313 _EcoreEvas::GetFloatingMode(void) const
1315 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1317 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1319 SetLastResult(E_SUCCESS);
1321 return (ret ? true : false);
1324 // [ToDo] Remove API
1326 _EcoreEvas::GetFloatingMode(const _Window& window) const
1328 _EflLayer* pLayer = GetEflLayer(window);
1329 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1331 Evas_Object* pWinObj = pLayer->GetElmWin();
1332 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1334 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1336 SetLastResult(E_SUCCESS);
1338 return (ret ? true : false);
1341 // [ToDo] Remove API
1343 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1347 // [ToDo] Remove API
1349 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1354 _EcoreEvas::GetActiveWindow(void)
1356 Ecore_X_Window* pRoots = null;
1357 Ecore_X_Window activeWin = 0;
1360 pRoots = ecore_x_window_root_list(&num);
1363 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1364 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1378 _EcoreEvas::GetProcessId(unsigned int window)
1381 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1383 if (ret != EINA_TRUE)
1392 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1394 Ecore_X_Window win = ecore_x_icccm_transient_for_get(ownee);
1397 ecore_x_icccm_transient_for_unset(ownee);
1398 ecore_x_icccm_transient_for_set(ownee, owner);
1399 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", ownee, owner);
1404 _EcoreEvas::ActivateWindow(const _Window& window)
1406 _EflLayer* pLayer = GetEflLayer(window);
1407 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1409 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1410 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1412 ecore_evas_activate(pEcoreEvas);
1414 NativeWindowHandle currentWindow = window.GetNativeHandle();
1415 unsigned int activeWindow = GetActiveWindow();
1416 int pid = GetProcessId(activeWindow);
1417 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1419 SetLastResult(E_SUCCESS);
1423 _EcoreEvas::MinimizeWindow(_Window& window)
1425 _EflLayer* pLayer = GetEflLayer(window);
1426 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1428 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1429 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1431 //ecore_evas_lower(pEcoreEvas);
1432 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1434 SetLastResult(E_SUCCESS);
1438 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1442 case _RENDER_BACKEND_SW:
1443 elm_config_preferred_engine_set("software_x11");
1445 case _RENDER_BACKEND_GL:
1446 elm_config_preferred_engine_set("opengl_x11");
1448 case _RENDER_BACKEND_DEFAULT:
1451 elm_config_preferred_engine_set(NULL);
1457 _EcoreEvas::GetRenderBackend(void)
1459 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1461 const char* pEngine = elm_config_preferred_engine_get();
1463 if (pEngine == NULL)
1465 backend = _RENDER_BACKEND_DEFAULT;
1467 else if (strcmp(pEngine, "software_x11") == 0)
1469 backend = _RENDER_BACKEND_SW;
1471 else if (strcmp(pEngine, "opengl_x11") == 0)
1473 backend = _RENDER_BACKEND_GL;
1480 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1482 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1483 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1485 Ecore_X_Atom dataType = 0;
1489 case _CLIP_FORMAT_TEXT:
1490 dataType = ecore_x_atom_get("UTF8_STRING");
1492 case _CLIP_FORMAT_IMAGE:
1493 dataType = ecore_x_atom_get("text/uri");
1495 case _CLIP_FORMAT_HTML:
1496 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1502 _ControlManager* pControlManager = _ControlManager::GetInstance();
1504 _Window* pWindow = pControlManager->GetClipboardOwner();
1510 _EflLayer* pLayer = GetEflLayer(*pWindow);
1516 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1519 SetCbhmItem(window, dataType, (char*)pChar);
1525 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1527 Ecore_X_Atom dataType = 0;
1529 _ControlManager* pControlManager = _ControlManager::GetInstance();
1531 _Window* pWindow = pControlManager->GetClipboardOwner();
1537 _EflLayer* pLayer = GetEflLayer(*pWindow);
1543 GetCbhmItem(index, &dataType, pData);
1545 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1546 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1548 *format = _CLIP_FORMAT_TEXT;
1550 else if (dataType == ecore_x_atom_get("text/uri"))
1552 *format = _CLIP_FORMAT_IMAGE;
1554 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1556 *format = _CLIP_FORMAT_HTML;
1564 // Convert markup to utf8.
1565 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1567 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1568 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1578 _EcoreEvas::GetClipCount(void) const
1580 _ControlManager* pControlManager = _ControlManager::GetInstance();
1582 _Window* pWindow = pControlManager->GetClipboardOwner();
1588 _EflLayer* pLayer = GetEflLayer(*pWindow);
1594 int count = GetCbhmItemCount();
1600 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1602 _ControlManager* pControlManager = _ControlManager::GetInstance();
1604 _Window* pWindow = pControlManager->GetClipboardOwner();
1610 _EflLayer* pLayer = GetEflLayer(*pWindow);
1616 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1619 ecore_x_selection_secondary_set(window, "", 1);
1621 if (_CLIP_FORMAT_IMAGE & clipFormats)
1623 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1627 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1630 __openClipboard = true;
1634 _EcoreEvas::CloseClipboard(void)
1636 _ControlManager* pControlManager = _ControlManager::GetInstance();
1638 _Window* pWindow = pControlManager->GetClipboardOwner();
1644 _EflLayer* pLayer = GetEflLayer(*pWindow);
1650 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1653 __openClipboard = false;
1654 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1658 _EcoreEvas::IsClipboardOpened(void)
1660 return __openClipboard;
1664 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1666 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1667 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1669 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1670 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1672 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1678 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1680 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1681 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1683 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1684 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1686 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1692 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1694 _EflLayer* pLayer = GetEflLayer(window);
1695 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1697 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1698 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1700 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1704 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1708 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1715 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1717 _EflLayer* pLayer = GetEflLayer(window);
1718 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1720 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1721 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1723 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1724 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1726 bool showState = true;
1727 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1731 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1739 // [ToDo] Remove API
1741 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1743 _EflLayer* pLayer = GetEflLayer(window);
1744 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1746 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1747 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1749 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1750 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1758 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1759 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1761 SetLastResult(E_SUCCESS);
1763 return Rectangle(x, y, width, height);
1766 // [ToDo] Remove API
1768 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1770 _EflLayer* pLayer = GetEflLayer(window);
1771 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1773 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1774 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1776 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1778 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1781 case _INDICATOR_OPACITY_UNKNOWN:
1782 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1784 case _INDICATOR_OPACITY_OPAQUE:
1785 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1787 case _INDICATOR_OPACITY_TRANSLUCENT:
1788 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1790 case _INDICATOR_OPACITY_TRANSPARENT:
1791 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1794 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1795 return E_INVALID_ARG;
1798 ecore_x_e_illume_indicator_opacity_set(win, mode);
1803 // [ToDo] Remove API
1805 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1807 _EflLayer* pLayer = GetEflLayer(window);
1808 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1810 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1811 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1813 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1814 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1816 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1819 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1820 opacity = _INDICATOR_OPACITY_UNKNOWN;
1822 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1823 opacity = _INDICATOR_OPACITY_OPAQUE;
1825 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1826 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1828 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1829 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1832 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1833 return _INDICATOR_OPACITY_UNKNOWN;
1836 SetLastResult(E_SUCCESS);
1842 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
1844 _EflLayer* pLayer = GetEflLayer(window);
1845 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1847 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1848 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1850 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1852 Eina_Bool acceptsFocus;
1853 Ecore_X_Window_State_Hint initialState;
1854 Ecore_X_Pixmap iconPixmap;
1855 Ecore_X_Pixmap iconMask;
1856 Ecore_X_Window iconWindow;
1857 Ecore_X_Window windowGroup;
1860 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1861 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
1865 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
1867 _EflLayer* pLayer = GetEflLayer(window);
1868 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1870 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1871 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1873 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1875 Eina_Bool acceptsFocus;
1876 Ecore_X_Window_State_Hint initialState;
1877 Ecore_X_Pixmap iconPixmap;
1878 Ecore_X_Pixmap iconMask;
1879 Ecore_X_Window iconWindow;
1880 Ecore_X_Window windowGroup;
1883 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
1885 return (acceptsFocus ? true : false);
1889 _EcoreEvas::SetWindowName(const _Window& window, const Tizen::Base::String& name)
1891 _EflLayer* pLayer = GetEflLayer(window);
1892 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1894 Evas_Object* pWinObj = pLayer->GetElmWin();
1895 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1897 const char* windowName = _StringConverter::CopyToCharArrayN(name);
1900 elm_win_title_set(pWinObj, windowName);
1902 delete[] windowName;
1907 _EcoreEvas::SetWindowType(const _Window& window, int winType)
1909 _EflLayer* pLayer = GetEflLayer(window);
1910 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1912 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1913 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1915 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1917 if (winType == _WINDOW_TYPE_SUB)
1919 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
1924 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
1926 _EflLayer* pLayer = GetEflLayer(window);
1927 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1929 Evas_Object* pWinObj = pLayer->GetElmWin();
1930 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1932 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
1937 // [ToDo] Remove API
1939 _EcoreEvas::GetEvas(void) const
1941 SysLog(NID_UI, "Do not use.");
1942 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1948 _EflLayer* pLayer = GetEflLayer(*pWindow);
1954 return pLayer->GetEvas();
1957 // [ToDo] Remove API
1959 _EcoreEvas::GetEcoreEvas(void) const
1961 SysLog(NID_UI, "Do not use.");
1962 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1968 _EflLayer* pLayer = GetEflLayer(*pWindow);
1974 return pLayer->GetEcoreEvas();
1977 // [ToDo] Remove API
1979 _EcoreEvas::GetWindowObject(void) const
1981 SysLog(NID_UI, "Do not use.");
1982 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
1988 _EflLayer* pLayer = GetEflLayer(*pWindow);
1994 return pLayer->GetElmWin();
1997 // [ToDo] Remove API
1999 _EcoreEvas::GetXWindow(void) const
2001 SysLog(NID_UI, "Do not use.");
2002 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2008 _EflLayer* pLayer = GetEflLayer(*pWindow);
2014 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2020 _EcoreEvas::AllowSetWindowBounds(bool allow)
2022 __changeBounds = allow;
2026 _EcoreEvas::IsWindowVisible(const _Window& window)
2028 _EflLayer* pLayer = GetEflLayer(window);
2029 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2031 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2032 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2034 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2036 int ret = ecore_x_window_visible_get(win);
2047 // [ToDo] Remove API
2049 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2052 _EflLayer* pLayer = GetEflLayer(window);
2053 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2055 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2056 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2058 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2059 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2061 unsigned int val[3];
2062 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2073 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2077 // [ToDo] Remove API
2079 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2082 _EflLayer* pLayer = GetEflLayer(window);
2083 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2085 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2086 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2088 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2089 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2091 unsigned int val[3];
2092 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2108 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
2110 _EflLayer* pLayer = GetEflLayer(window);
2111 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2113 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2114 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2116 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2117 ecore_x_icccm_transient_for_unset(win);
2119 if (level == _WINDOW_LEVEL_NORMAL)
2121 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2123 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2125 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2126 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2128 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2130 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2131 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2134 SetLastResult(E_SUCCESS);
2138 _EcoreEvas::GetWindowLevel(const _Window& window) const
2140 _EflLayer* pLayer = GetEflLayer(window);
2141 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2143 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2144 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2146 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2148 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2149 ecore_x_netwm_window_type_get(win, &type);
2151 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2152 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2154 winLevel = _WINDOW_LEVEL_NORMAL;
2156 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2158 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2160 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2162 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2164 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2166 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2170 SetLastResult(E_SUCCESS);
2176 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2178 if (__changeBounds == false)
2183 _EflLayer* pLayer = GetEflLayer(window);
2184 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2186 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2187 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2189 Evas_Object* pWinObject = pLayer->GetElmWin();
2190 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2192 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2194 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2196 _Window* pWindow = const_cast<_Window*>(&window);
2198 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2205 _ControlManager* pControlManager = _ControlManager::GetInstance();
2206 if (pControlManager)
2208 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2211 int ownerRotate = GetWindowRotation(*pCurFrame);
2212 if (ownerRotate != rotate)
2220 int winX = winBounds.x;
2221 int winY = winBounds.y;
2225 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2230 winX = rootW - winBounds.y - winBounds.height;
2235 winY = rootH - winBounds.x - winBounds.width;
2238 winX = rootW - winBounds.x - winBounds.width;
2239 winY = rootH - winBounds.y - winBounds.height;
2249 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2251 evas_object_move(pWinObject, winX, winY);
2253 if (ret == EINA_FALSE)
2255 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2256 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);
2260 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2263 SetLastResult(E_SUCCESS);
2267 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2269 if (__changeBounds == false)
2274 _EflLayer* pLayer = GetEflLayer(window);
2275 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2277 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2278 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2280 Evas_Object* pWinObject = pLayer->GetElmWin();
2281 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2283 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2284 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2286 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2288 _Window* pWindow = const_cast<_Window*>(&window);
2290 _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2297 _ControlManager* pControlManager = _ControlManager::GetInstance();
2298 if (pControlManager)
2300 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2303 int ownerRotate = GetWindowRotation(*pCurFrame);
2304 if (ownerRotate != rotate)
2312 int winX = winBounds.x;
2313 int winY = winBounds.y;
2317 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2322 winX = rootW - winBounds.y - winBounds.height;
2327 winY = rootH - winBounds.x - winBounds.width;
2330 winX = rootW - winBounds.x - winBounds.width;
2331 winY = rootH - winBounds.y - winBounds.height;
2341 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2343 evas_object_move(pWinObject, winX, winY);
2345 if (ret == EINA_FALSE)
2347 evas_object_resize(pWinObject, winBounds.width, winBounds.height);
2348 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);
2352 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set bounds(rot = %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY);
2355 SetLastResult(E_SUCCESS);
2359 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2361 _EflLayer* pLayer = GetEflLayer(window);
2362 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2364 Evas_Object* pWinObj = pLayer->GetElmWin();
2365 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2367 pLayer->SetShowState(visibleState);
2369 SetLastResult(E_SUCCESS);
2373 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2375 _Window* pOwnerWindow = owner.GetRootWindow();
2376 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2378 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2379 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2381 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2382 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2384 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2385 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2387 Ecore_X_Window_Type type;
2388 ecore_x_netwm_window_type_get(owneeWin, &type);
2389 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2391 Ecore_X_Window win = ecore_x_icccm_transient_for_get(owneeWin);
2392 if (win != ownerWin)
2394 ecore_x_icccm_transient_for_unset(owneeWin);
2395 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2396 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2401 SysLog(NID_UI, "[Window Order Group][Window : 0x%x] Skip to transient_for_set", owneeWin);
2405 // 1. IsLayoutChangable : true
2406 // 2. IsRotationSynchronized : true
2409 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2411 int* rotations = null;
2412 unsigned int count = 0;
2413 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2419 SetWindowAvailabledRotation(ownee, rotations, count);
2424 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2425 if (preferredRoation == true)
2427 int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2428 SetWindowPreferredRotation(ownee, preferredRotation);
2432 SetWindowPreferredRotation(ownee, -1);
2437 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2438 SetWindowPreferredRotation(ownee, ownerRotation);
2441 SetLastResult(E_SUCCESS);
2445 _EcoreEvas::GetWindowRotation(const _Window& window)
2447 _EflLayer* pLayer = GetEflLayer(window);
2453 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2458 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation, bool force)
2460 _EflLayer* pLayer = GetEflLayer(window);
2466 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2470 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2472 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
2473 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2475 _Window* pWindow = const_cast<_Window*>(&window);
2480 pWindow->SetPreferredRotation(false);
2484 pWindow->SetPreferredRotation(true);
2490 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count, bool force)
2492 _EflLayer* pLayer = GetEflLayer(window);
2498 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2500 // Skip available_set if there is not change
2503 int* prevRotations = null;
2504 unsigned int prevCount = 0;
2505 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2506 free(prevRotations);
2510 if (prevCount == count)
2518 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2521 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window available rotation(%d).", win, count);
2522 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2526 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2528 _EflLayer* pLayer = GetEflLayer(window);
2534 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2538 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2540 _EflLayer* pLayer = GetEflLayer(window);
2546 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2548 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2549 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);
2550 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2554 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2556 _EflLayer* pLayer = GetEflLayer(window);
2562 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2563 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2565 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2566 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);
2567 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2570 // [ToDo] Remove API
2572 _EcoreEvas::GetFrame(void) const
2574 SysLog(NID_UI, "Do not use.");
2578 // [ToDo] Remove API
2580 _EcoreEvas::GetRootVisualElement(void)const
2582 SysLog(NID_UI, "Do not use.");
2586 // [ToDo] Remove API
2588 _EcoreEvas::SetFrame(const _Control& control)
2590 SysLog(NID_UI, "Do not use.");
2591 __pFrame = const_cast<_Control*>(&control);
2595 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2597 Ecore_X_Window cbhmWin = GetCbhmWindow();
2598 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2599 Ecore_X_Atom atomItemType = 0;
2601 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2604 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2605 if (atomItemType == x_atom_cbhm_error)
2622 *pDataType = atomItemType;
2632 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2634 Eina_Bool acc = elm_config_access_get();
2638 void* _GetEcoreEvasHandle(void)
2640 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2641 if (pEcoreEvasMgr == null)
2646 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2647 if (pUiEcoreEvas == null)
2652 return (void*)pUiEcoreEvas->GetEcoreEvas();
2655 void* _GetEvasHandle(void)
2657 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2658 if (pEcoreEvasMgr == null)
2663 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2664 if (pUiEcoreEvas == null)
2669 return (void*)pUiEcoreEvas->GetEvas();
2673 _EcoreEvas::InitializeAtomList(void)
2675 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2676 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2677 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2678 __atomList[_ATOM_TARGETS].response = RequestClip;
2679 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2680 __atomList[_ATOM_TARGETS].atom = 0;
2682 __atomList[_ATOM_ATOM].pName = "ATOM";
2683 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2684 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2685 __atomList[_ATOM_ATOM].response = RequestClip;
2686 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2687 __atomList[_ATOM_ATOM].atom = 0;
2689 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2690 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2691 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2692 __atomList[_ATOM_XELM].response = null;
2693 __atomList[_ATOM_XELM].notify = NotifyEdje;
2694 __atomList[_ATOM_XELM].atom = 0;
2696 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2697 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2698 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2699 __atomList[_ATOM_TEXT_URI].response = null;
2700 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2701 __atomList[_ATOM_TEXT_URI].atom = 0;
2703 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2704 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2705 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2706 __atomList[_ATOM_TEXT_URILIST].response = null;
2707 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2708 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2710 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2711 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2712 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2713 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2714 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2715 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2717 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2718 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2719 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2720 __atomList[_ATOM_IMAGE_PNG].response = null;
2721 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2722 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2724 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2725 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2726 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2727 __atomList[_ATOM_IMAGE_JPEG].response = null;
2728 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2729 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2731 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2732 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2733 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2734 __atomList[_ATOM_IMAGE_BMP].response = null;
2735 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2736 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2738 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2739 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2740 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2741 __atomList[_ATOM_IMAGE_GIF].response = null;
2742 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2743 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2745 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2746 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2747 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2748 __atomList[_ATOM_IMAGE_TIFF].response = null;
2749 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2750 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2752 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2753 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2754 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2755 __atomList[_ATOM_IMAGE_SVG].response = null;
2756 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2757 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2759 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2760 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2761 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2762 __atomList[_ATOM_IMAGE_XPM].response = null;
2763 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2764 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2766 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2767 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2768 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2769 __atomList[_ATOM_IMAGE_TGA].response = null;
2770 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2771 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2773 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2774 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2775 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2776 __atomList[_ATOM_IMAGE_PPM].response = null;
2777 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2778 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2780 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2781 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2782 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2783 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2784 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2785 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2787 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2788 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2789 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2790 __atomList[_ATOM_TEXT_HTML].response = null;
2791 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2792 __atomList[_ATOM_TEXT_HTML].atom = 0;
2794 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2795 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2796 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2797 __atomList[_ATOM_STRING_UTF8].response = null;
2798 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2799 __atomList[_ATOM_STRING_UTF8].atom = 0;
2801 __atomList[_ATOM_STRING].pName = "STRING";
2802 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2803 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2804 __atomList[_ATOM_STRING].response = null;
2805 __atomList[_ATOM_STRING].notify = NotifyText;
2806 __atomList[_ATOM_STRING].atom = 0;
2808 __atomList[_ATOM_TEXT].pName = "TEXT";
2809 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2810 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2811 __atomList[_ATOM_TEXT].response = null;
2812 __atomList[_ATOM_TEXT].notify = null;
2813 __atomList[_ATOM_TEXT].atom = 0;
2815 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2816 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2817 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2818 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2819 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2820 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2822 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2823 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2824 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2825 __atomList[_ATOM_TEXT_PLAIN].response = null;
2826 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2827 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2829 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2830 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2831 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2832 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2833 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2834 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2835 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2836 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2837 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
2839 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
2840 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
2841 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
2842 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
2843 __clipList[_CLIP_TYPE_SECONDARY].active = false;
2844 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
2845 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
2846 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
2847 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
2849 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
2850 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
2851 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
2852 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
2853 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
2854 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
2855 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
2856 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
2857 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
2859 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
2860 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
2861 __clipList[_CLIP_TYPE_XDND].active = false;
2862 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
2863 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
2864 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
2865 __clipList[_CLIP_TYPE_XDND].completed = false;
2867 for (int i = 0; i < _ATOM_MAX; i++)
2869 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
2870 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
2872 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
2875 result r = E_SUCCESS;
2877 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
2878 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2880 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
2881 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2883 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
2884 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2886 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
2891 for (int i = 0; i < _ATOM_MAX; i++)
2893 if (__atomList[i].atom)
2895 ecore_x_selection_converter_atom_del(__atomList[i].atom);
2901 ecore_event_handler_del(__pClearClip);
2902 __pClearClip = null;
2907 ecore_event_handler_del(__pNotifyClip);
2908 __pNotifyClip = null;
2911 if (__pClipboardClosed)
2913 ecore_event_handler_del(__pClipboardClosed);
2914 __pClipboardClosed = null;
2921 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
2923 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
2924 (_CLIP_FORMAT_MARKUP & clipFormat) ||
2925 (_CLIP_FORMAT_IMAGE & clipFormat) ||
2926 (_CLIP_FORMAT_VCARD & clipFormat) ||
2927 (_CLIP_FORMAT_HTML & clipFormat));
2931 _EcoreEvas::GetCbhmWindow(void) const
2933 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
2934 Ecore_X_Window cbhmWin = 0;
2936 unsigned char* pBuf = NULL;
2938 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
2942 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
2954 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
2956 Ecore_X_Window cbhmWin = GetCbhmWindow();
2957 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
2959 if (!cbhmWin || !atomCbhmMsg)
2964 XClientMessageEvent m;
2965 memset(&m, 0, sizeof(m));
2966 m.type = ClientMessage;
2967 m.display = (Display*)ecore_x_display_get();
2969 m.message_type = atomCbhmMsg;
2971 snprintf(m.data.b, 20, "%s", pMsg);
2973 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
2984 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
2986 Ecore_X_Window cbhmWin = GetCbhmWindow();
2987 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
2990 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
2993 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
3002 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
3004 unsigned char* pData = null;
3023 long unsigned int numRet = 0;
3024 long unsigned int bytes = 0;
3028 unsigned char* pPropRet = null;
3029 Ecore_X_Atom typeRet;
3031 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
3032 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3044 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3053 for (i = 0; i < numRet; i++)
3054 (pData)[i] = pPropRet[i];
3057 for (i = 0; i < numRet; i++)
3058 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3061 for (i = 0; i < numRet; i++)
3062 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3078 *pDataType = typeRet;
3085 _EcoreEvas::GetCbhmItemCount(void) const
3090 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3091 Ecore_X_Window cbhmWin = GetCbhmWindow();
3093 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3105 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3114 *(int*)pDataType = 0;
3117 Ecore_X_Window cbhmWin = GetCbhmWindow();
3121 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3122 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3123 Ecore_X_Atom atomItemType = 0;
3125 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3139 *pDataType = atomItemType;
3142 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3143 if (atomItemType == x_atom_cbhm_error)
3161 // [ToDo] Remove API
3163 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3165 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3168 // [ToDo] Remove API
3170 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3172 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3175 // [ToDo] Remove API
3176 _OSP_EXPORT_ unsigned int
3177 _GetActiveWindow(void)
3179 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3182 // [ToDo] Remove API
3184 _GetProcessId(unsigned int window)
3186 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);