better shift and special keybord management

This commit is contained in:
Edouard Dupin 2012-03-11 13:53:11 +01:00
parent 64a079f615
commit f1cdfdc811
6 changed files with 54 additions and 30 deletions

View File

@ -202,6 +202,15 @@ void ewol::Widget::SetCanHaveFocus(bool canFocusState)
} }
} }
/**
* @brief Keep the focus on this widget ==> this remove the previous focus on all other widget
* @param ---
* @return ---
*/
void ewol::Widget::KeepFocus(void)
{
ewol::widgetManager::FocusKeep(this);
}
/** /**
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])

View File

@ -284,6 +284,12 @@ namespace ewol {
*/ */
void SetCanHaveFocus(bool canFocusState); void SetCanHaveFocus(bool canFocusState);
protected: protected:
/**
* @brief Keep the focus on this widget ==> this remove the previous focus on all other widget
* @param ---
* @return ---
*/
void KeepFocus(void);
/** /**
* @brief Event of the focus has been grep by the current widget * @brief Event of the focus has been grep by the current widget
* @param --- * @param ---

View File

@ -82,6 +82,8 @@ typedef struct {
void EWOL_NativeResize(int w, int h ); void EWOL_NativeResize(int w, int h );
void EWOL_NativeRegenerateDisplay(void); void EWOL_NativeRegenerateDisplay(void);
extern eventSpecialKey_ts specialCurrentKey;
static void* BaseAppEntry(void* param) static void* BaseAppEntry(void* param)
{ {
bool requestEndProcessing = false; bool requestEndProcessing = false;
@ -161,6 +163,7 @@ static void* BaseAppEntry(void* param)
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
{ {
eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data; eventKeyboardKey_ts * tmpData = (eventKeyboardKey_ts*)data.data;
specialCurrentKey = tmpData->special;
if (false==ewol::shortCut::Process(tmpData->special.shift, tmpData->special.ctrl, tmpData->special.alt, tmpData->special.meta, tmpData->myChar, tmpData->isDown)) { if (false==ewol::shortCut::Process(tmpData->special.shift, tmpData->special.ctrl, tmpData->special.alt, tmpData->special.meta, tmpData->myChar, tmpData->isDown)) {
guiAbstraction::SendKeyboardEvent(tmpData->isDown, tmpData->myChar); guiAbstraction::SendKeyboardEvent(tmpData->isDown, tmpData->myChar);
} }
@ -170,6 +173,7 @@ static void* BaseAppEntry(void* param)
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE"); //EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
{ {
eventKeyboardMove_ts * tmpData = (eventKeyboardMove_ts*)data.data; eventKeyboardMove_ts * tmpData = (eventKeyboardMove_ts*)data.data;
specialCurrentKey = tmpData->special;
guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move); guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
} }
break; break;

View File

@ -144,10 +144,21 @@ extern int32_t offsetMoveClickedDouble;
void ewol::eventInput::Motion(int pointerID, coord2D_ts pos) void ewol::eventInput::Motion(int pointerID, coord2D_ts pos)
{ {
if( pointerID > MAX_MANAGE_INPUT if( pointerID > MAX_MANAGE_INPUT
|| pointerID <= 0) { || pointerID < 0) {
// not manage input // not manage input
return; return;
} }
// special PC State :
if(pointerID == 0) {
ewol::Widget* destWidget = NULL;
if(NULL != gui_uniqueWindows) {
destWidget = gui_uniqueWindows->GetWidgetAtPos(pos);
}
if (NULL != destWidget) {
destWidget->OnEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, pos);
}
return;
}
if (true == eventInputSaved[pointerID].isUsed) { if (true == eventInputSaved[pointerID].isUsed) {
if (true == eventInputSaved[pointerID].isInside) { if (true == eventInputSaved[pointerID].isInside) {

View File

@ -465,7 +465,7 @@ void X11_Run(void)
case KeyRelease: case KeyRelease:
//EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" "); //EWOL_DEBUG("X11 event : " << event.type << " = \"KeyPress/KeyRelease\" ");
{ {
EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state); //EWOL_DEBUG("eventKey : " << event.xkey.keycode << " state : " << event.xkey.state);
if (event.xkey.state & (1<<0) ) { if (event.xkey.state & (1<<0) ) {
//EWOL_DEBUG(" Special Key : SHIFT"); //EWOL_DEBUG(" Special Key : SHIFT");
guiKeyBoardMode.shift = true; guiKeyBoardMode.shift = true;
@ -556,17 +556,17 @@ void X11_Run(void)
case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break; case 76: keyInput = ewol::EVENT_KB_MOVE_TYPE_F10; break;
case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break; case 95: keyInput = ewol::EVENT_KB_MOVE_TYPE_F11; break;
case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break; case 96: keyInput = ewol::EVENT_KB_MOVE_TYPE_F12; break;
case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; break; case 66: keyInput = ewol::EVENT_KB_MOVE_TYPE_CAPLOCK; guiKeyBoardMode.capLock = (event.type == KeyPress) ? true : false; break;
case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; break; case 50: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; break; case 62: keyInput = ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT; guiKeyBoardMode.shift = (event.type == KeyPress) ? true : false; break;
case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; break; case 37: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; break; case 105: keyInput = ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT; guiKeyBoardMode.ctrl = (event.type == KeyPress) ? true : false; break;
case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; break; case 133: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_LEFT; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; break; case 134: keyInput = ewol::EVENT_KB_MOVE_TYPE_META_RIGHT; guiKeyBoardMode.meta = (event.type == KeyPress) ? true : false; break;
case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; break; case 64: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT; guiKeyBoardMode.alt = (event.type == KeyPress) ? true : false; break;
case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; break; case 108: keyInput = ewol::EVENT_KB_MOVE_TYPE_ALT_GR; guiKeyBoardMode.altGr = (event.type == KeyPress) ? true : false; break;
case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break; case 135: keyInput = ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU; break;
case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; break; case 77: keyInput = ewol::EVENT_KB_MOVE_TYPE_VER_NUM; guiKeyBoardMode.verNum = (event.type == KeyPress) ? true : false; break;
case 91: // Suppr on keypad case 91: // Suppr on keypad
find = false; find = false;
{ {
@ -584,7 +584,7 @@ void X11_Run(void)
find = false; find = false;
{ {
char buf[11]; char buf[11];
EWOL_DEBUG("Keycode: " << event.xkey.keycode); //EWOL_DEBUG("Keycode: " << event.xkey.keycode);
// change keystate for simple reson of the ctrl error... // change keystate for simple reson of the ctrl error...
int32_t keyStateSave = event.xkey.state; int32_t keyStateSave = event.xkey.state;
if (event.xkey.state & (1<<2) ) { if (event.xkey.state & (1<<2) ) {
@ -620,7 +620,7 @@ void X11_Run(void)
break; break;
} }
if (true == find) { if (true == find) {
EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) ); //EWOL_DEBUG("eventKey Move type : " << GetCharTypeMoveEvent(keyInput) );
eventKeyboardMove_ts specialEvent; eventKeyboardMove_ts specialEvent;
specialEvent.special = guiKeyBoardMode; specialEvent.special = guiKeyBoardMode;
if(event.type == KeyPress) { if(event.type == KeyPress) {

View File

@ -25,6 +25,7 @@
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/WidgetManager.h> #include <ewol/WidgetManager.h>
#include <ewol/base/MainThread.h>
#include <ewol/base/gui.h> #include <ewol/base/gui.h>
@ -86,52 +87,45 @@ void ewol::ForceRedrawAll(void)
} }
bool guiKeyBoardMode_CapLock = false; eventSpecialKey_ts specialCurrentKey;
bool ewol::IsSetCapsLock(void) bool ewol::IsSetCapsLock(void)
{ {
return guiKeyBoardMode_CapLock; return specialCurrentKey.capLock;
} }
bool guiKeyBoardMode_Shift = false;
bool ewol::IsSetShift(void) bool ewol::IsSetShift(void)
{ {
return guiKeyBoardMode_Shift; return specialCurrentKey.shift;
} }
bool guiKeyBoardMode_Ctrl = false;
bool ewol::IsSetCtrl(void) bool ewol::IsSetCtrl(void)
{ {
return guiKeyBoardMode_Ctrl; return specialCurrentKey.ctrl;
} }
bool guiKeyBoardMode_Meta = false;
bool ewol::IsSetMeta(void) bool ewol::IsSetMeta(void)
{ {
return guiKeyBoardMode_Meta; return specialCurrentKey.meta;
} }
bool guiKeyBoardMode_Alt = false;
bool ewol::IsSetAlt(void) bool ewol::IsSetAlt(void)
{ {
return guiKeyBoardMode_Alt; return specialCurrentKey.alt;
} }
bool guiKeyBoardMode_AltGr = false;
bool ewol::IsSetAltGr(void) bool ewol::IsSetAltGr(void)
{ {
return guiKeyBoardMode_AltGr; return specialCurrentKey.altGr;
} }
bool guiKeyBoardMode_VerNum = false;
bool ewol::IsSetVerNum(void) bool ewol::IsSetVerNum(void)
{ {
return guiKeyBoardMode_VerNum; return specialCurrentKey.verNum;
} }
bool guiKeyBoardMode_Insert = false;
bool ewol::IsSetInsert(void) bool ewol::IsSetInsert(void)
{ {
return guiKeyBoardMode_Insert; return specialCurrentKey.insert;
} }