Some widget corection and correct the multiple event when a new layer arrive in a pop-up apear
This commit is contained in:
parent
af4d77e5bb
commit
f2b777f3c0
@ -60,14 +60,18 @@ void ewol::clipBoard::UnInit(void)
|
||||
void ewol::clipBoard::Set(uint8_t clipboardID, etk::UString &data)
|
||||
{
|
||||
// check if ID is correct
|
||||
if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
|
||||
EWOL_WARNING("request ClickBoard id error");
|
||||
} else if(0 == data.Size()) {
|
||||
if(0 == data.Size()) {
|
||||
EWOL_INFO("request a copy of nothing");
|
||||
return;
|
||||
} else if (ewol::clipBoard::CLIPBOARD_STD == clipboardID) {
|
||||
guiAbstraction::ClipBoardSet(data, guiAbstraction::CLIPBOARD_MODE_STD);
|
||||
return;
|
||||
} else if (ewol::clipBoard::CLIPBOARD_SELECTION == clipboardID) {
|
||||
guiAbstraction::ClipBoardSet(data, guiAbstraction::CLIPBOARD_MODE_PRIMARY);
|
||||
return;
|
||||
}else if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
|
||||
EWOL_WARNING("request ClickBoard id error");
|
||||
return;
|
||||
}
|
||||
// Copy datas ...
|
||||
mesCopy[clipboardID] = data;
|
||||
@ -75,14 +79,15 @@ void ewol::clipBoard::Set(uint8_t clipboardID, etk::UString &data)
|
||||
|
||||
void ewol::clipBoard::Get(uint8_t clipboardID, etk::UString &data)
|
||||
{
|
||||
if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
|
||||
EWOL_WARNING("request ClickBoard id error");
|
||||
} else if (ewol::clipBoard::CLIPBOARD_STD == clipboardID) {
|
||||
if (ewol::clipBoard::CLIPBOARD_STD == clipboardID) {
|
||||
guiAbstraction::ClipBoardGet(data, guiAbstraction::CLIPBOARD_MODE_STD);
|
||||
return;
|
||||
} else if (ewol::clipBoard::CLIPBOARD_SELECTION == clipboardID) {
|
||||
guiAbstraction::ClipBoardGet(data, guiAbstraction::CLIPBOARD_MODE_PRIMARY);
|
||||
return;
|
||||
} else if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
|
||||
EWOL_WARNING("request ClickBoard id error");
|
||||
return;
|
||||
}
|
||||
// Copy datas ...
|
||||
data = mesCopy[clipboardID];
|
||||
|
@ -33,7 +33,7 @@ namespace ewol {
|
||||
namespace clipBoard
|
||||
{
|
||||
enum {
|
||||
CLIPBOARD_STD,
|
||||
CLIPBOARD_0,
|
||||
CLIPBOARD_1,
|
||||
CLIPBOARD_2,
|
||||
CLIPBOARD_3,
|
||||
@ -43,8 +43,9 @@ namespace ewol {
|
||||
CLIPBOARD_7,
|
||||
CLIPBOARD_8,
|
||||
CLIPBOARD_9,
|
||||
CLIPBOARD_SELECTION,
|
||||
TOTAL_OF_CLICKBOARD,
|
||||
CLIPBOARD_STD,
|
||||
CLIPBOARD_SELECTION,
|
||||
};
|
||||
void Init(void);
|
||||
void UnInit(void);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/importgl.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/base/eventInputManagement.h>
|
||||
|
||||
|
||||
|
||||
@ -270,6 +271,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||
// Regenerate the size calculation :
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
m_needFlipFlop = true;
|
||||
ewol::eventInput::NewLayerSet();
|
||||
}
|
||||
|
||||
void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode)
|
||||
|
@ -35,21 +35,6 @@ typedef struct {
|
||||
#define MAX_MANAGE_INPUT (10)
|
||||
InputPoperty_ts eventInputSaved[MAX_MANAGE_INPUT];
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::eventInput::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
if (eventInputSaved[iii].curentWidgetEvent == removeObject) {
|
||||
eventInputSaved[iii].curentWidgetEvent = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanInputElement(int32_t idInput)
|
||||
{
|
||||
eventInputSaved[idInput].isUsed = false;
|
||||
@ -67,6 +52,36 @@ static void CleanInputElement(int32_t idInput)
|
||||
eventInputSaved[idInput].nbClickEvent = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inform object that an other object is removed ...
|
||||
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::eventInput::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
if (eventInputSaved[iii].curentWidgetEvent == removeObject) {
|
||||
// remove the property of this input ...
|
||||
CleanInputElement(iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief a new layer on the windows is set ==> might remove all the property of the current element ...
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::eventInput::NewLayerSet(void)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
// remove the property of this input ...
|
||||
CleanInputElement(iii);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ewol::eventInput::Init(void)
|
||||
{
|
||||
EWOL_INFO("Init");
|
||||
|
@ -21,6 +21,12 @@ namespace ewol
|
||||
* @return ---
|
||||
*/
|
||||
void OnObjectRemove(ewol::EObject * removeObject);
|
||||
/**
|
||||
* @brief a new layer on the windows is set ==> might remove all the property of the current element ...
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void NewLayerSet(void);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -74,6 +74,8 @@ int64_t m_previousTime = 0;
|
||||
bool m_previousDouble = false;
|
||||
|
||||
|
||||
static etk::UString l_clipBoardPrimary(""); // local copy of the selection
|
||||
static etk::UString l_clipBoardStd(""); // local copy of the clipboard
|
||||
|
||||
|
||||
static etkFloat_t gTriangleVertices[] = { 0.0f, 0.0f, 200.0f, 0.0f, 0.0f, 200.0f };
|
||||
@ -191,6 +193,52 @@ void ewol::SetTitle(etk::UString title)
|
||||
// can not set the title in Android ...
|
||||
}
|
||||
|
||||
// ClipBoard AREA :
|
||||
void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
|
||||
{
|
||||
EWOL_INFO("Request Get of a clipboard : " << mode << " size=" << newData.Size() );
|
||||
newData = "";
|
||||
switch (mode)
|
||||
{
|
||||
case CLIPBOARD_MODE_PRIMARY:
|
||||
// get our own buffer ... (no current selectin on Android ...
|
||||
newData = l_clipBoardPrimary;
|
||||
break;
|
||||
case CLIPBOARD_MODE_STD:
|
||||
EWOL_TODO("implement on Android");
|
||||
// get our own buffer ...
|
||||
newData = l_clipBoardStd;
|
||||
break;
|
||||
default:
|
||||
EWOL_ERROR("Request an unknow ClipBoard ...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::ClipBoardSet(etk::UString &newData, clipBoardMode_te mode)
|
||||
{
|
||||
EWOL_VERBOSE("Request set of a clipboard : " << mode << " size=" << newData.Size() );
|
||||
switch (mode)
|
||||
{
|
||||
case CLIPBOARD_MODE_PRIMARY:
|
||||
if (newData.Size() > 0) {
|
||||
// copy it ...
|
||||
l_clipBoardPrimary = newData;
|
||||
}
|
||||
break;
|
||||
case CLIPBOARD_MODE_STD:
|
||||
if (newData.Size() > 0) {
|
||||
// copy it ...
|
||||
l_clipBoardStd = newData;
|
||||
// Request the clipBoard :
|
||||
EWOL_TODO("implement on Android copy the copy data");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
EWOL_ERROR("Request an unknow ClipBoard ...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "guiAbstraction"
|
||||
|
@ -127,12 +127,12 @@ int32_t offsetMoveClickedDouble = 20;
|
||||
bool inputIsPressed[20];
|
||||
|
||||
// internal copy of the clipBoard ...
|
||||
static ewol::simpleMsg::simpleMsg_ts l_clipboardMessage;
|
||||
static bool l_clipBoardRequestPrimary = false;
|
||||
static bool l_clipBoardOwnerPrimary = false;
|
||||
static etk::UString l_clipBoardPrimary("");
|
||||
static bool l_clipBoardOwnerStd = false;
|
||||
static etk::UString l_clipBoardStd("");
|
||||
static ewol::simpleMsg::simpleMsg_ts l_clipboardMessage; /// message to prevent the other thread that we have receive the requested data
|
||||
static bool l_clipBoardRequestPrimary = false; // if false : request the copy/past buffer, if true : request current selection
|
||||
static bool l_clipBoardOwnerPrimary = false; // we are the owner of the current selection
|
||||
static etk::UString l_clipBoardPrimary(""); // local copy of the selection
|
||||
static bool l_clipBoardOwnerStd = false; // we are the owner of the current copy buffer
|
||||
static etk::UString l_clipBoardStd(""); // local copy of the clipboard
|
||||
// Atom access...
|
||||
static Atom XAtomeSelection = 0;
|
||||
static Atom XAtomeClipBoard = 0;
|
||||
@ -525,10 +525,12 @@ void X11_Run(void)
|
||||
);
|
||||
if (true == l_clipBoardRequestPrimary) {
|
||||
l_clipBoardPrimary = (char*)buf;
|
||||
// inform that we have receive the data
|
||||
ewol::simpleMsg::SendMessage(l_clipboardMessage, 4);
|
||||
EWOL_VERBOSE(" ==> data : " << l_clipBoardPrimary);
|
||||
} else {
|
||||
l_clipBoardStd = (char*)buf;
|
||||
// inform that we have receive the data
|
||||
ewol::simpleMsg::SendMessage(l_clipboardMessage, 2);
|
||||
EWOL_VERBOSE(" ==> data : " << l_clipBoardStd);
|
||||
}
|
||||
@ -914,6 +916,9 @@ void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
|
||||
case CLIPBOARD_MODE_PRIMARY:
|
||||
if (false == l_clipBoardOwnerPrimary) {
|
||||
l_clipBoardRequestPrimary = true;
|
||||
// clear old request ..
|
||||
ewol::simpleMsg::Clear(l_clipboardMessage);
|
||||
// Generate a request on X11
|
||||
XConvertSelection(m_display,
|
||||
XAtomeSelection,// atom,
|
||||
XAtomeTargetStringUTF8, // type?
|
||||
@ -932,6 +937,9 @@ void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
|
||||
case CLIPBOARD_MODE_STD:
|
||||
if (false == l_clipBoardOwnerStd) {
|
||||
l_clipBoardRequestPrimary = false;
|
||||
// clear old request ..
|
||||
ewol::simpleMsg::Clear(l_clipboardMessage);
|
||||
// Generate a request on X11
|
||||
XConvertSelection(m_display,
|
||||
XAtomeClipBoard,// atom,
|
||||
XAtomeTargetStringUTF8, // type?
|
||||
@ -985,29 +993,6 @@ void guiAbstraction::ClipBoardSet(etk::UString &newData, clipBoardMode_te mode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
void ewol::clipboard::Copy(etk::UString newData, int32_t bufferId)
|
||||
{
|
||||
char * tmpPointer = newData.Utf8Data();
|
||||
|
||||
Atom selection = XA_PRIMARY;
|
||||
//All your selection are belong to us...
|
||||
XSetSelectionOwner(m_display, selection, WindowHandle, CurrentTime);
|
||||
|
||||
EWOL_DEBUG("--------------------------------------------------------------");
|
||||
if (BadAlloc == XStoreBuffer(m_display, tmpPointer, strlen(tmpPointer), bufferId)) {
|
||||
EWOL_ERROR("Copy error");
|
||||
} else {
|
||||
EWOL_DEBUG("Copy well done : \"" << tmpPointer << "\"=" << strlen(tmpPointer));
|
||||
}
|
||||
if (BadAlloc == XStoreBytes(m_display, tmpPointer, strlen(tmpPointer))) {
|
||||
EWOL_ERROR("Copy error");
|
||||
} else {
|
||||
EWOL_DEBUG("Copy well done");
|
||||
}
|
||||
EWOL_DEBUG("--------------------------------------------------------------");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -262,4 +262,21 @@ void ewol::simpleMsg::SendMessage(ewol::simpleMsg::simpleMsg_ts& handle, uint32_
|
||||
}
|
||||
|
||||
|
||||
void ewol::simpleMsg::Clear(simpleMsg_ts& handle)
|
||||
{
|
||||
if (false == handle.isInit) {
|
||||
return;
|
||||
}
|
||||
pthread_mutex_lock(&handle.mutex);
|
||||
if (handle.messageValue !=0) {
|
||||
struct timespec timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_nsec = 0;
|
||||
pthread_cond_timedwait(&handle.condition, &handle.mutex, &timeout);
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&handle.mutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -79,6 +79,7 @@ namespace ewol {
|
||||
void UnInit( simpleMsg_ts& handle);
|
||||
uint32_t WaitingMessage(simpleMsg_ts& handle, int32_t timeOut=0);
|
||||
void SendMessage( simpleMsg_ts& handle, uint32_t message);
|
||||
void Clear( simpleMsg_ts& handle);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -165,7 +165,8 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
clipping_ts drawClipping;
|
||||
drawClipping.x = 0;
|
||||
drawClipping.y = 0;
|
||||
drawClipping.w = m_size.x - (boxSize+5);
|
||||
// note : pb on the clipping properties ...
|
||||
drawClipping.w = m_size.x;// - (boxSize+5);
|
||||
drawClipping.h = m_size.y;
|
||||
tmpText->Text(textPos, drawClipping, m_label);
|
||||
|
||||
|
@ -45,6 +45,11 @@ ewol::PopUp::PopUp(void)
|
||||
m_colorEmptyArea.blue = 0.0;
|
||||
m_colorEmptyArea.alpha = 0.50;
|
||||
|
||||
m_colorBorder.red = 0.0;
|
||||
m_colorBorder.green = 0.0;
|
||||
m_colorBorder.blue = 0.0;
|
||||
m_colorBorder.alpha = 0.50;
|
||||
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_subWidget[iii] = 0;
|
||||
}
|
||||
@ -196,7 +201,7 @@ void ewol::PopUp::OnDraw(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define BORDER_SIZE_TMP (4)
|
||||
void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
@ -212,6 +217,8 @@ void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
BGOObjects->SetColor(m_colorBorder);
|
||||
BGOObjects->Rectangle(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP, tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP);
|
||||
BGOObjects->SetColor(m_colorBackGroung);
|
||||
BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y);
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ namespace ewol {
|
||||
void SetDisplayRatio(etkFloat_t ratio);
|
||||
private:
|
||||
color_ts m_colorBackGroung;
|
||||
color_ts m_colorBorder;
|
||||
color_ts m_colorEmptyArea;
|
||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||
etkFloat_t m_displayRatio;
|
||||
|
Loading…
x
Reference in New Issue
Block a user