[DEV] use lambda function to execute env
This commit is contained in:
parent
abaca40325
commit
3341c55489
@ -74,7 +74,7 @@ void gale::Application::onPointer(enum gale::key::type _type, int32_t _pointerID
|
||||
|
||||
}
|
||||
|
||||
void gale::Application::onKeyboard(gale::key::Special& _special,
|
||||
void gale::Application::onKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
gale::key::status _state) {
|
||||
|
@ -93,7 +93,7 @@ namespace gale {
|
||||
* @param[in] _value Unicode value of the char pushed (viable only if _type==gale::key::keyboard_char).
|
||||
* @param[in] _state State of the key (up/down/upRepeate/downRepeate)
|
||||
*/
|
||||
virtual void onKeyboard(gale::key::Special& _special,
|
||||
virtual void onKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
char32_t _value,
|
||||
gale::key::status _state);
|
||||
|
@ -431,24 +431,19 @@ class AndroidContext : public gale::Context {
|
||||
java_detach_current_thread(status);
|
||||
}
|
||||
public:
|
||||
void OS_SetInputMotion(int _pointerID, const vec2& _pos) {
|
||||
gale::Context::OS_SetInputMotion(_pointerID, vec2(_pos.x(),m_currentHeight-_pos.y()) );
|
||||
}
|
||||
|
||||
void OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos) {
|
||||
gale::Context::OS_SetInputState(_pointerID, _isDown, vec2(_pos.x(),m_currentHeight-_pos.y()) );
|
||||
}
|
||||
|
||||
void OS_SetMouseMotion(int _pointerID, const vec2& _pos) {
|
||||
gale::Context::OS_SetMouseMotion(_pointerID, vec2(_pos.x(),m_currentHeight-_pos.y()) );
|
||||
}
|
||||
|
||||
void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos) {
|
||||
gale::Context::OS_SetMouseState(_pointerID, _isDown, vec2(_pos.x(),m_currentHeight-_pos.y()) );
|
||||
void OS_SetInput(enum gale::key::type _type,
|
||||
enum gale::key::status _status,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos) {
|
||||
gale::Context::OS_SetInput(_type, _status, _pointerID, vec2(_pos.x(),m_currentHeight-_pos.y()));
|
||||
}
|
||||
|
||||
void ANDROID_SetKeyboard(char32_t _myChar, bool _isDown, bool _isARepeateKey=false) {
|
||||
OS_SetKeyboard(m_guiKeyBoardSpecialKeyMode, _myChar, _isDown, _isARepeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
||||
gale::key::keyboard_char,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_isARepeateKey,
|
||||
_myChar);
|
||||
}
|
||||
|
||||
bool ANDROID_systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down) {
|
||||
@ -458,7 +453,10 @@ class AndroidContext : public gale::Context {
|
||||
// direct wrapping :
|
||||
enum gale::key::keyboard move = (enum gale::key::keyboard)_move;
|
||||
m_guiKeyBoardSpecialKeyMode.update(move, _isDown);
|
||||
OS_SetKeyboardMove(m_guiKeyBoardSpecialKeyMode, move, _isDown, _isARepeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardSpecialKeyMode,
|
||||
move,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_isARepeateKey);
|
||||
}
|
||||
|
||||
void OS_Resize(const vec2& _size) {
|
||||
@ -683,7 +681,10 @@ extern "C" {
|
||||
// TODO : generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_SetInputMotion(_pointerID+1, vec2(_x,_y));
|
||||
s_listInstance[_id]->OS_SetInput(gale::key::type_finger,
|
||||
gale::key::status_move,
|
||||
_pointerID+1,
|
||||
vec2(_x,_y));
|
||||
}
|
||||
|
||||
void Java_org_gale_Gale_EWinputEventState(JNIEnv* _env,
|
||||
@ -701,7 +702,10 @@ extern "C" {
|
||||
// TODO : generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_SetInputState(_pointerID+1, _isUp, vec2(_x,_y));
|
||||
s_listInstance[_id]->OS_SetInput(gale::key::type_finger,
|
||||
(_isUp==false?gale::key::status_down:gale::key::status_up),
|
||||
_pointerID+1,
|
||||
vec2(_x,_y));
|
||||
}
|
||||
|
||||
void Java_org_gale_Gale_EWmouseEventMotion(JNIEnv* _env,
|
||||
@ -718,7 +722,10 @@ extern "C" {
|
||||
// TODO : generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_SetMouseMotion(_pointerID+1, vec2(_x,_y));
|
||||
s_listInstance[_id]->OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
_pointerID+1,
|
||||
vec2(_x,_y));
|
||||
}
|
||||
|
||||
void Java_org_gale_Gale_EWmouseEventState(JNIEnv* _env,
|
||||
@ -736,7 +743,10 @@ extern "C" {
|
||||
// TODO : generate error in java to stop the current instance
|
||||
return;
|
||||
}
|
||||
s_listInstance[_id]->OS_SetMouseState(_pointerID+1, _isUp, vec2(_x,_y));
|
||||
s_listInstance[_id]->OS_SetInput(gale::key::type_mouse,
|
||||
(_isUp==false?gale::key::status_down:gale::key::status_up),
|
||||
_pointerID+1,
|
||||
vec2(_x,_y));
|
||||
}
|
||||
|
||||
void Java_org_gale_Gale_EWunknowEvent(JNIEnv* _env,
|
||||
|
@ -149,21 +149,14 @@ void gale::Context::inputEventUnGrabPointer() {
|
||||
void gale::Context::processEvents() {
|
||||
int32_t nbEvent = 0;
|
||||
//GALE_DEBUG(" ******** Event");
|
||||
std::shared_ptr<gale::context::LoopAction> data;
|
||||
while (m_msgSystem.count()>0) {
|
||||
nbEvent++;
|
||||
m_msgSystem.wait(data);
|
||||
if (data == nullptr) {
|
||||
std::function<void(gale::Context& _context)> func;
|
||||
m_msgSystem.wait(func);
|
||||
if (func == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if (m_imulationActive == true) {
|
||||
std::string dataExecuted = data->createString();
|
||||
m_simulationFile.filePuts(dataExecuted);
|
||||
m_simulationFile.filePuts("\n");
|
||||
GALE_VERBOSE("plop: " + dataExecuted);
|
||||
}
|
||||
data->doAction(*this);
|
||||
data.reset();
|
||||
func(*this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +186,6 @@ void gale::Context::setArchiveDir(int _mode, const char* _str) {
|
||||
|
||||
|
||||
gale::Context::Context(gale::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
//m_application(std::make_shared<gale::Application>(_application)),
|
||||
m_application(_application),
|
||||
m_imulationActive(false),
|
||||
m_simulationFile("gale.gsim"),
|
||||
@ -209,8 +201,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
|
||||
m_FpsSystemContext("Context ", false),
|
||||
m_FpsSystem( "Draw ", true),
|
||||
m_FpsFlush( "Flush ", false),
|
||||
m_windowsSize(320,480),
|
||||
m_initStepId(0) {
|
||||
m_windowsSize(320,480) {
|
||||
// set a basic
|
||||
etk::thread::setName("galeThread");
|
||||
if (m_application == nullptr) {
|
||||
@ -282,7 +273,21 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
|
||||
// TODO : remove this ...
|
||||
etk::initDefaultFolder("galeApplNoName");
|
||||
// request the init of the application in the main context of openGL ...
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionInit>());
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":INIT");
|
||||
m_simulationFile.filePuts("\n");
|
||||
}
|
||||
m_msgSystem.post([](gale::Context& _context){
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onCreate(_context);
|
||||
appl->onStart(_context);
|
||||
appl->onResume(_context);
|
||||
});
|
||||
|
||||
// force a recalculation
|
||||
requestUpdateSize();
|
||||
#if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__)
|
||||
@ -335,13 +340,31 @@ gale::Context::~Context() {
|
||||
}
|
||||
|
||||
void gale::Context::requestUpdateSize() {
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionRecalculateSize>());
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":RECALCULATE_SIZE\n");
|
||||
}
|
||||
m_msgSystem.post([](gale::Context& _context){
|
||||
//GALE_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
_context.forceRedrawAll();
|
||||
});
|
||||
}
|
||||
|
||||
void gale::Context::OS_Resize(const vec2& _size) {
|
||||
// TODO : Better in the thread ... == > but generate some init error ...
|
||||
// TODO : Better in the thread ... ==> but generate some init error ...
|
||||
gale::Dimension::setPixelWindowsSize(_size);
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionResize>(_size));
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":RESIZE:");
|
||||
m_simulationFile.filePuts(etk::to_string(_size));
|
||||
m_simulationFile.filePuts("\n");
|
||||
}
|
||||
m_msgSystem.post([_size](gale::Context& _context){
|
||||
//GALE_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
_context.m_windowsSize = _size;
|
||||
gale::Dimension::setPixelWindowsSize(_context.m_windowsSize);
|
||||
_context.forceRedrawAll();
|
||||
});
|
||||
}
|
||||
void gale::Context::OS_Move(const vec2& _pos) {
|
||||
/*
|
||||
@ -359,7 +382,7 @@ void gale::Context::OS_SetInput(enum gale::key::type _type,
|
||||
const vec2& _pos ) {
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":INPUT:";);
|
||||
m_simulationFile.filePuts(":INPUT:");
|
||||
m_simulationFile.filePuts(etk::to_string(_type));
|
||||
m_simulationFile.filePuts(":");
|
||||
m_simulationFile.filePuts(etk::to_string(_status));
|
||||
@ -381,80 +404,96 @@ void gale::Context::OS_SetInput(enum gale::key::type _type,
|
||||
});
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
|
||||
OS_SetInput(gale::key::type_finger,
|
||||
gale::key::status_move,
|
||||
_pointerID,
|
||||
_pos));
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
||||
OS_SetInput(gale::key::type_finger,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_pointerID,
|
||||
_pos));
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
_pointerID,
|
||||
_pos));
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos ) {
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_pointerID,
|
||||
_pos));
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetKeyboard(gale::key::Special& _special,
|
||||
char32_t _myChar,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey) {
|
||||
enum gale::key::status state = _isDown==true?gale::key::status_down:gale::key::status_up;
|
||||
void gale::Context::OS_setKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
enum gale::key::status _state,
|
||||
bool _isARepeateKey,
|
||||
char32_t _char) {
|
||||
if (_isARepeateKey == true) {
|
||||
if (state == gale::key::status_down) {
|
||||
state = gale::key::status_downRepeate;
|
||||
if (_state == gale::key::status_down) {
|
||||
_state = gale::key::status_downRepeate;
|
||||
} else {
|
||||
state = gale::key::status_upRepeate;
|
||||
_state = gale::key::status_upRepeate;
|
||||
}
|
||||
}
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionKeyboard>(_special,
|
||||
gale::key::keyboard_char,
|
||||
state,
|
||||
_myChar));
|
||||
}
|
||||
|
||||
void gale::Context::OS_SetKeyboardMove(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _move,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey) {
|
||||
gale::key::status state = _isDown==true?gale::key::status_down:gale::key::status_up;
|
||||
if (_isARepeateKey == true) {
|
||||
if (state == gale::key::status_down) {
|
||||
state = gale::key::status_downRepeate;
|
||||
} else {
|
||||
state = gale::key::status_upRepeate;
|
||||
}
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":KEYBOARD:");
|
||||
m_simulationFile.filePuts(etk::to_string(_special));
|
||||
m_simulationFile.filePuts(":");
|
||||
m_simulationFile.filePuts(etk::to_string(_type));
|
||||
m_simulationFile.filePuts(":");
|
||||
m_simulationFile.filePuts(etk::to_string(_state));
|
||||
m_simulationFile.filePuts(":");
|
||||
m_simulationFile.filePuts(etk::to_string(uint64_t(_char)));
|
||||
m_simulationFile.filePuts("\n");
|
||||
}
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionKeyboard>(_special,
|
||||
_move,
|
||||
state));
|
||||
m_msgSystem.post([_special, _type, _state, _char](gale::Context& _context){
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onKeyboard(_special,
|
||||
_type,
|
||||
_char,
|
||||
_state);
|
||||
});
|
||||
}
|
||||
|
||||
void gale::Context::OS_Hide() {
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionView>(false));
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":VIEW:false\n");
|
||||
}
|
||||
m_msgSystem.post([](gale::Context& _context){
|
||||
/*
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onKeyboard(_special,
|
||||
_type,
|
||||
_char,
|
||||
_state);
|
||||
*/
|
||||
GALE_TODO("HIDE ... ");
|
||||
});
|
||||
}
|
||||
|
||||
void gale::Context::OS_Show() {
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionView>(true));
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":VIEW:true\n");
|
||||
}
|
||||
m_msgSystem.post([](gale::Context& _context){
|
||||
/*
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onKeyboard(_special,
|
||||
_type,
|
||||
_char,
|
||||
_state);
|
||||
*/
|
||||
GALE_TODO("SHOW ... ");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void gale::Context::OS_ClipBoardArrive(enum gale::context::clipBoard::clipboardListe _clipboardID) {
|
||||
m_msgSystem.post(std::make_shared<gale::context::LoopActionClipboardArrive>(_clipboardID));
|
||||
if (m_imulationActive == true) {
|
||||
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
|
||||
m_simulationFile.filePuts(":CLIPBOARD_ARRIVE:");
|
||||
m_simulationFile.filePuts(etk::to_string(_clipboardID));
|
||||
m_simulationFile.filePuts("\n");
|
||||
}
|
||||
m_msgSystem.post([_clipboardID](gale::Context& _context){
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl != nullptr) {
|
||||
appl->onClipboardEvent(_clipboardID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void gale::Context::clipBoardGet(enum gale::context::clipBoard::clipboardListe _clipboardID) {
|
||||
|
@ -23,14 +23,12 @@
|
||||
#include <memory>
|
||||
#include <gale/orientation.h>
|
||||
#include <gale/context/clipBoard.h>
|
||||
#include <gale/context/LoopAction.h>
|
||||
#include <etk/thread/tools.h>
|
||||
|
||||
#define MAX_MANAGE_INPUT (15)
|
||||
|
||||
namespace gale {
|
||||
class Context/* : private gale::object::RemoveEvent */{
|
||||
friend gale::context::LoopActionResize;
|
||||
private:
|
||||
std::shared_ptr<gale::Application> m_application; //!< Application handle
|
||||
public:
|
||||
@ -70,7 +68,7 @@ namespace gale {
|
||||
private:
|
||||
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
||||
// TODO : gale::context::InputManager m_input;
|
||||
etk::Fifo<std::shared_ptr<gale::context::LoopAction> > m_msgSystem;
|
||||
etk::Fifo<std::function<void(gale::Context& _context)> > m_msgSystem;
|
||||
bool m_displayFps;
|
||||
gale::context::Fps m_FpsSystemEvent;
|
||||
gale::context::Fps m_FpsSystemContext;
|
||||
@ -84,20 +82,15 @@ namespace gale {
|
||||
|
||||
virtual void setArchiveDir(int _mode, const char* _str);
|
||||
|
||||
virtual void OS_SetInputMotion(int _pointerID, const vec2& _pos);
|
||||
virtual void OS_SetInputState(int _pointerID, bool _isDown, const vec2& _pos);
|
||||
|
||||
virtual void OS_SetMouseMotion(int _pointerID, const vec2& _pos);
|
||||
virtual void OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _pos);
|
||||
|
||||
virtual void OS_SetKeyboard(gale::key::Special& _special,
|
||||
char32_t _myChar,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey=false);
|
||||
virtual void OS_SetKeyboardMove(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _move,
|
||||
bool _isDown,
|
||||
bool _isARepeateKey=false);
|
||||
virtual void OS_SetInput(enum gale::key::type _type,
|
||||
enum gale::key::status _status,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos);
|
||||
virtual void OS_setKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
enum gale::key::status _state,
|
||||
bool _isARepeateKey = false,
|
||||
char32_t _char = u32char::Null);
|
||||
/**
|
||||
* @brief The current context is suspended
|
||||
*/
|
||||
@ -285,9 +278,6 @@ namespace gale {
|
||||
* @return normal error int for the application error management
|
||||
*/
|
||||
static int main(int _argc, const char *_argv[]);
|
||||
private:
|
||||
size_t m_initStepId;
|
||||
size_t m_initTotalStep;
|
||||
public:
|
||||
/**
|
||||
* @brief Special for init (main) set the start image when loading data
|
||||
|
@ -76,16 +76,28 @@ public:
|
||||
OS_Resize(vec2(_x,_y));
|
||||
}
|
||||
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||
OS_SetMouseState(_id, _isDown, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
||||
OS_SetMouseMotion(_id, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetInputState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||
OS_SetInputState(_id, _isDown, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_finger,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetInputMotion(int32_t _id, float _x, float _y) {
|
||||
OS_SetInputMotion(_id, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_finger,
|
||||
gale::key::status_move,
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetKeyboard(gale::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) {
|
||||
if (_unichar == u32char::Delete) {
|
||||
@ -113,15 +125,24 @@ public:
|
||||
move = gale::key::keyboardRight;
|
||||
break;
|
||||
}
|
||||
OS_SetKeyboardMove(_keyboardMode, move, !_isDown, _isAReapeateKey);
|
||||
OS_setKeyboard(_keyboardMode,
|
||||
move,
|
||||
(_isDown==false?gale::key::status_down:gale::key::status_up),
|
||||
_isARepeateKey);
|
||||
} else {
|
||||
OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey);
|
||||
OS_setKeyboard(_keyboardMode,
|
||||
gale::key::keyboard_char,
|
||||
(_isDown==false?gale::key::status_down:gale::key::status_up),
|
||||
_isARepeateKey,
|
||||
_unichar);
|
||||
}
|
||||
}
|
||||
void MAC_SetKeyboardMove(gale::key::Special& _special,
|
||||
enum gale::key::keyboard _move,
|
||||
bool _isDown) {
|
||||
OS_SetKeyboardMove(_special, _move, _isDown);
|
||||
OS_setKeyboard(_keyboardMode,
|
||||
_move,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up));
|
||||
}
|
||||
void openURL(const std::string& _url) {
|
||||
mm_openURL(_url.c_str());
|
||||
|
@ -1,202 +0,0 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/etk.h>
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <etk/os/Fifo.h>
|
||||
#include <etk/Hash.h>
|
||||
#include <etk/thread/tools.h>
|
||||
#include <mutex>
|
||||
#include <date/date.h>
|
||||
#include <gale/gale.h>
|
||||
#include <gale/Dimension.h>
|
||||
#include <gale/debug.h>
|
||||
|
||||
#include <gale/context/LoopAction.h>
|
||||
#include <gale/context/Context.h>
|
||||
|
||||
etk::Hash<std::function<std::shared_ptr<gale::context::LoopAction>(const std::string&)> >& getList() {
|
||||
static etk::Hash<std::function<std::shared_ptr<gale::context::LoopAction>(const std::string&)> > list;
|
||||
return list;
|
||||
}
|
||||
|
||||
std::shared_ptr<gale::context::LoopAction> gale::context::createAction(const std::string& _lineToParse) {
|
||||
// TODO: parse line ...
|
||||
std::string _name = "lkjlkjlkjlk";
|
||||
std::string nameLower = etk::tolower(_name);
|
||||
if (getList().exist(nameLower) == true) {
|
||||
std::function<std::shared_ptr<gale::context::LoopAction>(const std::string&)> func = getList()[nameLower];
|
||||
if (func != nullptr) {
|
||||
return func(_lineToParse);
|
||||
}
|
||||
}
|
||||
GALE_WARNING("try to create an UnExistant widget : " << nameLower);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void gale::context::addFactory(const std::string& _type, const std::function<std::shared_ptr<gale::context::LoopAction>(const std::string&)>& _func) {
|
||||
if (_func == nullptr) {
|
||||
return;
|
||||
}
|
||||
//Keep name in lower case :
|
||||
std::string nameLower = etk::tolower(_type);
|
||||
if (true == getList().exist(nameLower)) {
|
||||
GALE_WARNING("Replace Creator of a loop action : " << nameLower);
|
||||
getList()[nameLower] = _func;
|
||||
return;
|
||||
}
|
||||
GALE_INFO("Add Creator of a specify loop action : " << nameLower);
|
||||
getList().add(nameLower, _func);
|
||||
}
|
||||
|
||||
gale::context::LoopAction::LoopAction() {
|
||||
m_timestamp = gale::getTime();
|
||||
}
|
||||
|
||||
gale::context::LoopAction::~LoopAction() {
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void gale::context::LoopActionInit::doAction(gale::Context& _context) {
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
// this is due to the openGL context
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onCreate(_context);
|
||||
appl->onStart(_context);
|
||||
appl->onResume(_context);
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionInit::createString() {
|
||||
return etk::to_string(m_timestamp) + ":INIT";
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
gale::context::LoopActionResize::LoopActionResize(const vec2& _size) :
|
||||
m_size(_size) {
|
||||
|
||||
}
|
||||
|
||||
void gale::context::LoopActionResize::doAction(gale::Context& _context) {
|
||||
//GALE_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
_context.m_windowsSize = m_size;
|
||||
gale::Dimension::setPixelWindowsSize(_context.m_windowsSize);
|
||||
_context.forceRedrawAll();
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionResize::createString() {
|
||||
return etk::to_string(m_timestamp) + ":RESIZE:" + etk::to_string(m_size);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
gale::context::LoopActionView::LoopActionView(bool _show) :
|
||||
m_show(_show) {
|
||||
|
||||
}
|
||||
|
||||
void gale::context::LoopActionView::doAction(gale::Context& _context) {
|
||||
GALE_TODO("kjhkjhkhkjh");
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionView::createString() {
|
||||
return etk::to_string(m_timestamp) + ":VIEW:" + etk::to_string(m_show);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void gale::context::LoopActionRecalculateSize::doAction(gale::Context& _context) {
|
||||
_context.forceRedrawAll();
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionRecalculateSize::createString() {
|
||||
return etk::to_string(m_timestamp) + ":RECALCULATE_SIZE";
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
gale::context::LoopActionInput::LoopActionInput(enum gale::key::type _type,
|
||||
enum gale::key::status _status,
|
||||
int32_t _pointerID,
|
||||
const vec2& _pos) :
|
||||
m_type(_type),
|
||||
m_status(_status),
|
||||
m_pointerID(_pointerID),
|
||||
m_pos(_pos) {
|
||||
|
||||
}
|
||||
|
||||
void gale::context::LoopActionInput::doAction(gale::Context& _context) {
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onPointer(m_type,
|
||||
m_pointerID,
|
||||
m_pos,
|
||||
m_status);
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionInput::createString() {
|
||||
return etk::to_string(m_timestamp) + ":INPUT:" + etk::to_string(m_type) + ":" + etk::to_string(m_status) + ":" + etk::to_string(m_pointerID) + ":" + etk::to_string(m_pos);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
gale::context::LoopActionKeyboard::LoopActionKeyboard(const gale::key::Special& _special,
|
||||
enum gale::key::keyboard _type,
|
||||
enum gale::key::status _state,
|
||||
char32_t _char) :
|
||||
m_special(_special),
|
||||
m_type(_type),
|
||||
m_state(_state),
|
||||
m_char(_char) {
|
||||
|
||||
}
|
||||
|
||||
void gale::context::LoopActionKeyboard::doAction(gale::Context& _context) {
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl == nullptr) {
|
||||
return;
|
||||
}
|
||||
appl->onKeyboard(m_special,
|
||||
m_type,
|
||||
m_char,
|
||||
m_state);
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionKeyboard::createString() {
|
||||
return etk::to_string(m_timestamp) + ":KEYBOARD:" + etk::to_string(m_special) + ":" + etk::to_string(m_type) + ":" + etk::to_string(m_state) + ":" + etk::to_string(uint64_t(m_char));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
gale::context::LoopActionClipboardArrive::LoopActionClipboardArrive(enum gale::context::clipBoard::clipboardListe _id) :
|
||||
m_id(_id) {
|
||||
|
||||
}
|
||||
|
||||
void gale::context::LoopActionClipboardArrive::doAction(gale::Context& _context) {
|
||||
std::shared_ptr<gale::Application> appl = _context.getApplication();
|
||||
if (appl != nullptr) {
|
||||
appl->onClipboardEvent(m_id);
|
||||
}
|
||||
}
|
||||
|
||||
std::string gale::context::LoopActionClipboardArrive::createString() {
|
||||
return etk::to_string(m_timestamp) + ":CLIPBOARD_ARRIVE:" + etk::to_string(m_id);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1,112 +0,0 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __GALE_CONTEXT_LOOP_ACTION_H__
|
||||
#define __GALE_CONTEXT_LOOP_ACTION_H__
|
||||
|
||||
#include <etk/os/Fifo.h>
|
||||
#include <gale/debug.h>
|
||||
#include <gale/gale.h>
|
||||
#include <gale/key/key.h>
|
||||
#include <memory>
|
||||
#define MAX_MANAGE_INPUT (15)
|
||||
|
||||
namespace gale {
|
||||
namespace context {
|
||||
|
||||
class LoopAction : public std::enable_shared_from_this<LoopAction> {
|
||||
protected:
|
||||
int64_t m_timestamp; //!< time of the signal is emit (used for simulation)
|
||||
public:
|
||||
LoopAction();
|
||||
virtual ~LoopAction();
|
||||
virtual void doAction(gale::Context& _context) = 0;
|
||||
virtual std::string createString() = 0;
|
||||
};
|
||||
/**
|
||||
* @brief Create action from the simulation string line
|
||||
* @param[in] _lineToParse Simulation string line
|
||||
* @return Created action.
|
||||
*/
|
||||
std::shared_ptr<LoopAction> createAction(const std::string& _lineToParse);
|
||||
/**
|
||||
* @brief Add a factory to create an event from a specific type
|
||||
* @param[in] _type Type of the action
|
||||
* @param[in] _func function to call to create
|
||||
* @return Created action.
|
||||
*/
|
||||
void addFactory(const std::string& _type, const std::function<std::shared_ptr<LoopAction>(const std::string&)>& _func);
|
||||
|
||||
class LoopActionInit : public LoopAction {
|
||||
public:
|
||||
LoopActionInit() {};
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionResize : public LoopAction {
|
||||
protected:
|
||||
vec2 m_size;
|
||||
public:
|
||||
LoopActionResize(const vec2& _size);
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionView : public LoopAction {
|
||||
protected:
|
||||
bool m_show;
|
||||
public:
|
||||
LoopActionView(bool _show);
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionRecalculateSize : public LoopAction {
|
||||
public:
|
||||
LoopActionRecalculateSize() {};
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionInput : public LoopAction {
|
||||
private:
|
||||
enum gale::key::type m_type;
|
||||
enum gale::key::status m_status;
|
||||
int32_t m_pointerID;
|
||||
const vec2& m_pos;
|
||||
public:
|
||||
LoopActionInput(enum gale::key::type _type, enum gale::key::status _status, int32_t _pointerID, const vec2& _pos);
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionKeyboard : public LoopAction {
|
||||
private:
|
||||
gale::key::Special m_special;
|
||||
enum gale::key::keyboard m_type;
|
||||
enum gale::key::status m_state;
|
||||
char32_t m_char;
|
||||
public:
|
||||
LoopActionKeyboard(const gale::key::Special& _special, enum gale::key::keyboard _type, enum gale::key::status _state, char32_t _char=u32char::Null);
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
|
||||
class LoopActionClipboardArrive : public LoopAction {
|
||||
private:
|
||||
enum gale::context::clipBoard::clipboardListe m_id;
|
||||
public:
|
||||
LoopActionClipboardArrive(enum gale::context::clipBoard::clipboardListe _id);
|
||||
virtual void doAction(gale::Context& _context);
|
||||
virtual std::string createString();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -74,12 +74,18 @@ class MacOSInterface : public ewol::Context {
|
||||
OS_Resize(vec2(_x,_y));
|
||||
}
|
||||
void MAC_SetMouseState(int32_t _id, bool _isDown, float _x, float _y) {
|
||||
OS_SetMouseState(_id, _isDown, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(_isDown==true?gale::key::status_down:gale::key::status_up),
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetMouseMotion(int32_t _id, float _x, float _y) {
|
||||
OS_SetMouseMotion(_id, vec2(_x, _y));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
_id,
|
||||
vec2(_x, _y));
|
||||
}
|
||||
void MAC_SetKeyboard(ewol::key::Special _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) {
|
||||
void MAC_SetKeyboard(ewol::key::Special _special, int32_t _unichar, bool _isDown, bool _isAReapeateKey) {
|
||||
if (char32_t(_unichar) == u32char::Delete) {
|
||||
_unichar = u32char::Suppress;
|
||||
} else if (char32_t(_unichar) == u32char::Suppress) {
|
||||
@ -105,16 +111,16 @@ class MacOSInterface : public ewol::Context {
|
||||
move = ewol::key::keyboardRight;
|
||||
break;
|
||||
}
|
||||
OS_SetKeyboardMove(_keyboardMode, move, !_isDown, _isAReapeateKey);
|
||||
OS_setKeyboard(_special, move, (_isDown==false?gale::key::status_down:gale::key::status_up), _isAReapeateKey);
|
||||
} else {
|
||||
OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey);
|
||||
OS_setKeyboard(_special, gale::key::keyboard_char, (_isDown==false?gale::key::status_down:gale::key::status_up), _isAReapeateKey, _unichar);
|
||||
}
|
||||
}
|
||||
void MAC_SetKeyboardMove(ewol::key::Special& _special,
|
||||
enum ewol::key::keyboard _move,
|
||||
bool _isDown,
|
||||
bool _isAReapeateKey) {
|
||||
OS_SetKeyboardMove(_special, _move, _isDown, _isAReapeateKey);
|
||||
OS_setKeyboard(_special, _move, (_isDown==true?gale::key::status_down:gale::key::status_up), _isAReapeateKey);
|
||||
}
|
||||
void openURL(const std::string& _url) {
|
||||
std::string req = "open " + _url;
|
||||
|
@ -398,9 +398,15 @@ class WindowsContext : public gale::Context {
|
||||
GALE_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
|
||||
if (tmpChar == 0) {
|
||||
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
||||
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, buttonIsDown);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
move,
|
||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up));
|
||||
} else {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, buttonIsDown);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
||||
false,
|
||||
tmpChar);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -414,7 +420,10 @@ class WindowsContext : public gale::Context {
|
||||
pos.setValue(GET_X_LPARAM(_lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
||||
mouseButtonId,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
@ -424,7 +433,10 @@ class WindowsContext : public gale::Context {
|
||||
pos.setValue(GET_X_LPARAM(_lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
||||
mouseButtonId,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
@ -434,7 +446,10 @@ class WindowsContext : public gale::Context {
|
||||
pos.setValue(GET_X_LPARAM(_lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
(buttonIsDown==true?gale::key::status_down:gale::key::status_up),
|
||||
mouseButtonId,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
@ -447,8 +462,14 @@ class WindowsContext : public gale::Context {
|
||||
}
|
||||
pos.setValue(GET_X_LPARAM(_lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||
OS_SetMouseState(mouseButtonId, true, vec2(pos.x(),pos.y()));
|
||||
OS_SetMouseState(mouseButtonId, false, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_down,
|
||||
mouseButtonId,
|
||||
vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_up,
|
||||
mouseButtonId,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEHOVER:
|
||||
@ -458,12 +479,18 @@ class WindowsContext : public gale::Context {
|
||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
||||
if (true == m_inputIsPressed[iii]) {
|
||||
GALE_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||
OS_SetMouseMotion(iii, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_motion),
|
||||
iii,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
GALE_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||
OS_SetMouseMotion(0, vec2(pos.x(),pos.y()));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_motion),
|
||||
0,
|
||||
vec2(pos.x(),pos.y()));
|
||||
return 0;
|
||||
|
||||
default:
|
||||
|
@ -435,7 +435,10 @@ class X11Interface : public gale::Context {
|
||||
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
||||
m_inputIsPressed[event.xbutton.button] = true;
|
||||
}
|
||||
OS_SetMouseState(event.xbutton.button, true, vec2(event.xbutton.x, m_cursorEventY));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_down,
|
||||
event.xbutton.button,
|
||||
vec2(event.xbutton.x, m_cursorEventY));
|
||||
break;
|
||||
case ButtonRelease:
|
||||
X11_INFO("X11 event ButtonRelease");
|
||||
@ -444,7 +447,10 @@ class X11Interface : public gale::Context {
|
||||
if (event.xbutton.button < MAX_MANAGE_INPUT) {
|
||||
m_inputIsPressed[event.xbutton.button] = false;
|
||||
}
|
||||
OS_SetMouseState(event.xbutton.button, false, vec2(event.xbutton.x, m_cursorEventY));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_up,
|
||||
event.xbutton.button,
|
||||
vec2(event.xbutton.x, m_cursorEventY));
|
||||
break;
|
||||
case EnterNotify:
|
||||
X11_INFO("X11 event EnterNotify");
|
||||
@ -490,13 +496,19 @@ class X11Interface : public gale::Context {
|
||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
||||
if (true == m_inputIsPressed[iii]) {
|
||||
X11_DEBUG("X11 event: bt=" << iii << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
||||
OS_SetMouseMotion(iii, vec2(m_cursorEventX, m_cursorEventY));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
iii,
|
||||
vec2(m_cursorEventX, m_cursorEventY));
|
||||
findOne = true;
|
||||
}
|
||||
}
|
||||
if (false == findOne) {
|
||||
X11_DEBUG("X11 event: bt=" << 0 << " " << event.type << " = \"MotionNotify\" (" << m_cursorEventX << "," << m_cursorEventY << ")");
|
||||
OS_SetMouseMotion(0, vec2(m_cursorEventX, m_cursorEventY));
|
||||
OS_SetInput(gale::key::type_mouse,
|
||||
gale::key::status_move,
|
||||
0,
|
||||
vec2(m_cursorEventX, m_cursorEventY));
|
||||
}
|
||||
if (true == m_grabAllEvent) {
|
||||
if (m_positionChangeRequested == false) {
|
||||
@ -644,22 +656,46 @@ class X11Interface : public gale::Context {
|
||||
case 91: // Suppr on keypad
|
||||
find = false;
|
||||
if(m_guiKeyBoardMode.getNumLock() == true){
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, '.', (event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
'.');
|
||||
if (true == thisIsAReapeateKey) {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, '.', !(event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
'.');
|
||||
}
|
||||
} else {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, (event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
0x7F);
|
||||
if (true == thisIsAReapeateKey) {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, 0x7F, !(event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
0x7F);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 23: // special case for TAB
|
||||
find = false;
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, (event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
0x09);
|
||||
if (true == thisIsAReapeateKey) {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, 0x09, !(event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
0x09);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -691,9 +727,17 @@ class X11Interface : public gale::Context {
|
||||
m_lastKeyPressed = utf8::convertChar32(buf);
|
||||
}
|
||||
X11_INFO("event Key : " << event.xkey.keycode << " char=\"" << buf << "\"'len=" << strlen(buf) << " unicode=" << m_lastKeyPressed);
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, m_lastKeyPressed, (event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
m_lastKeyPressed);
|
||||
if (true == thisIsAReapeateKey) {
|
||||
OS_SetKeyboard(m_guiKeyBoardMode, m_lastKeyPressed, !(event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
gale::key::keyboard_char,
|
||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey,
|
||||
m_lastKeyPressed);
|
||||
}
|
||||
} else {
|
||||
GALE_WARNING("Unknow event Key : " << event.xkey.keycode << " res='" << buf << "' repeate=" << thisIsAReapeateKey);
|
||||
@ -703,9 +747,15 @@ class X11Interface : public gale::Context {
|
||||
}
|
||||
if (true == find) {
|
||||
//GALE_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
||||
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, (event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
keyInput,
|
||||
(event.type==KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey);
|
||||
if (true == thisIsAReapeateKey) {
|
||||
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, !(event.type == KeyPress), thisIsAReapeateKey);
|
||||
OS_setKeyboard(m_guiKeyBoardMode,
|
||||
keyInput,
|
||||
(event.type!=KeyPress?gale::key::status_down:gale::key::status_up),
|
||||
thisIsAReapeateKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ def create(target):
|
||||
'gale/context/commandLine.cpp',
|
||||
'gale/context/Context.cpp',
|
||||
'gale/context/cursor.cpp',
|
||||
'gale/context/LoopAction.cpp',
|
||||
#'gale/context/InputManager.cpp'
|
||||
])
|
||||
if target.name=="Linux":
|
||||
myModule.add_src_file('gale/context/X11/Context.cpp')
|
||||
|
Loading…
x
Reference in New Issue
Block a user