From 0265f54413993b08bb167ae26bf2624e70ceabf8 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Mon, 31 Oct 2011 13:49:31 +0100 Subject: [PATCH] Wondows : start the moving of the windows ith X11 system ==> not really obvious --- Sources/base/guiX11.cpp | 31 +++++++++++++++++++++++-- Sources/base/guiX11.h | 2 ++ Sources/ewol.cpp | 5 +++++ Sources/ewolWindows.cpp | 50 ++++++++++++++++++++++++++++++++++++----- 4 files changed, 80 insertions(+), 8 deletions(-) diff --git a/Sources/base/guiX11.cpp b/Sources/base/guiX11.cpp index 7d0adb0c..ac1c5572 100644 --- a/Sources/base/guiX11.cpp +++ b/Sources/base/guiX11.cpp @@ -269,7 +269,6 @@ namespace guiAbstraction { } //code to remove decoration - /* { Hints hints; @@ -284,7 +283,6 @@ namespace guiAbstraction { EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ...."); } } - */ return true; } @@ -430,6 +428,7 @@ namespace guiAbstraction { case ConfigureNotify: EWOL_DEBUG("X11 event : " << event.type << " = \"ConfigureNotify\" Origin(" << event.xconfigure.x << "," << event.xconfigure.y << ") Size(" << event.xconfigure.width << "," << event.xconfigure.height << ")"); m_uniqueWindows->CalculateSize((double)event.xconfigure.width, (double)event.xconfigure.height); + m_uniqueWindows->SetOrigin(event.xconfigure.x, event.xconfigure.y); break; case Expose: EWOL_DEBUG("X11 event : " << event.type << " = \"Expose\""); @@ -603,6 +602,16 @@ namespace guiAbstraction { { m_run = false; } + + void ChangeSize(int32_t w, int32_t h) + { + XResizeWindow(m_display, WindowHandle, w, h); + } + + void ChangePos(int32_t x, int32_t y) + { + XMoveWindow(m_display, WindowHandle, x, y); + } }; }; @@ -671,3 +680,21 @@ void guiAbstraction::UnInit(void) } +void guiAbstraction::ChangeSize(int32_t w, int32_t h) +{ + if (true == guiAbstractionIsInit) { + myX11Access->ChangeSize(w, h); + } else { + EWOL_CRITICAL("X11 ==> not init ... "); + } +} + +void guiAbstraction::ChangePos(int32_t x, int32_t y) +{ + if (true == guiAbstractionIsInit) { + myX11Access->ChangePos(x, y); + } else { + EWOL_CRITICAL("X11 ==> not init ... "); + } +} + diff --git a/Sources/base/guiX11.h b/Sources/base/guiX11.h index 7ac92dc9..7eaeedc0 100644 --- a/Sources/base/guiX11.h +++ b/Sources/base/guiX11.h @@ -36,6 +36,8 @@ namespace guiAbstraction void Stop(void); void UnInit(void); void SetDisplayOnWindows(ewol::Windows * newOne); + void ChangeSize(int32_t w, int32_t h); + void ChangePos(int32_t x, int32_t y); }; diff --git a/Sources/ewol.cpp b/Sources/ewol.cpp index e04c7a7a..89c9fc5a 100644 --- a/Sources/ewol.cpp +++ b/Sources/ewol.cpp @@ -70,4 +70,9 @@ void ewol::DisplayWindows(ewol::Windows * windows) } +void ewol::Stop(void) +{ + guiAbstraction::Stop(); +} + diff --git a/Sources/ewolWindows.cpp b/Sources/ewolWindows.cpp index aa5db0c0..b93002cf 100644 --- a/Sources/ewolWindows.cpp +++ b/Sources/ewolWindows.cpp @@ -29,9 +29,28 @@ #include #include #include +#include + +#if __PLATFORM__ == X11 + #include "guiX11.h" +#elif __PLATFORM__ == DoubleBuffer + #include "guiDoubleBuffer.h" +#elif __PLATFORM__ == Android + #include "guiAndroid.h" +#elif __PLATFORM__ == AndroidTablet + #include "guiAndroidTablet.h" +#elif __PLATFORM__ == IPhone + #include "guiIPhone.h" +#elif __PLATFORM__ == IPad + #include "guiIPad.h" +#else + #error you need to specify a platform ... +#endif #include + + #undef __class__ #define __class__ "ewol::Windows" @@ -76,15 +95,33 @@ bool ewol::Windows::CalculateSize(double availlableX, double availlableY) bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) { -/* - if( EVENT_INPUT_TYPE_UP == typeEvent - && 1 == IdInput) + if( x >= 60 + && y <=20) { - EWOL_INFO("Request ???"); + static int32_t test=0; + static int32_t lastX=x; + static int32_t lastY=x; + if( 1 == IdInput + && EVENT_INPUT_TYPE_DOWN == typeEvent) { + test = 1; + lastX=x; + lastY=y; + EWOL_DEBUG("EVENT DOWN ... "); + } else if( 1 == IdInput + && EVENT_INPUT_TYPE_UP == typeEvent) { + test = 0; + EWOL_DEBUG("EVENT UP ... "); + } else if(EVENT_INPUT_TYPE_MOVE == typeEvent) { + EWOL_DEBUG("EVENT MOVE ... "); + if (test==1) { + EWOL_DEBUG("change POS ... "); + guiAbstraction::ChangePos(m_origin.x + (x - lastX), m_origin.y + (y - lastY)); + lastX=x; + lastY=y; + } + } } return true; -*/ - return false; } @@ -137,6 +174,7 @@ bool ewol::Windows::OnEventArea(const char * generateEventId, double x, double y //EWOL_DEBUG("Receive event : \"" << generateEventId << "\""); if(ewolEventWindowsClose == generateEventId) { EWOL_INFO("Request close of the windows"); + ewol::Stop(); eventIsOK = true; } else if(ewolEventWindowsMinimize == generateEventId) { EWOL_INFO("Request Minimize of the windows");