[DEBUG] windows compialtion is back (not tested)
This commit is contained in:
parent
942b3a155d
commit
4d54a562fc
2
build
2
build
@ -1 +1 @@
|
|||||||
Subproject commit b1cbee3b4b65bacad8abbbbdc99cdf9e472b76e4
|
Subproject commit e46e6add5ecf90b8bbe0436628936d774b8b3f85
|
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 3db451068b0a00411a9a89301986fcd99cab5115
|
Subproject commit 311346dce226ae70133dd3d68b27c0c1eb22f525
|
@ -9,15 +9,15 @@
|
|||||||
|
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <etk/os/FSNode.h>
|
||||||
|
|
||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
#include <etk/math/Vector3D.h>
|
#include <etk/math/Vector3D.h>
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/unicode.h>
|
|
||||||
#include <ewol/widget/Manager.h>
|
#include <ewol/widget/Manager.h>
|
||||||
|
|
||||||
#include <ewol/resources/Texture.h>
|
#include <ewol/resource/Texture.h>
|
||||||
#include <ewol/resources/Image.h>
|
#include <ewol/resource/Image.h>
|
||||||
#include <ewol/context/Context.h>
|
#include <ewol/context/Context.h>
|
||||||
#include <ewol/openGL/openGL.h>
|
#include <ewol/openGL/openGL.h>
|
||||||
|
|
||||||
@ -39,16 +39,16 @@ int64_t ewol::getTime() {
|
|||||||
#define __class__ "ContextWindows"
|
#define __class__ "ContextWindows"
|
||||||
|
|
||||||
|
|
||||||
class WindowsContext : public ewol::eContext {
|
class WindowsContext : public ewol::Context {
|
||||||
private:
|
private:
|
||||||
int32_t m_currentHeight = 0;
|
int32_t m_currentHeight = 0;
|
||||||
bool m_inputIsPressed[MAX_MANAGE_INPUT];
|
bool m_inputIsPressed[MAX_MANAGE_INPUT];
|
||||||
ewol::SpecialKey m_guiKeyBoardMode;
|
ewol::key::Special m_guiKeyBoardMode;
|
||||||
bool m_run = true;
|
bool m_run = true;
|
||||||
bool m_clipBoardOwnerStd = false;
|
bool m_clipBoardOwnerStd = false;
|
||||||
public:
|
public:
|
||||||
WindowsContext(ewol::context::Application* _application, int32_t _argc, char* _argv[]) :
|
WindowsContext(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||||
ewol::eContext(_application, _argc, _argv) {
|
ewol::Context(_application, _argc, _argv) {
|
||||||
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
|
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
|
||||||
m_inputIsPressed[iii] = false;
|
m_inputIsPressed[iii] = false;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class WindowsContext : public ewol::eContext {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Run() {
|
int32_t run() {
|
||||||
HINSTANCE hInstance = 0;
|
HINSTANCE hInstance = 0;
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
@ -72,8 +72,8 @@ class WindowsContext : public ewol::eContext {
|
|||||||
wc.cbClsExtra = 0;
|
wc.cbClsExtra = 0;
|
||||||
wc.cbWndExtra = 0;
|
wc.cbWndExtra = 0;
|
||||||
wc.hInstance = hInstance;
|
wc.hInstance = hInstance;
|
||||||
wc.hIcon = loadIcon( nullptr, IDI_APPLICATION );
|
wc.hIcon = LoadIcon( nullptr, IDI_APPLICATION );
|
||||||
wc.hCursor = loadCursor( nullptr, IDC_ARROW );
|
wc.hCursor = LoadCursor( nullptr, IDC_ARROW );
|
||||||
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
||||||
wc.lpszMenuName = nullptr;
|
wc.lpszMenuName = nullptr;
|
||||||
wc.lpszClassName = "EwolMainWindows";
|
wc.lpszClassName = "EwolMainWindows";
|
||||||
@ -83,11 +83,11 @@ class WindowsContext : public ewol::eContext {
|
|||||||
hWnd = CreateWindow( "EwolMainWindows", "Ewol ... TODO Title",
|
hWnd = CreateWindow( "EwolMainWindows", "Ewol ... TODO Title",
|
||||||
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX,
|
WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_SIZEBOX,
|
||||||
0, 0, 800, 600,
|
0, 0, 800, 600,
|
||||||
nullptr, NULL, hInstance, NULL );
|
nullptr, nullptr, hInstance, nullptr);
|
||||||
int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
|
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||||
int title_size = getSystemMetrics(SM_CYCAPTION);
|
int title_size = GetSystemMetrics(SM_CYCAPTION);
|
||||||
m_currentHeight = 600-2*border_thickness -title_size;
|
m_currentHeight = 600-2*border_thickness -title_size;
|
||||||
OS_Resize(800-2*border_thickness, m_currentHeight);
|
OS_Resize(vec2(800-2*border_thickness, m_currentHeight));
|
||||||
|
|
||||||
// enable openGL for the window
|
// enable openGL for the window
|
||||||
enableOpenGL( hWnd, &hDC, &hRC );
|
enableOpenGL( hWnd, &hDC, &hRC );
|
||||||
@ -100,11 +100,11 @@ class WindowsContext : public ewol::eContext {
|
|||||||
if ( msg.message == WM_QUIT ) {
|
if ( msg.message == WM_QUIT ) {
|
||||||
m_run = false;
|
m_run = false;
|
||||||
} else {
|
} else {
|
||||||
translateMessage( &msg );
|
TranslateMessage( &msg );
|
||||||
DispatchMessage( &msg );
|
DispatchMessage( &msg );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
()Draw(true);
|
OS_Draw(true);
|
||||||
SwapBuffers( hDC );
|
SwapBuffers( hDC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,10 +122,10 @@ class WindowsContext : public ewol::eContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSize(const vec2& _size) {
|
void setSize(const vec2& _size) {
|
||||||
int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
|
float border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||||
int title_size = getSystemMetrics(SM_CYCAPTION);
|
float title_size = GetSystemMetrics(SM_CYCAPTION);
|
||||||
size.setValue(_size.x() + border_thickness*2,
|
vec2 newSize(_size.x() + border_thickness*2.0f,
|
||||||
_size.y() + border_thickness*2 + title_size);
|
_size.y() + border_thickness*2.0f + title_size);
|
||||||
//m_currentHeight = size.y;
|
//m_currentHeight = size.y;
|
||||||
// TODO : Later
|
// TODO : Later
|
||||||
}
|
}
|
||||||
@ -133,21 +133,20 @@ class WindowsContext : public ewol::eContext {
|
|||||||
void ClipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
void ClipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||||
// this is to force the local system to think we have the buffer
|
// this is to force the local system to think we have the buffer
|
||||||
// TODO : remove this 2 line when code will be writen
|
// TODO : remove this 2 line when code will be writen
|
||||||
l_clipBoardOwnerStd = true;
|
m_clipBoardOwnerStd = true;
|
||||||
switch (_clipboardID)
|
switch (_clipboardID) {
|
||||||
{
|
|
||||||
case ewol::context::clipBoard::clipboardSelection:
|
case ewol::context::clipBoard::clipboardSelection:
|
||||||
// NOTE : Windows does not support the middle button the we do it internaly
|
// NOTE : Windows does not support the middle button the we do it internaly
|
||||||
// just transmit an event , we have the data in the system
|
// just transmit an event , we have the data in the system
|
||||||
ClipBoardArrive(_clipboardID);
|
OS_ClipBoardArrive(ewol::context::clipBoard::clipboardSelection);
|
||||||
break;
|
break;
|
||||||
case ewol::context::clipBoard::clipboardStd:
|
case ewol::context::clipBoard::clipboardStd:
|
||||||
if (false == l_clipBoardOwnerStd) {
|
if (false == m_clipBoardOwnerStd) {
|
||||||
// generate a request TO the OS
|
// generate a request TO the OS
|
||||||
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
|
// TODO : Send the message to the OS "We disire to receive the copy buffer ...
|
||||||
} else {
|
} else {
|
||||||
// just transmit an event , we have the data in the system
|
// just transmit an event , we have the data in the system
|
||||||
ClipBoardArrive(_clipboardID);
|
OS_ClipBoardArrive(ewol::context::clipBoard::clipboardStd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -157,8 +156,7 @@ class WindowsContext : public ewol::eContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
void ClipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||||
switch (_clipboardID)
|
switch (_clipboardID) {
|
||||||
{
|
|
||||||
case ewol::context::clipBoard::clipboardSelection:
|
case ewol::context::clipBoard::clipboardSelection:
|
||||||
// NOTE : nothing to do : Windows deas ot supported Middle button
|
// NOTE : nothing to do : Windows deas ot supported Middle button
|
||||||
break;
|
break;
|
||||||
@ -180,11 +178,11 @@ class WindowsContext : public ewol::eContext {
|
|||||||
// enable openGL
|
// enable openGL
|
||||||
void enableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC) {
|
void enableOpenGL(HWND _hWnd, HDC* _hDC, HGLRC* _hRC) {
|
||||||
// get the device context (DC)
|
// get the device context (DC)
|
||||||
*hDC = getDC( _hWnd );
|
*_hDC = GetDC( _hWnd );
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
// set the pixel format for the DC
|
// set the pixel format for the DC
|
||||||
ZeroMemory( &pfd, sizeof( pfd ) );
|
ZeroMemory(&pfd, sizeof( pfd ) );
|
||||||
pfd.nSize = sizeof( pfd );
|
pfd.nSize = sizeof( pfd );
|
||||||
pfd.nVersion = 1;
|
pfd.nVersion = 1;
|
||||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||||
@ -193,9 +191,9 @@ class WindowsContext : public ewol::eContext {
|
|||||||
pfd.cDepthBits = 16;
|
pfd.cDepthBits = 16;
|
||||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||||
int format = ChoosePixelFormat( *_hDC, &pfd );
|
int format = ChoosePixelFormat( *_hDC, &pfd );
|
||||||
setPixelFormat( *_hDC, format, &pfd );
|
SetPixelFormat( *_hDC, format, &pfd );
|
||||||
|
|
||||||
// create and enable the render context (RC)
|
// create and enable the render context(RC)
|
||||||
*_hRC = wglCreateContext( *_hDC );
|
*_hRC = wglCreateContext( *_hDC );
|
||||||
wglMakeCurrent( *_hDC, *_hRC );
|
wglMakeCurrent( *_hDC, *_hRC );
|
||||||
|
|
||||||
@ -206,14 +204,15 @@ class WindowsContext : public ewol::eContext {
|
|||||||
void disableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC) {
|
void disableOpenGL(HWND _hWnd, HDC _hDC, HGLRC _hRC) {
|
||||||
wglMakeCurrent( nullptr, NULL );
|
wglMakeCurrent( nullptr, NULL );
|
||||||
wglDeleteContext( _hRC );
|
wglDeleteContext( _hRC );
|
||||||
releaseDC( _hWnd, _hDC );
|
ReleaseDC( _hWnd, _hDC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Window Procedure
|
// Window Procedure
|
||||||
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) {
|
static LRESULT CALLBACK WndProc(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) {
|
||||||
// TODO : set this function really work...
|
// TODO : set this function really work...
|
||||||
classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam);
|
// TODO : return classPointer->WndProcReal(_hWnd, _message, _wParam, _lParam);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) {
|
LRESULT CALLBACK WndProcReal(HWND _hWnd, UINT _message, WPARAM _wParam, LPARAM _lParam) {
|
||||||
@ -221,8 +220,7 @@ class WindowsContext : public ewol::eContext {
|
|||||||
int32_t mouseButtonId = 0;
|
int32_t mouseButtonId = 0;
|
||||||
ivec2 pos;
|
ivec2 pos;
|
||||||
// to know all _message : http://wiki.winehq.org/List_Of_Windows__messages
|
// to know all _message : http://wiki.winehq.org/List_Of_Windows__messages
|
||||||
switch (_message)
|
switch (_message) {
|
||||||
{
|
|
||||||
/* **************************************************************************
|
/* **************************************************************************
|
||||||
* Gui event
|
* Gui event
|
||||||
* **************************************************************************/
|
* **************************************************************************/
|
||||||
@ -259,10 +257,10 @@ class WindowsContext : public ewol::eContext {
|
|||||||
if (nullptr != tmpVal) {
|
if (nullptr != tmpVal) {
|
||||||
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
|
//EWOL_DEBUG("WM_WINDOWPOSCHANGING : : (" << tmpVal->x << "," << tmpVal->y << ") ( " << tmpVal->cx << "," << tmpVal->cy << ")");
|
||||||
// in windows system, we need to remove the size of the border elements :
|
// in windows system, we need to remove the size of the border elements :
|
||||||
int border_thickness = getSystemMetrics(SM_CXSIZEFRAME);
|
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||||
int title_size = getSystemMetrics(SM_CYCAPTION);
|
int title_size = GetSystemMetrics(SM_CYCAPTION);
|
||||||
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
|
m_currentHeight = tmpVal->cy - 2*border_thickness - title_size;
|
||||||
OS_Resize(tmpVal->cx-2*border_thickness, m_currentHeight);
|
OS_Resize(vec2(tmpVal->cx-2*border_thickness, m_currentHeight));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -301,7 +299,7 @@ class WindowsContext : public ewol::eContext {
|
|||||||
//case 90: // keypad
|
//case 90: // keypad
|
||||||
case VK_INSERT:
|
case VK_INSERT:
|
||||||
keyInput = ewol::key::keyboardInsert;
|
keyInput = ewol::key::keyboardInsert;
|
||||||
guiKeyBoardMode.insert = buttonIsDown;
|
m_guiKeyBoardMode.setInsert(buttonIsDown);
|
||||||
break;
|
break;
|
||||||
case VK_F1: keyInput = ewol::key::keyboardF1; break;
|
case VK_F1: keyInput = ewol::key::keyboardF1; break;
|
||||||
case VK_F2: keyInput = ewol::key::keyboardF2; break;
|
case VK_F2: keyInput = ewol::key::keyboardF2; break;
|
||||||
@ -327,33 +325,59 @@ class WindowsContext : public ewol::eContext {
|
|||||||
case VK_F22:
|
case VK_F22:
|
||||||
case VK_F23:
|
case VK_F23:
|
||||||
case VK_F24: keyInput = ewol::key::keyboardF12; break;
|
case VK_F24: keyInput = ewol::key::keyboardF12; break;
|
||||||
case VK_CAPITAL: keyInput = ewol::key::keyboardCapLock; guiKeyBoardMode.capLock = buttonIsDown; break;
|
case VK_CAPITAL:
|
||||||
|
keyInput = ewol::key::keyboardCapLock;
|
||||||
|
m_guiKeyBoardMode.setCapsLock(buttonIsDown);
|
||||||
|
break;
|
||||||
case VK_SHIFT:
|
case VK_SHIFT:
|
||||||
case VK_LSHIFT: keyInput = ewol::key::keyboardShiftLeft; guiKeyBoardMode.shift = buttonIsDown; break;
|
case VK_LSHIFT:
|
||||||
case VK_RSHIFT: keyInput = ewol::key::keyboardShiftRight; guiKeyBoardMode.shift = buttonIsDown; break;
|
keyInput = ewol::key::keyboardShiftLeft;
|
||||||
|
m_guiKeyBoardMode.setShift(buttonIsDown);
|
||||||
|
break;
|
||||||
|
case VK_RSHIFT:
|
||||||
|
keyInput = ewol::key::keyboardShiftRight;
|
||||||
|
m_guiKeyBoardMode.setShift(buttonIsDown);
|
||||||
|
break;
|
||||||
case VK_CONTROL:
|
case VK_CONTROL:
|
||||||
case VK_LCONTROL: keyInput = ewol::key::keyboardCtrlLeft; guiKeyBoardMode.ctrl = buttonIsDown; break;
|
case VK_LCONTROL:
|
||||||
case VK_RCONTROL: keyInput = ewol::key::keyboardCtrlRight; guiKeyBoardMode.ctrl = buttonIsDown; break;
|
keyInput = ewol::key::keyboardCtrlLeft;
|
||||||
|
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
||||||
case VK_LWIN: keyInput = ewol::key::keyboardMetaLeft; guiKeyBoardMode.meta = buttonIsDown; break;
|
break;
|
||||||
case VK_RWIN: keyInput = ewol::key::keyboardMetaRight; guiKeyBoardMode.meta = buttonIsDown; break;
|
case VK_RCONTROL:
|
||||||
|
keyInput = ewol::key::keyboardCtrlRight;
|
||||||
|
m_guiKeyBoardMode.setCtrl(buttonIsDown);
|
||||||
|
break;
|
||||||
|
case VK_LWIN:
|
||||||
|
keyInput = ewol::key::keyboardMetaLeft;
|
||||||
|
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
||||||
|
break;
|
||||||
|
case VK_RWIN:
|
||||||
|
keyInput = ewol::key::keyboardMetaRight;
|
||||||
|
m_guiKeyBoardMode.setMeta(buttonIsDown);
|
||||||
|
break;
|
||||||
case VK_MENU:
|
case VK_MENU:
|
||||||
case VK_LMENU: keyInput = ewol::key::keyboardAlt; guiKeyBoardMode.alt = buttonIsDown; break;
|
case VK_LMENU:
|
||||||
case VK_RMENU: keyInput = ewol::key::keyboardAltGr; guiKeyBoardMode.altGr = buttonIsDown; break;
|
keyInput = ewol::key::keyboardAlt;
|
||||||
|
m_guiKeyBoardMode.setAlt(buttonIsDown);
|
||||||
|
break;
|
||||||
|
case VK_RMENU:
|
||||||
|
keyInput = ewol::key::keyboardAltGr;
|
||||||
|
m_guiKeyBoardMode.setAltGr(buttonIsDown);
|
||||||
|
break;
|
||||||
//case : keyInput = ewol::key::keyboardContextMenu; break;
|
//case : keyInput = ewol::key::keyboardContextMenu; break;
|
||||||
case VK_NUMLOCK: keyInput = ewol::key::keyboardNumLock; guiKeyBoardMode.numLock = buttonIsDown; break;
|
case VK_NUMLOCK:
|
||||||
|
keyInput = ewol::key::keyboardNumLock;
|
||||||
|
m_guiKeyBoardMode.setNumLock(buttonIsDown);
|
||||||
|
break;
|
||||||
case VK_BACK: // DEL
|
case VK_BACK: // DEL
|
||||||
tmpChar.set(0x08);
|
tmpChar = 0x08;
|
||||||
break;
|
break;
|
||||||
// TODO : Really strang, need to understand why ...
|
// TODO : Really strang, need to understand why ...
|
||||||
case 46: // Suppr
|
case 46: // Suppr
|
||||||
tmpChar.set(0x7F);
|
tmpChar = 0x7F;
|
||||||
break;
|
break;
|
||||||
case VK_TAB: // special case for TAB
|
case VK_TAB: // special case for TAB
|
||||||
tmpChar.set(0x09);
|
tmpChar = 0x09;
|
||||||
break;
|
break;
|
||||||
case VK_RETURN: // special case for TAB
|
case VK_RETURN: // special case for TAB
|
||||||
tmpChar = '\n';
|
tmpChar = '\n';
|
||||||
@ -361,21 +385,21 @@ class WindowsContext : public ewol::eContext {
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
BYTE kbd[256];
|
BYTE kbd[256];
|
||||||
getKeyboardState(kbd);
|
GetKeyboardState(kbd);
|
||||||
const int BUFFER_LENGTH = 8; //Length of the buffer
|
const int BUFFER_LENGTH = 8; //Length of the buffer
|
||||||
WCHAR chars[BUFFER_LENGTH];
|
WCHAR chars[BUFFER_LENGTH];
|
||||||
|
|
||||||
ToUnicode(wParam,lParam,kbd,chars,BUFFER_LENGTH,0);
|
ToUnicode(_wParam, _lParam, kbd, chars,BUFFER_LENGTH,0);
|
||||||
tmpChar.setUtf8((char*)chars);
|
tmpChar = utf8::convertChar32((char*)chars);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
|
EWOL_DEBUG("kjhkjhkjhkjhkj = " << _wParam);
|
||||||
if (tmpChar == 0) {
|
if (tmpChar == 0) {
|
||||||
//EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
//EWOL_DEBUG("eventKey Move type : " << getCharTypeMoveEvent(keyInput) );
|
||||||
OS_SetKeyboardMove(guiKeyBoardMode, keyInput, buttonIsDown);
|
OS_SetKeyboardMove(m_guiKeyBoardMode, keyInput, buttonIsDown);
|
||||||
} else {
|
} else {
|
||||||
OS_SetKeyboard(guiKeyBoardMode, tmpChar, buttonIsDown);
|
OS_SetKeyboard(m_guiKeyBoardMode, tmpChar, buttonIsDown);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -388,8 +412,8 @@ class WindowsContext : public ewol::eContext {
|
|||||||
mouseButtonId = 1;
|
mouseButtonId = 1;
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
|
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
@ -398,8 +422,8 @@ class WindowsContext : public ewol::eContext {
|
|||||||
mouseButtonId = 2;
|
mouseButtonId = 2;
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
|
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
@ -408,71 +432,71 @@ class WindowsContext : public ewol::eContext {
|
|||||||
mouseButtonId = 3;
|
mouseButtonId = 3;
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
inputIsPressed[mouseButtonId] = buttonIsDown;
|
m_inputIsPressed[mouseButtonId] = buttonIsDown;
|
||||||
OS_SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
|
OS_SetMouseState(mouseButtonId, buttonIsDown, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
if (wParam & 0x200000) {
|
if (_wParam & 0x200000) {
|
||||||
EWOL_DEBUG("event SCROOL UP");
|
EWOL_DEBUG("event SCROOL UP");
|
||||||
mouseButtonId = 4;
|
mouseButtonId = 4;
|
||||||
} else{
|
} else {
|
||||||
EWOL_DEBUG("event SCROOL DOWN");
|
EWOL_DEBUG("event SCROOL DOWN");
|
||||||
mouseButtonId = 5;
|
mouseButtonId = 5;
|
||||||
}
|
}
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
OS_SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y());
|
OS_SetMouseState(mouseButtonId, true, vec2(pos.x(),pos.y()));
|
||||||
OS_SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y());
|
OS_SetMouseState(mouseButtonId, false, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_MOUSEHOVER:
|
case WM_MOUSEHOVER:
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
pos.setValue(GET_X_LPARAM(_lParam),
|
pos.setValue(GET_X_LPARAM(_lParam),
|
||||||
m_currentHeight-GET_Y_LPARAM(_lParam));
|
m_currentHeight-GET_Y_LPARAM(_lParam));
|
||||||
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
|
for (int32_t iii=0; iii<MAX_MANAGE_INPUT ; iii++) {
|
||||||
if (true == inputIsPressed[iii]) {
|
if (true == m_inputIsPressed[iii]) {
|
||||||
EWOL_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
EWOL_VERBOSE("Windows event: bt=" << iii << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
OS_SetMouseMotion(iii, (float)pos.x(), (float)pos.y());
|
OS_SetMouseMotion(iii, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << _message << " = \"WM_MOUSEMOVE\" " << pos );
|
||||||
OS_SetMouseMotion(0, (float)pos.x(), (float)pos.y());
|
OS_SetMouseMotion(0, vec2(pos.x(),pos.y()));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
EWOL_DEBUG("event ..." << message );
|
EWOL_DEBUG("event ..." << _message );
|
||||||
return DefWindowProc( _hWnd, _message, _wParam, _lParam );
|
return DefWindowProc( _hWnd, _message, _wParam, _lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Main of the program
|
* @brief Main of the program
|
||||||
* @param std IO
|
* @param std IO
|
||||||
* @return std IO
|
* @return std IO
|
||||||
*/
|
*/
|
||||||
int ewol::Run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
|
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
|
||||||
|
etk::setArgZero(_argv[0]);
|
||||||
GLenum err = glewInit();
|
GLenum err = glewInit();
|
||||||
if (GLEW_OK != err) {
|
if (GLEW_OK != err) {
|
||||||
/* Problem: glewInit failed, something is seriously wrong. */
|
// Problem: glewInit failed, something is seriously wrong.
|
||||||
EWOL_ERROR("Error:" << glewGetErrorString(err));
|
EWOL_ERROR("Error:" << glewGetErrorString(err));
|
||||||
}
|
}
|
||||||
if (!glewIsSupported("GL_VERSION_2_0")) {
|
if (!glewIsSupported("GL_VERSION_2_0")) {
|
||||||
EWOL_ERROR("OpenGL 2.0 not available");
|
EWOL_ERROR("OpenGL 2.0 not available");
|
||||||
//return 1;
|
//return 1;
|
||||||
}
|
}
|
||||||
WindowsContext* interface = new WindowsContext(_application, _argc, _argv);
|
WindowsContext* localInterface = new WindowsContext(_application, _argc, _argv);
|
||||||
if (nullptr == interface) {
|
if (localInterface == nullptr) {
|
||||||
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
|
EWOL_CRITICAL("Can not create the 'Windows' interface ... MEMORY allocation error");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t retValue = interface->Run();
|
int32_t retValue = localInterface->run();
|
||||||
delete(interface);
|
delete(localInterface);
|
||||||
interface = nullptr;
|
localInterface = nullptr;
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1346,7 +1346,7 @@ class X11Interface : public ewol::Context {
|
|||||||
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
|
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
|
||||||
etk::setArgZero(_argv[0]);
|
etk::setArgZero(_argv[0]);
|
||||||
X11Interface* interface = new X11Interface(_application, _argc, _argv);
|
X11Interface* interface = new X11Interface(_application, _argc, _argv);
|
||||||
if (nullptr == interface) {
|
if (interface == nullptr) {
|
||||||
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
|
EWOL_CRITICAL("Can not create the X11 interface ... MEMORY allocation error");
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user