end of the simplification of the Gui abstraction interface
This commit is contained in:
parent
e177dd4db3
commit
58295c552b
@ -1 +1 @@
|
||||
Subproject commit 375af92e27d48c9d6678be26f11182477a36e77d
|
||||
Subproject commit 7d902650c3195ccd5e6d71daf0d7aa1908fa0fab
|
@ -45,13 +45,20 @@
|
||||
#define EVENT_DEBUG EWOL_VERBOSE
|
||||
//#define EVENT_DEBUG EWOL_DEBUG
|
||||
|
||||
// defined by the platform specific file :
|
||||
extern int32_t separateClickTime;
|
||||
extern int32_t offsetMoveClicked;
|
||||
extern int32_t offsetMoveClickedDouble;
|
||||
|
||||
|
||||
void ewol::eSystemInput::CalculateLimit(void)
|
||||
{
|
||||
m_eventInputLimit.sepatateTime = 300000; // µs
|
||||
m_eventInputLimit.DpiOffset = m_dpi*100;
|
||||
m_eventMouseLimit.sepatateTime = 30000; // µs
|
||||
m_eventMouseLimit.DpiOffset = (float)m_dpi*(float)0.1;
|
||||
}
|
||||
|
||||
void ewol::eSystemInput::SetDpi(int32_t newDPI)
|
||||
{
|
||||
m_dpi = newDPI;
|
||||
// recalculate the DPI system ...
|
||||
CalculateLimit();
|
||||
}
|
||||
|
||||
void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInput)
|
||||
{
|
||||
@ -80,13 +87,13 @@ void ewol::eSystemInput::CleanElement(InputPoperty_ts *eventTable, int32_t idInp
|
||||
void ewol::eSystemInput::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
if (eventInputSaved[iii].curentWidgetEvent == removeObject) {
|
||||
if (m_eventInputSaved[iii].curentWidgetEvent == removeObject) {
|
||||
// remove the property of this input ...
|
||||
CleanElement(eventInputSaved, iii);
|
||||
CleanElement(m_eventInputSaved, iii);
|
||||
}
|
||||
if (eventMouseSaved[iii].curentWidgetEvent == removeObject) {
|
||||
if (m_eventMouseSaved[iii].curentWidgetEvent == removeObject) {
|
||||
// remove the property of this input ...
|
||||
CleanElement(eventMouseSaved, iii);
|
||||
CleanElement(m_eventMouseSaved, iii);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,8 +107,8 @@ void ewol::eSystemInput::NewLayerSet(void)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
// remove the property of this input ...
|
||||
CleanElement(eventInputSaved, iii);
|
||||
CleanElement(eventMouseSaved, iii);
|
||||
CleanElement(m_eventInputSaved, iii);
|
||||
CleanElement(m_eventMouseSaved, iii);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,13 +116,14 @@ void ewol::eSystemInput::Reset(void)
|
||||
{
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
// remove the property of this input ...
|
||||
CleanElement(eventInputSaved, iii);
|
||||
CleanElement(eventMouseSaved, iii);
|
||||
CleanElement(m_eventInputSaved, iii);
|
||||
CleanElement(m_eventMouseSaved, iii);
|
||||
}
|
||||
}
|
||||
|
||||
ewol::eSystemInput::eSystemInput(void)
|
||||
{
|
||||
SetDpi(200);
|
||||
EWOL_INFO("Init");
|
||||
Reset();
|
||||
}
|
||||
@ -160,10 +168,10 @@ int32_t ewol::eSystemInput::localGetDestinationId(ewol::inputType_te type, ewol:
|
||||
if (type == ewol::INPUT_TYPE_FINGER) {
|
||||
int32_t lastMinimum = 0;
|
||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||
if (true==eventInputSaved[iii].isUsed) {
|
||||
if (eventInputSaved[iii].curentWidgetEvent == destWidget) {
|
||||
if (true==m_eventInputSaved[iii].isUsed) {
|
||||
if (m_eventInputSaved[iii].curentWidgetEvent == destWidget) {
|
||||
if (iii != realInputId) {
|
||||
lastMinimum = etk_max(lastMinimum, eventInputSaved[iii].destinationInputId);
|
||||
lastMinimum = etk_max(lastMinimum, m_eventInputSaved[iii].destinationInputId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,9 +189,9 @@ void ewol::eSystemInput::Motion(ewol::inputType_te type, int pointerID, Vector2D
|
||||
|
||||
InputPoperty_ts *eventTable = NULL;
|
||||
if (type == ewol::INPUT_TYPE_MOUSE) {
|
||||
eventTable = eventMouseSaved;
|
||||
eventTable = m_eventMouseSaved;
|
||||
} else if (type == ewol::INPUT_TYPE_FINGER) {
|
||||
eventTable = eventInputSaved;
|
||||
eventTable = m_eventInputSaved;
|
||||
} else {
|
||||
EWOL_ERROR("Unknown type of event");
|
||||
return;
|
||||
@ -264,10 +272,13 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
// convert position in Open-GL coordonates ...
|
||||
pos.y = ewol::GetCurrentHeight() - pos.y;
|
||||
InputPoperty_ts *eventTable = NULL;
|
||||
inputLimit_ts localLimit;
|
||||
if (type == ewol::INPUT_TYPE_MOUSE) {
|
||||
eventTable = eventMouseSaved;
|
||||
eventTable = m_eventMouseSaved;
|
||||
localLimit = m_eventMouseLimit;
|
||||
} else if (type == ewol::INPUT_TYPE_FINGER) {
|
||||
eventTable = eventInputSaved;
|
||||
eventTable = m_eventInputSaved;
|
||||
localLimit = m_eventInputLimit;
|
||||
} else {
|
||||
EWOL_ERROR("Unknown type of event");
|
||||
return;
|
||||
@ -285,10 +296,10 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
|
||||
if(true == eventTable[pointerID].isUsed) {
|
||||
// we have an event previously ... check delay between click and offset position
|
||||
if (currentTime - eventTable[pointerID].lastTimeEvent > separateClickTime) {
|
||||
if (currentTime - eventTable[pointerID].lastTimeEvent > localLimit.sepatateTime) {
|
||||
CleanElement(eventTable, pointerID);
|
||||
} else if( abs(eventTable[pointerID].downStart.x - pos.x) >= offsetMoveClicked
|
||||
|| abs(eventTable[pointerID].downStart.y - pos.y) >= offsetMoveClicked ){
|
||||
} else if( abs(eventTable[pointerID].downStart.x - pos.x) >= localLimit.DpiOffset
|
||||
|| abs(eventTable[pointerID].downStart.y - pos.y) >= localLimit.DpiOffset ){
|
||||
CleanElement(eventTable, pointerID);
|
||||
}
|
||||
}
|
||||
@ -338,8 +349,8 @@ void ewol::eSystemInput::State(ewol::inputType_te type, int pointerID, bool isDo
|
||||
EVENT_DEBUG("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
|
||||
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos);
|
||||
// generate event (single)
|
||||
if( abs(eventTable[pointerID].downStart.x - pos.x) < offsetMoveClicked
|
||||
&& abs(eventTable[pointerID].downStart.y - pos.y) < offsetMoveClicked ){
|
||||
if( abs(eventTable[pointerID].downStart.x - pos.x) < localLimit.DpiOffset
|
||||
&& abs(eventTable[pointerID].downStart.y - pos.y) < localLimit.DpiOffset ){
|
||||
// Save current position :
|
||||
eventTable[pointerID].downStart = pos;
|
||||
// save start time
|
||||
|
@ -46,13 +46,21 @@ namespace ewol
|
||||
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
|
||||
} InputPoperty_ts;
|
||||
|
||||
typedef struct {
|
||||
int32_t sepatateTime;
|
||||
int32_t DpiOffset;
|
||||
} inputLimit_ts;
|
||||
|
||||
class eSystemInput
|
||||
{
|
||||
private:
|
||||
int32_t m_dpi;
|
||||
inputLimit_ts m_eventInputLimit;
|
||||
inputLimit_ts m_eventMouseLimit;
|
||||
void CalculateLimit(void);
|
||||
#define MAX_MANAGE_INPUT (10)
|
||||
InputPoperty_ts eventInputSaved[MAX_MANAGE_INPUT];
|
||||
InputPoperty_ts eventMouseSaved[MAX_MANAGE_INPUT];
|
||||
InputPoperty_ts m_eventInputSaved[MAX_MANAGE_INPUT];
|
||||
InputPoperty_ts m_eventMouseSaved[MAX_MANAGE_INPUT];
|
||||
void CleanElement(InputPoperty_ts *eventTable, int32_t idInput);
|
||||
bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos);
|
||||
int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId);
|
||||
@ -60,6 +68,7 @@ namespace ewol
|
||||
eSystemInput(void);
|
||||
~eSystemInput(void);
|
||||
void Reset(void);
|
||||
void SetDpi(int32_t newDPI);
|
||||
|
||||
// note if id<0 ==> the it was finger event ...
|
||||
void Motion(ewol::inputType_te type, int pointerID, Vector2D<float> pos );
|
||||
|
@ -42,9 +42,6 @@
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "AndroidJNI"
|
||||
int32_t separateClickTime = 800000;
|
||||
int32_t offsetMoveClicked = 40000;
|
||||
int32_t offsetMoveClickedDouble = 300000;
|
||||
|
||||
int64_t guiInterface::GetTime(void)
|
||||
{
|
||||
@ -55,22 +52,6 @@ int64_t guiInterface::GetTime(void)
|
||||
}
|
||||
|
||||
|
||||
void Draw(void);
|
||||
#define OFFSET_MOVE_CLICKED (20)
|
||||
#define OFFSET_MOVE_CLICKED_DOUBLE (40)
|
||||
#undef SEPARATED_CLICK_TIME
|
||||
#define SEPARATED_CLICK_TIME (300)
|
||||
|
||||
//bool inputIsPressed[NB_MAX_INPUT];// = {false, false, false};
|
||||
int32_t m_previousBouttonId = -1;
|
||||
int32_t m_previousDown_x = -1;
|
||||
int32_t m_previousDown_y = -1;
|
||||
int32_t m_previous_x = -1;
|
||||
int32_t m_previous_y = -1;
|
||||
int64_t m_previousTime = 0;
|
||||
bool m_previousDouble = false;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the new title of the windows
|
||||
* @param title New desired title
|
||||
@ -150,7 +131,7 @@ void guiInterface::ClipBoardSet(ewol::clipBoard::clipboardListe_te clipboardID)
|
||||
|
||||
void guiInterface::Stop(void)
|
||||
{
|
||||
// TODo : send a message to the android system to stop ...
|
||||
// TODO : send a message to the android system to stop ...
|
||||
}
|
||||
|
||||
// java system to send message :
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file guiIPhone.cpp
|
||||
* @brief Gui abstraction layer (Sources)
|
||||
* @file guiIOs.cpp
|
||||
* @brief Gui abstraction layer for i-OS platform (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 20/10/2011
|
||||
* @par Project
|
||||
@ -22,25 +22,3 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <ewol/Debug.h>
|
||||
#include <base/guiIPhone.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "guiAbstraction"
|
||||
|
||||
void guiAbstraction::Init(int32_t argc, char *argv[])
|
||||
{
|
||||
EWOL_INFO("INIT for IPhone environement");
|
||||
}
|
||||
|
||||
void guiAbstraction::Run(void)
|
||||
{
|
||||
EWOL_INFO("Start Running");
|
||||
EWOL_INFO("Stop Running");
|
||||
}
|
||||
|
||||
void guiAbstraction::UnInit(void)
|
||||
{
|
||||
EWOL_INFO("UN-INIT for IPhone environement");
|
||||
}
|
||||
|
@ -46,11 +46,6 @@ int64_t guiInterface::GetTime(void)
|
||||
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
|
||||
}
|
||||
|
||||
|
||||
int32_t separateClickTime = 300000;
|
||||
int32_t offsetMoveClicked = 10000;
|
||||
int32_t offsetMoveClickedDouble = 20000;
|
||||
|
||||
bool inputIsPressed[20];
|
||||
|
||||
static eSystem::specialKey_ts guiKeyBoardMode;
|
||||
@ -134,6 +129,8 @@ void guiInterface::ChangePos(Vector2D<int32_t> pos)
|
||||
void guiInterface::GetAbsPos(Vector2D<int32_t>& pos)
|
||||
{
|
||||
// TODO : Later
|
||||
size.x = 0;
|
||||
size.y = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -249,8 +246,6 @@ int main(int argc, char *argv[])
|
||||
guiKeyBoardMode.verNum = false;
|
||||
guiKeyBoardMode.insert = false;
|
||||
|
||||
// start X11 thread ...
|
||||
// TODO : ...
|
||||
//start the basic thread :
|
||||
eSystem::Init();
|
||||
// get the icon file :
|
||||
@ -259,7 +254,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Run ...
|
||||
Windows_Run();
|
||||
// close X11 :
|
||||
// close windows system :
|
||||
guiInterface::Stop();
|
||||
// uninit ALL :
|
||||
eSystem::UnInit();
|
||||
|
@ -120,10 +120,6 @@ XVisualInfo * m_visual = NULL;
|
||||
bool m_doubleBuffered = 0;
|
||||
bool m_run = 0;
|
||||
|
||||
int32_t separateClickTime = 300000;
|
||||
int32_t offsetMoveClicked = 10000;
|
||||
int32_t offsetMoveClickedDouble = 20000;
|
||||
|
||||
bool inputIsPressed[20];
|
||||
|
||||
// internal copy of the clipBoard ...
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 01864817805c5a43c937753e569ebb15be4f71a5
|
||||
Subproject commit a20f0bacb64194ead87f219acccbd0a1165a94f2
|
@ -1 +1 @@
|
||||
Subproject commit fa4bf3927867e835c7d14d56602f007b39517ad9
|
||||
Subproject commit ff5881a51a76141535a0e2e45c5d47bc1730b1df
|
@ -1 +1 @@
|
||||
Subproject commit 8fadc04e607fccf3550a200545ffc008cfe2f811
|
||||
Subproject commit ceb0a9a5b73231278bb59923b5477cb128c1d432
|
@ -1 +1 @@
|
||||
Subproject commit 70c27fedadc92931598f52d34903d76078fd5ae3
|
||||
Subproject commit fc100697e315ac17c7fc6e3e4afa9e24e945ef7b
|
@ -1 +1 @@
|
||||
Subproject commit c45bed1333b3524fe62dfc2f093eeede80bd4477
|
||||
Subproject commit 29ed717922c583f058908cfabf9afa142c542b92
|
@ -1 +1 @@
|
||||
Subproject commit e1b5eb9833c6e0e40e7cf9d022d14e0bc7645192
|
||||
Subproject commit f00eaf59fd2b77170831ac0cfa66ec6aabd8abfc
|
@ -1 +1 @@
|
||||
Subproject commit 2e64a66b5f269c15cc2381d921419da68e1f5f3f
|
||||
Subproject commit bc39bbab0164b41379e7c1104bcda5a894b45db1
|
Loading…
x
Reference in New Issue
Block a user