animations/platform/FUiAnim_NativeWindow.cpp
animations/platform/FUiAnim_X11Window.cpp
animations/platform/FUiAnim_X11.cpp
+ animations/platform/FUiAnim_EcoreX.cpp
animations/platform/FUiAnim_GlContext.cpp
animations/platform/FUiAnim_Egl.cpp
animations/platform/FUiAnim_Wgl.cpp
Eina_Bool
OnIdleEntered(void* pData)
{
-
+#if !defined(USE_ECORE_X)
_Looper* pLooper = _Looper::GetInstance();
PRINT("OnIdleEntered\n");
pLooper->DispatchRawEvent(rawEvent);
}
} while (event == true);
+#endif
return EINA_TRUE;
}
Eina_Bool
OnFdEventOccured(void *data, Ecore_Fd_Handler *fd_handler)
{
+#if !defined(USE_ECORE_X)
_Looper* pLooper = _Looper::GetInstance();
PRINT("OnFdEventOccured\n");
pLooper->CallEventProducer(data);
+#endif
return EINA_TRUE;
--- /dev/null
+#include <Ecore_X.h>
+#include "FUiAnim_EcoreX.h"
+#include "FUiAnim_GlLayer.h"
+#include "FUiAnim_X11Window.h"
+#include "FUiAnim_DisplayManager.h"
+
+using namespace Tizen::Ui::Animations;
+
+namespace
+{
+
+Eina_Bool
+OnXShown(void* pData, int type, void* pEventInfo)
+{
+ if ((!pData) || (!pEventInfo))
+ {
+ return EINA_TRUE;
+ }
+
+ Ecore_X_Event_Window_Show* pEvent = (Ecore_X_Event_Window_Show*)pEventInfo;
+
+ _EcoreX* pEcoreX = (_EcoreX*)pData;
+
+ if (pEvent->win != 0)
+ {
+ _GlLayer* pGlLayer = pEcoreX->GetLayer(pEvent->win);
+
+ if (pGlLayer)
+ {
+ _RawEvent rawEvent;
+
+ rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
+ rawEvent.rawWindow = pEvent->win;
+
+ _X11Window* pWindow = static_cast<_X11Window *>(pGlLayer->GetWindow());
+ if (pWindow)
+ {
+ XEvent xEvent;
+ xEvent.type = MapNotify;
+
+ pWindow->ProcessEvent(pGlLayer, xEvent);
+ }
+
+ rawEvent.data.flush.layerWindowHandle = pGlLayer->GetWindowHandle();
+ rawEvent.data.flush.layerId = pGlLayer->GetId();
+
+ pEcoreX->ProcessRawEvent(rawEvent);
+ }
+ }
+
+ return EINA_TRUE;
+}
+
+} // Anonymous
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+_EcoreX* _EcoreX::__pInstance = null;
+
+_EcoreX*
+_EcoreX::GetInstance(void)
+{
+ return _EcoreX::__pInstance;
+}
+
+void
+_EcoreX::Init(void)
+{
+ if(!_EcoreX::__pInstance)
+ {
+ _EcoreX::__pInstance = new (std::nothrow) _EcoreX;
+ }
+}
+
+void
+_EcoreX::Destroy(void)
+{
+ if(_EcoreX::__pInstance)
+ {
+ delete _EcoreX::__pInstance;
+ _EcoreX::__pInstance = null;
+ }
+}
+
+_EcoreX::_EcoreX(void)
+ : __pShowHandler(NULL)
+{
+ __pDisplay = (Display*)ecore_x_display_get();
+ SysAssertf(__pDisplay, "Cannot initialize X display");
+
+ __XColormap = DefaultColormap(__pDisplay, DefaultScreen(__pDisplay));
+
+ __pShowHandler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, OnXShown, (void*) this);
+}
+
+_EcoreX::~_EcoreX(void)
+{
+ if (__pShowHandler)
+ {
+ ecore_event_handler_del(__pShowHandler);
+ __pShowHandler = NULL;
+ }
+}
+
+Display*
+_EcoreX::GetXDisplay(void) const
+{
+ return __pDisplay;
+}
+
+bool
+_EcoreX::MonitorRawEvents(void)
+{
+ return true;
+}
+
+bool
+_EcoreX::ProduceRawEvents(int fd)
+{
+ return true;
+}
+
+_GlLayer*
+_EcoreX::GetLayer(Window window)
+{
+ _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
+
+ int count = pDisplayManager->GetLayerCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ _NativeLayer* pLayer = pDisplayManager->GetLayer(i);
+ if (likely(pLayer))
+ {
+ if (pLayer->GetWindowHandle() == window)
+ {
+ return dynamic_cast<_GlLayer*>(pLayer);
+ }
+ }
+ }
+
+ return null;
+}
+
+void
+_EcoreX::ProcessRawEvent(_RawEvent& rawEvent)
+{
+ _Looper* pLooper = _Looper::GetInstance();
+
+ pLooper->PostRawEvent(rawEvent);
+
+ _RawEvent peekRawEvent;
+ bool event = true;
+
+ SysLog(NID_UI_ANIM, "%d 0x%x", rawEvent.type, rawEvent.rawWindow);
+
+ do
+ {
+ event = pLooper->PeekRawEvent(peekRawEvent, true);
+ if (event)
+ {
+ pLooper->DispatchRawEvent(peekRawEvent);
+ }
+ } while (event == true);
+}
+
+}}} // Tizen::Ui::Animations
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiAnim_EcoreX.h
+ * @brief This is the header file for the _EcoreX class.
+ *
+ * This header file contains the declarations of the _EcoreX class. @n
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_ECORE_X_H_
+#define _FUI_ANIM_INTERNAL_ECORE_X_H_
+
+#include <X11/Xlib.h>
+#include "FUiAnim_Looper.h"
+#include "FUiAnim_NativeWindow.h"
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+class _GlLayer;
+
+class _EcoreX
+ : public _IRawEventProducer
+ , public _IRawEventMonitor
+{
+public:
+ static _EcoreX* GetInstance(void);
+
+ static void Init(void);
+ static void Destroy(void);
+
+public:
+ virtual bool MonitorRawEvents(void);
+ virtual bool ProduceRawEvents(int fd);
+
+ void ProcessRawEvent(_RawEvent& rawEvent);
+
+ Display* GetXDisplay(void) const;
+
+ _GlLayer* GetLayer(Window window);
+
+private:
+ _EcoreX(void);
+ virtual ~_EcoreX(void);
+
+private:
+ Display* __pDisplay;
+ Colormap __XColormap;
+ static _EcoreX* __pInstance;
+
+ Ecore_Event_Handler* __pShowHandler;
+}; // _EcoreX
+
+}}} // Tizen::Ui::Animations
+
+#endif // _FUI_ANIM_INTERNAL_ECORE_X_H_
#include "FUiAnim_GlRenderManager.h"
#include "FUiAnim_X11Window.h"
#include "FUiAnim_X11.h"
+#include "FUiAnim_EcoreX.h"
using namespace Tizen::Base;
using namespace Tizen::Graphics;
bool
_X11Window::X11WindowSystemInit()
{
+#if defined(USE_ECORE_X)
+ if(_EcoreX::GetInstance())
+#else
if(_X11::GetInstance())
+#endif
{
return false;
}
+#if defined(USE_ECORE_X)
+ _EcoreX::Init();
+#else
_X11::Init();
+#endif
return true;
}
bool
_X11Window::X11WindowSystemDestroy()
{
+#if defined(USE_ECORE_X)
+ if(!_EcoreX::GetInstance())
+#else
if(!_X11::GetInstance())
+#endif
{
return false;
}
+#if defined(USE_ECORE_X)
+ _EcoreX::Destroy();
+#else
_X11::Destroy();
+#endif
return true;
}
Handle
_X11Window::X11WindowSystemGetDisplay()
{
+#if defined(USE_ECORE_X)
+ if(_EcoreX::GetInstance())
+ {
+ return (Handle)_EcoreX::GetInstance()->GetXDisplay();
+ }
+#else
if(_X11::GetInstance())
{
return (Handle)_X11::GetInstance()->GetXDisplay();
}
+#endif
return (Handle)0;
}
void
_X11Window::OnDestructing()
{
+#if defined(USE_ECORE_X)
+ ::XDestroyWindow(_EcoreX::GetInstance()->GetXDisplay(), GetHandle());
+#else
::XDestroyWindow(_X11::GetInstance()->GetXDisplay(), GetHandle());
+#endif
}
void
if (window)
{
FloatRectangle bounds = newBounds;
+#if defined(USE_ECORE_X)
+ Display* pDisplay =_EcoreX::GetInstance()->GetXDisplay();
+#else
Display* pDisplay =_X11::GetInstance()->GetXDisplay();
+#endif
// CHECKME: float --> int ?
int x = (int)bounds.x;
int y = (int)bounds.y;
Handle window = GetHandle();
if (window)
{
+#if defined(USE_ECORE_X)
+ Display* pDisplay = _EcoreX::GetInstance()->GetXDisplay();
+#else
Display* pDisplay = _X11::GetInstance()->GetXDisplay();
+#endif
if (newShowState)
{
{
Window parent = hParent;
+#if defined(USE_ECORE_X)
+ Display* pDisplay = _EcoreX::GetInstance()->GetXDisplay();
+#else
Display* pDisplay = _X11::GetInstance()->GetXDisplay();
+#endif
XSetWindowAttributes winAttributes;
if(hParent == 0)
XRenderPictFormat *fmt;
Visual *vis;
+#if defined(USE_ECORE_X)
+ Display* pDisplay = _EcoreX::GetInstance()->GetXDisplay();
+#else
Display* pDisplay = _X11::GetInstance()->GetXDisplay();
+#endif
if (parent == 0)
{
parent = DefaultRootWindow(pDisplay);
Handle dummyWin;
int x, y;
unsigned int w, h, dummyBorder, dummyDepth;
+#if defined(USE_ECORE_X)
+ if (!XGetGeometry(_EcoreX::GetInstance()->GetXDisplay(), (Window)window, (Window*)&dummyWin, &x, &y, &w, &h, &dummyBorder, &dummyDepth))
+#else
if (!XGetGeometry(_X11::GetInstance()->GetXDisplay(), (Window)window, (Window*)&dummyWin, &x, &y, &w, &h, &dummyBorder, &dummyDepth))
+#endif
{
x = 0;
y = 0;
{
XWindowAttributes attr;
+#if defined(USE_ECORE_X)
+ return XGetWindowAttributes(_EcoreX::GetInstance()->GetXDisplay(), window, &attr) && (attr.map_state == IsViewable);
+#else
return XGetWindowAttributes(_X11::GetInstance()->GetXDisplay(), window, &attr) && (attr.map_state == IsViewable);
+#endif
}
return false;
#ifdef GLX_USE
#else
Window parent = hParent;
+#if defined(USE_ECORE_X)
+ Display* pDisplay = _EcoreX::GetInstance()->GetXDisplay();
+#else
Display* pDisplay = _X11::GetInstance()->GetXDisplay();
+#endif
XSetWindowAttributes winAttributes;
if(hParent == 0)
bool GetWindowShowState(void) const;
Tizen::Graphics::FloatRectangle GetWindowGeometry(void) const;
+ void ProcessEvent(_GlLayer* pLayer, XEvent& xEvent);
+
private:
// README!!
// We cannot use Window type, which is declared in X lib, because it makes a conflict with Tizen::Ui::Window
void XDestroyWindow(Handle window);
Handle GetVisual(Handle parent);
- void ProcessEvent(_GlLayer* pLayer, XEvent& xEvent);
-
protected:
virtual Handle OnConstructing(void);
virtual void OnDestructing(void);
TARGET_LINK_LIBRARIES(${this_target} "-ldlog" )
TARGET_LINK_LIBRARIES(${this_target} "-lpthread" )
TARGET_LINK_LIBRARIES(${this_target} "-lecore" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_x" )
TARGET_LINK_LIBRARIES(${this_target} "-lxml2" )
TARGET_LINK_LIBRARIES(${this_target} "-lfontconfig" )
TARGET_LINK_LIBRARIES(${this_target} "-lcairo" )