[DEV] change the multiple event on keyboard

This commit is contained in:
Edouard DUPIN 2013-01-29 22:20:32 +01:00
parent e7503c8824
commit a05a5adccb
19 changed files with 272 additions and 212 deletions

View File

@ -149,7 +149,7 @@ void ewol::resource::ContextHasBeenDestroyed(void)
// internal generic keeper ...
static ewol::Resource* LocalKeep(etk::UString& filename)
static ewol::Resource* LocalKeep(const etk::UString& filename)
{
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << filename << "\"");
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
@ -179,7 +179,7 @@ static void LocalAdd(ewol::Resource* object)
}
// return the type of the resource ...
bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::TexturedFont*& object)
{
EWOL_VERBOSE("KEEP : TexturedFont : file : \"" << filename << "\"");
object = static_cast<ewol::TexturedFont*>(LocalKeep(filename));
@ -197,7 +197,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TexturedFont*& object)
}
bool ewol::resource::Keep(etk::UString& filename, ewol::FontBase*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::FontBase*& object)
{
EWOL_VERBOSE("KEEP : Font : file : \"" << filename << "\"");
object = static_cast<ewol::FontBase*>(LocalKeep(filename));
@ -214,7 +214,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::FontBase*& object)
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::Program*& object)
{
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
object = static_cast<ewol::Program*>(LocalKeep(filename));
@ -231,7 +231,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::Shader*& object)
{
EWOL_VERBOSE("KEEP : Simpleshader : file : \"" << filename << "\"");
object = static_cast<ewol::Shader*>(LocalKeep(filename));
@ -296,7 +296,7 @@ static int32_t nextP2(int32_t value)
return val;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, ivec2 size)
bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size)
{
ivec2 size2(nextP2(size.x()), nextP2(size.y()));
etk::UString TmpFilename = filename;
@ -320,7 +320,7 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::TextureFile*& object, iv
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::MeshObj*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::MeshObj*& object)
{
object = static_cast<ewol::MeshObj*>(LocalKeep(filename));
if (NULL != object) {
@ -348,7 +348,7 @@ bool ewol::resource::Keep(const etk::UString& accesMode, ewol::VirtualBufferObje
return true;
}
bool ewol::resource::Keep(etk::UString& filename, ewol::ConfigFile*& object)
bool ewol::resource::Keep(const etk::UString& filename, ewol::ConfigFile*& object)
{
EWOL_INFO("KEEP : SimpleConfig : file : \"" << filename << "\"");
object = static_cast<ewol::ConfigFile*>(LocalKeep(filename));

View File

@ -66,15 +66,15 @@ namespace ewol
* @note when you call the Keep function, you must call the Realease function ==> otherwise the resources will never be freed
* @note The resources with the same name are loaded only one time, a counter prevent multiple loading...
*/
bool Keep(etk::UString& filename, ewol::TexturedFont*& object);
bool Keep(etk::UString& filename, ewol::FontBase*& object);
bool Keep(etk::UString& filename, ewol::Program*& object);
bool Keep(etk::UString& filename, ewol::Shader*& object);
bool Keep(const etk::UString& filename, ewol::TexturedFont*& object);
bool Keep(const etk::UString& filename, ewol::FontBase*& object);
bool Keep(const etk::UString& filename, ewol::Program*& object);
bool Keep(const etk::UString& filename, ewol::Shader*& object);
bool Keep(ewol::Texture*& object); // no name needed here ...
bool Keep(etk::UString& filename, ewol::TextureFile*& object, ivec2 size);
bool Keep(const etk::UString& filename, ewol::TextureFile*& object, ivec2 size);
bool Keep(const etk::UString& accesMode, ewol::VirtualBufferObject*& object);
bool Keep(etk::UString& filename, ewol::MeshObj*& object);
bool Keep(etk::UString& filename, ewol::ConfigFile*& object);
bool Keep(const etk::UString& filename, ewol::MeshObj*& object);
bool Keep(const etk::UString& filename, ewol::ConfigFile*& object);
bool Keep(ewol::Colored3DObject*& object);
/**

View File

@ -88,6 +88,7 @@ class eSystemMessage {
// generic dimentions
vec2 dimention;
// keyboard events :
bool repeateKey; //!< special flag for the repeating key on the PC interface
bool stateIsDown;
uniChar_t keyboardChar;
ewol::keyEvent::keyboard_te keyboardMove;
@ -99,6 +100,7 @@ class eSystemMessage {
inputType(ewol::keyEvent::typeUnknow),
inputId(-1),
dimention(0,0),
repeateKey(false),
stateIsDown(false),
keyboardChar(0),
keyboardMove(ewol::keyEvent::keyboardUnknow)
@ -157,25 +159,33 @@ void ewolProcessEvents(void)
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardSpecial,
data.keyboardChar,
data.keyboardMove,
data.stateIsDown) ) {
// generate the direct event ...
if (data.TypeMessage == THREAD_KEYBORAD_KEY) {
if(true == data.stateIsDown) {
tmpWidget->OnEventKb(ewol::keyEvent::statusDown, data.keyboardChar);
} else {
tmpWidget->OnEventKb(ewol::keyEvent::statusUp, data.keyboardChar);
}
} else { // THREAD_KEYBORAD_MOVE
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown);
if(true == data.stateIsDown) {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusDown, data.keyboardMove);
} else {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusUp, data.keyboardMove);
// check if the widget allow repeating key events.
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->GetKeyboardRepeate() << " state=" << data.stateIsDown);
if( false==data.repeateKey
|| ( true==data.repeateKey
&& true==tmpWidget->GetKeyboardRepeate()) ) {
// check Widget shortcut
if (false==tmpWidget->OnEventShortCut(data.keyboardSpecial,
data.keyboardChar,
data.keyboardMove,
data.stateIsDown) ) {
// generate the direct event ...
if (data.TypeMessage == THREAD_KEYBORAD_KEY) {
if(true == data.stateIsDown) {
tmpWidget->OnEventKb(ewol::keyEvent::statusDown, data.keyboardChar);
} else {
tmpWidget->OnEventKb(ewol::keyEvent::statusUp, data.keyboardChar);
}
} else { // THREAD_KEYBORAD_MOVE
EWOL_DEBUG("THREAD_KEYBORAD_MOVE" << data.keyboardMove << " " << data.stateIsDown);
if(true == data.stateIsDown) {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusDown, data.keyboardMove);
} else {
tmpWidget->OnEventKbMove(ewol::keyEvent::statusUp, data.keyboardMove);
}
}
} else {
EWOL_DEBUG("remove Repeate key ...");
}
}
}
@ -391,7 +401,8 @@ void eSystem::SetMouseState(int pointerID, bool isDown, float x, float y )
void eSystem::SetKeyboard(ewol::SpecialKey& special,
uniChar_t myChar,
bool isDown)
bool isDown,
bool isARepeateKey)
{
if (true == isGlobalSystemInit) {
eSystemMessage data;
@ -399,13 +410,15 @@ void eSystem::SetKeyboard(ewol::SpecialKey& special,
data.stateIsDown = isDown;
data.keyboardChar = myChar;
data.keyboardSpecial = special;
data.repeateKey = isARepeateKey;
l_msgSystem.Post(data);
}
}
void eSystem::SetKeyboardMove(ewol::SpecialKey& special,
ewol::keyEvent::keyboard_te move,
bool isDown)
bool isDown,
bool isARepeateKey)
{
if (true == isGlobalSystemInit) {
eSystemMessage data;
@ -413,6 +426,7 @@ void eSystem::SetKeyboardMove(ewol::SpecialKey& special,
data.stateIsDown = isDown;
data.keyboardMove = move;
data.keyboardSpecial = special;
data.repeateKey = isARepeateKey;
l_msgSystem.Post(data);
}
}

View File

@ -34,10 +34,12 @@ namespace eSystem
void SetKeyboard(ewol::SpecialKey& special,
uniChar_t myChar,
bool isDown);
bool isDown,
bool isARepeateKey=false);
void SetKeyboardMove(ewol::SpecialKey& special,
ewol::keyEvent::keyboard_te move,
bool isDown);
bool isDown,
bool isARepeateKey=false);
void ClipBoardArrive(ewol::clipBoard::clipboardListe_te clipboardID);

View File

@ -855,172 +855,194 @@ void X11_Run(void)
break;
case KeyPress:
case KeyRelease:
// filter repeate key :
if( event.type == KeyRelease
&& XEventsQueued(m_display, QueuedAfterReading)) {
XEvent nev;
XPeekEvent(m_display, &nev);
if( nev.type == KeyPress
&& nev.xkey.time == event.xkey.time
&& nev.xkey.keycode == event.xkey.keycode) {
// Key was not actually released
// remove next event too ...
XNextEvent(m_display, &nev);
break;
}
}
X11_INFO("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
{
X11_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
if (event.xkey.state & (1<<0) ) {
//EWOL_DEBUG(" Special Key : SHIFT");
guiKeyBoardMode.shift = true;
} else {
guiKeyBoardMode.shift = false;
bool thisIsAReapeateKey = false;
// filter repeate key :
if( event.type == KeyRelease
&& XEventsQueued(m_display, QueuedAfterReading)) {
XEvent nev;
XPeekEvent(m_display, &nev);
if( nev.type == KeyPress
&& nev.xkey.time == event.xkey.time
&& nev.xkey.keycode == event.xkey.keycode) {
// Key was not actually released
// remove next event too ...
//This remove repeate key
XNextEvent(m_display, &nev);
//break;
thisIsAReapeateKey = true;
}
}
if (event.xkey.state & (1<<1) ) {
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
guiKeyBoardMode.capLock = true;
} else {
guiKeyBoardMode.capLock = false;
}
if (event.xkey.state & (1<<2) ) {
//EWOL_DEBUG(" Special Key : Ctrl");
guiKeyBoardMode.ctrl = true;
} else {
guiKeyBoardMode.ctrl = false;
}
if (event.xkey.state & (1<<3) ) {
//EWOL_DEBUG(" Special Key : Alt");
guiKeyBoardMode.alt = true;
} else {
guiKeyBoardMode.alt = false;
}
if (event.xkey.state & (1<<4) ) {
//EWOL_DEBUG(" Special Key : VER_num");
guiKeyBoardMode.numLock = true;
} else {
guiKeyBoardMode.numLock = false;
}
if (event.xkey.state & (1<<5) ) {
EWOL_DEBUG(" Special Key : MOD");
}
if (event.xkey.state & (1<<6) ) {
//EWOL_DEBUG(" Special Key : META");
guiKeyBoardMode.meta = true;
} else {
guiKeyBoardMode.meta = false;
}
if (event.xkey.state & (1<<7) ) {
//EWOL_DEBUG(" Special Key : ALT_GR");
guiKeyBoardMode.altGr = true;
} else {
guiKeyBoardMode.altGr = false;
}
bool find = true;
ewol::keyEvent::keyboard_te keyInput;
switch (event.xkey.keycode) {
//case 80: // keypad
case 111: keyInput = ewol::keyEvent::keyboardUp; break;
//case 83: // keypad
case 113: keyInput = ewol::keyEvent::keyboardLeft; break;
//case 85: // keypad
case 114: keyInput = ewol::keyEvent::keyboardRight; break;
//case 88: // keypad
case 116: keyInput = ewol::keyEvent::keyboardDown; break;
//case 81: // keypad
case 112: keyInput = ewol::keyEvent::keyboardPageUp; break;
//case 89: // keypad
case 117: keyInput = ewol::keyEvent::keyboardPageDown; break;
//case 79: // keypad
case 110: keyInput = ewol::keyEvent::keyboardStart; break;
//case 87: // keypad
case 115: keyInput = ewol::keyEvent::keyboardEnd; break;
case 78: keyInput = ewol::keyEvent::keyboardStopDefil; break;
case 127: keyInput = ewol::keyEvent::keyboardWait; break;
//case 90: // keypad
case 118:
keyInput = ewol::keyEvent::keyboardInsert;
if(event.type == KeyRelease) {
if (true == guiKeyBoardMode.insert) {
guiKeyBoardMode.insert = false;
X11_INFO("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
{
X11_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
if (event.xkey.state & (1<<0) ) {
//EWOL_DEBUG(" Special Key : SHIFT");
guiKeyBoardMode.shift = true;
} else {
guiKeyBoardMode.shift = false;
}
if (event.xkey.state & (1<<1) ) {
//EWOL_DEBUG(" Special Key : CAPS_LOCK");
guiKeyBoardMode.capLock = true;
} else {
guiKeyBoardMode.capLock = false;
}
if (event.xkey.state & (1<<2) ) {
//EWOL_DEBUG(" Special Key : Ctrl");
guiKeyBoardMode.ctrl = true;
} else {
guiKeyBoardMode.ctrl = false;
}
if (event.xkey.state & (1<<3) ) {
//EWOL_DEBUG(" Special Key : Alt");
guiKeyBoardMode.alt = true;
} else {
guiKeyBoardMode.alt = false;
}
if (event.xkey.state & (1<<4) ) {
//EWOL_DEBUG(" Special Key : VER_num");
guiKeyBoardMode.numLock = true;
} else {
guiKeyBoardMode.numLock = false;
}
if (event.xkey.state & (1<<5) ) {
EWOL_DEBUG(" Special Key : MOD");
}
if (event.xkey.state & (1<<6) ) {
//EWOL_DEBUG(" Special Key : META");
guiKeyBoardMode.meta = true;
} else {
guiKeyBoardMode.meta = false;
}
if (event.xkey.state & (1<<7) ) {
//EWOL_DEBUG(" Special Key : ALT_GR");
guiKeyBoardMode.altGr = true;
} else {
guiKeyBoardMode.altGr = false;
}
bool find = true;
ewol::keyEvent::keyboard_te keyInput;
switch (event.xkey.keycode) {
//case 80: // keypad
case 111: keyInput = ewol::keyEvent::keyboardUp; break;
//case 83: // keypad
case 113: keyInput = ewol::keyEvent::keyboardLeft; break;
//case 85: // keypad
case 114: keyInput = ewol::keyEvent::keyboardRight; break;
//case 88: // keypad
case 116: keyInput = ewol::keyEvent::keyboardDown; break;
//case 81: // keypad
case 112: keyInput = ewol::keyEvent::keyboardPageUp; break;
//case 89: // keypad
case 117: keyInput = ewol::keyEvent::keyboardPageDown; break;
//case 79: // keypad
case 110: keyInput = ewol::keyEvent::keyboardStart; break;
//case 87: // keypad
case 115: keyInput = ewol::keyEvent::keyboardEnd; break;
case 78: keyInput = ewol::keyEvent::keyboardStopDefil; break;
case 127: keyInput = ewol::keyEvent::keyboardWait; break;
//case 90: // keypad
case 118:
keyInput = ewol::keyEvent::keyboardInsert;
if(event.type == KeyRelease) {
if (true == guiKeyBoardMode.insert) {
guiKeyBoardMode.insert = false;
} else {
guiKeyBoardMode.insert = true;
}
}
break;
//case 84: keyInput = ewol::keyEvent::keyboardCenter; break; // Keypad
case 67: keyInput = ewol::keyEvent::keyboardF1; break;
case 68: keyInput = ewol::keyEvent::keyboardF2; break;
case 69: keyInput = ewol::keyEvent::keyboardF3; break;
case 70: keyInput = ewol::keyEvent::keyboardF4; break;
case 71: keyInput = ewol::keyEvent::keyboardF5; break;
case 72: keyInput = ewol::keyEvent::keyboardF6; break;
case 73: keyInput = ewol::keyEvent::keyboardF7; break;
case 74: keyInput = ewol::keyEvent::keyboardF8; break;
case 75: keyInput = ewol::keyEvent::keyboardF9; break;
case 76: keyInput = ewol::keyEvent::keyboardF10; break;
case 95: keyInput = ewol::keyEvent::keyboardF11; break;
case 96: keyInput = ewol::keyEvent::keyboardF12; break;
case 66: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = (event.type == KeyPress) ? true : false; break;
case 50: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 62: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 37: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 105: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 133: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 134: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 64: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = (event.type == KeyPress) ? true : false; break;
case 108: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = (event.type == KeyPress) ? true : false; break;
case 135: keyInput = ewol::keyEvent::keyboardContextMenu; break;
case 77: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break;
case 91: // Suppr on keypad
find = false;
if(guiKeyBoardMode.numLock==true){
eSystem::SetKeyboard(guiKeyBoardMode, '.', (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
eSystem::SetKeyboard(guiKeyBoardMode, '.', !(event.type==KeyPress), thisIsAReapeateKey);
}
} else {
guiKeyBoardMode.insert = true;
eSystem::SetKeyboard(guiKeyBoardMode, 0x7F, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
eSystem::SetKeyboard(guiKeyBoardMode, 0x7F, !(event.type==KeyPress), thisIsAReapeateKey);
}
}
break;
case 23: // special case for TAB
find = false;
eSystem::SetKeyboard(guiKeyBoardMode, 0x09, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
eSystem::SetKeyboard(guiKeyBoardMode, 0x09, !(event.type==KeyPress), thisIsAReapeateKey);
}
break;
default:
find = false;
{
char buf[11];
//EWOL_DEBUG("Keycode: " << event.xkey.keycode);
// change keystate for simple reson of the ctrl error...
int32_t keyStateSave = event.xkey.state;
if (event.xkey.state & (1<<2) ) {
event.xkey.state = event.xkey.state & 0xFFFFFFFB;
}
KeySym keysym;
XComposeStatus status;
int count = XLookupString(&event.xkey, buf, 10, &keysym, &status);
// retreave real keystate
event.xkey.state = keyStateSave;
buf[count] = '\0';
// Replace \r error ...
if (buf[0] == '\r') {
buf[0] = '\n';
buf[1] = '\0';
}
if (count>0) {
// transform it in unicode
uniChar_t tmpChar = 0;
unicode::convertIsoToUnicode(unicode::EDN_CHARSET_ISO_8859_15, buf[0], tmpChar);
//EWOL_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << unicodeValue);
eSystem::SetKeyboard(guiKeyBoardMode, tmpChar, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
eSystem::SetKeyboard(guiKeyBoardMode, tmpChar, !(event.type==KeyPress), thisIsAReapeateKey);
}
} else {
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
}
}
break;
}
if (true == find) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
eSystem::SetKeyboardMove(guiKeyBoardMode, keyInput, (event.type==KeyPress), thisIsAReapeateKey);
if (true==thisIsAReapeateKey) {
eSystem::SetKeyboardMove(guiKeyBoardMode, keyInput, !(event.type==KeyPress), thisIsAReapeateKey);
}
break;
//case 84: keyInput = ewol::keyEvent::keyboardCenter; break; // Keypad
case 67: keyInput = ewol::keyEvent::keyboardF1; break;
case 68: keyInput = ewol::keyEvent::keyboardF2; break;
case 69: keyInput = ewol::keyEvent::keyboardF3; break;
case 70: keyInput = ewol::keyEvent::keyboardF4; break;
case 71: keyInput = ewol::keyEvent::keyboardF5; break;
case 72: keyInput = ewol::keyEvent::keyboardF6; break;
case 73: keyInput = ewol::keyEvent::keyboardF7; break;
case 74: keyInput = ewol::keyEvent::keyboardF8; break;
case 75: keyInput = ewol::keyEvent::keyboardF9; break;
case 76: keyInput = ewol::keyEvent::keyboardF10; break;
case 95: keyInput = ewol::keyEvent::keyboardF11; break;
case 96: keyInput = ewol::keyEvent::keyboardF12; break;
case 66: keyInput = ewol::keyEvent::keyboardCapLock; guiKeyBoardMode.capLock = (event.type == KeyPress) ? true : false; break;
case 50: keyInput = ewol::keyEvent::keyboardShiftLeft; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 62: keyInput = ewol::keyEvent::keyboardShiftRight; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 37: keyInput = ewol::keyEvent::keyboardCtrlLeft; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 105: keyInput = ewol::keyEvent::keyboardCtrlRight; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 133: keyInput = ewol::keyEvent::keyboardMetaLeft; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 134: keyInput = ewol::keyEvent::keyboardMetaRight; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 64: keyInput = ewol::keyEvent::keyboardAlt; guiKeyBoardMode.alt = (event.type == KeyPress) ? true : false; break;
case 108: keyInput = ewol::keyEvent::keyboardAltGr; guiKeyBoardMode.altGr = (event.type == KeyPress) ? true : false; break;
case 135: keyInput = ewol::keyEvent::keyboardContextMenu; break;
case 77: keyInput = ewol::keyEvent::keyboardNumLock; guiKeyBoardMode.numLock = (event.type == KeyPress) ? true : false; break;
case 91: // Suppr on keypad
find = false;
if(guiKeyBoardMode.numLock==true){
eSystem::SetKeyboard(guiKeyBoardMode, '.', (event.type==KeyPress));
} else {
eSystem::SetKeyboard(guiKeyBoardMode, 0x7F, (event.type==KeyPress));
}
break;
case 23: // special case for TAB
find = false;
eSystem::SetKeyboard(guiKeyBoardMode, 0x09, (event.type==KeyPress));
break;
default:
find = false;
{
char buf[11];
//EWOL_DEBUG("Keycode: " << event.xkey.keycode);
// change keystate for simple reson of the ctrl error...
int32_t keyStateSave = event.xkey.state;
if (event.xkey.state & (1<<2) ) {
event.xkey.state = event.xkey.state & 0xFFFFFFFB;
}
KeySym keysym;
XComposeStatus status;
int count = XLookupString(&event.xkey, buf, 10, &keysym, &status);
// retreave real keystate
event.xkey.state = keyStateSave;
buf[count] = '\0';
// Replace \r error ...
if (buf[0] == '\r') {
buf[0] = '\n';
buf[1] = '\0';
}
if (count>0) {
// transform it in unicode
uniChar_t tmpChar = 0;
unicode::convertIsoToUnicode(unicode::EDN_CHARSET_ISO_8859_15, buf[0], tmpChar);
//EWOL_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << unicodeValue);
eSystem::SetKeyboard(guiKeyBoardMode, tmpChar, (event.type==KeyPress));
} else {
EWOL_WARNING("Unknow event Key : " << event.xkey.keycode);
}
}
break;
}
if (true == find) {
//EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
eSystem::SetKeyboardMove(guiKeyBoardMode, keyInput, (event.type==KeyPress));
}
}
}
break;

View File

@ -23,7 +23,7 @@ void ewol::SimpleConfigElement::Parse(etk::UString value)
ewol::ConfigFile::ConfigFile(etk::UString& filename):
ewol::ConfigFile::ConfigFile(const etk::UString& filename):
ewol::Resource(filename)
{
EWOL_DEBUG("SFP : load \"" << filename << "\"");

View File

@ -42,7 +42,7 @@ namespace ewol
etk::Vector<ewol::SimpleConfigElement*> m_list;
etk::UString m_errorString;
public:
ConfigFile(etk::UString& filename);
ConfigFile(const etk::UString& filename);
virtual ~ConfigFile(void);
const char* GetType(void) { return "ewol::SimpleConfigFile"; };
void Reload(void);

View File

@ -47,7 +47,7 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
if (inputDataLine[1]=='n') {
// Vertice normal : vn 0.000000 0.000000 -1.000000
vec3 vertex(0,0,0);
sscanf(&inputDataLine[3], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[1] );
sscanf(&inputDataLine[3], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] );
normals.PushBack(vertex);
} else if (inputDataLine[1]=='t') {
// Texture position : vt 0.748573 0.750412
@ -57,7 +57,7 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
} else {
// Vertice position : v 1.000000 -1.000000 -1.000000
vec3 vertex(0,0,0);
sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[1] );
sscanf(&inputDataLine[2], "%f %f %f", &vertex.m_floats[0], &vertex.m_floats[1], &vertex.m_floats[2] );
vertices.PushBack(vertex);
}
} else if (inputDataLine[0]=='f') {

View File

@ -15,7 +15,7 @@
//#define LOCAL_DEBUG EWOL_VERBOSE
#define LOCAL_DEBUG EWOL_DEBUG
ewol::Program::Program(etk::UString& filename) :
ewol::Program::Program(const etk::UString& filename) :
ewol::Resource(filename),
m_exist(false),
m_program(0),

View File

@ -57,7 +57,7 @@ namespace ewol
* @brief Contructor of an opengl Program.
* @param[in] filename Standard file name format. see @ref etk::FSNode
*/
Program(etk::UString& filename);
Program(const etk::UString& filename);
/**
* @brief Destructor, remove the current Program.
*/

View File

@ -41,7 +41,7 @@ namespace ewol
m_uniqueId = valBase;
valBase++;
};
Resource(etk::UString& filename) :
Resource(const etk::UString& filename) :
m_name(filename),
m_counter(1),
m_resourceLevel(MAX_RESOURCE_LEVEL-1)
@ -50,7 +50,7 @@ namespace ewol
valBase++;
};
virtual ~Resource(void) { };
virtual bool HasName(etk::UString& fileName)
virtual bool HasName(const etk::UString& fileName)
{
EWOL_VERBOSE("G : check : " << fileName << " ?= " << m_name << " = " << (fileName==m_name) );
return fileName==m_name;

View File

@ -13,7 +13,7 @@
ewol::Shader::Shader(etk::UString& filename):
ewol::Shader::Shader(const etk::UString& filename):
ewol::Resource(filename),
m_exist(false),
m_fileData(NULL),

View File

@ -31,7 +31,7 @@ namespace ewol
* @brief Contructor of an opengl Shader
* @param[in] filename Standard file name format. see @ref etk::FSNode
*/
Shader(etk::UString& filename);
Shader(const etk::UString& filename);
/**
* @brief Destructor, remove the current Shader
*/

View File

@ -274,7 +274,7 @@ ewol::TexturedFont::~TexturedFont(void)
}
bool ewol::TexturedFont::HasName(etk::UString& fileName)
bool ewol::TexturedFont::HasName(const etk::UString& fileName)
{
etk::UString tmpName = m_name;
tmpName += ":";

View File

@ -44,7 +44,7 @@ namespace ewol
public:
TexturedFont(etk::UString fontName);
~TexturedFont(void);
virtual bool HasName(etk::UString& fileName);
virtual bool HasName(const etk::UString& fileName);
const char* GetType(void) { return "ewol::TexturedFont"; };
int32_t getFontSize(void) { return m_size; };
/**

View File

@ -209,7 +209,7 @@ void widget::Button::OnRegenerateDisplay(void)
tmpTextOrigin += vec3(padding.x(), padding.y(), 0);
localSize -= ivec2(2*padding.x(), 2*padding.y());
tmpTextOrigin.setY(tmpTextOrigin.x()+ (m_minSize.y()-2*padding.y()) - minSize.y());
tmpTextOrigin.setY(tmpTextOrigin.y()+ (m_minSize.y()-2*padding.y()) - minSize.y());
vec2 textPos(tmpTextOrigin.x(), tmpTextOrigin.y());

View File

@ -207,8 +207,11 @@ widget::Scene::Scene(btDynamicsWorld* gameEngine) :
{
// this permit to display direct element ...
ewol::resource::Keep(m_directDrawObject);
// Remove repeating event from keyboard...
SetKeyboardRepeate(false);
// Can get the keybord events...
SetCanHaveFocus(true);
// This widget change in time...
PeriodicCallSet(true);
m_zoom = 1.0/1000.0;
m_ratioTime = 1.0f;

View File

@ -22,6 +22,7 @@
ewol::Widget::Widget(void) :
m_userMaxSize(-1,-1)
{
m_allowRepeateKeyboardEvent = true;
m_limitMouseEvent = 3;
m_needRegenerateDisplay = true;
m_origin.setValue(0,0);

View File

@ -271,6 +271,24 @@ namespace ewol {
*/
void SetMouseLimit(int32_t numberState) { m_limitMouseEvent = numberState; };
// ----------------------------------------------------------------------------------------------------------------
// -- keyboard event properties Area
// ----------------------------------------------------------------------------------------------------------------
private:
bool m_allowRepeateKeyboardEvent; //!< This remove the repeating keybord event due to the constant pressing key.
public:
/**
* @brief Get the keyboard repeating event supporting.
* @return true : the event can be repeated.
* @return false : the event must not be repeated.
*/
bool GetKeyboardRepeate(void) { return m_allowRepeateKeyboardEvent; };
/**
* @brief Set the keyboard repeating event supporting.
* @param[in] state The repeating status (true: enable, false disable).
*/
void SetKeyboardRepeate(bool state) { m_allowRepeateKeyboardEvent = state; };
// ----------------------------------------------------------------------------------------------------------------
// -- Periodic call Area
// ----------------------------------------------------------------------------------------------------------------