X11: manage more than 3 mouse boutton. Widget: Manage the event on multiple buttons...

This commit is contained in:
Edouard Dupin 2011-10-27 13:58:45 +02:00
parent 9b5d0d336c
commit bcfffb599f
3 changed files with 34 additions and 29 deletions

View File

@ -434,13 +434,8 @@ namespace guiAbstraction {
break; break;
case ButtonPress: case ButtonPress:
{ {
int32_t btId = 0; int32_t btId = event.xbutton.button;
//EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonPress\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")"); //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")");
if ( event.xbutton.button & Button2 ) {
btId = 2;
} else if (event.xbutton.button & Button1) {
btId = 1;
}
// Send Down message // Send Down message
m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOWN, (double)event.xbutton.x, (double)event.xbutton.y); m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_DOWN, (double)event.xbutton.x, (double)event.xbutton.y);
// Check double or triple click event ... // Check double or triple click event ...
@ -468,13 +463,9 @@ namespace guiAbstraction {
break; break;
case ButtonRelease: case ButtonRelease:
{ {
int32_t btId = 0; int32_t btId = event.xbutton.button;
//EWOL_DEBUG("X11 event : " << event.type << " = \"ButtonRelease\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")");
if(event.xbutton.button & Button2) { //EWOL_DEBUG("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (double)event.xbutton.x << "," << (double)event.xbutton.y << ")");
btId = 2;
} else if (event.xbutton.button & Button1) {
btId = 1;
}
// send Up event ... // send Up event ...
m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_UP, (double)event.xbutton.x, (double)event.xbutton.y); m_uniqueWindows->GenEventInput(btId, ewol::EVENT_INPUT_TYPE_UP, (double)event.xbutton.x, (double)event.xbutton.y);

View File

@ -62,13 +62,7 @@ bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, d
&& m_inputEvent[iii].area.origin.x + m_inputEvent[iii].area.size.x > x && m_inputEvent[iii].area.origin.x + m_inputEvent[iii].area.size.x > x
&& m_inputEvent[iii].area.origin.y + m_inputEvent[iii].area.size.y > y ) && m_inputEvent[iii].area.origin.y + m_inputEvent[iii].area.size.y > y )
{ {
// TODO : What is the flags for ??? how can we use it... if( (m_inputEvent[iii].area.flags & (1<<(IdInput-1)) )
if( ( ( (FLAG_EVENT_INPUT_1 & m_inputEvent[iii].area.flags) && 1 == IdInput )
|| ( (FLAG_EVENT_INPUT_2 & m_inputEvent[iii].area.flags) && 2 == IdInput)
|| ( (FLAG_EVENT_INPUT_3 & m_inputEvent[iii].area.flags) && 3 == IdInput)
|| ( (FLAG_EVENT_INPUT_4 & m_inputEvent[iii].area.flags) && 4 == IdInput)
|| ( (FLAG_EVENT_INPUT_5 & m_inputEvent[iii].area.flags) && 5 == IdInput)
)
&& ( ( (FLAG_EVENT_INPUT_MOTION & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_MOVE == typeEvent) && ( ( (FLAG_EVENT_INPUT_MOTION & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_MOVE == typeEvent)
|| ( (FLAG_EVENT_INPUT_ENTER & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_ENTER == typeEvent) || ( (FLAG_EVENT_INPUT_ENTER & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_ENTER == typeEvent)
|| ( (FLAG_EVENT_INPUT_LEAVE & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_LEAVE == typeEvent) || ( (FLAG_EVENT_INPUT_LEAVE & m_inputEvent[iii].area.flags) && EVENT_INPUT_TYPE_LEAVE == typeEvent)

View File

@ -69,16 +69,36 @@ namespace ewol {
FLAG_EVENT_INPUT_3 = 1 << 2, FLAG_EVENT_INPUT_3 = 1 << 2,
FLAG_EVENT_INPUT_4 = 1 << 3, FLAG_EVENT_INPUT_4 = 1 << 3,
FLAG_EVENT_INPUT_5 = 1 << 4, FLAG_EVENT_INPUT_5 = 1 << 4,
FLAG_EVENT_INPUT_MOTION = 1 << 5, FLAG_EVENT_INPUT_6 = 1 << 5,
FLAG_EVENT_INPUT_ENTER = 1 << 6, FLAG_EVENT_INPUT_7 = 1 << 6,
FLAG_EVENT_INPUT_LEAVE = 1 << 7, FLAG_EVENT_INPUT_8 = 1 << 7,
FLAG_EVENT_INPUT_DOWN = 1 << 8, FLAG_EVENT_INPUT_9 = 1 << 8,
FLAG_EVENT_INPUT_UP = 1 << 9, FLAG_EVENT_INPUT_10 = 1 << 9,
FLAG_EVENT_INPUT_CLICKED = 1 << 10, FLAG_EVENT_INPUT_11 = 1 << 10,
FLAG_EVENT_INPUT_CLICKED_DOUBLE = 1 << 11, FLAG_EVENT_INPUT_12 = 1 << 11,
FLAG_EVENT_INPUT_CLICKED_TRIPLE = 1 << 12, FLAG_EVENT_INPUT_13 = 1 << 12,
FLAG_EVENT_INPUT_14 = 1 << 13,
FLAG_EVENT_INPUT_15 = 1 << 14,
FLAG_EVENT_INPUT_16 = 1 << 15,
FLAG_EVENT_INPUT_17 = 1 << 16,
FLAG_EVENT_INPUT_MOTION = 1 << 20,
FLAG_EVENT_INPUT_ENTER = 1 << 21,
FLAG_EVENT_INPUT_LEAVE = 1 << 21,
FLAG_EVENT_INPUT_DOWN = 1 << 23,
FLAG_EVENT_INPUT_UP = 1 << 24,
FLAG_EVENT_INPUT_CLICKED = 1 << 25,
FLAG_EVENT_INPUT_CLICKED_DOUBLE = 1 << 26,
FLAG_EVENT_INPUT_CLICKED_TRIPLE = 1 << 27,
}; };
#define FLAG_EVENT_INPUT_BT_LEFT (FLAG_EVENT_INPUT_1)
#define FLAG_EVENT_INPUT_BT_CENTER (FLAG_EVENT_INPUT_2)
#define FLAG_EVENT_INPUT_BT_RIGHT (FLAG_EVENT_INPUT_3)
#define FLAG_EVENT_INPUT_BT_SCROOL_UP (FLAG_EVENT_INPUT_4)
#define FLAG_EVENT_INPUT_BT_SCROOL_DOWN (FLAG_EVENT_INPUT_5)
#define UTF8_MAX_SIZE (8) #define UTF8_MAX_SIZE (8)
#define EWOL_EVENT_AREA (0) #define EWOL_EVENT_AREA (0)
#define EWOL_EVENT_SHORTCUT (1) #define EWOL_EVENT_SHORTCUT (1)