moved X-related codes to X11Window.cpp
authorDae Young Ryu <karzia@samsung.com>
Thu, 25 Jul 2013 01:01:33 +0000 (10:01 +0900)
committerDae Young Ryu <karzia@samsung.com>
Thu, 25 Jul 2013 01:01:33 +0000 (10:01 +0900)
Change-Id: If28cfde877cb2f61b1fe9a111144f2eba00e41be
Signed-off-by: Dae Young Ryu <karzia@samsung.com>
src/graphics/opengl/FGrpEgl.cpp
src/ui/CMakeLists.txt
src/ui/animations/FUiAnim_GlDisplayManager.cpp
src/ui/animations/FUiAnim_GlDisplayManager.h
src/ui/animations/FUiAnim_GlLayer.cpp
src/ui/animations/FUiAnim_GlLayer.h
src/ui/animations/FUiAnim_GlRenderManager.cpp
src/ui/animations/FUiAnim_XAtom.cpp

index eb2fb68..196a12f 100644 (file)
@@ -44,7 +44,7 @@
 #include <Ecore_Evas.h>
 #include <Ecore_X.h>
 #else
-#include <FUiAnim_GlDisplayManager.h>
+#include <FUiAnim_NativeWindow.h>
 #include <FGrp_Canvas.h>
 #endif
 
@@ -326,7 +326,7 @@ public:
 #ifdef VE_EFL
                Display* pDisplay = (Display*)ecore_x_display_get();
 #else
-               Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
+               Display* pDisplay = (Display*)_NativeWindow::GetDisplay();
 #endif
 
 #if defined(FGRAPHICS_INTERNAL_USE_DRM)
@@ -819,6 +819,7 @@ _GetEvasEngineType(void* pObject)
                }
        }
 #endif
+       return ENGINE_TYPE_ETC;
 }
 
 void
@@ -1039,7 +1040,7 @@ _SglGetDisplay(EGLNativeDisplayType displayId)
 #ifdef VE_EFL
                return eglGetDisplay((EGLNativeDisplayType) ecore_x_display_get());
 #else
-               return eglGetDisplay((EGLNativeDisplayType) _GlDisplayManager::GetInstance()->GetXDisplay());
+               return eglGetDisplay((EGLNativeDisplayType) _NativeWindow::GetDisplay());
 #endif
        }
 
@@ -1415,7 +1416,7 @@ _CreateNativePixmap(_SglIndex sglIndex, Tizen::Graphics::Bitmap* pBitmap)
 #ifdef VE_EFL
        pNativeDisplay = (Display*) ecore_x_display_get();
 #else
-       pNativeDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
+       pNativeDisplay = (Display*)_NativeWindow::GetDisplay();
 #endif
 
        nativeWindow = DefaultRootWindow(pNativeDisplay);
@@ -1638,7 +1639,7 @@ _CreateNativePixmapEx(Tizen::Graphics::Bitmap* pBitmap, Tizen::Graphics::BufferI
 #ifdef VE_EFL
        pNativeDisplay = (Display*) ecore_x_display_get();
 #else
-       pNativeDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
+       pNativeDisplay = (Display*)_NativeWindow::GetDisplay();
 #endif
 
        nativeWindow = DefaultRootWindow(pNativeDisplay);
index 63318ab..182621f 100644 (file)
@@ -55,6 +55,8 @@ SET (${this_target}_SOURCE_FILES
     animations/FUiAnim_GeometryInfo.cpp
     animations/FUiAnim_MeshImportSample.cpp        
     animations/FUiAnimMesh.cpp
+    animations/platform/FUiAnim_NativeWindow.cpp
+    animations/platform/FUiAnim_X11Window.cpp
 ###########################################################
        animations/FUiAnim_VariantEx.cpp
        animations/FUiAnim_TransformMatrix3Df.cpp
index 82c2488..b38fdc3 100644 (file)
@@ -24,9 +24,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/sync.h>
-#include <X11/Xutil.h>
 #include <new>
 #include <FBaseSysLog.h>
 #include <FGrpFloatRectangle.h>
@@ -47,9 +44,7 @@ using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Ui::Animations;
 
-//#define PRINT fprintf(stderr, __VA_ARGS__)
-#define PRINT(...)
-
+#define PRINT printf
 namespace
 {
 
@@ -74,735 +69,8 @@ WakeupEventCallback(void* pData, int type, void* pEvent)
 
 }
 
-#ifdef ENABLE_X_DEBUG
-static int
-__XErrorHandler(Display *d, XErrorEvent *ev)
-{
-       PRINT("ERROR\n");
-       return 0;
-}
-
-static int
-__XIOErrorHandler(Display *d)
-{
-       PRINT("IO ERROR\n");
-       return 0;
-}
-#endif
-
-
-char infoStr[2048]={0,};
-
-#define CASE_RET_STR(_CASE) case _CASE : pTypeName = (char*)#_CASE ;
-
-char* GetEventInfoString(XEvent& xEvent)
-{
-       char* pTypeName = null;
-
-       switch(xEvent.type)
-       {
-       CASE_RET_STR(KeyPress)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) state(%d) keycode(%d) same_screen(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xkey.root
-                               ,xEvent.xkey.subwindow
-                               ,xEvent.xkey.time
-                               ,xEvent.xkey.x, xEvent.xkey.y
-                               ,xEvent.xkey.x_root, xEvent.xkey.y_root
-                               ,xEvent.xkey.state
-                               ,xEvent.xkey.keycode
-                               ,xEvent.xkey.same_screen);
-               break;
-       }
-       CASE_RET_STR(KeyRelease)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) state(%d) keycode(%d) same_screen(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xkey.root
-                               ,xEvent.xkey.subwindow
-                               ,xEvent.xkey.time
-                               ,xEvent.xkey.x, xEvent.xkey.y
-                               ,xEvent.xkey.x_root, xEvent.xkey.y_root
-                               ,xEvent.xkey.state
-                               ,xEvent.xkey.keycode
-                               ,xEvent.xkey.same_screen);
-               break;
-       }
-       CASE_RET_STR(ButtonPress)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) state(%d) button(%d) same_screen(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xbutton.root
-                               ,xEvent.xbutton.subwindow
-                               ,xEvent.xbutton.time
-                               ,xEvent.xbutton.x, xEvent.xbutton.y
-                               ,xEvent.xbutton.x_root, xEvent.xbutton.y_root
-                               ,xEvent.xbutton.state
-                               ,xEvent.xbutton.button
-                               ,xEvent.xbutton.same_screen);
-               break;
-       }
-       CASE_RET_STR(ButtonRelease)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) state(%d) button(%d) same_screen(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xbutton.root
-                               ,xEvent.xbutton.subwindow
-                               ,xEvent.xbutton.time
-                               ,xEvent.xbutton.x, xEvent.xbutton.y
-                               ,xEvent.xbutton.x_root, xEvent.xbutton.y_root
-                               ,xEvent.xbutton.state
-                               ,xEvent.xbutton.button
-                               ,xEvent.xbutton.same_screen);
-               break;
-       }
-       CASE_RET_STR(MotionNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) state(%d) is_hint(%d) same_screen(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xmotion.root
-                               ,xEvent.xmotion.subwindow
-                               ,xEvent.xmotion.time
-                               ,xEvent.xmotion.x, xEvent.xmotion.y
-                               ,xEvent.xmotion.x_root, xEvent.xmotion.y_root
-                               ,xEvent.xmotion.state
-                               ,xEvent.xmotion.is_hint
-                               ,xEvent.xmotion.same_screen);
-               break;
-       }
-       CASE_RET_STR(EnterNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) mode(%d) detail(%d) same_screen(%d), focus(%d), state(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xcrossing.root
-                               ,xEvent.xcrossing.subwindow
-                               ,xEvent.xcrossing.time
-                               ,xEvent.xcrossing.x, xEvent.xcrossing.y
-                               ,xEvent.xcrossing.x_root, xEvent.xcrossing.y_root
-                               ,xEvent.xcrossing.mode
-                               ,xEvent.xcrossing.detail
-                               ,xEvent.xcrossing.same_screen
-                               ,xEvent.xcrossing.focus
-                               ,xEvent.xcrossing.state);
-               break;
-       }
-       CASE_RET_STR(LeaveNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) root(%ld) subwindow(%ld) time(%ld) \n\t x(%d) y(%d) x_root(%d) y_root(%d) mode(%d) detail(%d) same_screen(%d), focus(%d), state(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xcrossing.root
-                               ,xEvent.xcrossing.subwindow
-                               ,xEvent.xcrossing.time
-                               ,xEvent.xcrossing.x, xEvent.xcrossing.y
-                               ,xEvent.xcrossing.x_root, xEvent.xcrossing.y_root
-                               ,xEvent.xcrossing.mode
-                               ,xEvent.xcrossing.detail
-                               ,xEvent.xcrossing.same_screen
-                               ,xEvent.xcrossing.focus
-                               ,xEvent.xcrossing.state);
-               break;
-       }
-       CASE_RET_STR(FocusIn)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) mode(%d), detail(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xfocus.mode
-                               ,xEvent.xfocus.detail );
-               break;
-       }
-       CASE_RET_STR(FocusOut)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) mode(%d), detail(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xfocus.mode
-                               ,xEvent.xfocus.detail );
-               break;
-       }
-       CASE_RET_STR(KeymapNotify)
-       {
-               char* pKey =xEvent.xkeymap.key_vector;
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t key_vector(%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,pKey[0],pKey[1],pKey[2],pKey[3],pKey[4],pKey[5],pKey[6],pKey[7],pKey[8],pKey[9]
-                               ,pKey[10],pKey[11],pKey[12],pKey[13],pKey[14],pKey[15],pKey[16],pKey[17],pKey[18],pKey[19]
-                               ,pKey[20],pKey[21],pKey[22],pKey[23],pKey[24],pKey[25],pKey[26],pKey[27],pKey[28],pKey[29]
-                               ,pKey[30],pKey[31]);
-               break;
-       }
-       CASE_RET_STR(Expose)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t x(%d) y(%d) width(%d) height(%d) count(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xexpose.x
-                               ,xEvent.xexpose.y
-                               ,xEvent.xexpose.width
-                               ,xEvent.xexpose.height
-                               ,xEvent.xexpose.count );
-               break;
-       }
-       CASE_RET_STR(GraphicsExpose)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) drawable(%ld)\n\t x(%d) y(%d) width(%d) height(%d) count(%d) major_code(%d) minor_code(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xgraphicsexpose.drawable
-                               ,xEvent.xgraphicsexpose.x
-                               ,xEvent.xgraphicsexpose.y
-                               ,xEvent.xgraphicsexpose.width
-                               ,xEvent.xgraphicsexpose.height
-                               ,xEvent.xgraphicsexpose.count
-                               ,xEvent.xgraphicsexpose.major_code
-                               ,xEvent.xgraphicsexpose.minor_code);
-               break;
-       }
-       CASE_RET_STR(NoExpose)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) drawable(%ld)\n\t major_code(%d) minor_code(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xnoexpose.drawable
-                               ,xEvent.xnoexpose.major_code
-                               ,xEvent.xnoexpose.minor_code);
-               break;
-       }
-       CASE_RET_STR(VisibilityNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\tstate(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xvisibility.state);
-               break;
-       }
-       CASE_RET_STR(CreateNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t x(%d) y(%d) width(%d) height(%d) border_width(%d) override_redirect(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xany.window
-                               ,xEvent.xcreatewindow.x
-                               ,xEvent.xcreatewindow.y
-                               ,xEvent.xcreatewindow.width
-                               ,xEvent.xcreatewindow.height
-                               ,xEvent.xcreatewindow.border_width
-                               ,xEvent.xcreatewindow.override_redirect);
-               break;
-       }
-       CASE_RET_STR(DestroyNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xdestroywindow.event
-                               ,xEvent.xdestroywindow.window);
-               break;
-       }
-       CASE_RET_STR(UnmapNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) from_configure(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xunmap.event
-                               ,xEvent.xunmap.window
-                               ,xEvent.xunmap.from_configure);
-               break;
-       }
-       CASE_RET_STR(MapNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) override_redirect(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xmap.event
-                               ,xEvent.xmap.window
-                               ,xEvent.xmap.override_redirect);
-               break;
-       }
-       CASE_RET_STR(MapRequest)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) parent(%ld) window(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xmaprequest.parent
-                               ,xEvent.xmaprequest.window);
-               break;
-       }
-       CASE_RET_STR(ReparentNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) parent(%ld)\n\t x(%d) y(%d) override_redirect(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xreparent.event
-                               ,xEvent.xreparent.window
-                               ,xEvent.xreparent.parent
-                               ,xEvent.xreparent.x
-                               ,xEvent.xreparent.y
-                               ,xEvent.xreparent.override_redirect);
-               break;
-       }
-       CASE_RET_STR(ConfigureNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) \n\t x(%d) y(%d) width(%d) height(%d) border_width(%d) above(%ld) override_redirect(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xconfigure.event
-                               ,xEvent.xconfigure.window
-                               ,xEvent.xconfigure.x
-                               ,xEvent.xconfigure.y
-                               ,xEvent.xconfigure.width
-                               ,xEvent.xconfigure.height
-                               ,xEvent.xconfigure.border_width
-                               ,xEvent.xconfigure.above
-                               ,xEvent.xconfigure.override_redirect);
-               break;
-       }
-       CASE_RET_STR(ConfigureRequest)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) parent(%ld) window(%ld) \n\t x(%d) y(%d) width(%d) height(%d) border_width(%d) above(%ld) detail(%d) value_mask(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xconfigurerequest.parent
-                               ,xEvent.xconfigurerequest.window
-                               ,xEvent.xconfigurerequest.x
-                               ,xEvent.xconfigurerequest.y
-                               ,xEvent.xconfigurerequest.width
-                               ,xEvent.xconfigurerequest.height
-                               ,xEvent.xconfigurerequest.border_width
-                               ,xEvent.xconfigurerequest.above
-                               ,xEvent.xconfigurerequest.detail
-                               ,xEvent.xconfigurerequest.value_mask);
-               break;
-       }
-       CASE_RET_STR(GravityNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) \n\t x(%d) y(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xgravity.event
-                               ,xEvent.xgravity.window
-                               ,xEvent.xgravity.x
-                               ,xEvent.xgravity.y
-                               );
-               break;
-       }
-       CASE_RET_STR(ResizeRequest)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld) \n\t width(%d) height(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xresizerequest.window
-                               ,xEvent.xresizerequest.width
-                               ,xEvent.xresizerequest.height
-                               );
-               break;
-       }
-       CASE_RET_STR(CirculateNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld)\n\t place(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xcirculate.event
-                               ,xEvent.xcirculate.window
-                               ,xEvent.xcirculate.place
-                               );
-               break;
-       }
-       CASE_RET_STR(CirculateRequest)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) event(%ld) window(%ld) place(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xcirculate.event
-                               ,xEvent.xcirculate.window
-                               ,xEvent.xcirculate.place
-                               );
-               break;
-       }
-       CASE_RET_STR(PropertyNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t atom(%s,%ld) time(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xproperty.window
-                               ,GetXAtomName(xEvent.xproperty.atom)
-                               ,xEvent.xproperty.atom
-                               ,xEvent.xproperty.time
-                               );
-               break;
-       }
-       CASE_RET_STR(SelectionClear)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t selection(%ld) time(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xselectionclear.window
-                               ,xEvent.xselectionclear.selection
-                               ,xEvent.xselectionclear.time
-                               );
-               break;
-       }
-       CASE_RET_STR(SelectionRequest)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) owner(%ld) requestor(%ld)\n\t selection(%ld) target(%ld) property(%ld) time(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xselectionrequest.owner
-                               ,xEvent.xselectionrequest.requestor
-                               ,xEvent.xselectionrequest.selection
-                               ,xEvent.xselectionrequest.target
-                               ,xEvent.xselectionrequest.property
-                               ,xEvent.xselectionrequest.time
-                               );
-               break;
-       }
-       CASE_RET_STR(SelectionNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) requestor(%ld)\n\t selection(%ld) target(%ld) property(%ld) time(%ld)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xselection.requestor
-                               ,xEvent.xselection.selection
-                               ,xEvent.xselection.target
-                               ,xEvent.xselection.property
-                               ,xEvent.xselection.time
-                               );
-               break;
-       }
-       CASE_RET_STR(ColormapNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t colormap(%ld) c_new(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xcolormap.window
-                               ,xEvent.xcolormap.colormap
-                               ,xEvent.xcolormap.c_new
-                               );
-               break;
-       }
-       CASE_RET_STR(ClientMessage)
-       {
-               char* pChar = xEvent.xclient.data.b;
-               short* pData = xEvent.xclient.data.s;
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t message_type(%s:%ld) format(%d) data\n\t%x %x %x %x | %x %x %x %x | %x %x \n\t%c%c%c%c%c%c%c%c | %c%c%c%c%c%c%c%c | %c%c%c%c\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xclient.window
-                               ,GetXAtomName(xEvent.xclient.message_type),xEvent.xclient.message_type
-                               ,xEvent.xclient.format
-                               ,pData[0],      pData[1],       pData[2],       pData[3],       pData[4],       pData[5],       pData[6],       pData[7]
-                               ,pData[16],     pData[17]
-                               ,pChar[0],      pChar[1],       pChar[2],       pChar[3],       pChar[4],       pChar[5],       pChar[6],       pChar[7],       pChar[8],       pChar[9],       pChar[10],      pChar[11],      pChar[12],      pChar[13],      pChar[14],      pChar[15]
-                               ,pChar[16],     pChar[17],      pChar[18],      pChar[19]
-
-                               );
-               break;
-       }
-       CASE_RET_STR(MappingNotify)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) window(%ld)\n\t request(%d) first_keycode(%d) count(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xmapping.window
-                               ,xEvent.xmapping.request
-                               ,xEvent.xmapping.first_keycode
-                               ,xEvent.xmapping.count
-                               );
-               break;
-       }
-       CASE_RET_STR(GenericEvent)
-       {
-               sprintf(infoStr,"[XEvent:%s] - serial(%ld) send_event(%d) display(0x%x) \n\t extension(%d) evtype(%d)\n"
-                               ,pTypeName
-                               ,xEvent.xany.serial
-                               ,xEvent.xany.send_event
-                               ,(unsigned int)xEvent.xany.display
-                               ,xEvent.xgeneric.extension
-                               ,xEvent.xgeneric.evtype
-                               );
-               break;
-       }
-       default:
-               {
-                       sprintf(infoStr,"[XEvent:Unknown]\n");
-                       break;
-               }
-       }
-return infoStr;
-}
-
 namespace Tizen { namespace Ui { namespace Animations {
 
-class _RawXEventMonitor :  public _IRawEventProducer , public _IRawEventMonitor
-{
-public:
-       explicit _RawXEventMonitor(Display* pDisplay)
-       {
-               __pDisplay = pDisplay;
-       }
-       virtual ~_RawXEventMonitor(void)
-       {
-
-       }
-public:
-       Display* GetXDisplay(void) const
-       {
-               return __pDisplay;
-       }
-
-       bool ConvertXEventToRawEvent(XEvent& xEvent, _RawEvent& rawEvent)
-       {
-//             PRINT("ConvertXEventToRawEvent:xEvent.type = %d\n", xEvent.type);
-               PRINT("%s \n",GetEventInfoString(xEvent));
-               bool validRawEvent = false;
-               Window targetWindow = 0;
-               switch(xEvent.type)
-               {
-               case KeyPress:
-                       rawEvent.type = _RawEvent::RAWEVENT_KEYPRESS;
-                       targetWindow = rawEvent.rawWindow = xEvent.xkey.window;
-                       rawEvent.timeStamp = xEvent.xkey.time;
-                       rawEvent.data.key.keyState = xEvent.xkey.state;
-                       rawEvent.data.key.keySymbol = XLookupKeysym(&xEvent.xkey, 0);
-                       validRawEvent = true;
-                       break;
-
-               case KeyRelease:
-                       rawEvent.type = _RawEvent::RAWEVENT_KEYRELEASE;
-                       targetWindow = rawEvent.rawWindow = xEvent.xkey.window;
-                       rawEvent.timeStamp = xEvent.xkey.time;
-                       rawEvent.data.key.keyState = xEvent.xkey.state;
-                       rawEvent.data.key.keySymbol = XLookupKeysym(&xEvent.xkey, 0);
-                       validRawEvent = true;
-                       break;
-
-               case ButtonPress:
-                       rawEvent.type = _RawEvent::RAWEVENT_TOUCHPRESS;
-                       targetWindow = rawEvent.rawWindow = xEvent.xbutton.window;
-                       rawEvent.timeStamp = xEvent.xbutton.time;
-                       rawEvent.data.touchPress.x = xEvent.xbutton.x_root;
-                       rawEvent.data.touchPress.y = xEvent.xbutton.y_root;
-                       validRawEvent = true;
-                       break;
-
-               case ButtonRelease:
-                       rawEvent.type = _RawEvent::RAWEVENT_TOUCHRELEASE;
-                       targetWindow = rawEvent.rawWindow = xEvent.xbutton.window;
-                       rawEvent.timeStamp = xEvent.xbutton.time;
-                       rawEvent.data.touchPress.x = xEvent.xbutton.x_root;
-                       rawEvent.data.touchPress.y = xEvent.xbutton.y_root;
-                       validRawEvent = true;
-                       break;
-
-               case MotionNotify:
-                       rawEvent.type = _RawEvent::RAWEVENT_TOUCHMOVE;
-                       rawEvent.rawWindow = xEvent.xmotion.window;
-                       rawEvent.timeStamp = xEvent.xmotion.time;
-                       rawEvent.data.touchPress.x = xEvent.xmotion.x_root;
-                       rawEvent.data.touchPress.y = xEvent.xmotion.y_root;
-                       validRawEvent = true;
-                       break;
-               case EnterNotify:               break;
-               case LeaveNotify:               break;
-               case FocusIn:                   break;
-               case FocusOut:                  break;
-               case KeymapNotify:              break;
-               case Expose:                    break;
-               case GraphicsExpose:    break;
-               case NoExpose:                  break;
-               case VisibilityNotify:  break;
-               case CreateNotify:              break;
-               case DestroyNotify:             break;
-               case UnmapNotify:
-               {
-                       targetWindow = rawEvent.rawWindow = xEvent.xunmap.window;
-                       break;
-               }
-               case MapNotify:
-               {
-                       rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
-                       targetWindow = rawEvent.rawWindow = xEvent.xmap.window;
-                       validRawEvent = true;
-                       break;
-               }
-               case MapRequest:                break;
-               case ReparentNotify:    break;
-                       targetWindow = xEvent.xreparent.window;
-                       break;
-                       /* If the screen was resized, call the appropriate function. */
-               case ConfigureNotify:
-                       targetWindow = xEvent.xconfigure.window;
-                       break;
-
-               case ConfigureRequest:
-                       targetWindow = xEvent.xconfigurerequest.window;
-                       break;
-
-               case GravityNotify:             break;
-               case ResizeRequest:             break;
-               case CirculateNotify:   break;
-               case CirculateRequest:  break;
-               case PropertyNotify:
-               {
-                       rawEvent.type = _RawEvent::RAWEVENT_X_WINDOW_PROPERTY;
-                       targetWindow = rawEvent.rawWindow = xEvent.xproperty.window;
-                       rawEvent.data.xWindowProperty.atom = xEvent.xproperty.atom;
-                       rawEvent.data.xWindowProperty.time = xEvent.xproperty.time;
-
-                       validRawEvent = true;
-                       break;
-               }
-               case SelectionClear:    break;
-               case SelectionRequest:  break;
-               case SelectionNotify:   break;
-               case ColormapNotify:    break;
-               case ClientMessage:
-               {
-                       targetWindow = rawEvent.rawWindow = xEvent.xclient.window;
-                       break;
-               }
-               case MappingNotify:             break;
-               case GenericEvent:              break;
-
-               }
-
-               if(targetWindow != 0)
-               {
-                       _GlLayer* pLayer = null;
-                       pLayer = _GlDisplayManager::GetInstance()->GetLayerWithNativeWindow(targetWindow);
-                       if(pLayer)
-                       {
-                               pLayer->ProcessXEvent(xEvent);
-                       }
-               }
-
-               return validRawEvent;
-       }
-       // interface method
-
-       virtual bool MonitorRawEvents(void)
-       {
-               if (XPending(__pDisplay) > 0)
-                       return true;
-               else
-                       return false;
-       }
-       // interface method
-       virtual bool ProduceRawEvents(int fd)
-       {
-               if (!XPending(__pDisplay))
-               {
-//                     PRINT("_RawXEventMonitor::ProduceRawEvents: XPending is failed!\n");
-                       return false;
-               }
-
-               XEvent xEvent;
-               _RawEvent rawEvent;
-
-               XNextEvent(__pDisplay, &xEvent);
-
-               if(ConvertXEventToRawEvent(xEvent, rawEvent) == true)
-               {
-                       if(_Looper::GetInstance())
-                       {
-                               _Looper::GetInstance()->PostRawEvent(rawEvent);
-                       }
-                       return true;
-               }
-               return true;
-       }
-
-private:
-       Display* __pDisplay;
-};
-
 _GlDisplayManager* _GlDisplayManager::__pInstance = null;
 _GlDisplayManager::RestoreContextCallback _GlDisplayManager::__pRestoreContextCallback = null;
 int _GlDisplayManager::__eventType = 0;
@@ -813,25 +81,8 @@ bool _GlDisplayManager::__wakeUpEventAdded = false;
 _GlDisplayManager::_GlDisplayManager(void)
        : __layers()
        , __needUpdates(false)
-       , __pDisplay(null)
-       , __XColormap(null)
        , __needsComposite()
-       , __pRawXEventMonitor(null)
 {
-       XInitThreads();
-
-       __pDisplay = XOpenDisplay(NULL);
-       SysAssertf(__pDisplay, "Cannot initialize X display");
-
-       //__XColormap = XCreateColormap(__pDisplay, DefaultRootWindow(__pDisplay), __pXVisualInfo->visual, AllocNone);
-       __XColormap = DefaultColormap(__pDisplay, DefaultScreen(__pDisplay));
-
-       InitXAtom(__pDisplay);
-
-#ifdef  ENABLE_X_DEBUG
-       XSetErrorHandler((XErrorHandler)__XErrorHandler);
-       XSetIOErrorHandler((XIOErrorHandler)__XIOErrorHandler);
-#endif
 
        _VisualElementEnvironment::Initialize();
        _VisualElementSurfaceManager::Initialize();
@@ -840,9 +91,6 @@ _GlDisplayManager::_GlDisplayManager(void)
 
        __needsComposite = 0;
 
-
-       __pRawXEventMonitor = new (std::nothrow) _RawXEventMonitor(__pDisplay);
-
 //     __fdWakeup = open("./wakeup", O_WRONLY | O_CREATE, S_IUSER | S_IWUSER);
 //     if(__fdWakeup == -1)
 //     {
@@ -853,11 +101,6 @@ _GlDisplayManager::_GlDisplayManager(void)
 _GlDisplayManager::~_GlDisplayManager(void)
 {
 
-       if(__pRawXEventMonitor)
-       {
-               delete __pRawXEventMonitor;
-       }
-       __pRawXEventMonitor = null;
 
 // don't have to clean up layer list. (it should be removed on the user side)
 
@@ -869,8 +112,7 @@ _GlDisplayManager::~_GlDisplayManager(void)
 //             __layers.RemoveAt(0);
 //     }
 
-       XCloseDisplay(__pDisplay);
-       __pDisplay = null;
+
 }
 
 result
@@ -879,7 +121,7 @@ _GlDisplayManager::CreateInstance(void)
        SysTryReturnResult(NID_UI_ANIM, !__pInstance, E_OBJ_ALREADY_EXIST, "The display manager already created.");
 
        __pInstance = new (std::nothrow) _GlDisplayManager();
-       if (!__pInstance || !__pInstance->__pRawXEventMonitor)
+       if (!__pInstance)
        {
                return E_OUT_OF_MEMORY;
        }
@@ -889,7 +131,8 @@ _GlDisplayManager::CreateInstance(void)
 
        _Looper::CreateInstance();
 
-       _Looper::GetInstance()->AddRawEventProducer(ConnectionNumber(__pInstance->__pDisplay), __pInstance->__pRawXEventMonitor, __pInstance->__pRawXEventMonitor);
+       _NativeWindow::WindowSystemInit();
+
 
        _GlRenderManager::CreateInstance();
 //     _GlRenderManager::GetInstance()->SyncRenderManager();
index eb23b34..7754b58 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef _FUI_ANIM_INTERNAL_GL_DISPLAY_MANAGER_H_
 #define _FUI_ANIM_INTERNAL_GL_DISPLAY_MANAGER_H_
 
-#include <X11/Xlib.h>
 #include <FBaseColArrayList.h>
 #include "FUiAnim_AtomicInteger.h"
 #include "FUiAnim_Looper.h"
@@ -42,7 +41,7 @@ namespace Tizen { namespace Ui { namespace Animations
 class _NativeLayer;
 class _GlLayer;
 class _RootVisualElement;
-class _RawXEventMonitor;
+
 
 class _OSP_EXPORT_ _GlDisplayManager
 {
@@ -61,8 +60,6 @@ public:
        static void SetRestoreContextCallback(RestoreContextCallback pRestoreContextCallback);
        static void RestoreContext(void);
 public:
-       Display* GetXDisplay(void) const { return __pDisplay; }
-       Colormap GetXColormap(void) const { return __XColormap; }
 
        result RegisterLayer(_NativeLayer& layer);
        result UnregisterLayer(_NativeLayer& layer);
@@ -97,13 +94,9 @@ private:
 private:
        Tizen::Base::Collection::ArrayList __layers;
        bool __needUpdates;
-       Display* __pDisplay;
-       Colormap __XColormap;
 
        _AtomicInteger __needsComposite;
 
-       _RawXEventMonitor* __pRawXEventMonitor;
-
        static _GlDisplayManager* __pInstance;
        static RestoreContextCallback __pRestoreContextCallback;
 
index 9950087..3969572 100644 (file)
  * This file contains implementation _GlLayer class.
  */
 
-#include <X11/Xutil.h>
-#include <X11/extensions/Xrender.h>
-
 #include <FBaseErrors.h>
 #include <FBaseSysLog.h>
 
 #include <FGrpFloatRectangle.h>
-#include "FUiAnim_XAtom.h"
-#include "FUiAnim_NativeLayer.h"
+#include "FUiAnim_NativeWindow.h"
 #include "FUiAnim_GlLayer.h"
 #include "FUiAnim_GlNode.h"
 #include "FUiAnim_VisualElementImpl.h"
@@ -64,174 +60,13 @@ namespace Tizen { namespace Ui { namespace Animations
 {
 
 
-Handle
-_GlLayer::XCreateWindow(Handle hParent, int x, int y, unsigned int width, unsigned int height, bool needEvent)
-{
-
-       Window parent = hParent;
-       Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-       XSetWindowAttributes winAttributes;
-
-       if(hParent == 0)
-       {
-               parent  = DefaultRootWindow(pDisplay);
-       }
-
-       winAttributes.colormap = DefaultColormap(pDisplay, DefaultScreen(pDisplay));
-       // winAttributes.colormap = _GlDisplayManager::GetInstance()->GetXColormap();
-       winAttributes.backing_store = NotUseful;
-       winAttributes.override_redirect = False;
-       winAttributes.border_pixel = 0;
-       winAttributes.background_pixmap = None;
-       winAttributes.bit_gravity = NorthWestGravity;//NorthWestGravity;
-       winAttributes.win_gravity = NorthWestGravity;//NorthWestGravity;
-       winAttributes.save_under = False;
-       winAttributes.do_not_propagate_mask = NoEventMask;
-       winAttributes.event_mask = 
-               KeyPressMask | KeyReleaseMask |
-               ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
-               ExposureMask | VisibilityChangeMask | StructureNotifyMask | FocusChangeMask | PropertyChangeMask | ColormapChangeMask;
-
-       return ::XCreateWindow(
-               pDisplay,
-               parent,
-               x,
-               y,
-               width,
-               height,
-               32,
-               CopyFromParent,
-               InputOutput,
-               CopyFromParent,
-               (needEvent ? CWEventMask : 0) |
-                               //CWColormap |
-                               CWBackingStore | CWOverrideRedirect | CWBorderPixel | CWBackPixmap | CWSaveUnder | CWDontPropagate | CWBitGravity | CWWinGravity,
-               &winAttributes
-       );
-}
-
-Handle
-_GlLayer::GetVisual(Handle parent)
-{
-       XWindowAttributes att;
-       XVisualInfo *xvi;
-       XVisualInfo vi_in;
-       int nvi, i, scr = 0;
-       XRenderPictFormat *fmt;
-       Visual *vis;
-
-       Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-       if (parent == 0)
-       {
-               parent = DefaultRootWindow(pDisplay);
-               scr = DefaultScreen(pDisplay);
-       }
-       else
-       {
-               /* ewww - round trip */
-               XGetWindowAttributes(pDisplay, parent, &att);
-               for (i = 0; i < ScreenCount(pDisplay); i++)
-               {
-                       if (att.screen == ScreenOfDisplay(pDisplay, i))
-                       {
-                               scr = i;
-                               break;
-                       }
-               }
-       }
-
-       vi_in.screen = scr;
-       vi_in.depth = 32;
-       vi_in.c_class = TrueColor;
-       xvi = XGetVisualInfo(pDisplay,
-                                                VisualScreenMask |
-                                                VisualDepthMask |
-                                                VisualClassMask,
-                                                &vi_in,
-                                                &nvi);
-       if (!xvi)
-         return null;
-
-       vis = NULL;
-       for (i = 0; i < nvi; i++)
-       {
-               fmt = XRenderFindVisualFormat(pDisplay, xvi[i].visual);
-               if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
-               {
-                       vis = xvi[i].visual;
-                       break;
-               }
-       }
-       XFree (xvi);
-       return (Handle)vis;
-}
-
-
-Handle
-_GlLayer::XCreateArgbWindow(Handle hParent, int x, int y, unsigned int width, unsigned int height, bool needEvent)
-{
-#ifdef GLX_USE
-#else
-       Window parent = hParent;
-       Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-       XSetWindowAttributes winAttributes;
-
-       if(hParent == 0)
-       {
-               parent  = DefaultRootWindow(pDisplay);
-       }
-
-       Visual* pVisual = (Visual*)GetVisual(hParent);
-
-    winAttributes.colormap = XCreateColormap(pDisplay, parent,
-                                    pVisual, AllocNone);
-
-    winAttributes.backing_store = NotUseful;
-    winAttributes.override_redirect = False;
-    winAttributes.border_pixel = 0;
-    winAttributes.background_pixmap = None;
-    winAttributes.bit_gravity = NorthWestGravity;
-    winAttributes.win_gravity = NorthWestGravity;
-    winAttributes.save_under = False;
-    winAttributes.do_not_propagate_mask = NoEventMask;
-    winAttributes.event_mask =
-        KeyPressMask | KeyReleaseMask |
-        ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
-        ExposureMask | VisibilityChangeMask | StructureNotifyMask | FocusChangeMask | PropertyChangeMask | ColormapChangeMask;
-
-       return ::XCreateWindow(
-               pDisplay,
-               parent,
-               x,
-               y,
-               width,
-               height,
-               0,
-               32,
-               InputOutput,
-               pVisual,
-               (needEvent ? CWEventMask : 0) |
-                               CWColormap | CWBackingStore | CWOverrideRedirect | CWBorderPixel | CWBackPixmap | CWSaveUnder | CWDontPropagate | CWBitGravity | CWWinGravity,
-               &winAttributes
-       );
-
-#endif
-}
-
-
-void
-_GlLayer::XDestroyWindow(Handle window)
-{
-       ::XDestroyWindow(_GlDisplayManager::GetInstance()->GetXDisplay(), window);
-}
-
 _GlLayer::_GlLayer(void)
        : __showState(false)
+       , __opacity(1.0f)
        , __pRootVisualElement(null)
-       , __window(None)
+       , __pWindow(null)
        , __surface(EGL_NO_SURFACE)
        , __reconfigureNeeded(false)
-       , __isMapped(false)
 #ifdef VE_USE_GL_MULTI_CONTEXT
        , __pContext(null)
 #endif
@@ -240,44 +75,31 @@ _GlLayer::_GlLayer(void)
 
 _GlLayer::~_GlLayer(void)
 {
-       if (__window)
-       {
-               _GlRenderManager::GetInstance()->FinalizeGLLayer(this);
+       _GlRenderManager::GetInstance()->FinalizeGLLayer(this);
 
-               XDestroyWindow(__window);
+       if (__pWindow)
+       {
+               _NativeWindow::DestroyNativeWindow(__pWindow);
+               __pWindow = null;
        }
 
-       __window = 0;
 }
 
 
 result
 _GlLayer::OnConstructed(void)
 {
-       SysAssertf(__window == 0, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
-
-//     __window = XCreateWindow(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, true);
-//     __window = XCreateWindow(0, 0, 0, DEF_WIDTH, DEF_HEIGHT, true);
-       __window = XCreateArgbWindow(0, 0, 0, DEF_WIDTH, DEF_HEIGHT, true);
-
-       //ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atom, 1);
-       unsigned int atom = X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
-       SetXAtomValue(__window, X_ATOM_NET_WM_WINDOW_TYPE, X_ATOM_ATOM, &atom, 1);
-
-       if (__window == None)
-       {
-               return E_INVALID_STATE;
-       }
+       SysAssertf(__pWindow == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
 
        __bounds.SetBounds(0, 0, DEF_WIDTH, DEF_HEIGHT);
 
-//     Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-//     XSetStandardProperties(pDisplay, __window, "test", "haha", None, NULL, 0, NULL);
+       __pWindow = _NativeWindow::CreateNativeWindow(null, __bounds, null);
 
        if (!_GlRenderManager::GetInstance()->InitializeGLLayer(this))
        {
-               XDestroyWindow(__window);
-               __window = 0;
+               _NativeWindow::DestroyNativeWindow(__pWindow);
+               __pWindow = null;
+
                return E_INVALID_STATE; // CHECKME:
        }
 
@@ -310,41 +132,16 @@ _GlLayer::Configure(_RootVisualElement& rootElement)
 }
 
 
-void
-_GlLayer::ProcessXEvent(XEvent& xEvent)
-{
-
-       switch(xEvent.type)
-       {
-       case ConfigureNotify:
-       case ConfigureRequest:
-               SetReconfigureNeeded(true);
-               break;
-       case MapNotify:
-               __isMapped = true;
-               break;
-       case UnmapNotify:
-               __isMapped = false;
-               break;
-       }
-}
 
 result
 _GlLayer::SetBounds(const FloatRectangle& bounds)
 {
-       if (__window)
+
+       __bounds = bounds;
+
+       if(__pWindow)
        {
-               Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-               // CHECKME: float --> int ?
-               int x = (int)bounds.x;
-               int y = (int)bounds.y;
-               unsigned int w = (unsigned int)(bounds.width <= 0.0f ? 1.0f : bounds.width);
-               unsigned int h = (unsigned int)(bounds.height <= 0.0f ? 1.0f : bounds.height);
-
-               XMoveResizeWindow(pDisplay, __window, x, y, w, h); // CHECKME: What's the result of this API ?
-               __bounds.SetBounds(x, y, w, h);
-               XSync(pDisplay,FALSE);
-//             XFlush(pDisplay);       // CHECKME: Why is this needed ???
+               return __pWindow->SetBounds(bounds);
        }
 
        return E_SUCCESS;
@@ -353,126 +150,59 @@ _GlLayer::SetBounds(const FloatRectangle& bounds)
 FloatRectangle
 _GlLayer::GetBounds(void) const
 {
-       if (__window)
-       {
-#if 1
-               Handle dummyWin;
-               int x, y;
-               unsigned int w, h, dummyBorder, dummyDepth;
-               if (!XGetGeometry(_GlDisplayManager::GetInstance()->GetXDisplay(), (Window)__window, (Window*)&dummyWin, &x, &y, &w, &h, &dummyBorder, &dummyDepth))
-               {
-                       x = 0;
-                       y = 0;
-                       w = 0;
-                       h = 0;
-               }
-
-               return FloatRectangle(x, y, w, h);
-#else
-               return FloatRectangle(__bounds.x, __bounds.y, __bounds.width, __bounds.height);
-#endif
-       }
-
-       return FloatRectangle();
+       return __bounds;
 }
 
 result
 _GlLayer::SetShowState(bool show)
 {
-       if (__window)
+       __showState = true;
+       if(__pWindow)
        {
-               Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
-
-               if (show)
-               {
-                       XMapWindow(pDisplay, __window);
-               }
-               else
-               {
-                       // CHECKME: Why ?
-                       XEvent xev;
-                       Handle root;
-                       int idum;
-                       unsigned int uidum;
-
-                       // ICCCM: SEND unmap event...
-                       root = __window;
-                       if (ScreenCount(pDisplay) == 1)
-                       {
-                               root = DefaultRootWindow(pDisplay);
-                       }
-                       else
-                       {
-                               XGetGeometry(
-                                       pDisplay,
-                                       (Window)__window,
-                                       (Window*)&root,
-                                       &idum,
-                                       &idum,
-                                       &uidum,
-                                       &uidum,
-                                       &uidum,
-                                       &uidum
-                               );
-                       }
-
-                       xev.xunmap.type = UnmapNotify;
-                       xev.xunmap.serial = 0;
-                       xev.xunmap.send_event = True;
-                       xev.xunmap.display = pDisplay;
-                       xev.xunmap.event = root;
-                       xev.xunmap.window = __window;
-                       xev.xunmap.from_configure = False;
-                       XSendEvent(pDisplay, xev.xunmap.event, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
-                       XUnmapWindow(pDisplay, __window);
-               }
-
-               __showState = show;
-               XFlush(pDisplay);       // CHECKME: Why is this needed ???
+               return __pWindow->SetShowState(show);
        }
-
        return E_SUCCESS;
 }
 
 bool
 _GlLayer::GetShowState(void) const
 {
-       if (__window)
-       {
-#if 0
-               XWindowAttributes attr;
-               return XGetWindowAttributes(_GlDisplayManager::GetInstance()->GetXDisplay(), __window, &attr) && (attr.map_state == IsViewable);
-#else
-               // CHECKME: The value returned from XGetWindowAttributes is not synchorinized with latest state. Why ?
-               return __showState;
-#endif
-       }
-
-       return false;
+       return __showState;
 }
 
 
 void
 _GlLayer::SetOpacity(float opacity)
 {
-       // FIXME: How to ???
+       __opacity = opacity;
+       if(__pWindow)
+       {
+               __pWindow->SetOpacity(opacity);
+       }
 }
 
 float
 _GlLayer::GetOpacity(void)
 {
        // FIXME: How to ???
-       return 1.0f;
+       return __opacity;
+//     return 1.0f;
+}
+bool
+_GlLayer::IsMapped(void) const
+{
+       if(__pWindow)
+       {
+               return __pWindow->IsMapped();
+       }
+       return false;
 }
-
 
 void
 _GlLayer::Flush(void)
 {
        SysAssertf(false, "_GlLayer::Flush should not be called !");
 
-       if (!__window)
-               return;
 }
 
 
index 7cb7783..6734d0c 100644 (file)
@@ -31,6 +31,7 @@
 #include <FGrpRectangle.h>
 #include <FGrpFloatRectangle.h>
 #include "FUiAnim_NativeLayer.h"
+#include "FUiAnim_NativeWindow.h"
 
 namespace Tizen { namespace Ui { namespace Animations
 {
@@ -63,7 +64,7 @@ public:
 
        bool IsReconfigureNeeded(void) const { return __reconfigureNeeded; }
        void SetReconfigureNeeded(bool need) { __reconfigureNeeded = need; }
-       bool IsMapped(void) const {return __isMapped;}
+       bool IsMapped(void) const;
 
        _RootVisualElement* GetRootVisualElement(void) const
        {
@@ -72,7 +73,19 @@ public:
 
        Handle GetNativeWindow(void) const
        {
-               return (Handle)__window;
+               if(__pWindow)
+               {
+                       return __pWindow->GetHandle();
+               }
+               return (Handle)0;
+       }
+       _NativeWindow* GetWindow(void) const
+       {
+               if(__pWindow)
+               {
+                       return __pWindow;
+               }
+               return null;
        }
 
        Handle GetNativeSurface(void) const
@@ -87,25 +100,17 @@ public:
        }
 #endif
 
-       void ProcessXEvent(XEvent& xEvent);
 
-protected:
-       // README!!
-       // We cannot use Window type, which is declared in X lib, because it makes a conflict with Tizen::Ui::Window
-       Handle XCreateWindow(Handle hParent,int x, int y, unsigned int width, unsigned int height, bool needEvent);
-       Handle XCreateArgbWindow(Handle hParent, int x, int y, unsigned int width, unsigned int height, bool needEvent);
-       void XDestroyWindow(Handle window);
-       Handle GetVisual(Handle parent);
 
 
 private:
-       Tizen::Graphics::Rectangle __bounds;
+       Tizen::Graphics::FloatRectangle __bounds;
        bool __showState;
+       float __opacity;
        _RootVisualElement* __pRootVisualElement;
-       Handle __window;
+       _NativeWindow* __pWindow;
        EGLSurface __surface;
        bool __reconfigureNeeded;
-       bool __isMapped;
 
 #ifdef VE_USE_GL_MULTI_CONTEXT
        _GlContext* __pContext;
index 885edc9..fb34862 100644 (file)
@@ -605,7 +605,7 @@ bool
 _GlRenderManager::CommandHandlerInitializeGLLayer(_GlLayer* pGlLayer)
 {
 #ifdef VE_USE_GL_MULTI_CONTEXT
-       pGlLayer->__pContext = new _GlContext((Handle)_GlDisplayManager::GetInstance()->GetXDisplay(), (EGLNativeWindowType)pGlLayer->GetNativeWindow());
+       pGlLayer->__pContext = new _GlContext((Handle)_NativeWindow::GetDisplay(), (EGLNativeWindowType)pGlLayer->GetNativeWindow());
 
        __pGlContext = pGlLayer->__pContext;
 
@@ -953,7 +953,7 @@ _GlRenderManager::RenderProc(void* pData)
        pThis->__threadId = syscall(SYS_gettid);
 
 #ifndef VE_USE_GL_MULTI_CONTEXT
-       _GlContext::CreateInstance((Handle)_GlDisplayManager::GetInstance()->GetXDisplay());
+       _GlContext::CreateInstance(_NativeWindow::GetDisplay());
        pThis->__pGlContext = _GlContext::GetInstance();
 
        pThis->PrepareShaders();
index c09c6b0..2fc277c 100644 (file)
@@ -1,7 +1,9 @@
+#include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <FBaseTypes.h>
 #include "FUiAnim_XAtom.h"
 #include "FUiAnim_GlDisplayManager.h"
+#include "FUiAnim_NativeWindow.h"
 
 //#define PRINT fprintf(stderr, __VA_ARGS__)
 #define PRINT(...)
@@ -840,7 +842,7 @@ GetXAtomValue(Handle window, unsigned int atom, unsigned int type, unsigned int*
         return -1;
     }
 
-    Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
+       Display* pDisplay = (Display*)_NativeWindow::GetDisplay();
 
     prop_ret = NULL;
     if (XGetWindowProperty(pDisplay, window, atom, 0, 0x7fffffff, False,
@@ -909,7 +911,7 @@ SetXAtomValue(Handle window, unsigned int atom, unsigned int type, unsigned int*
     }
 
 
-    Display* pDisplay = _GlDisplayManager::GetInstance()->GetXDisplay();
+       Display* pDisplay = (Display*)_NativeWindow::GetDisplay();
 
 #if SIZEOF_INT == SIZEOF_LONG
    XChangeProperty(pDisplay, window, atom, type, 32, PropModeReplace,