rework x11 envent when move : generate event with the ID of input ....

This commit is contained in:
Edouard Dupin 2011-12-09 13:17:14 +01:00
parent 0dc3241a72
commit fb6f1e0703
6 changed files with 55 additions and 39 deletions

View File

@ -49,7 +49,7 @@ DEFAULT_PLATFORM=X11
# default platform can be overridden
PLATFORM?=$(DEFAULT_PLATFORM)
DATA_MODE=MEMORY
#DATA_MODE=MEMORY
ifeq ($(PLATFORM), X11)
CXXFILES += base/guiX11.cpp

View File

@ -64,6 +64,12 @@ static long _getTime(void)
void Draw(void);
#define MAX_INPUT (3)
etkFloat_t inputX[MAX_INPUT] = {0.0, 0.0, 0.0}
etkFloat_t inputY[MAX_INPUT] = {0.0, 0.0, 0.0}
bool inputIsPressed[MAX_INPUT] = {false, false, false};
extern "C"
{
@ -88,6 +94,7 @@ extern "C"
ewol::TextureOGLContext(true);
if (NULL != m_uniqueWindows) {
m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
m_uniqueWindows->SetOrigin(0.0, 0.0);
}
}
@ -123,8 +130,8 @@ extern "C"
//appMove(x,y);
if(NULL != m_uniqueWindows) {
m_uniqueWindows->GenEventInput(ewol::FLAG_EVENT_INPUT_1, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)x, (etkFloat_t)y);
m_uniqueWindows->GenEventInput(ewol::FLAG_EVENT_INPUT_1 | ewol::FLAG_EVENT_INPUT_CLICKED, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
m_uniqueWindows->GenEventInput(ewol::FLAG_EVENT_INPUT_1, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)x, (etkFloat_t)y);
m_uniqueWindows->GenEventInput(ewol::FLAG_EVENT_INPUT_1 | ewol::FLAG_EVENT_INPUT_CLICKED, ewol::EVENT_INPUT_TYPE_SINGLE, (etkFloat_t)x, (etkFloat_t)y);
//m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
}
}

View File

@ -501,7 +501,7 @@ namespace guiAbstraction {
m_moveMode = false;
m_resizeMode = false;
int32_t btId = event.xbutton.button;
//EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
// Send Down message
m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOWN, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y);
// Check double or triple click event ...
@ -532,7 +532,7 @@ namespace guiAbstraction {
m_moveMode = false;
m_resizeMode = false;
int32_t btId = event.xbutton.button;
//EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
// send Up event ...
m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_UP, (etkFloat_t)event.xbutton.x, (etkFloat_t)event.xbutton.y);
@ -627,8 +627,19 @@ namespace guiAbstraction {
//EWOL_DEBUG("Change POS : (" << (m_startY - m_screenOffsetX) << "," << (m_startY - m_screenOffsetY) << ") ==> (" << newPosX << "," << newPosY << ")");
this->ChangePos(newPosX, newPosY);
} else {
//EWOL_DEBUG("X11 event : " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
// For compatibility of the Android system :
bool findOne = false;
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) {
EWOL_DEBUG("X11 event: bt=" << iii+1 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
m_uniqueWindows->GenEventInput(iii+1, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
findOne = true;
}
}
if (false == findOne) {
EWOL_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << (etkFloat_t)event.xmotion.x << "," << (etkFloat_t)event.xmotion.y << ")");
m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, (etkFloat_t)event.xmotion.x, (etkFloat_t)event.xmotion.y);
}
}
break;
case LeaveNotify:
@ -715,6 +726,13 @@ namespace guiAbstraction {
Window fromroot, tmpwin;
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
};
void ForceRedrawAll(void)
{
if (NULL != m_uniqueWindows) {
m_uniqueWindows->CalculateSize((etkFloat_t)m_width, (etkFloat_t)m_height);
}
};
private:
bool m_resizeMode;
@ -881,6 +899,15 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
}
}
void guiAbstraction::ForceRedrawAll(void)
{
if (true == guiAbstractionIsInit) {
myX11Access->ForceRedrawAll();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
#include <ewol/ewol.h>

View File

@ -158,9 +158,9 @@ bool etk::File::operator!= (const etk::File &etkF) const
}
etk::String baseFolderData = "./";
etk::String baseFolderDataUser = "~/.tmp/userData";
etk::String baseFolderCache = "~/.tmp/cache";
etk::String baseFolderData = "";
etk::String baseFolderDataUser = "~/.tmp/userData/";
etk::String baseFolderCache = "~/.tmp/cache/";
// for specific device contraint :
void etk::SetBaseFolderData(const char * folder)
{
@ -239,7 +239,6 @@ void etk::File::SetCompleateName(etk::String &newFilename, etk::FileType_te type
#else
etk::String tmpFilename = destFilename;
destFilename = baseFolderData;
destFilename += '/';
destFilename += tmpFilename;
#endif
}
@ -251,7 +250,6 @@ void etk::File::SetCompleateName(etk::String &newFilename, etk::FileType_te type
#endif
etk::String tmpFilename = destFilename;
destFilename = baseFolderDataUser;
destFilename += '/';
destFilename += tmpFilename;
}
needUnpack = true;
@ -263,7 +261,6 @@ void etk::File::SetCompleateName(etk::String &newFilename, etk::FileType_te type
#endif
etk::String tmpFilename = destFilename;
destFilename = baseFolderCache;
destFilename += '/';
destFilename += tmpFilename;
}
needUnpack = true;
@ -581,7 +578,12 @@ bool etk::File::fSeek(long int offset, int origin)
return false;
}
#endif
return fseek(m_PointerFile, offset, origin);
fseek(m_PointerFile, offset, origin);
if(ferror(m_PointerFile)) {
return false;
} else {
return true;
}
}

View File

@ -378,7 +378,7 @@ void ewol::DrawText(int32_t fontID,
char * tmpVal = (char*)utf8String;
fontTextureId = s_listLoadedFonts[fontID]->GetOglId();
EWOL_DEBUG("**************** plop2 " << fontTextureId);
//EWOL_DEBUG("**************** plop2 " << fontTextureId);
int32_t size = s_listLoadedFonts[fontID]->GetHeight();
etkFloat_t posDrawX = drawPosition.x;

View File

@ -136,15 +136,11 @@ void ewol::Test::OnRegenerateDisplay(void)
tmpOObjects->CirclePart(150, 60, 60, 2, 45, 180);
AddOObject(tmpOObjects, "BouttonDecoration");
//tmpOObjects = new ewol::OObject2DColored;
//ewol::theme::Generate(0, 0, *tmpOObjects, 50, 50, m_size.x*0.75, m_size.y*0.75);
//AddOObject(tmpOObjects, "themeObject");
/*
tmpOObjects = new ewol::OObject2DColored;
ewol::theme::Generate(0, 0, *tmpOObjects, 50, 50, m_size.x*0.75, m_size.y*0.75);
AddOObject(tmpOObjects, "themeObject");
*/
// Regenerate the event Area:
EventAreaRemoveAll();
@ -155,22 +151,6 @@ void ewol::Test::OnRegenerateDisplay(void)
size.x = m_size.x-6;
size.y = m_size.y-6;
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventTestPressed);
//tmpOObjects->SetColor(1.0, 0.0, 0.0, 1.0);
//tmpOObjects->Circle(100, 100, 100, 35);
/*
tmpOObjects->SetPoint(-20, -20);
tmpOObjects->SetPoint(50, 50);
tmpOObjects->SetPoint(-20, 100);
*/
/*
tmpOObjects->SetPoint(20, -20);
tmpOObjects->SetPoint(50, 50);
tmpOObjects->SetPoint(-20, 100);
AddOObject(tmpOObjects, "BouttonDecoration");
*/
}
bool ewol::Test::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)