diff --git a/Sources/libewol/ewol/Widget.h b/Sources/libewol/ewol/Widget.h index 242fa985..90370652 100644 --- a/Sources/libewol/ewol/Widget.h +++ b/Sources/libewol/ewol/Widget.h @@ -37,13 +37,6 @@ namespace ewol { #include namespace ewol { - extern "C" { - // TODO : Remove this bu coord2D_ts - typedef struct { - etkFloat_t x; - etkFloat_t y; - } coord; - } typedef enum { EVENT_INPUT_TYPE_DOWN, EVENT_INPUT_TYPE_MOVE, @@ -100,9 +93,6 @@ namespace ewol { char* GetCharTypeMoveEvent(eventKbMoveType_te type); - #define EWOL_EVENT_AREA (0) - #define EWOL_EVENT_SHORTCUT (1) - // TODO : Remove this and set it at the Windows only ... extern "C" { typedef struct { const char * generateEventId; //!< event generate ID (to be unique it was pointer on the string name) @@ -129,26 +119,26 @@ namespace ewol { // ---------------------------------------------------------------------------------------------------------------- protected: // internal element calculated by the system - coord m_origin; //!< internal ... I do not really known how i can use it ... - coord m_size; //!< internal : current size of the widget - coord m_minSize; //!< user define the minimum size of the widget + coord2D_ts m_origin; //!< internal ... I do not really known how i can use it ... + coord2D_ts m_size; //!< internal : current size of the widget + coord2D_ts m_minSize; //!< user define the minimum size of the widget // user configuaration - coord m_userMinSize; //!< user define the minimum size of the widget + coord2D_ts m_userMinSize; //!< user define the minimum size of the widget bool m_userExpendX; bool m_userExpendY; bool m_userFillX; bool m_userFillY; public: void SetOrigin(etkFloat_t x, etkFloat_t y) { m_origin.x=x; m_origin.y=y;}; - coord GetOrigin(void) { return m_origin; }; + coord2D_ts GetOrigin(void) { return m_origin; }; virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); // this generate the current size ... //update the min Size ... and the expend parameters for the sizer virtual bool CalculateMinSize(void) {m_minSize.x = m_userMinSize.x; m_minSize.y = m_userMinSize.y; MarkToReedraw(); return true; }; virtual void SetMinSize(etkFloat_t x=-1, etkFloat_t y=-1) { m_userMinSize.x = x; m_userMinSize.y = y; }; - coord GetMinSize(void) { return m_minSize; }; - coord GetSize(void) { return m_size; }; + coord2D_ts GetMinSize(void) { return m_minSize; }; + coord2D_ts GetSize(void) { return m_size; }; void SetCurrentSise(etkFloat_t x=-1, etkFloat_t y=-1) { m_size.x = x; m_size.y = y; MarkToReedraw();}; - coord GetCurrentSize(void) { return m_size; }; + coord2D_ts GetCurrentSize(void) { return m_size; }; virtual void SetExpendX(bool newExpend=false) { m_userExpendX = newExpend; }; virtual bool CanExpentX(void) { return m_userExpendX; }; virtual void SetExpendY(bool newExpend=false) { m_userExpendY = newExpend; }; diff --git a/Sources/libewol/ewol/WidgetManager.cpp b/Sources/libewol/ewol/WidgetManager.cpp index 761d7fba..bf2fec9a 100644 --- a/Sources/libewol/ewol/WidgetManager.cpp +++ b/Sources/libewol/ewol/WidgetManager.cpp @@ -35,7 +35,7 @@ extern "C" { }; static pthread_mutex_t localMutex; - +static bool IsInit = false; // internal element of the widget manager : static etk::VectorType m_widgetList; // all widget allocated ==> all time increment ... never removed ... @@ -54,6 +54,7 @@ void ewol::widgetManager::Init(void) m_widgetList.Clear(); m_focusWidgetDefault = NULL; m_focusWidgetCurrent = NULL; + IsInit = true; } void ewol::widgetManager::UnInit(void) @@ -66,15 +67,16 @@ void ewol::widgetManager::UnInit(void) ewol::widgetManager::RemoveAllMarkWidget(); EWOL_INFO(" Remove missing user widget"); - for(int32_t iii=0; iii m_widgetDeletedList_tmp = m_widgetDeletedList; - pthread_mutex_lock(&localMutex); - // flip/Flop all the widget registered : - for(int32_t iii=0; iii m_widgetDeletedList_tmp = m_widgetDeletedList; + /* + if (m_widgetDeletedList.Size() > 0 ) { + EWOL_DEBUG("NB element to remove : " << m_widgetDeletedList.Size()); } - } - pthread_mutex_unlock(&localMutex); - - if (m_widgetDeletedList.Size() != 0 ) { - EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size()); - // in every case clean the list ... - m_widgetDeletedList.Clear(); + */ + // flip/Flop all the widget registered : + for(int32_t iii=0; iii 0 ) { + EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size()); + // in every case clean the list ... + m_widgetDeletedList.Clear(); + } + */ + pthread_mutex_unlock(&localMutex); } } diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 038ed7e3..1c05d569 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -80,7 +80,7 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY int32_t keyboardHigh = 0; if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { m_keyBoardwidget->CalculateMinSize(); - coord tmpSize = m_keyBoardwidget->GetMinSize(); + coord2D_ts tmpSize = m_keyBoardwidget->GetMinSize(); keyboardHigh = (int32_t)tmpSize.y; m_keyBoardwidget->SetOrigin(0, m_size.y - keyboardHigh); m_keyBoardwidget->CalculateSize(m_size.x, keyboardHigh); @@ -106,7 +106,7 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { - coord tmpSize = m_keyBoardwidget->GetMinSize(); + coord2D_ts tmpSize = m_keyBoardwidget->GetMinSize(); if (y > m_size.y - tmpSize.y) { m_keyBoardwidget->GenEventInput(IdInput, typeEvent, x, y); return true; diff --git a/Sources/libewol/ewol/base/MainThread.cpp b/Sources/libewol/ewol/base/MainThread.cpp index 21c4177a..551f03db 100644 --- a/Sources/libewol/ewol/base/MainThread.cpp +++ b/Sources/libewol/ewol/base/MainThread.cpp @@ -247,8 +247,8 @@ void EWOL_SystemStart(void) // init the thread : EWOL_DEBUG("Create the thread"); pthread_attr_init(&androidJniThreadAttr); - //pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE) - pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED); + pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE); + //pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED); //pthread_attr_setscope( &androidJniThreadAttr, PTHREAD_SCOPE_SYSTEM); /* // note android does not permit to change the thread priority ... // try to set prio : diff --git a/Sources/libewol/ewol/widget/ContextMenu.cpp b/Sources/libewol/ewol/widget/ContextMenu.cpp index ebf8ae09..263be171 100644 --- a/Sources/libewol/ewol/widget/ContextMenu.cpp +++ b/Sources/libewol/ewol/widget/ContextMenu.cpp @@ -69,8 +69,8 @@ bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availla m_size.y = availlableY; if (NULL != m_subWidget) { - coord subWidgetSize; - coord subWidgetOrigin; + coord2D_ts subWidgetSize; + coord2D_ts subWidgetOrigin; subWidgetSize = m_subWidget->GetMinSize(); if (true == m_subWidget->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -142,7 +142,7 @@ bool ewol::ContextMenu::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget) { m_subWidget->CalculateMinSize(); - coord tmpSize = m_subWidget->GetMinSize(); + coord2D_ts tmpSize = m_subWidget->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -205,8 +205,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) AddOObject(BGOObjects); if (NULL != m_subWidget) { - coord tmpSize = m_subWidget->GetSize(); - coord tmpOrigin = m_subWidget->GetOrigin(); + coord2D_ts tmpSize = m_subWidget->GetSize(); + coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); // display border ... BGOObjects->SetColor(m_colorBorder); @@ -246,8 +246,8 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { if (NULL != m_subWidget) { - coord tmpSize = m_subWidget->GetSize(); - coord tmpOrigin = m_subWidget->GetOrigin(); + coord2D_ts tmpSize = m_subWidget->GetSize(); + coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { diff --git a/Sources/libewol/ewol/widget/Menu.cpp b/Sources/libewol/ewol/widget/Menu.cpp index 08e0bc6c..399dba4b 100644 --- a/Sources/libewol/ewol/widget/Menu.cpp +++ b/Sources/libewol/ewol/widget/Menu.cpp @@ -155,8 +155,8 @@ bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEven newPosition.y = y; ewol::Widget * eventFromWidget = ewol::widgetManager::Get(widgetID); if (NULL != eventFromWidget) { - coord tmpOri = eventFromWidget->GetOrigin(); - coord tmpSize = eventFromWidget->GetSize(); + coord2D_ts tmpOri = eventFromWidget->GetOrigin(); + coord2D_ts tmpSize = eventFromWidget->GetSize(); // calculate the correct position newPosition.x = tmpOri.x + tmpSize.x/2; newPosition.y = tmpOri.y + tmpSize.y; diff --git a/Sources/libewol/ewol/widget/PopUp.cpp b/Sources/libewol/ewol/widget/PopUp.cpp index 39d22162..55d14d8f 100644 --- a/Sources/libewol/ewol/widget/PopUp.cpp +++ b/Sources/libewol/ewol/widget/PopUp.cpp @@ -60,8 +60,8 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY) m_size.y = availlableY; if (NULL != m_subWidget) { - coord subWidgetSize; - coord subWidgetOrigin; + coord2D_ts subWidgetSize; + coord2D_ts subWidgetOrigin; subWidgetSize = m_subWidget->GetMinSize(); if (true == m_subWidget->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -97,7 +97,7 @@ bool ewol::PopUp::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget) { m_subWidget->CalculateMinSize(); - coord tmpSize = m_subWidget->GetMinSize(); + coord2D_ts tmpSize = m_subWidget->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; } @@ -164,8 +164,8 @@ void ewol::PopUp::OnRegenerateDisplay(void) BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); // set the area in white ... if (NULL != m_subWidget) { - coord tmpSize = m_subWidget->GetSize(); - coord tmpOrigin = m_subWidget->GetOrigin(); + coord2D_ts tmpSize = m_subWidget->GetSize(); + coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); BGOObjects->SetColor(m_colorBackGroung); BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); } @@ -178,8 +178,8 @@ void ewol::PopUp::OnRegenerateDisplay(void) bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { if (NULL != m_subWidget) { - coord tmpSize = m_subWidget->GetSize(); - coord tmpOrigin = m_subWidget->GetOrigin(); + coord2D_ts tmpSize = m_subWidget->GetSize(); + coord2D_ts tmpOrigin = m_subWidget->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { diff --git a/Sources/libewol/ewol/widget/SizerHori.cpp b/Sources/libewol/ewol/widget/SizerHori.cpp index 6ecceb72..1a728f50 100644 --- a/Sources/libewol/ewol/widget/SizerHori.cpp +++ b/Sources/libewol/ewol/widget/SizerHori.cpp @@ -53,7 +53,7 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iiiGetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); unexpendableSize += tmpSize.x; if (false == m_subWidget[iii]->CanExpentX()) { nbWidgetFixedSize++; @@ -70,12 +70,12 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl sizeToAddAtEveryOne=0; } } - coord tmpOrigin; + coord2D_ts tmpOrigin; tmpOrigin.x = 0; tmpOrigin.y = 0; for (int32_t iii=0; iiiGetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -110,7 +110,7 @@ bool ewol::SizerHori::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_userExpendY = true; } - coord tmpSize = m_subWidget[iii]->GetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); m_minSize.x += tmpSize.x; if (tmpSize.y>m_minSize.y) { m_minSize.y = tmpSize.y; @@ -239,8 +239,8 @@ bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, { for (int32_t iii=0; iiiGetSize(); - coord tmpOrigin = m_subWidget[iii]->GetOrigin(); + coord2D_ts tmpSize = m_subWidget[iii]->GetSize(); + coord2D_ts tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { diff --git a/Sources/libewol/ewol/widget/SizerVert.cpp b/Sources/libewol/ewol/widget/SizerVert.cpp index a28df76b..1e8ca211 100644 --- a/Sources/libewol/ewol/widget/SizerVert.cpp +++ b/Sources/libewol/ewol/widget/SizerVert.cpp @@ -54,7 +54,7 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl int32_t nbWidgetNotFixedSize=0; for (int32_t iii=0; iiiGetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); unexpendableSize += tmpSize.y; if (false == m_subWidget[iii]->CanExpentY()) { nbWidgetFixedSize++; @@ -72,12 +72,12 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl sizeToAddAtEveryOne=0; } } - coord tmpOrigin; + coord2D_ts tmpOrigin; tmpOrigin.x = 0; tmpOrigin.y = 0; for (int32_t iii=0; iiiGetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); // Set the origin : //EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")"); m_subWidget[iii]->SetOrigin(tmpOrigin.x, tmpOrigin.y); @@ -112,7 +112,7 @@ bool ewol::SizerVert::CalculateMinSize(void) if (true == m_subWidget[iii]->CanExpentY()) { m_userExpendY = true; } - coord tmpSize = m_subWidget[iii]->GetMinSize(); + coord2D_ts tmpSize = m_subWidget[iii]->GetMinSize(); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); m_minSize.y += tmpSize.y; if (tmpSize.x>m_minSize.x) { @@ -239,8 +239,8 @@ bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, { for (int32_t iii=0; iiiGetSize(); - coord tmpOrigin = m_subWidget[iii]->GetOrigin(); + coord2D_ts tmpSize = m_subWidget[iii]->GetSize(); + coord2D_ts tmpOrigin = m_subWidget[iii]->GetOrigin(); if( (tmpOrigin.x <= x && tmpOrigin.x + tmpSize.x >= x) && (tmpOrigin.y <= y && tmpOrigin.y + tmpSize.y >= y) ) { diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.h b/Sources/libewol/ewol/widget/WidgetScrolled.h index ee6401b6..0cfb51bc 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.h +++ b/Sources/libewol/ewol/widget/WidgetScrolled.h @@ -44,11 +44,11 @@ namespace ewol { class WidgetScrooled : virtual public ewol::Widget { protected: - coord m_originScrooled; - coord m_maxSize; + coord2D_ts m_originScrooled; + coord2D_ts m_maxSize; private: etkFloat_t m_pixelScrolling; - coord m_highSpeedStartPos; + coord2D_ts m_highSpeedStartPos; highSpeedMode_te m_highSpeedMode; public: WidgetScrooled(void); diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp index f26155d6..61500b7e 100644 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp @@ -62,7 +62,10 @@ ewol::Keyboard::Keyboard(void) ewol::Keyboard::~Keyboard(void) { - + if (NULL != m_subWidget) { + ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); + m_subWidget = NULL; + } } #define ADD_BUTTON(upperWidget,widget,text,event) do { \ @@ -231,7 +234,7 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable m_size.y = availlableY; if (NULL != m_subWidget) { - coord subWidgetSize; + coord2D_ts subWidgetSize; subWidgetSize = m_subWidget->GetMinSize(); if (true == m_subWidget->CanExpentX()) { subWidgetSize.x = m_size.x; @@ -243,7 +246,7 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable subWidgetSize.x = (int32_t)subWidgetSize.x; subWidgetSize.y = (int32_t)subWidgetSize.y; - m_subWidget->SetOrigin(m_origin.x, m_origin.y); + m_subWidget->SetOrigin(0, 0); m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y); } MarkToReedraw(); @@ -259,7 +262,7 @@ bool ewol::Keyboard::CalculateMinSize(void) m_minSize.y = 50.0; if (NULL != m_subWidget) { m_subWidget->CalculateMinSize(); - coord tmpSize = m_subWidget->GetMinSize(); + coord2D_ts tmpSize = m_subWidget->GetMinSize(); m_minSize.x = tmpSize.x; m_minSize.y = tmpSize.y; }