grep mouse event in the Windows platform
This commit is contained in:
parent
d75f9e97a1
commit
69993f8c59
2
Build
2
Build
@ -1 +1 @@
|
|||||||
Subproject commit 3db5b49b02a5f2fea62b6113d3e01efd5974cc3c
|
Subproject commit d51a211876127e44d0618683d0aeff154f87d64f
|
@ -44,7 +44,7 @@ etk::UString baseApplName = "ewolNoName";
|
|||||||
etk::UString baseFolderCache = "/sdcard/.tmp/cache/"; // Temporary data (can be removed the next time)
|
etk::UString baseFolderCache = "/sdcard/.tmp/cache/"; // Temporary data (can be removed the next time)
|
||||||
#else
|
#else
|
||||||
etk::UString baseFolderHome = "~"; // home folder
|
etk::UString baseFolderHome = "~"; // home folder
|
||||||
etk::UString baseFolderData = "assets/"; // program Data
|
etk::UString baseFolderData = "share/"; // program Data
|
||||||
etk::UString baseFolderDataUser = "~/.tmp/userData/"; // Data specific user (local modification)
|
etk::UString baseFolderDataUser = "~/.tmp/userData/"; // Data specific user (local modification)
|
||||||
etk::UString baseFolderCache = "~/.tmp/cache/"; // Temporary data (can be removed the next time)
|
etk::UString baseFolderCache = "~/.tmp/cache/"; // Temporary data (can be removed the next time)
|
||||||
#endif
|
#endif
|
||||||
@ -122,11 +122,11 @@ void etk::InitDefaultFolder(const char * applName)
|
|||||||
#else
|
#else
|
||||||
char cCurrentPath[FILENAME_MAX];
|
char cCurrentPath[FILENAME_MAX];
|
||||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||||
baseFolderData = "./assets/";
|
baseFolderData = "./share/";
|
||||||
} else {
|
} else {
|
||||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||||
baseFolderData = cCurrentPath;
|
baseFolderData = cCurrentPath;
|
||||||
baseFolderData += "/assets/";
|
baseFolderData += "/share/";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
baseFolderDataUser = baseFolderHome;
|
baseFolderDataUser = baseFolderHome;
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
#include <etk/TypesCoordonate.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <etk/unicode.h>
|
#include <etk/unicode.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
@ -40,6 +42,9 @@ int32_t separateClickTime = 300000;
|
|||||||
int32_t offsetMoveClicked = 10000;
|
int32_t offsetMoveClicked = 10000;
|
||||||
int32_t offsetMoveClickedDouble = 20000;
|
int32_t offsetMoveClickedDouble = 20000;
|
||||||
|
|
||||||
|
bool inputIsPressed[20];
|
||||||
|
|
||||||
|
|
||||||
void ewol::SetTitle(etk::UString title)
|
void ewol::SetTitle(etk::UString title)
|
||||||
{
|
{
|
||||||
// TODO ...
|
// TODO ...
|
||||||
@ -48,7 +53,7 @@ void ewol::SetTitle(etk::UString title)
|
|||||||
|
|
||||||
void EWOL_NativeRender(void)
|
void EWOL_NativeRender(void)
|
||||||
{
|
{
|
||||||
EWOL_GenericDraw(false);
|
EWOL_GenericDraw(true);
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,8 +120,15 @@ void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
|
|||||||
|
|
||||||
bool guiAbstraction::IsPressedInput(int32_t inputID)
|
bool guiAbstraction::IsPressedInput(int32_t inputID)
|
||||||
{
|
{
|
||||||
|
if( NB_MAX_INPUT > inputID
|
||||||
|
&& 0 <= inputID)
|
||||||
|
{
|
||||||
|
return inputIsPressed[inputID];
|
||||||
|
} else {
|
||||||
|
EWOL_WARNING("Wrong input ID : " << inputID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -211,6 +223,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
|
||||||
|
inputIsPressed[iii] = false;
|
||||||
|
}
|
||||||
|
|
||||||
// start X11 thread ...
|
// start X11 thread ...
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
//start the basic thread :
|
//start the basic thread :
|
||||||
@ -241,14 +258,11 @@ int main(int argc, char *argv[])
|
|||||||
int plop(void)
|
int plop(void)
|
||||||
{
|
{
|
||||||
HINSTANCE hInstance = 0;
|
HINSTANCE hInstance = 0;
|
||||||
HINSTANCE hPrevInstance = 0;
|
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
HGLRC hRC;
|
HGLRC hRC;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
BOOL quit = FALSE;
|
|
||||||
float theta = 0.0f;
|
|
||||||
|
|
||||||
// register window class
|
// register window class
|
||||||
wc.style = CS_OWNDC;
|
wc.style = CS_OWNDC;
|
||||||
@ -307,9 +321,14 @@ int plop(void)
|
|||||||
|
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
bool mouseButtonIsDown = true;
|
||||||
|
int32_t mouseButtonId = 0;
|
||||||
|
Vector2D<int32_t> pos;
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
|
/* **************************************************************************
|
||||||
|
* Gui event
|
||||||
|
* **************************************************************************/
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
EWOL_DEBUG("WM_CREATE");
|
EWOL_DEBUG("WM_CREATE");
|
||||||
return 0;
|
return 0;
|
||||||
@ -317,11 +336,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
EWOL_DEBUG("WM_CLOSE");
|
EWOL_DEBUG("WM_CLOSE");
|
||||||
PostQuitMessage( 0 );
|
PostQuitMessage( 0 );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
EWOL_DEBUG("WM_DESTROY");
|
EWOL_DEBUG("WM_DESTROY");
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_MOVE:
|
||||||
|
EWOL_DEBUG("WM_MOVE");
|
||||||
|
return 0;
|
||||||
|
case WM_SIZE:
|
||||||
|
EWOL_DEBUG("WM_SIZE");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
/* **************************************************************************
|
||||||
|
* Keyboard management
|
||||||
|
* **************************************************************************/
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
EWOL_DEBUG("WM_KEYDOWN");
|
EWOL_DEBUG("WM_KEYDOWN");
|
||||||
switch ( wParam ) {
|
switch ( wParam ) {
|
||||||
@ -330,21 +357,56 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case WM_MOVE:
|
/* **************************************************************************
|
||||||
EWOL_DEBUG("WM_MOVE");
|
* Mouse management
|
||||||
|
* **************************************************************************/
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
mouseButtonIsDown = false;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
mouseButtonId = 1;
|
||||||
|
pos.x = GET_X_LPARAM(lParam);
|
||||||
|
pos.y = GET_Y_LPARAM(lParam);
|
||||||
|
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
|
||||||
|
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SIZE:
|
case WM_MBUTTONUP:
|
||||||
EWOL_DEBUG("WM_SIZE");
|
mouseButtonIsDown = false;
|
||||||
|
case WM_MBUTTONDOWN:
|
||||||
|
mouseButtonId = 2;
|
||||||
|
pos.x = GET_X_LPARAM(lParam);
|
||||||
|
pos.y = GET_Y_LPARAM(lParam);
|
||||||
|
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
|
||||||
|
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
mouseButtonIsDown = false;
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
mouseButtonId = 3;
|
||||||
|
pos.x = GET_X_LPARAM(lParam);
|
||||||
|
pos.y = GET_Y_LPARAM(lParam);
|
||||||
|
inputIsPressed[mouseButtonId] = mouseButtonIsDown;
|
||||||
|
guiSystem::event::SetMouseState(mouseButtonId, mouseButtonIsDown, (float)pos.x, (float)pos.y);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// TODO : Set the other bt ...
|
||||||
|
|
||||||
|
case WM_MOUSEHOVER:
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
{
|
pos.x = GET_X_LPARAM(lParam);
|
||||||
int32_t posX = GET_X_LPARAM(lParam);
|
pos.y = GET_Y_LPARAM(lParam);
|
||||||
int32_t posY = GET_Y_LPARAM(lParam);
|
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
|
||||||
EWOL_DEBUG("WM_MOUSEMOVE : (" << posX << "," << posY << ")");
|
if (true == inputIsPressed[iii]) {
|
||||||
|
EWOL_VERBOSE("Windows event: bt=" << iii << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
|
guiSystem::event::SetMouseMotion(iii, (float)pos.x, (float)pos.y);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
|
guiSystem::event::SetMouseMotion(0, (float)pos.x, (float)pos.y);
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
EWOL_DEBUG("event ..." << message );
|
EWOL_VERBOSE("event ..." << message );
|
||||||
return DefWindowProc( hWnd, message, wParam, lParam );
|
return DefWindowProc( hWnd, message, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,9 +451,6 @@ void X11_Init(void)
|
|||||||
m_originY = 0;
|
m_originY = 0;
|
||||||
m_cursorEventX = 0;
|
m_cursorEventX = 0;
|
||||||
m_cursorEventY = 0;
|
m_cursorEventY = 0;
|
||||||
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
|
|
||||||
inputIsPressed[iii] = false;
|
|
||||||
}
|
|
||||||
CreateX11Context();
|
CreateX11Context();
|
||||||
CreateOGlContext();
|
CreateOGlContext();
|
||||||
// reset clipBoard
|
// reset clipBoard
|
||||||
@ -1230,6 +1227,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int32_t iii=0; iii<NB_MAX_INPUT; iii++) {
|
||||||
|
inputIsPressed[iii] = false;
|
||||||
|
}
|
||||||
|
|
||||||
// start X11 thread ...
|
// start X11 thread ...
|
||||||
X11_Init();
|
X11_Init();
|
||||||
//start the basic thread :
|
//start the basic thread :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user