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"
66 #include "FUi_TouchManager.h"
68 using namespace Tizen::Base;
69 using namespace Tizen::Base::Runtime;
70 using namespace Tizen::App;
71 using namespace Tizen::Graphics;
72 using namespace Tizen::Ui;
73 using namespace Tizen::Ui::Animations;
74 using namespace Tizen::Ui::Controls;
76 #define ATOM_CBHM_WINDOW_NAME "CBHM_XWIN"
77 #define ATOM_CBHM_MSG "CBHM_MSG"
78 #define ATOM_CBHM_COUNT_GET "CBHM_cCOUNT"
79 #define ATOM_CBHM_SERIAL_NUMBER "CBHM_SERIAL_NUMBER"
80 #define ATOM_CBHM_ERROR "CBHM_ERROR"
81 #define ATOM_CBHM_ITEM "CBHM_ITEM"
82 #define ATOM_CBHM_SET_ITEM "SET_ITEM"
83 #define ATOM_CBHM_CLIPBOARD_SHOW_ALL "show1"
84 #define ATOM_CBHM_CLIPBOARD_SHOW "show0"
85 #define ATOM_CBHM_CLIPBOARD_HIDE "cbhm_hide"
86 #define ATOM_CBHM_SELECTED_ITEM "CBHM_SELECTED_ITEM"
87 #define ATOM_ROTATE_AUTO "_E_WINDOW_ROTATION_SUPPORTED"
89 namespace Tizen { namespace Ui
91 static _EcoreEvas* _pEvas = null;
97 Ecore_X_Atom __atomRotateRootAngle = 0;
99 int __clipboardHeight = 0;
102 OnWindowStateChanged(Ecore_Evas* pEcoreEvas)
104 _ControlManager* pControlManager = _ControlManager::GetInstance();
105 if (!pControlManager)
110 Ecore_X_Window targetWin = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
112 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] OnWindowStateChanged is called.", targetWin);
114 int winCount = pControlManager->GetAllWindowCount();
115 for (int i = 0; i < winCount; i++)
117 _Window* pWindow = pControlManager->GetAllWindow(i);
123 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
125 if (win == targetWin)
127 pWindow->OnWindowStateChanged();
135 OnWindowPropertyChanged(void* pData, int type, void* pEvent)
137 Ecore_X_Event_Window_Property* pEv = (Ecore_X_Event_Window_Property*)pEvent;
140 return ECORE_CALLBACK_PASS_ON;
143 Ecore_X_Window targetWin = pEv->win;
146 return ECORE_CALLBACK_PASS_ON;
149 if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
151 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
152 Ecore_X_Illume_Clipboard_State clipboardState = ecore_x_e_illume_clipboard_state_get(zone);
154 if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
160 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
162 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
164 if (__clipboardHeight == 0)
166 SysLog(NID_UI, "[Clipboard] Clipboard is opened. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
167 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_OPENED, clipboardDim.width, clipboardDim.height);
168 __clipboardHeight = clipboardDim.height;
172 // SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
173 // _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
176 else if (clipboardState == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
178 SysLog(NID_UI, "[Clipboard] Clipboard is closed.");
179 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_CLOSED, 0, 0);
180 __clipboardHeight = 0;
181 _Clipboard::GetInstance()->HidePopup();
184 else if (pEv->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY)
186 // Only after opening Clipboard
187 if (__clipboardHeight != 0)
189 Ecore_X_Window zone = ecore_x_e_illume_zone_get(targetWin);
195 ecore_x_e_illume_clipboard_geometry_get(zone, &x, &y, &w, &h);
197 Dimension clipboardDim = _CoordinateSystemUtils::InverseTransform(Dimension(w, h));
199 if (clipboardDim.height != 0)
201 SysLog(NID_UI, "[Clipboard] The bounds of Clipboard is changed. -> w = %d, h = %d", clipboardDim.width, clipboardDim.height);
202 _Clipboard::GetInstance()->FirePopupEvent(_CLIPBOARD_POPUP_STATE_BOUNDS_CHANGED, clipboardDim.width, clipboardDim.height);
206 else if (pEv->atom == ECORE_X_ATOM_WM_STATE)
208 _ControlManager* pControlManager = _ControlManager::GetInstance();
209 if (!pControlManager)
211 return ECORE_CALLBACK_PASS_ON;
214 int winCount = pControlManager->GetWindowCount();
216 for (int i = 0; i < winCount; i++)
218 _Window* pWindow = pControlManager->GetWindow(i);
224 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
225 if (win != targetWin)
230 if (pWindow->IsOrientationRoot() == true)
232 _Frame* pFrame = static_cast<_Frame*>(pWindow);
233 _DisplayContextImpl* pContext = _DisplayContextImpl::GetInstance(*pFrame->GetDisplayContext());
234 _EflLayer* pLayer = static_cast<_EflLayer*>(pContext->GetNativeLayer());
237 Ecore_X_Window_State_Hint state = ecore_x_icccm_state_get(targetWin);
240 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
241 pLayer->SetRenderNeeded(false);
244 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
245 pLayer->SetRenderNeeded(false);
246 pFrame->OnFrameMinimized();
248 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
249 pLayer->SetRenderNeeded(true);
250 pFrame->OnFrameRestored();
261 return ECORE_CALLBACK_PASS_ON;
265 OnWindowVisibilityChanged(void* pData, int type, void* pEvent)
267 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
268 SysTryReturn(NID_UI, pEvent, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
270 Ecore_X_Event_Window_Visibility_Change* pE = (Ecore_X_Event_Window_Visibility_Change*) pEvent;
271 _ControlManager* pControlManager = _ControlManager::GetInstance();
273 int count = pControlManager->GetWindowCount();
275 _Window* pWindow = null;
278 for (int i = 0; i < count; i++)
280 pWindow = pControlManager->GetWindow(i);
283 NativeWindowHandle handle = pWindow->GetNativeHandle();
284 if (handle == pE->win)
292 Tizen::Base::Collection::ArrayList* pArgs = null;
293 String* pType = null;
294 Integer* pObscured = null;
298 const _Control* pDestination = pWindow;
300 pArgs = new (std::nothrow) Tizen::Base::Collection::ArrayList;
301 SysTryReturn(NID_UI, pArgs, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
303 result r = pArgs->Construct();
304 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
306 pType = new (std::nothrow) String(L"VisibilityEvent");
307 r = pArgs->Add(*pType);
308 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
310 pObscured = new (std::nothrow) Integer(pE->fully_obscured);
311 r = pArgs->Add(*pObscured);
312 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
314 _UiNotificationEvent event(pDestination->GetHandle(), pArgs);
316 r = _UiEventManager::GetInstance()->SendEvent(event);
319 return ECORE_CALLBACK_RENEW;
322 pArgs->RemoveAll(true);
344 OnWindowConfigured(void* pData, int type, void* pEvent)
346 Ecore_X_Event_Window_Configure* pEv = (Ecore_X_Event_Window_Configure*)pEvent;
349 return ECORE_CALLBACK_PASS_ON;
352 if (pEv->from_wm == EINA_FALSE)
354 return ECORE_CALLBACK_PASS_ON;
357 Ecore_X_Window targetWin = pEv->win;
360 return ECORE_CALLBACK_PASS_ON;
363 if ((frameX == pEv->x) && (frameY == pEv->y) && (frameW == pEv->w) && (frameH == pEv->h))
365 return ECORE_CALLBACK_PASS_ON;
373 _ControlManager* pControlManager = _ControlManager::GetInstance();
374 if (!pControlManager)
376 return ECORE_CALLBACK_PASS_ON;
379 _TouchManager* pTouchManager = _TouchManager::GetInstance();
382 return ECORE_CALLBACK_PASS_ON;
385 if (pTouchManager->GetPointCount() > 0)
387 return ECORE_CALLBACK_PASS_ON;
390 _Window* pWindow = pControlManager->GetCurrentFrame();
393 return ECORE_CALLBACK_PASS_ON;
396 if (pWindow->IsOrientationRoot() == false)
398 return ECORE_CALLBACK_PASS_ON;
401 _Frame* pFrame = static_cast<_Frame*>(pWindow);
402 if (pFrame->GetShowMode() == FRAME_SHOW_MODE_FULL_SCREEN)
404 return ECORE_CALLBACK_PASS_ON;
407 Ecore_X_Window win = (Ecore_X_Window)pFrame->GetNativeHandle();
408 if (win != targetWin)
410 return ECORE_CALLBACK_PASS_ON;
413 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
416 return ECORE_CALLBACK_PASS_ON;
419 Rectangle frameBounds = pFrame->GetBounds();
420 int rotation = pEcoreEvas->GetWindowRotation(*pFrame);
422 Dimension winSize = _CoordinateSystemUtils::InverseTransform(Dimension(pEv->w, pEv->h));
423 Dimension newSize(winSize.width, winSize.height);
424 if ((rotation == 270) || (rotation == 90))
426 newSize.width = winSize.height;
427 newSize.height = winSize.width;
430 if ((frameBounds.width != newSize.width) || (frameBounds.height != newSize.height))
432 return ECORE_CALLBACK_PASS_ON;
435 Dimension screenSize = pControlManager->GetScreenSize();
436 Point winPosition = _CoordinateSystemUtils::InverseTransform(Point(pEv->x, pEv->y));
438 Point newPosition(0, 0);
442 newPosition.x = winPosition.y;
443 newPosition.y = screenSize.width - winPosition.x - frameBounds.height;
446 newPosition.x = screenSize.width - winPosition.x - frameBounds.width;
447 newPosition.y = screenSize.height - winPosition.y - frameBounds.height;
450 newPosition.x = screenSize.height - winPosition.y - frameBounds.width;
451 newPosition.y = winPosition.x;
454 newPosition.x = winPosition.x;
455 newPosition.y = winPosition.y;
459 if ((frameBounds.x != newPosition.x) || (frameBounds.y != newPosition.y))
461 pFrame->SetChangingBoundsEnabled(false);
462 pFrame->SetPosition(newPosition);
463 pFrame->SetChangingBoundsEnabled(true);
466 return ECORE_CALLBACK_PASS_ON;
470 OnWindowShown(void* pData, int type, void* pEvent)
472 return ECORE_CALLBACK_PASS_ON;
476 OnClientMessageReceived(void* pData, int type, void* pEvent)
478 Ecore_X_Event_Client_Message* pClientEvent = static_cast<Ecore_X_Event_Client_Message*>(pEvent);
479 SysTryReturn(NID_UI, pClientEvent, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
481 _ControlManager* pControlManager = _ControlManager::GetInstance();
482 if (!pControlManager)
484 return ECORE_CALLBACK_RENEW;
487 if (pClientEvent->message_type == __atomRotateRootAngle)
489 int angle = pClientEvent->data.l[0];
491 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_RENEW, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
493 pControlManager->OnWindowRotated(angle);
496 if (pClientEvent->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
499 int winCount = pControlManager->GetWindowCount();
500 for (int i = 0; i < winCount; i++)
502 _Window* pWindow = pControlManager->GetWindow(i);
508 Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
510 if (win == (Ecore_X_Window)pClientEvent->data.l[0])
519 return ECORE_CALLBACK_RENEW;
524 if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
526 SysLog(NID_UI, "Accessibility action : Move next");
527 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN);
529 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
531 SysLog(NID_UI, "Accessibility action : Move next");
532 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT);
534 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
536 SysLog(NID_UI, "Accessibility action : Move previous");
537 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT);
539 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
541 SysLog(NID_UI, "Accessibility action : Move previous");
542 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_FLICK_UP);
544 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
546 SysLog(NID_UI, "Accessibility action : Activate");
547 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP);
549 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
551 x = (Evas_Coord)pClientEvent->data.l[2];
552 y = (Evas_Coord)pClientEvent->data.l[3];
553 SysLog(NID_UI, "Accessibility action : Read");
554 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP, x, y);
556 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
558 SysLog(NID_UI, "Accessibility action : value increased");
559 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED);
561 else if ((unsigned int)pClientEvent->data.l[1] == ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_"))
563 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
564 x = (Evas_Coord)pClientEvent->data.l[3];
565 y = (Evas_Coord)pClientEvent->data.l[4];
566 if (pClientEvent->data.l[2] == 0)
568 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
570 else if (pClientEvent->data.l[2] == 1)
572 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
574 else if (pClientEvent->data.l[2] == 2)
576 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
579 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_SCROLL)
581 SysLog(NID_UI, "Accessibility action : scroll %d, %d, %d", pClientEvent->data.l[2], pClientEvent->data.l[3], pClientEvent->data.l[4]);
582 x = (Evas_Coord)pClientEvent->data.l[3];
583 y = (Evas_Coord)pClientEvent->data.l[4];
584 if (pClientEvent->data.l[2] == 0)
586 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED, x, y);
588 else if (pClientEvent->data.l[2] == 1)
590 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED, x, y);
592 else if (pClientEvent->data.l[2] == 2)
594 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED, x, y);
597 else if ((unsigned int)pClientEvent->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
599 SysLog(NID_UI, "Accessibility action : value decreased");
600 _AccessibilityGesture::ProcessGesture(_ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED);
604 if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
606 SysLog(NID_UI, "[Ime Rotation]");
608 _Window* pWindow = pControlManager->GetCurrentFrame();
611 NativeWindowHandle handle = pWindow->GetNativeHandle();
613 if (pClientEvent->win == handle)
615 int angle = pClientEvent->data.l[1];
616 SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
618 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
622 _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
625 _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
627 if (pCurrentFormImpl)
629 pCurrentFormImpl->UpdateOrientation(angle);
633 pFrameImpl->UpdateOrientation(angle);
641 return ECORE_CALLBACK_RENEW;
654 _CLIP_TYPE_SECONDARY,
655 _CLIP_TYPE_CLIPBOARD,
662 Ecore_X_Selection selection;
663 Eina_Bool (* set)(Ecore_X_Window window, const void* pData, int size);
664 Eina_Bool (* clear)(void);
665 void (* request)(Ecore_X_Window window, const char* pTarget);
671 _ClipFormat requestedFormat;
672 char* pRetrievedBuffer;
677 typedef Eina_Bool (*ClipConverter)(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
678 typedef int (*ClipResponseHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
679 typedef int (*ClipNotifyHandler)(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
685 _ATOM_LISTING_ATOMS = _ATOM_ATOM,
699 _ATOM_TEXT_HTML_UTF8,
704 _ATOM_TEXT_PLAIN_UTF8,
713 ClipConverter convert;
714 ClipResponseHandler response;
715 ClipNotifyHandler notify;
719 Eina_Bool ClearClip(void* pData __UNUSED__, int type, void* pEvent);
720 Eina_Bool NotifyClip(void* pData __UNUSED__, int type, void* pEvent);
722 Eina_Bool ConvertClipIntoTarget(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
723 Eina_Bool ConvertClipIntoText(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
724 Eina_Bool ConvertClipIntoHtml(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
725 Eina_Bool ConvertClipIntoEdje(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
726 Eina_Bool ConvertClipIntoUri(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
727 Eina_Bool ConvertClipIntoImage(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
728 Eina_Bool ConvertClipIntoVCard(char* pTarget, void* pData, int size, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize);
730 int NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
731 int NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
732 int NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
733 int NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
734 int NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
735 int NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
737 int RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify);
739 _Atom __atomList[_ATOM_MAX];
740 _Clip __clipList[_CLIP_TYPE_MAX];
743 ClearClip(void* pData __UNUSED__, int type __UNUSED__, void* pEvent)
745 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
747 Ecore_X_Event_Selection_Clear* pE = (Ecore_X_Event_Selection_Clear*) pEvent;
748 Ecore_X_Window window = pE->win;
750 _ClipType clipType = _CLIP_TYPE_SECONDARY;
751 __clipList[clipType].requestedFormat = (_ClipFormat)(_CLIP_FORMAT_TEXT|_CLIP_FORMAT_IMAGE);
753 ecore_x_selection_secondary_request(window, ECORE_X_SELECTION_TARGET_TARGETS);
755 return ECORE_CALLBACK_PASS_ON;
759 ConvertClipIntoTarget(char* pTarget __UNUSED__, void* pData, int size__UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType, int* pTypeSize)
764 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
765 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
766 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
767 SysTryReturn(NID_UI, pType, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
768 SysTryReturn(NID_UI, pTypeSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
770 int index = *((int*) pData);
771 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
774 for (int i = 0; i < _ATOM_MAX; i++)
776 if (__clipList[index].format & __atomList[i].formats)
780 // Make the atom list to be possible to return data.
781 Ecore_X_Atom* pAtoms = null;
784 pAtoms = (Ecore_X_Atom*) malloc(sizeof(Ecore_X_Atom) * count);
785 SysTryReturn(NID_UI, pAtoms, EINA_FALSE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
787 for (int i = 0, count = 0; i < _ATOM_MAX; i++)
789 if (__clipList[index].format & __atomList[i].formats)
790 pAtoms[count++] = __atomList[i].atom;
797 *pType = ECORE_X_ATOM_ATOM;
804 ConvertClipIntoText(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
806 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
807 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
808 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
810 int index = *((int*) pData);
811 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
812 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
814 if (__clipList[index].format & _CLIP_FORMAT_TEXT)
816 *outData = strdup(__clipList[index].pBuffer);
817 *outSize = strlen(__clipList[index].pBuffer);
824 ConvertClipIntoHtml(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
826 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
827 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
828 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
830 int index = *((int*) pData);
831 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
832 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
834 if (__clipList[index].format & _CLIP_FORMAT_HTML)
836 *outData = strdup(__clipList[index].pBuffer);
837 *outSize = strlen(__clipList[index].pBuffer);
844 ConvertClipIntoEdje(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
850 ConvertClipIntoUri(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData, int* outSize, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
852 SysTryReturn(NID_UI, outData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
853 SysTryReturn(NID_UI, outSize, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
854 SysTryReturn(NID_UI, pData, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
856 int index = *((int*) pData);
857 SysTryReturn(NID_UI, index < _CLIP_TYPE_MAX, EINA_FALSE, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
858 SysTryReturn(NID_UI, __clipList[index].active, EINA_FALSE, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
860 if (__clipList[index].format & _CLIP_FORMAT_IMAGE)
862 *outData = strdup(__clipList[index].pBuffer);
863 *outSize = strlen(__clipList[index].pBuffer);
870 ConvertClipIntoImage(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
876 ConvertClipIntoVCard(char* pTarget __UNUSED__, void* pData, int size __UNUSED__, void** outData __UNUSED__, int* outSize __UNUSED__, Ecore_X_Atom* pType __UNUSED__, int* pTypeSize __UNUSED__)
882 RequestClip(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
888 OnClipboardClosed(void* pData __UNUSED__, int type, void* pEvent)
890 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
892 _Clipboard* pClipboard = _Clipboard::GetInstance();
895 bool visible = pClipboard->IsPopupVisible();
899 pClipboard->FireEvent(0, null);
903 return ECORE_CALLBACK_PASS_ON;
907 NotifyClip(void* pData __UNUSED__, int type, void* pEvent)
909 SysTryReturn(NID_UI, pEvent, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
911 Ecore_X_Event_Selection_Notify* pE = (Ecore_X_Event_Selection_Notify*) pEvent;
914 for (i = 0; i < _CLIP_TYPE_MAX; i++)
916 if (__clipList[i].selection == pE->selection)
922 SysTryReturn(NID_UI, i < _CLIP_TYPE_MAX, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
924 _Clip* pClip = __clipList + i;
925 for (i = 0; i < _ATOM_MAX; i++)
927 if (!strcmp(pE->target, __atomList[i].pName))
929 if (__atomList[i].notify)
931 __atomList[i].notify(pClip, pE);
936 return ECORE_CALLBACK_PASS_ON;
940 NotifyTarget(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
942 SysTryReturn(NID_UI, pClip, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
943 SysTryReturn(NID_UI, pNotify, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
945 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
946 SysTryReturn(NID_UI, pEcoreEvas, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
948 _ControlManager* pControlManager = _ControlManager::GetInstance();
949 SysTryReturn(NID_UI, pControlManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
951 _Window* pWindow = pControlManager->GetClipboardOwner();
952 SysTryReturn(NID_UI, pWindow, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
954 _RootVisualElement* pRootVE = pWindow->GetRootVisualElement();
955 SysTryReturn(NID_UI, pRootVE, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
957 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
958 SysTryReturn(NID_UI, pLayer, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
960 Ecore_Evas* pEE = pLayer->GetEcoreEvas();
961 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pEE);
963 Ecore_X_Atom dataType = 0;
964 char* pBuffer = null;
965 if (pEcoreEvas->GetSelectedCbhmItem(&dataType, &pBuffer))
969 const char* pHtmlAtomName = "text/html;charset=utf-8";
970 Ecore_X_Atom htmlType = ecore_x_atom_get(pHtmlAtomName);
972 if (dataType == htmlType)
974 pClip->request(window, pHtmlAtomName);
975 return ECORE_CALLBACK_PASS_ON;
979 Ecore_X_Selection_Data_Targets* pTargets = (Ecore_X_Selection_Data_Targets*) (pNotify->data);
980 Ecore_X_Atom* pAtomList = (Ecore_X_Atom*) (pTargets->data.data);
983 for (j = (_ATOM_LISTING_ATOMS+1); j < _ATOM_MAX; j++)
985 SysLog(NID_UI, "[Clipboard] __atomList[%d].atom = %d", j, __atomList[j].atom);
987 if (!(__atomList[j].formats & pClip->requestedFormat))
992 for (i = 0; i < pTargets->data.length; i++)
994 SysLog(NID_UI, "[Clipboard] pAtomList[%d] = %d", i, pAtomList[i]);
996 if ((__atomList[j].atom == pAtomList[i]) && (__atomList[j].notify))
998 if ((j == _ATOM_XELM) && (!(pClip->requestedFormat & _CLIP_FORMAT_MARKUP)))
1003 SysLog(NID_UI, "[Clipboard] go to __atomList[%d].atom = %d", j, __atomList[j].atom);
1009 return ECORE_CALLBACK_PASS_ON;
1012 pClip->request(window, __atomList[j].pName);
1013 return ECORE_CALLBACK_PASS_ON;
1017 NotifyText(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1019 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1020 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1022 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1023 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1025 pClip->bufferLength = (int) pData->length;
1027 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1030 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1031 pStr[pClip->bufferLength] = '\0';
1035 SysLog(NID_UI, "[Clipboard] pStr is null.");
1039 pClip->pRetrievedBuffer = pStr;
1041 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
1047 NotifyImage(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1049 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1050 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1052 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1053 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1055 pClip->bufferLength = (int) pData->length;
1057 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1060 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1061 pStr[pClip->bufferLength] = '\0';
1065 SysLog(NID_UI, "[Clipboard] pStr is null.");
1069 pClip->pRetrievedBuffer = pStr;
1071 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
1077 NotifyUri(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1079 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1080 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1082 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1083 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1085 pClip->bufferLength = (int) pData->length;
1087 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1090 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1091 pStr[pClip->bufferLength] = '\0';
1095 SysLog(NID_UI, "[Clipboard] pStr is null.");
1099 pClip->pRetrievedBuffer = pStr;
1101 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_IMAGE, pClip->pRetrievedBuffer);
1107 NotifyEdje(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1109 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1110 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1112 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1113 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1115 pClip->bufferLength = (int) pData->length;
1117 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1120 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1121 pStr[pClip->bufferLength] = '\0';
1125 SysLog(NID_UI, "[Clipboard] pStr is null.");
1129 pClip->pRetrievedBuffer = pStr;
1131 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_TEXT, pClip->pRetrievedBuffer);
1137 NotifyHtml(_Clip* pClip, Ecore_X_Event_Selection_Notify* pNotify)
1139 SysTryReturn(NID_UI, pClip, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1140 SysTryReturn(NID_UI, pNotify, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1142 Ecore_X_Selection_Data* pData = (Ecore_X_Selection_Data*) pNotify->data;
1143 SysTryReturn(NID_UI, pData->data, 0, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1145 pClip->bufferLength = (int) pData->length;
1147 char* pStr = (char*)malloc(sizeof(char) * (pClip->bufferLength + 1));
1150 strncpy(pStr, (char*)pData->data, pClip->bufferLength);
1151 pStr[pClip->bufferLength] = '\0';
1155 SysLog(NID_UI, "[Clipboard] pStr is null.");
1159 pClip->pRetrievedBuffer = pStr;
1161 _Clipboard::GetInstance()->FireEvent(_CLIP_FORMAT_HTML, pClip->pRetrievedBuffer);
1167 namespace Tizen { namespace Ui
1171 _EcoreEvas::CreateInstanceN(void)
1173 _EcoreEvas* pEcoreEvas = new (std::nothrow) _EcoreEvas;
1174 SysTryReturn(NID_UI, pEcoreEvas, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1176 result r = GetLastResult();
1177 SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1179 SetLastResult(E_SUCCESS);
1188 _EcoreEvas::_EcoreEvas(void)
1189 : __pWindowVisibilityChanged(null)
1190 , __pWindowPropertyChanged(null)
1191 , __pWindowShown(null)
1192 , __pWindowConfigured(null)
1193 , __pClientMessageReceived(null)
1194 , __pClearClip(null)
1195 , __pNotifyClip(null)
1196 , __pClipboardClosed(null)
1198 , __pForegroundWindow(null)
1200 , __changeBounds(true)
1201 , __openClipboard(false)
1203 int ret = appcore_unset_rotation_cb();
1204 SysLog(NID_UI, "[WM ROTATION] appcore_unset_rotation_cb = %d", ret);
1206 __pWindowVisibilityChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, OnWindowVisibilityChanged, (void*) this);
1207 SysTryReturnVoidResult(NID_UI, __pWindowVisibilityChanged, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1209 __pClientMessageReceived = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, OnClientMessageReceived, NULL);
1211 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
1212 ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
1216 GetEcoreEvasMgr()->SetEcoreEvas(*this);
1219 //ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, OnAutoRotationChanged, NULL);
1220 //SysTryCatch(NID_UI, ret == 0, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1222 result r = InitializeAtomList();
1223 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1225 __pWindowShown = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnWindowShown, (void*) this);
1226 SysTryCatch(NID_UI, __pWindowShown, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1228 __pWindowConfigured = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, OnWindowConfigured, NULL);
1229 SysTryCatch(NID_UI, __pWindowConfigured, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1231 __pWindowPropertyChanged = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, OnWindowPropertyChanged, NULL);
1232 SysTryCatch(NID_UI, __pWindowPropertyChanged, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1234 SetLastResult(E_SUCCESS);
1239 if (__pWindowVisibilityChanged)
1241 ecore_event_handler_del(__pWindowVisibilityChanged);
1242 __pWindowVisibilityChanged = null;
1247 ecore_event_handler_del(__pWindowShown);
1248 __pWindowShown = null;
1251 if (__pWindowConfigured)
1253 ecore_event_handler_del(__pWindowConfigured);
1254 __pWindowConfigured = null;
1258 _EcoreEvas::~_EcoreEvas(void)
1260 if (__pWindowVisibilityChanged)
1262 ecore_event_handler_del(__pWindowVisibilityChanged);
1263 __pWindowVisibilityChanged = null;
1268 ecore_event_handler_del(__pWindowShown);
1269 __pWindowShown = null;
1272 if (__pWindowConfigured)
1274 ecore_event_handler_del(__pWindowConfigured);
1275 __pWindowConfigured = null;
1278 if (__pClientMessageReceived)
1280 ecore_event_handler_del(__pClientMessageReceived);
1281 __pClientMessageReceived = null;
1284 for (int i = 0; i < _ATOM_MAX; i++)
1286 if (__atomList[i].atom)
1288 ecore_x_selection_converter_atom_del(__atomList[i].atom);
1294 ecore_event_handler_del(__pClearClip);
1295 __pClearClip = null;
1300 ecore_event_handler_del(__pNotifyClip);
1301 __pNotifyClip = null;
1304 if (__pClipboardClosed)
1306 ecore_event_handler_del(__pClipboardClosed);
1307 __pClipboardClosed = null;
1310 if (__pWindowPropertyChanged)
1312 ecore_event_handler_del(__pWindowPropertyChanged);
1313 __pWindowPropertyChanged = null;
1316 //runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED);
1320 _EcoreEvas::RotateWindow(const _Window& window, int orientation, bool rotateEvas)
1322 // Set window bounds according to the rotation
1325 _EflLayer* pLayer = GetEflLayer(window);
1331 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1334 int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
1335 if (curOrientation == orientation)
1341 bool rotatePartial = true;
1343 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
1346 FrameShowMode showMode = pFrame->GetShowMode(false);
1347 if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
1349 rotatePartial = false;
1353 _Window* pWindow = const_cast<_Window*>(&window);
1354 if (pWindow->IsLayoutChangable() == true)
1356 rotatePartial = false;
1359 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1363 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
1365 if (rotatePartial == false)
1367 if (rotateEvas == true)
1369 ecore_evas_rotation_with_resize_set(pEcoreEvas, orientation);
1372 if ((orientation == 0) || (orientation == 180))
1374 pLayer->SetBounds(FloatRectangle(0, 0, rootW, rootH));
1378 pLayer->SetBounds(FloatRectangle(0, 0, rootH, rootW));
1381 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x, FULL SCREEN] Rotate bounds(ROT %d).", win, orientation);
1386 if (rotateEvas == true)
1388 ecore_evas_rotation_set(pEcoreEvas, orientation);
1391 Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
1392 int rotate = ecore_evas_rotation_get(pEcoreEvas);
1394 int winX = winBounds.x;
1395 int winY = winBounds.y;
1400 winX = rootW - winBounds.y - winBounds.height;
1405 winY = rootH - winBounds.x - winBounds.width;
1408 winX = rootW - winBounds.x - winBounds.width;
1409 winY = rootH - winBounds.y - winBounds.height;
1419 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
1422 if (ret == EINA_FALSE)
1424 pLayer->SetBounds(FloatRectangle(winX, winY, winBounds.width, winBounds.height));
1425 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x, PARTIAL SCREEN] Rotate bounds(ROT %d, %d, %d, %d, %d).", win, orientation, winX, winY, winBounds.width, winBounds.height);
1429 pLayer->SetBounds(FloatRectangle(winX, winY, w, h));
1430 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x, PARTIAL SCREEN] Rotate bounds(ROT %d, %d, %d) ONLY MOVE.", win, orientation, winX, winY);
1436 _EcoreEvas::GetEflLayer(const _Window& window) const
1438 _RootVisualElement* pRootVisualElement = null;
1440 pRootVisualElement = window.GetRootVisualElement();
1441 if (!pRootVisualElement)
1443 SysLog(NID_UI, "The root visual element is null.");
1447 _EflLayer* pEflLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
1450 SysLog(NID_UI, "The efl layer is null.");
1458 _EcoreEvas::GetFloatingMode(void) const
1460 SysTryReturn(NID_UI, __pForegroundWindow, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1462 Eina_Bool ret = elm_win_floating_mode_get(__pForegroundWindow);
1464 SetLastResult(E_SUCCESS);
1466 return (ret ? true : false);
1469 // [ToDo] Remove API
1471 _EcoreEvas::GetFloatingMode(const _Window& window) const
1473 _EflLayer* pLayer = GetEflLayer(window);
1474 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1476 Evas_Object* pWinObj = pLayer->GetElmWin();
1477 SysTryReturn(NID_UI, pWinObj, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1479 Eina_Bool ret = elm_win_floating_mode_get(pWinObj);
1481 SetLastResult(E_SUCCESS);
1483 return (ret ? true : false);
1486 // [ToDo] Remove API
1488 _EcoreEvas::AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1492 // [ToDo] Remove API
1494 _EcoreEvas::RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
1499 _EcoreEvas::GetActiveWindow(void)
1501 Ecore_X_Window* pRoots = null;
1502 Ecore_X_Window activeWin = 0;
1505 pRoots = ecore_x_window_root_list(&num);
1508 Ecore_X_Atom activeAtom = ecore_x_atom_get("_NET_ACTIVE_WINDOW");
1509 int ret = ecore_x_window_prop_window_get(pRoots[0], activeAtom, &activeWin, 1);
1523 _EcoreEvas::GetProcessId(unsigned int window)
1526 Eina_Bool ret = ecore_x_netwm_pid_get(window, &pid);
1528 if (ret != EINA_TRUE)
1537 _EcoreEvas::SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner)
1539 Ecore_X_Window win = ecore_x_icccm_transient_for_get(ownee);
1542 ecore_x_icccm_transient_for_unset(ownee);
1543 ecore_x_icccm_transient_for_set(ownee, owner);
1544 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] transient_for_set -> 0x%x", ownee, owner);
1549 _EcoreEvas::ActivateWindow(const _Window& window)
1551 _EflLayer* pLayer = GetEflLayer(window);
1552 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1554 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1555 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1557 ecore_evas_activate(pEcoreEvas);
1559 NativeWindowHandle currentWindow = window.GetNativeHandle();
1560 unsigned int activeWindow = GetActiveWindow();
1561 int pid = GetProcessId(activeWindow);
1562 SysLog(NID_UI, "currentWindow = 0x%x, activeWindow = 0x%x, pid = %d", currentWindow, activeWindow, pid);
1564 SetLastResult(E_SUCCESS);
1568 _EcoreEvas::MinimizeWindow(_Window& window)
1570 _EflLayer* pLayer = GetEflLayer(window);
1571 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1573 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1574 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1576 //ecore_evas_lower(pEcoreEvas);
1577 ecore_evas_iconified_set(pEcoreEvas, EINA_TRUE);
1579 SetLastResult(E_SUCCESS);
1583 _EcoreEvas::SetRenderBackend(_RenderBackend backend)
1587 case _RENDER_BACKEND_SW:
1588 elm_config_preferred_engine_set("software_x11");
1590 case _RENDER_BACKEND_GL:
1591 elm_config_preferred_engine_set("opengl_x11");
1593 case _RENDER_BACKEND_DEFAULT:
1596 elm_config_preferred_engine_set(NULL);
1602 _EcoreEvas::GetRenderBackend(void)
1604 _RenderBackend backend = _RENDER_BACKEND_DEFAULT;
1606 const char* pEngine = elm_config_preferred_engine_get();
1608 if (pEngine == NULL)
1610 backend = _RENDER_BACKEND_DEFAULT;
1612 else if (strcmp(pEngine, "software_x11") == 0)
1614 backend = _RENDER_BACKEND_SW;
1616 else if (strcmp(pEngine, "opengl_x11") == 0)
1618 backend = _RENDER_BACKEND_GL;
1625 _EcoreEvas::CopyClip(_ClipFormat format, const char* pChar)
1627 SysTryReturn(NID_UI, IsValidClipFormat(format), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data type is invalid.");
1628 SysTryReturn(NID_UI, pChar, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The data is invalid.");
1630 Ecore_X_Atom dataType = 0;
1634 case _CLIP_FORMAT_TEXT:
1635 dataType = ecore_x_atom_get("UTF8_STRING");
1637 case _CLIP_FORMAT_IMAGE:
1638 dataType = ecore_x_atom_get("text/uri");
1640 case _CLIP_FORMAT_HTML:
1641 dataType = ecore_x_atom_get("text/html;charset=utf-8");
1647 _ControlManager* pControlManager = _ControlManager::GetInstance();
1649 _Window* pWindow = pControlManager->GetClipboardOwner();
1655 _EflLayer* pLayer = GetEflLayer(*pWindow);
1661 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1664 SetCbhmItem(window, dataType, (char*)pChar);
1670 _EcoreEvas::RetrieveClipN(int index, int* format, char** pData)
1672 Ecore_X_Atom dataType = 0;
1674 _ControlManager* pControlManager = _ControlManager::GetInstance();
1676 _Window* pWindow = pControlManager->GetClipboardOwner();
1682 _EflLayer* pLayer = GetEflLayer(*pWindow);
1688 GetCbhmItem(index, &dataType, pData);
1690 if ((dataType == ecore_x_atom_get("UTF8_STRING"))
1691 ||(dataType == ecore_x_atom_get("application/x-elementary-markup")))
1693 *format = _CLIP_FORMAT_TEXT;
1695 else if (dataType == ecore_x_atom_get("text/uri"))
1697 *format = _CLIP_FORMAT_IMAGE;
1699 else if (dataType == ecore_x_atom_get("text/html;charset=utf-8"))
1701 *format = _CLIP_FORMAT_HTML;
1709 // Convert markup to utf8.
1710 if (dataType == ecore_x_atom_get("application/x-elementary-markup"))
1712 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, *pData);
1713 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", *pData, pTempChar);
1723 _EcoreEvas::GetClipCount(void) const
1725 _ControlManager* pControlManager = _ControlManager::GetInstance();
1727 _Window* pWindow = pControlManager->GetClipboardOwner();
1733 _EflLayer* pLayer = GetEflLayer(*pWindow);
1739 int count = GetCbhmItemCount();
1745 _EcoreEvas::OpenClipboard(unsigned long clipFormats)
1747 _ControlManager* pControlManager = _ControlManager::GetInstance();
1749 _Window* pWindow = pControlManager->GetClipboardOwner();
1755 _EflLayer* pLayer = GetEflLayer(*pWindow);
1761 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1764 ecore_x_selection_secondary_set(window, "", 1);
1766 if (_CLIP_FORMAT_IMAGE & clipFormats)
1768 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW_ALL);
1772 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_SHOW);
1775 __openClipboard = true;
1779 _EcoreEvas::CloseClipboard(void)
1781 _ControlManager* pControlManager = _ControlManager::GetInstance();
1783 _Window* pWindow = pControlManager->GetClipboardOwner();
1789 _EflLayer* pLayer = GetEflLayer(*pWindow);
1795 Ecore_X_Window window = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
1798 __openClipboard = false;
1799 SendCbhmMessage(window, ATOM_CBHM_CLIPBOARD_HIDE);
1803 _EcoreEvas::IsClipboardOpened(void)
1805 return __openClipboard;
1809 _EcoreEvas::ConvertMarkupToUtf8(const String& string)
1811 char* pChar = _Clipboard::GetInstance()->EncodeToCharN(string);
1817 char* pTempChar = evas_textblock_text_markup_to_utf8(NULL, pChar);
1818 SysLog(NID_UI, "[Clipboard] markup[%s] -> utf8[%s]", pChar, pTempChar);
1821 String str(pTempChar);
1828 _EcoreEvas::SetEventPropagation(const _Control& control, bool enable)
1830 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1831 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1833 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1834 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1836 evas_object_propagate_events_set(pEvasObject, (enable ? EINA_TRUE : EINA_FALSE));
1842 _EcoreEvas::SetFocus(const _Control& control, bool focus)
1844 _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
1845 SysTryReturn(NID_UI, pEflNode, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1847 Evas_Object* pEvasObject = (Evas_Object*) pEflNode->GetGroupContainer();
1848 SysTryReturn(NID_UI, pEvasObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1850 evas_object_focus_set(pEvasObject, (focus ? EINA_TRUE : EINA_FALSE));
1856 _EcoreEvas::SetIndicatorShowState(const _Window& window, bool showState)
1858 _EflLayer* pLayer = GetEflLayer(window);
1859 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1861 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1862 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1864 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1868 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1872 ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1879 _EcoreEvas::GetIndicatorShowState(const _Window& window) const
1881 _EflLayer* pLayer = GetEflLayer(window);
1882 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1884 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1885 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1887 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1888 Ecore_X_Illume_Indicator_State state = ecore_x_e_illume_indicator_state_get(win);
1890 bool showState = true;
1891 if (state == ECORE_X_ILLUME_INDICATOR_STATE_ON)
1895 else if (state == ECORE_X_ILLUME_INDICATOR_STATE_OFF)
1903 // [ToDo] Remove API
1905 _EcoreEvas::GetIndicatorBounds(const _Window& window) const
1907 _EflLayer* pLayer = GetEflLayer(window);
1908 SysTryReturn(NID_UI, pLayer, Rectangle(0, 0, 0, 0), E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1910 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1911 SysTryReturn(NID_UI, pEcoreEvas, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1913 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1914 Ecore_X_Window rootWin = (Ecore_X_Window) ecore_x_window_root_get(win);
1922 ret = ecore_x_e_illume_indicator_geometry_get(rootWin, &x, &y, &width, &height);
1923 SysTryReturn(NID_UI, ret == true, Rectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1925 SetLastResult(E_SUCCESS);
1927 return Rectangle(x, y, width, height);
1930 // [ToDo] Remove API
1932 _EcoreEvas::SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity)
1934 _EflLayer* pLayer = GetEflLayer(window);
1935 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1937 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1938 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1940 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1942 Ecore_X_Illume_Indicator_Opacity_Mode mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1945 case _INDICATOR_OPACITY_UNKNOWN:
1946 mode = ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1948 case _INDICATOR_OPACITY_OPAQUE:
1949 mode = ECORE_X_ILLUME_INDICATOR_OPAQUE;
1951 case _INDICATOR_OPACITY_TRANSLUCENT:
1952 mode = ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1954 case _INDICATOR_OPACITY_TRANSPARENT:
1955 mode = ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1958 SysLogException(NID_UI, E_INVALID_ARG, "[E_INVALID_ARG] The specified data is not valid.");
1959 return E_INVALID_ARG;
1962 ecore_x_e_illume_indicator_opacity_set(win, mode);
1967 // [ToDo] Remove API
1969 _EcoreEvas::GetIndicatorOpacity(const _Window& window) const
1971 _EflLayer* pLayer = GetEflLayer(window);
1972 SysTryReturn(NID_UI, pLayer, _INDICATOR_OPACITY_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
1974 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
1975 SysTryReturn(NID_UI, pEcoreEvas, _INDICATOR_OPACITY_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1977 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
1978 Ecore_X_Illume_Indicator_Opacity_Mode mode = ecore_x_e_illume_indicator_opacity_get(win);
1980 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1983 case ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN:
1984 opacity = _INDICATOR_OPACITY_UNKNOWN;
1986 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1987 opacity = _INDICATOR_OPACITY_OPAQUE;
1989 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1990 opacity = _INDICATOR_OPACITY_TRANSLUCENT;
1992 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1993 opacity = _INDICATOR_OPACITY_TRANSPARENT;
1996 SysLogException(NID_UI, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
1997 return _INDICATOR_OPACITY_UNKNOWN;
2000 SetLastResult(E_SUCCESS);
2006 _EcoreEvas::SetWindowActivationEnabled(const _Window& window, bool enable)
2008 _EflLayer* pLayer = GetEflLayer(window);
2009 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2011 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2012 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2014 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2016 Eina_Bool acceptsFocus;
2017 Ecore_X_Window_State_Hint initialState;
2018 Ecore_X_Pixmap iconPixmap;
2019 Ecore_X_Pixmap iconMask;
2020 Ecore_X_Window iconWindow;
2021 Ecore_X_Window windowGroup;
2024 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
2025 ecore_x_icccm_hints_set(win, (enable ? EINA_TRUE : EINA_FALSE), initialState, iconPixmap, iconMask, iconWindow, windowGroup, isUrgent);
2029 _EcoreEvas::IsWindowActivationEnabled(const _Window& window)
2031 _EflLayer* pLayer = GetEflLayer(window);
2032 SysTryReturn(NID_UI, pLayer, true, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2034 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2035 SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2037 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2039 Eina_Bool acceptsFocus;
2040 Ecore_X_Window_State_Hint initialState;
2041 Ecore_X_Pixmap iconPixmap;
2042 Ecore_X_Pixmap iconMask;
2043 Ecore_X_Window iconWindow;
2044 Ecore_X_Window windowGroup;
2047 ecore_x_icccm_hints_get(win, &acceptsFocus, &initialState, &iconPixmap, &iconMask, &iconWindow, &windowGroup, &isUrgent);
2049 return (acceptsFocus ? true : false);
2053 _EcoreEvas::SetWindowName(const _Window& window, const Tizen::Base::String& name)
2055 _EflLayer* pLayer = GetEflLayer(window);
2056 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2058 Evas_Object* pWinObj = pLayer->GetElmWin();
2059 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2061 const char* windowName = _StringConverter::CopyToCharArrayN(name);
2064 elm_win_title_set(pWinObj, windowName);
2066 delete[] windowName;
2071 _EcoreEvas::SetWindowType(const _Window& window, int winType)
2073 _EflLayer* pLayer = GetEflLayer(window);
2074 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2076 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2077 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2079 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2081 if (winType == _WINDOW_TYPE_SUB)
2083 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_UTILITY);
2088 _EcoreEvas::SetFloatingMode(const _Window& window, bool enable)
2090 _EflLayer* pLayer = GetEflLayer(window);
2091 SysTryReturn(NID_UI, pLayer, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2093 Evas_Object* pWinObj = pLayer->GetElmWin();
2094 SysTryReturn(NID_UI, pWinObj, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2096 elm_win_floating_mode_set(pWinObj, (enable ? EINA_TRUE : EINA_FALSE));
2101 // [ToDo] Remove API
2103 _EcoreEvas::GetEvas(void) const
2105 SysLog(NID_UI, "Do not use.");
2106 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2112 _EflLayer* pLayer = GetEflLayer(*pWindow);
2118 return pLayer->GetEvas();
2121 // [ToDo] Remove API
2123 _EcoreEvas::GetEcoreEvas(void) const
2125 SysLog(NID_UI, "Do not use.");
2126 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2132 _EflLayer* pLayer = GetEflLayer(*pWindow);
2138 return pLayer->GetEcoreEvas();
2141 // [ToDo] Remove API
2143 _EcoreEvas::GetWindowObject(void) const
2145 SysLog(NID_UI, "Do not use.");
2146 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2152 _EflLayer* pLayer = GetEflLayer(*pWindow);
2158 return pLayer->GetElmWin();
2161 // [ToDo] Remove API
2163 _EcoreEvas::GetXWindow(void) const
2165 SysLog(NID_UI, "Do not use.");
2166 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
2172 _EflLayer* pLayer = GetEflLayer(*pWindow);
2178 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2184 _EcoreEvas::AllowSetWindowBounds(bool allow)
2186 __changeBounds = allow;
2190 _EcoreEvas::IsWindowVisible(const _Window& window)
2192 _EflLayer* pLayer = GetEflLayer(window);
2193 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2195 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2196 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2198 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2200 int ret = ecore_x_window_visible_get(win);
2211 // [ToDo] Remove API
2213 _EcoreEvas::SetQuickPanelScrollEnabled(const _Window& window, bool enable)
2216 _EflLayer* pLayer = GetEflLayer(window);
2217 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2219 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2220 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2222 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2223 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2225 unsigned int val[3];
2226 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2237 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
2241 // [ToDo] Remove API
2243 _EcoreEvas::IsQuickPanelScrollEnabled(const _Window& window)
2246 _EflLayer* pLayer = GetEflLayer(window);
2247 SysTryReturn(NID_UI, pLayer, false, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2249 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2250 SysTryReturn(NID_UI, pEcoreEvas, false, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2252 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2253 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
2255 unsigned int val[3];
2256 ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
2272 _EcoreEvas::SetWindowLevel(const _Window& window, _WindowLevel level)
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 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2280 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2281 ecore_x_icccm_transient_for_unset(win);
2282 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] transient_for_unset", win);
2284 if (level == _WINDOW_LEVEL_NORMAL)
2286 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
2287 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] set : ECORE_X_WINDOW_TYPE_NORMAL", win);
2289 else if (level == _WINDOW_LEVEL_NOTIFICATION_HIGH)
2291 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2292 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
2293 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] set : ECORE_X_WINDOW_TYPE_NOTIFICATION, UTILX_NOTIFICATION_LEVEL_HIGH", win);
2295 else if (level == _WINDOW_LEVEL_NOTIFICATION_MIDDLE)
2297 ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
2298 utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
2299 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] set : ECORE_X_WINDOW_TYPE_NOTIFICATION, UTILX_NOTIFICATION_LEVEL_NORMAL", win);
2302 SetLastResult(E_SUCCESS);
2306 _EcoreEvas::GetWindowLevel(const _Window& window) const
2308 _EflLayer* pLayer = GetEflLayer(window);
2309 SysTryReturn(NID_UI, pLayer, _WINDOW_LEVEL_UNKNOWN, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2311 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2312 SysTryReturn(NID_UI, pEcoreEvas, _WINDOW_LEVEL_UNKNOWN, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2314 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2316 Ecore_X_Window_Type type = ECORE_X_WINDOW_TYPE_UNKNOWN;
2317 ecore_x_netwm_window_type_get(win, &type);
2319 _WindowLevel winLevel = _WINDOW_LEVEL_UNKNOWN;
2320 if (type == ECORE_X_WINDOW_TYPE_NORMAL)
2322 winLevel = _WINDOW_LEVEL_NORMAL;
2324 else if (type == ECORE_X_WINDOW_TYPE_NOTIFICATION)
2326 Utilx_Notification_Level notificationLevel = utilx_get_system_notification_level((Display*)ecore_x_display_get(), win);
2328 if (notificationLevel == UTILX_NOTIFICATION_LEVEL_HIGH)
2330 winLevel = _WINDOW_LEVEL_NOTIFICATION_HIGH;
2332 else if (notificationLevel == UTILX_NOTIFICATION_LEVEL_NORMAL)
2334 winLevel = _WINDOW_LEVEL_NOTIFICATION_MIDDLE;
2338 SetLastResult(E_SUCCESS);
2344 _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds)
2346 if (__changeBounds == false)
2351 _EflLayer* pLayer = GetEflLayer(window);
2352 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2354 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2355 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2357 Evas_Object* pWinObject = pLayer->GetElmWin();
2358 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2360 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2362 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2364 // _Window* pWindow = const_cast<_Window*>(&window);
2365 // _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2366 // if (pContextMenu)
2367 if ((window.IsOrientationRoot() == false) && (window.IsRotationSynchronized() == false))
2369 _ControlManager* pControlManager = _ControlManager::GetInstance();
2370 if (pControlManager)
2372 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2375 int ownerRotate = GetWindowRotation(*pCurFrame);
2376 if (ownerRotate != rotate)
2384 int winX = winBounds.x;
2385 int winY = winBounds.y;
2389 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2394 winX = rootW - winBounds.y - winBounds.height;
2399 winY = rootH - winBounds.x - winBounds.width;
2402 winX = rootW - winBounds.x - winBounds.width;
2403 winY = rootH - winBounds.y - winBounds.height;
2413 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2416 if (ret == EINA_FALSE)
2418 pLayer->SetBounds(FloatRectangle(winX, winY, winBounds.width, winBounds.height));
2419 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set bounds(ROT %d, %d, %d, %d, %d).", win, rotate, winX, winY, winBounds.width, winBounds.height);
2423 pLayer->SetBounds(FloatRectangle(winX, winY, w, h));
2424 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set bounds(ROT %d, %d, %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY, w, h);
2427 SetLastResult(E_SUCCESS);
2431 _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds)
2433 if (__changeBounds == false)
2438 _EflLayer* pLayer = GetEflLayer(window);
2439 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2441 Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
2442 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
2444 Evas_Object* pWinObject = pLayer->GetElmWin();
2445 SysTryReturnVoidResult(NID_UI, pWinObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2447 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2448 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2450 int rotate = ecore_evas_rotation_get(pEcoreEvas);
2452 // _Window* pWindow = const_cast<_Window*>(&window);
2453 // _ContextMenu* pContextMenu = dynamic_cast<_ContextMenu*>(pWindow);
2454 // if (pContextMenu)
2455 if ((window.IsOrientationRoot() == false) && (window.IsRotationSynchronized() == false))
2457 _ControlManager* pControlManager = _ControlManager::GetInstance();
2458 if (pControlManager)
2460 _Window* pCurFrame = pControlManager->GetCurrentFrame();
2463 int ownerRotate = GetWindowRotation(*pCurFrame);
2464 if (ownerRotate != rotate)
2472 int winX = winBounds.x;
2473 int winY = winBounds.y;
2477 ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
2482 winX = rootW - winBounds.y - winBounds.height;
2487 winY = rootH - winBounds.x - winBounds.width;
2490 winX = rootW - winBounds.x - winBounds.width;
2491 winY = rootH - winBounds.y - winBounds.height;
2501 Eina_Bool ret = ecore_x_e_window_rotation_geometry_get(win, rotate, &x, &y, &w, &h);
2504 if (ret == EINA_FALSE)
2506 pLayer->SetBounds(FloatRectangle(winX, winY, winBounds.width, winBounds.height));
2507 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set bounds(ROT %d, %d, %d, %d, %d).", win, rotate, winX, winY, winBounds.width, winBounds.height);
2511 pLayer->SetBounds(FloatRectangle(winX, winY, w, h));
2512 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set bounds(ROT %d, %d, %d, %d, %d) ONLY MOVE.", win, rotate, winX, winY, w, h);
2515 SetLastResult(E_SUCCESS);
2519 _EcoreEvas::SetWindowVisibleState(const _Window& window, bool visibleState)
2521 _EflLayer* pLayer = GetEflLayer(window);
2522 SysTryReturnVoidResult(NID_UI, pLayer, E_INVALID_ARG, "[E_INVALID_ARG] The window doesn't have a elf layer.");
2524 Evas_Object* pWinObj = pLayer->GetElmWin();
2525 SysTryReturnVoidResult(NID_UI, pWinObj, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
2527 pLayer->SetShowState(visibleState);
2529 SetLastResult(E_SUCCESS);
2533 _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
2535 _Window* pOwnerWindow = owner.GetRootWindow();
2536 SysTryReturnVoidResult(NID_UI, pOwnerWindow, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a root window.");
2538 _EflLayer* pOwnerLayer = GetEflLayer(*pOwnerWindow);
2539 SysTryReturnVoidResult(NID_UI, pOwnerLayer, E_INVALID_ARG, "[E_INVALID_ARG] The owner doesn't have a elf layer.");
2541 _EflLayer* pOwneeLayer = GetEflLayer(ownee);
2542 SysTryReturnVoidResult(NID_UI, pOwneeLayer, E_INVALID_ARG, "[E_INVALID_ARG] The ownee doesn't have a elf layer.");
2544 Ecore_X_Window ownerWin = (Ecore_X_Window) ecore_evas_window_get(pOwnerLayer->GetEcoreEvas());
2545 Ecore_X_Window owneeWin = (Ecore_X_Window) ecore_evas_window_get(pOwneeLayer->GetEcoreEvas());
2547 Ecore_X_Window_Type type;
2548 ecore_x_netwm_window_type_get(owneeWin, &type);
2549 if ((type == ECORE_X_WINDOW_TYPE_NORMAL) || (type == ECORE_X_WINDOW_TYPE_UTILITY))
2551 Ecore_X_Window win = ecore_x_icccm_transient_for_get(owneeWin);
2552 if (win != ownerWin)
2554 ecore_x_icccm_transient_for_unset(owneeWin);
2555 ecore_x_icccm_transient_for_set(owneeWin, ownerWin);
2556 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] transient_for_set -> 0x%x", owneeWin, ownerWin);
2561 SysLog(NID_UI, "[WIN ORDER][WIN 0x%x] Skip to transient_for_set", owneeWin);
2565 // 1. IsLayoutChangable : true
2566 // 2. IsRotationSynchronized : true
2569 if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
2571 int* rotations = null;
2572 unsigned int count = 0;
2573 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
2579 SetWindowAvailabledRotation(ownee, rotations, count);
2584 bool preferredRoation = pOwnerWindow->GetPreferredRotation();
2585 if (preferredRoation == true)
2587 //int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
2588 int preferredRotation = 0;
2589 ecore_x_e_window_rotation_preferred_rotation_get(ownerWin, &preferredRotation);
2590 SetWindowPreferredRotation(ownee, preferredRotation);
2594 SetWindowPreferredRotation(ownee, -1);
2599 int ownerRotation = GetWindowRotation(*pOwnerWindow);
2600 SetWindowPreferredRotation(ownee, ownerRotation);
2603 SetLastResult(E_SUCCESS);
2607 _EcoreEvas::GetWindowRotation(const _Window& window)
2609 _EflLayer* pLayer = GetEflLayer(window);
2615 int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
2620 _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation, bool force)
2622 _EflLayer* pLayer = GetEflLayer(window);
2628 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2632 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2634 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set window preferred rotation(%d).", win, rotation);
2635 ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
2637 _Window* pWindow = const_cast<_Window*>(&window);
2642 pWindow->SetPreferredRotation(false);
2646 pWindow->SetPreferredRotation(true);
2652 _EcoreEvas::SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count, bool force)
2654 _EflLayer* pLayer = GetEflLayer(window);
2660 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2662 // Skip available_set if there is not change
2665 int* prevRotations = null;
2666 unsigned int prevCount = 0;
2667 Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pLayer->GetEcoreEvas(), &prevRotations, &prevCount);
2668 free(prevRotations);
2672 if (prevCount == count)
2680 ecore_x_e_window_rotation_app_set(win, EINA_TRUE);
2683 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set window available rotation(%d).", win, count);
2684 ecore_evas_wm_rotation_available_rotations_set(pLayer->GetEcoreEvas(), rotations, count);
2688 _EcoreEvas::RegisterWindowStateCallback(const _Window& window)
2690 _EflLayer* pLayer = GetEflLayer(window);
2696 ecore_evas_callback_state_change_set(pLayer->GetEcoreEvas(), OnWindowStateChanged);
2700 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds)
2702 _EflLayer* pLayer = GetEflLayer(window);
2708 Rectangle winBounds = _CoordinateSystemUtils::Transform(bounds);
2710 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2711 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set rotation bounds(ROT %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2712 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2716 _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds)
2718 _EflLayer* pLayer = GetEflLayer(window);
2724 FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds);
2725 Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF);
2727 Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
2728 SysLog(NID_UI, "[WM ROTATION][WIN 0x%x] Set rotation bounds(ROT %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2729 ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height);
2732 // [ToDo] Remove API
2734 _EcoreEvas::GetFrame(void) const
2736 SysLog(NID_UI, "Do not use.");
2740 // [ToDo] Remove API
2742 _EcoreEvas::GetRootVisualElement(void)const
2744 SysLog(NID_UI, "Do not use.");
2748 // [ToDo] Remove API
2750 _EcoreEvas::SetFrame(const _Control& control)
2752 SysLog(NID_UI, "Do not use.");
2753 __pFrame = const_cast<_Control*>(&control);
2757 _EcoreEvas::GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const
2759 Ecore_X_Window cbhmWin = GetCbhmWindow();
2760 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_SELECTED_ITEM);
2761 Ecore_X_Atom atomItemType = 0;
2763 char* pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
2766 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
2767 if (atomItemType == x_atom_cbhm_error)
2784 *pDataType = atomItemType;
2794 _EcoreEvas::IsAccessibilityScreenReaderActivated(void)
2796 Eina_Bool acc = elm_config_access_get();
2800 void* _GetEcoreEvasHandle(void)
2802 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2803 if (pEcoreEvasMgr == null)
2808 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2809 if (pUiEcoreEvas == null)
2814 return (void*)pUiEcoreEvas->GetEcoreEvas();
2817 void* _GetEvasHandle(void)
2819 _EcoreEvasMgr* pEcoreEvasMgr = GetEcoreEvasMgr();
2820 if (pEcoreEvasMgr == null)
2825 _EcoreEvas* pUiEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
2826 if (pUiEcoreEvas == null)
2831 return (void*)pUiEcoreEvas->GetEvas();
2835 _EcoreEvas::InitializeAtomList(void)
2837 __atomList[_ATOM_TARGETS].pName = "TARGETS";
2838 __atomList[_ATOM_TARGETS].formats = _CLIP_FORMAT_TARGETS;
2839 __atomList[_ATOM_TARGETS].convert = ConvertClipIntoTarget;
2840 __atomList[_ATOM_TARGETS].response = RequestClip;
2841 __atomList[_ATOM_TARGETS].notify = NotifyTarget;
2842 __atomList[_ATOM_TARGETS].atom = 0;
2844 __atomList[_ATOM_ATOM].pName = "ATOM";
2845 __atomList[_ATOM_ATOM].formats = _CLIP_FORMAT_TARGETS;
2846 __atomList[_ATOM_ATOM].convert = ConvertClipIntoTarget;
2847 __atomList[_ATOM_ATOM].response = RequestClip;
2848 __atomList[_ATOM_ATOM].notify = NotifyTarget;
2849 __atomList[_ATOM_ATOM].atom = 0;
2851 __atomList[_ATOM_XELM].pName = "application/x-elementary-markup";
2852 __atomList[_ATOM_XELM].formats = _CLIP_FORMAT_MARKUP;
2853 __atomList[_ATOM_XELM].convert = ConvertClipIntoEdje;
2854 __atomList[_ATOM_XELM].response = null;
2855 __atomList[_ATOM_XELM].notify = NotifyEdje;
2856 __atomList[_ATOM_XELM].atom = 0;
2858 __atomList[_ATOM_TEXT_URI].pName = "text/uri";
2859 __atomList[_ATOM_TEXT_URI].formats = _CLIP_FORMAT_IMAGE;
2860 __atomList[_ATOM_TEXT_URI].convert = ConvertClipIntoUri;
2861 __atomList[_ATOM_TEXT_URI].response = null;
2862 __atomList[_ATOM_TEXT_URI].notify = NotifyUri;
2863 __atomList[_ATOM_TEXT_URI].atom = 0;
2865 __atomList[_ATOM_TEXT_URILIST].pName = "text/uri-list";
2866 __atomList[_ATOM_TEXT_URILIST].formats = _CLIP_FORMAT_IMAGE;
2867 __atomList[_ATOM_TEXT_URILIST].convert = ConvertClipIntoUri;
2868 __atomList[_ATOM_TEXT_URILIST].response = null;
2869 __atomList[_ATOM_TEXT_URILIST].notify = NotifyUri;
2870 __atomList[_ATOM_TEXT_URILIST].atom = 0;
2872 __atomList[_ATOM_TEXT_X_VCARD].pName = "text/x-vcard";
2873 __atomList[_ATOM_TEXT_X_VCARD].formats = _CLIP_FORMAT_VCARD;
2874 __atomList[_ATOM_TEXT_X_VCARD].convert = null;
2875 __atomList[_ATOM_TEXT_X_VCARD].response = null;
2876 __atomList[_ATOM_TEXT_X_VCARD].notify = null;
2877 __atomList[_ATOM_TEXT_X_VCARD].atom = 0;
2879 __atomList[_ATOM_IMAGE_PNG].pName = "image/png";
2880 __atomList[_ATOM_IMAGE_PNG].formats = _CLIP_FORMAT_IMAGE;
2881 __atomList[_ATOM_IMAGE_PNG].convert = ConvertClipIntoImage;
2882 __atomList[_ATOM_IMAGE_PNG].response = null;
2883 __atomList[_ATOM_IMAGE_PNG].notify = NotifyImage;
2884 __atomList[_ATOM_IMAGE_PNG].atom = 0;
2886 __atomList[_ATOM_IMAGE_JPEG].pName = "image/jpeg";
2887 __atomList[_ATOM_IMAGE_JPEG].formats = _CLIP_FORMAT_IMAGE;
2888 __atomList[_ATOM_IMAGE_JPEG].convert = ConvertClipIntoImage;
2889 __atomList[_ATOM_IMAGE_JPEG].response = null;
2890 __atomList[_ATOM_IMAGE_JPEG].notify = NotifyImage;
2891 __atomList[_ATOM_IMAGE_JPEG].atom = 0;
2893 __atomList[_ATOM_IMAGE_BMP].pName = "image/x-ms-bmp";
2894 __atomList[_ATOM_IMAGE_BMP].formats = _CLIP_FORMAT_IMAGE;
2895 __atomList[_ATOM_IMAGE_BMP].convert = ConvertClipIntoImage;
2896 __atomList[_ATOM_IMAGE_BMP].response = null;
2897 __atomList[_ATOM_IMAGE_BMP].notify = NotifyImage;
2898 __atomList[_ATOM_IMAGE_BMP].atom = 0;
2900 __atomList[_ATOM_IMAGE_GIF].pName = "image/gif";
2901 __atomList[_ATOM_IMAGE_GIF].formats = _CLIP_FORMAT_IMAGE;
2902 __atomList[_ATOM_IMAGE_GIF].convert = ConvertClipIntoImage;
2903 __atomList[_ATOM_IMAGE_GIF].response = null;
2904 __atomList[_ATOM_IMAGE_GIF].notify = NotifyImage;
2905 __atomList[_ATOM_IMAGE_GIF].atom = 0;
2907 __atomList[_ATOM_IMAGE_TIFF].pName = "image/tiff";
2908 __atomList[_ATOM_IMAGE_TIFF].formats = _CLIP_FORMAT_IMAGE;
2909 __atomList[_ATOM_IMAGE_TIFF].convert = ConvertClipIntoImage;
2910 __atomList[_ATOM_IMAGE_TIFF].response = null;
2911 __atomList[_ATOM_IMAGE_TIFF].notify = NotifyImage;
2912 __atomList[_ATOM_IMAGE_TIFF].atom = 0;
2914 __atomList[_ATOM_IMAGE_SVG].pName = "image/svg+xml";
2915 __atomList[_ATOM_IMAGE_SVG].formats = _CLIP_FORMAT_IMAGE;
2916 __atomList[_ATOM_IMAGE_SVG].convert = ConvertClipIntoImage;
2917 __atomList[_ATOM_IMAGE_SVG].response = null;
2918 __atomList[_ATOM_IMAGE_SVG].notify = NotifyImage;
2919 __atomList[_ATOM_IMAGE_SVG].atom = 0;
2921 __atomList[_ATOM_IMAGE_XPM].pName = "image/x-xpixmap";
2922 __atomList[_ATOM_IMAGE_XPM].formats = _CLIP_FORMAT_IMAGE;
2923 __atomList[_ATOM_IMAGE_XPM].convert = ConvertClipIntoImage;
2924 __atomList[_ATOM_IMAGE_XPM].response = null;
2925 __atomList[_ATOM_IMAGE_XPM].notify = NotifyImage;
2926 __atomList[_ATOM_IMAGE_XPM].atom = 0;
2928 __atomList[_ATOM_IMAGE_TGA].pName = "image/x-tga";
2929 __atomList[_ATOM_IMAGE_TGA].formats = _CLIP_FORMAT_IMAGE;
2930 __atomList[_ATOM_IMAGE_TGA].convert = ConvertClipIntoImage;
2931 __atomList[_ATOM_IMAGE_TGA].response = null;
2932 __atomList[_ATOM_IMAGE_TGA].notify = NotifyImage;
2933 __atomList[_ATOM_IMAGE_TGA].atom = 0;
2935 __atomList[_ATOM_IMAGE_PPM].pName = "image/x-portable-pixmap";
2936 __atomList[_ATOM_IMAGE_PPM].formats = _CLIP_FORMAT_IMAGE;
2937 __atomList[_ATOM_IMAGE_PPM].convert = ConvertClipIntoImage;
2938 __atomList[_ATOM_IMAGE_PPM].response = null;
2939 __atomList[_ATOM_IMAGE_PPM].notify = NotifyImage;
2940 __atomList[_ATOM_IMAGE_PPM].atom = 0;
2942 __atomList[_ATOM_TEXT_HTML_UTF8].pName = "text/html;charset=utf-8";
2943 __atomList[_ATOM_TEXT_HTML_UTF8].formats = _CLIP_FORMAT_HTML;
2944 __atomList[_ATOM_TEXT_HTML_UTF8].convert = ConvertClipIntoHtml;
2945 __atomList[_ATOM_TEXT_HTML_UTF8].response = null;
2946 __atomList[_ATOM_TEXT_HTML_UTF8].notify = NotifyHtml;
2947 __atomList[_ATOM_TEXT_HTML_UTF8].atom = 0;
2949 __atomList[_ATOM_TEXT_HTML].pName = "text/html";
2950 __atomList[_ATOM_TEXT_HTML].formats = _CLIP_FORMAT_HTML;
2951 __atomList[_ATOM_TEXT_HTML].convert = ConvertClipIntoHtml;
2952 __atomList[_ATOM_TEXT_HTML].response = null;
2953 __atomList[_ATOM_TEXT_HTML].notify = NotifyHtml;
2954 __atomList[_ATOM_TEXT_HTML].atom = 0;
2956 __atomList[_ATOM_STRING_UTF8].pName = "UTF8_STRING";
2957 __atomList[_ATOM_STRING_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2958 __atomList[_ATOM_STRING_UTF8].convert = ConvertClipIntoText;
2959 __atomList[_ATOM_STRING_UTF8].response = null;
2960 __atomList[_ATOM_STRING_UTF8].notify = NotifyText;
2961 __atomList[_ATOM_STRING_UTF8].atom = 0;
2963 __atomList[_ATOM_STRING].pName = "STRING";
2964 __atomList[_ATOM_STRING].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2965 __atomList[_ATOM_STRING].convert = ConvertClipIntoText;
2966 __atomList[_ATOM_STRING].response = null;
2967 __atomList[_ATOM_STRING].notify = NotifyText;
2968 __atomList[_ATOM_STRING].atom = 0;
2970 __atomList[_ATOM_TEXT].pName = "TEXT";
2971 __atomList[_ATOM_TEXT].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2972 __atomList[_ATOM_TEXT].convert = ConvertClipIntoText;
2973 __atomList[_ATOM_TEXT].response = null;
2974 __atomList[_ATOM_TEXT].notify = null;
2975 __atomList[_ATOM_TEXT].atom = 0;
2977 __atomList[_ATOM_TEXT_PLAIN_UTF8].pName = "text/plain;charset=utf-8";
2978 __atomList[_ATOM_TEXT_PLAIN_UTF8].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2979 __atomList[_ATOM_TEXT_PLAIN_UTF8].convert = ConvertClipIntoText;
2980 __atomList[_ATOM_TEXT_PLAIN_UTF8].response = null;
2981 __atomList[_ATOM_TEXT_PLAIN_UTF8].notify = null;
2982 __atomList[_ATOM_TEXT_PLAIN_UTF8].atom = 0;
2984 __atomList[_ATOM_TEXT_PLAIN].pName = "text/plain";
2985 __atomList[_ATOM_TEXT_PLAIN].formats = (_ClipFormat) (_CLIP_FORMAT_TEXT | _CLIP_FORMAT_MARKUP | _CLIP_FORMAT_HTML);
2986 __atomList[_ATOM_TEXT_PLAIN].convert = ConvertClipIntoText;
2987 __atomList[_ATOM_TEXT_PLAIN].response = null;
2988 __atomList[_ATOM_TEXT_PLAIN].notify = null;
2989 __atomList[_ATOM_TEXT_PLAIN].atom = 0;
2991 __clipList[_CLIP_TYPE_PRIMARY].selection = ECORE_X_SELECTION_PRIMARY;
2992 __clipList[_CLIP_TYPE_PRIMARY].set = ecore_x_selection_primary_set;
2993 __clipList[_CLIP_TYPE_PRIMARY].clear = ecore_x_selection_primary_clear;
2994 __clipList[_CLIP_TYPE_PRIMARY].request = ecore_x_selection_primary_request;
2995 __clipList[_CLIP_TYPE_PRIMARY].active = false;
2996 __clipList[_CLIP_TYPE_PRIMARY].pBuffer = null;
2997 __clipList[_CLIP_TYPE_PRIMARY].pRetrievedBuffer = null;
2998 __clipList[_CLIP_TYPE_PRIMARY].bufferLength = 0;
2999 __clipList[_CLIP_TYPE_PRIMARY].completed = false;
3001 __clipList[_CLIP_TYPE_SECONDARY].selection = ECORE_X_SELECTION_SECONDARY;
3002 __clipList[_CLIP_TYPE_SECONDARY].set = ecore_x_selection_secondary_set;
3003 __clipList[_CLIP_TYPE_SECONDARY].clear = ecore_x_selection_secondary_clear;
3004 __clipList[_CLIP_TYPE_SECONDARY].request = ecore_x_selection_secondary_request;
3005 __clipList[_CLIP_TYPE_SECONDARY].active = false;
3006 __clipList[_CLIP_TYPE_SECONDARY].pBuffer = null;
3007 __clipList[_CLIP_TYPE_SECONDARY].pRetrievedBuffer = null;
3008 __clipList[_CLIP_TYPE_SECONDARY].bufferLength = 0;
3009 __clipList[_CLIP_TYPE_SECONDARY].completed = false;
3011 __clipList[_CLIP_TYPE_CLIPBOARD].selection = ECORE_X_SELECTION_CLIPBOARD;
3012 __clipList[_CLIP_TYPE_CLIPBOARD].set = ecore_x_selection_clipboard_set;
3013 __clipList[_CLIP_TYPE_CLIPBOARD].clear = ecore_x_selection_clipboard_clear;
3014 __clipList[_CLIP_TYPE_CLIPBOARD].request = ecore_x_selection_clipboard_request;
3015 __clipList[_CLIP_TYPE_CLIPBOARD].active = false;
3016 __clipList[_CLIP_TYPE_CLIPBOARD].pBuffer = null;
3017 __clipList[_CLIP_TYPE_CLIPBOARD].pRetrievedBuffer = null;
3018 __clipList[_CLIP_TYPE_CLIPBOARD].bufferLength = 0;
3019 __clipList[_CLIP_TYPE_CLIPBOARD].completed = false;
3021 __clipList[_CLIP_TYPE_XDND].selection = ECORE_X_SELECTION_XDND;
3022 __clipList[_CLIP_TYPE_XDND].request = ecore_x_selection_xdnd_request;
3023 __clipList[_CLIP_TYPE_XDND].active = false;
3024 __clipList[_CLIP_TYPE_XDND].pBuffer = null;
3025 __clipList[_CLIP_TYPE_XDND].pRetrievedBuffer = null;
3026 __clipList[_CLIP_TYPE_XDND].bufferLength = 0;
3027 __clipList[_CLIP_TYPE_XDND].completed = false;
3029 for (int i = 0; i < _ATOM_MAX; i++)
3031 __atomList[i].atom = ecore_x_atom_get(__atomList[i].pName);
3032 //ecore_x_selection_converter_atom_add(__atomList[i].atom, __atomList[i].convert);
3034 SysLog(NID_UI, "[Clipboard] __atomList[%d] : pName = %s, atom = %d", i, __atomList[i].pName, __atomList[i].atom);
3037 result r = E_SUCCESS;
3039 __pClearClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, ClearClip, NULL);
3040 SysTryCatch(NID_UI, __pClearClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
3042 __pNotifyClip = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, NotifyClip, NULL);
3043 SysTryCatch(NID_UI, __pNotifyClip, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
3045 __pClipboardClosed = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, OnClipboardClosed, null);
3046 SysTryCatch(NID_UI, __pClipboardClosed, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
3048 __atomRotateRootAngle = ecore_x_atom_get("_E_ILLUME_ROTATE_ROOT_ANGLE");
3053 for (int i = 0; i < _ATOM_MAX; i++)
3055 if (__atomList[i].atom)
3057 ecore_x_selection_converter_atom_del(__atomList[i].atom);
3063 ecore_event_handler_del(__pClearClip);
3064 __pClearClip = null;
3069 ecore_event_handler_del(__pNotifyClip);
3070 __pNotifyClip = null;
3073 if (__pClipboardClosed)
3075 ecore_event_handler_del(__pClipboardClosed);
3076 __pClipboardClosed = null;
3083 _EcoreEvas::IsValidClipFormat(_ClipFormat clipFormat)
3085 return ((_CLIP_FORMAT_TEXT & clipFormat) ||
3086 (_CLIP_FORMAT_MARKUP & clipFormat) ||
3087 (_CLIP_FORMAT_IMAGE & clipFormat) ||
3088 (_CLIP_FORMAT_VCARD & clipFormat) ||
3089 (_CLIP_FORMAT_HTML & clipFormat));
3093 _EcoreEvas::GetCbhmWindow(void) const
3095 Ecore_X_Atom atomCbhm = ecore_x_atom_get(ATOM_CBHM_WINDOW_NAME);
3096 Ecore_X_Window cbhmWin = 0;
3098 unsigned char* pBuf = NULL;
3100 int ret = ecore_x_window_prop_property_get(0, atomCbhm, XA_WINDOW, 0, &pBuf, &num);
3104 memcpy(&cbhmWin, pBuf, sizeof(Ecore_X_Window));
3116 _EcoreEvas::SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg)
3118 Ecore_X_Window cbhmWin = GetCbhmWindow();
3119 Ecore_X_Atom atomCbhmMsg = ecore_x_atom_get(ATOM_CBHM_MSG);
3121 if (!cbhmWin || !atomCbhmMsg)
3126 XClientMessageEvent m;
3127 memset(&m, 0, sizeof(m));
3128 m.type = ClientMessage;
3129 m.display = (Display*)ecore_x_display_get();
3131 m.message_type = atomCbhmMsg;
3133 snprintf(m.data.b, 20, "%s", pMsg);
3135 XSendEvent((Display*)ecore_x_display_get(), cbhmWin, False, NoEventMask, (XEvent*)&m);
3146 _EcoreEvas::SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData)
3148 Ecore_X_Window cbhmWin = GetCbhmWindow();
3149 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(ATOM_CBHM_ITEM);
3152 ecore_x_window_prop_property_set(cbhmWin, atomCbhmItem, dataType, 8, pItemData, strlen(pItemData) + 1);
3155 if (SendCbhmMessage(xwin, ATOM_CBHM_SET_ITEM))
3164 _EcoreEvas::GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const
3166 unsigned char* pData = null;
3185 long unsigned int numRet = 0;
3186 long unsigned int bytes = 0;
3190 unsigned char* pPropRet = null;
3191 Ecore_X_Atom typeRet;
3193 ret = XGetWindowProperty((Display*)ecore_x_display_get(), xwin, property, 0, LONG_MAX, False,
3194 ecore_x_window_prop_any_type(), (Atom*)&typeRet, &sizeRet, &numRet, &bytes, &pPropRet);
3206 if (!(pData = (unsigned char*)malloc(numRet * sizeRet / 8)))
3215 for (i = 0; i < numRet; i++)
3216 (pData)[i] = pPropRet[i];
3219 for (i = 0; i < numRet; i++)
3220 ((unsigned short *)pData)[i] = ((unsigned short *)pPropRet)[i];
3223 for (i = 0; i < numRet; i++)
3224 ((unsigned int *)pData)[i] = ((unsigned long *)pPropRet)[i];
3240 *pDataType = typeRet;
3247 _EcoreEvas::GetCbhmItemCount(void) const
3252 Ecore_X_Atom atomCbhmCountGet = ecore_x_atom_get(ATOM_CBHM_COUNT_GET);
3253 Ecore_X_Window cbhmWin = GetCbhmWindow();
3255 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmCountGet, null, null);
3267 _EcoreEvas::GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const
3276 *(int*)pDataType = 0;
3279 Ecore_X_Window cbhmWin = GetCbhmWindow();
3283 snprintf(sendBuf, 20, "CBHM_ITEM%d", index);
3284 Ecore_X_Atom atomCbhmItem = ecore_x_atom_get(sendBuf);
3285 Ecore_X_Atom atomItemType = 0;
3287 pRet = (char*)GetCbhmReply(cbhmWin, atomCbhmItem, &atomItemType, NULL);
3301 *pDataType = atomItemType;
3304 Ecore_X_Atom x_atom_cbhm_error = ecore_x_atom_get(ATOM_CBHM_ERROR);
3305 if (atomItemType == x_atom_cbhm_error)
3323 // [ToDo] Remove API
3325 _AddActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3327 GetEcoreEvasMgr()->GetEcoreEvas()->AddActiveWindowEventListener(listener);
3330 // [ToDo] Remove API
3332 _RemoveActiveWindowEventListener(const _IActiveWindowEventListener& listener)
3334 GetEcoreEvasMgr()->GetEcoreEvas()->RemoveActiveWindowEventListener(listener);
3337 // [ToDo] Remove API
3338 _OSP_EXPORT_ unsigned int
3339 _GetActiveWindow(void)
3341 return GetEcoreEvasMgr()->GetEcoreEvas()->GetActiveWindow();
3344 // [ToDo] Remove API
3346 _GetProcessId(unsigned int window)
3348 return GetEcoreEvasMgr()->GetEcoreEvas()->GetProcessId(window);