animations/FUiAnimShaderProgram.cpp
animations/platform/FUiAnim_NativeWindow.cpp
animations/platform/FUiAnim_X11Window.cpp
+ animations/platform/FUiAnim_X11.cpp
animations/platform/FUiAnim_GlContext.cpp
animations/platform/FUiAnim_Egl.cpp
animations/platform/FUiAnim_Wgl.cpp
--- /dev/null
+#include <X11/Xutil.h>
+#include <X11/extensions/Xrender.h>
+#include <X11/extensions/sync.h>
+#include <X11/Xutil.h>
+
+#include "FUiAnim_X11.h"
+#include "FUiAnim_Looper.h"
+#include "FUiAnim_XAtom.h"
+#include "FUiAnim_GlLayer.h"
+#include "FUiAnim_DisplayManager.h"
+#include "FUiAnim_GlRenderManager.h"
+#include "FUiAnim_X11Window.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Ui;
+
+#define PRINT(...) fprintf(stderr,__VA_ARGS__)
+//#define PRINT printf
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+#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;
+}
+
+_X11* _X11::__pInstance = null;
+
+_X11*
+_X11::GetInstance(void)
+{
+ return _X11::__pInstance;
+}
+
+void
+_X11::Init(void)
+{
+ if(!_X11::__pInstance)
+ {
+ _X11::__pInstance = new (std::nothrow) _X11;
+ }
+}
+
+void
+_X11::Destroy(void)
+{
+ if(_X11::__pInstance)
+ {
+ delete _X11::__pInstance;
+ _X11::__pInstance = null;
+ }
+}
+
+_X11::_X11(void)
+{
+ 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
+
+ _Looper::GetInstance()->AddRawEventProducer(ConnectionNumber(__pDisplay), this, this);
+}
+
+_X11::~_X11(void)
+{
+ if(__pDisplay)
+ {
+ XCloseDisplay(__pDisplay);
+ __pDisplay = null;
+ }
+}
+
+Display*
+_X11::GetXDisplay(void) const
+{
+ return __pDisplay;
+}
+
+bool
+_X11::MonitorRawEvents(void)
+{
+ if (XPending(__pDisplay) > 0)
+ return true;
+ else
+ return false;
+}
+
+bool
+_X11::ProduceRawEvents(int fd)
+{
+ if (!XPending(__pDisplay))
+ {
+// PRINT("_RawXEventMonitor::ProduceRawEvents: XPending is failed!\n");
+ return false;
+ }
+
+ XEvent xEvent;
+ _RawEvent rawEvent;
+
+ XNextEvent(__pDisplay, &xEvent);
+
+// PRINT("ConvertXEventToRawEvent:xEvent.type = %d\n", xEvent.type);
+// PRINT("%s \n",GetEventInfoString(xEvent));
+ bool sendRawEvent = 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);
+ sendRawEvent = 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);
+ sendRawEvent = 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;
+ sendRawEvent = 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;
+ sendRawEvent = 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;
+ sendRawEvent = 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;
+// sendRawEvent = 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;
+
+// sendRawEvent = true;
+ break;
+ }
+ case SelectionClear: break;
+ case SelectionRequest: break;
+ case SelectionNotify: break;
+ case ColormapNotify:
+ {
+ rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
+ targetWindow = rawEvent.rawWindow = xEvent.xcolormap.window;
+// sendRawEvent = true;
+ break;
+ }
+ case ClientMessage:
+ {
+ targetWindow = rawEvent.rawWindow = xEvent.xclient.window;
+ break;
+ }
+ case MappingNotify: break;
+ case GenericEvent: break;
+
+ }
+
+
+ if(targetWindow != 0)
+ {// ë§\98ì\97\90 ?\88ë\93¬....
+ _GlLayer* pGlLayer = GetLayer(targetWindow);
+
+ if(pGlLayer)
+ {
+ _X11Window * pWindow = static_cast<_X11Window *>(pGlLayer->GetWindow());
+ if(pWindow)
+ {
+ pWindow->ProcessEvent(pGlLayer, xEvent);
+ }
+
+ if(xEvent.type == MapNotify /*|| xEvent.type == ColormapNotify*/)
+ {
+ rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
+ rawEvent.data.flush.layerWindowHandle = pGlLayer->GetWindowHandle();
+ rawEvent.data.flush.layerId = pGlLayer->GetId();
+
+ sendRawEvent = true;
+ }
+
+ }
+ }
+
+ if(sendRawEvent)
+ {
+ if(_Looper::GetInstance())
+ {
+ _Looper::GetInstance()->PostRawEvent(rawEvent);
+ }
+ }
+
+ return true;
+}
+
+_GlLayer*
+_X11::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;
+}
+
+}}} // 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_X11.h
+ * @brief This is the header file for the _X11 class.
+ *
+ * This header file contains the declarations of the _X11 class. @n
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_X11_H_
+#define _FUI_ANIM_INTERNAL_X11_H_
+
+#include "FUiAnim_Looper.h"
+
+namespace Tizen { namespace Ui { namespace Animations {
+
+class _GlLayer;
+
+class _X11
+ : public _IRawEventProducer
+ , public _IRawEventMonitor
+{
+public:
+ static _X11* GetInstance(void);
+
+ static void Init(void);
+
+ static void Destroy(void);
+
+public:
+ virtual bool MonitorRawEvents(void);
+ virtual bool ProduceRawEvents(int fd);
+
+ Display* GetXDisplay(void) const;
+ _GlLayer* GetLayer(Window window);
+
+private:
+ _X11(void);
+ virtual ~_X11(void);
+
+private:
+ Display* __pDisplay;
+ Colormap __XColormap;
+ static _X11* __pInstance;
+}; // _X11
+
+}}} // Tizen::Ui::Animations
+
+#endif // _FUI_ANIM_INTERNAL_X11_H_
#include "FUiAnim_DisplayManager.h"
#include "FUiAnim_GlRenderManager.h"
#include "FUiAnim_X11Window.h"
+#include "FUiAnim_X11.h"
using namespace Tizen::Base;
using namespace Tizen::Graphics;
namespace Tizen { namespace Ui { namespace Animations {
-
-
-#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;
-}
-
-
-
-class _X11 : public _IRawEventProducer , public _IRawEventMonitor
-{
-public:
- static _X11* GetInstance()
- {
- return _X11::__pInstance;
- }
-
- static void Init()
- {
- if(!_X11::__pInstance)
- {
- _X11::__pInstance = new (std::nothrow) _X11;
- }
- }
-
- static void Destroy()
- {
- if(_X11::__pInstance)
- {
- delete _X11::__pInstance;
- _X11::__pInstance = null;
- }
- }
-
-private:
- _X11()
- {
- 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
-
- _Looper::GetInstance()->AddRawEventProducer(ConnectionNumber(__pDisplay), this, this);
-
- }
-
- virtual ~_X11()
- {
- if(__pDisplay)
- {
- XCloseDisplay(__pDisplay);
- __pDisplay = null;
- }
- }
-
-
-public:
- Display* GetXDisplay(void) const
- {
- return __pDisplay;
- }
-
-
- 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);
-
-// PRINT("ConvertXEventToRawEvent:xEvent.type = %d\n", xEvent.type);
-// PRINT("%s \n",GetEventInfoString(xEvent));
- bool sendRawEvent = 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);
- sendRawEvent = 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);
- sendRawEvent = 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;
- sendRawEvent = 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;
- sendRawEvent = 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;
- sendRawEvent = 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;
-// sendRawEvent = 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;
-
-// sendRawEvent = true;
- break;
- }
- case SelectionClear: break;
- case SelectionRequest: break;
- case SelectionNotify: break;
- case ColormapNotify:
- {
- rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
- targetWindow = rawEvent.rawWindow = xEvent.xcolormap.window;
-// sendRawEvent = true;
- break;
- }
- case ClientMessage:
- {
- targetWindow = rawEvent.rawWindow = xEvent.xclient.window;
- break;
- }
- case MappingNotify: break;
- case GenericEvent: break;
-
- }
-
-
- if(targetWindow != 0)
- {// 맘에 안듬....
- _GlLayer* pGlLayer = GetLayer(targetWindow);
-
- if(pGlLayer)
- {
- _X11Window * pWindow = static_cast<_X11Window *>(pGlLayer->GetWindow());
- if(pWindow)
- {
- pWindow->ProcessEvent(pGlLayer, xEvent);
- }
-
- if(xEvent.type == MapNotify /*|| xEvent.type == ColormapNotify*/)
- {
- rawEvent.type = _RawEvent::RAWEVENT_FLUSH;
- rawEvent.data.flush.layerWindowHandle = pGlLayer->GetWindowHandle();
- rawEvent.data.flush.layerId = pGlLayer->GetId();
-
- sendRawEvent = true;
- }
-
- }
- }
-
- if(sendRawEvent)
- {
- if(_Looper::GetInstance())
- {
- _Looper::GetInstance()->PostRawEvent(rawEvent);
- }
- }
-
- return true;
- }
-
- _GlLayer* 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;
- }
-
-private:
- Display* __pDisplay;
- Colormap __XColormap;
- static _X11* __pInstance;
-};
-_X11* _X11::__pInstance = null;
-
bool
_X11Window::X11WindowSystemInit()
{
unsigned int atom = X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
SetXAtomValue(window, X_ATOM_NET_WM_WINDOW_TYPE, X_ATOM_ATOM, &atom, 1);
- // Display* pDisplay = _X11::GetInstance()->GetXDisplay();
- // XSetStandardProperties(pDisplay, __window, "test", "haha", None, NULL, 0, NULL);
+// Display* pDisplay = _X11::GetInstance()->GetXDisplay();
+// XSetStandardProperties(pDisplay, __window, "test", "haha", None, NULL, 0, NULL);
return (Handle)window;
}
#endif
}
-
-
void
_X11Window::ProcessEvent(_GlLayer* pLayer, XEvent& xEvent)
{
}
}
-
}}} //namespace Tizen { namespace Ui { namespace Animations {
* This header file contains the declarations of the _X11Window class. @n
*/
-
-#ifndef _FUI_ANIM_X11_WINDOW_H_
-#define _FUI_ANIM_X11_WINDOW_H_
+#ifndef _FUI_ANIM_INTERNAL_X11_WINDOW_H_
+#define _FUI_ANIM_INTERNAL_X11_WINDOW_H_
#include <X11/Xlib.h>
#include "FUiAnim_NativeWindow.h"
void ProcessEvent(_GlLayer* pLayer, XEvent& xEvent);
-
protected:
virtual Handle OnConstructing(void);
virtual void OnDestructing(void);
}}} //namespace Tizen { namespace Ui { namespace Animations {
-#endif // _FUI_ANIM_X11_WINDOW_H_
+#endif // _FUI_ANIM_INTERNAL_X11_WINDOW_H_