From c6928fa591409c0d4914e7d404f478576b1c4f19 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 28 Nov 2013 00:55:19 +0100 Subject: [PATCH] [DEBUG] Remove some unused element of c++11 in MacOs and set it work again --- build | 2 +- external/etk | 2 +- sources/ewol/renderer/MacOs/Context.cpp | 32 +++++++++++++++--- sources/ewol/renderer/MacOs/Context.h | 2 +- sources/ewol/renderer/MacOs/OpenglView.h | 2 +- sources/ewol/renderer/MacOs/OpenglView.mm | 41 +++++++++++++---------- 6 files changed, 56 insertions(+), 25 deletions(-) diff --git a/build b/build index 051759ed..18b7c4a3 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 051759ed892a8392fb0dfb75308608765f321827 +Subproject commit 18b7c4a34a599f24add0d67a0a10e20582adf5d2 diff --git a/external/etk b/external/etk index 9f47018a..216f3a55 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 9f47018aa4fcac3c2bfd92012576be76e2c56b20 +Subproject commit 216f3a55280227155a8acded577dec14be5734a0 diff --git a/sources/ewol/renderer/MacOs/Context.cpp b/sources/ewol/renderer/MacOs/Context.cpp index 1ac7ed95..97d22bc6 100644 --- a/sources/ewol/renderer/MacOs/Context.cpp +++ b/sources/ewol/renderer/MacOs/Context.cpp @@ -78,11 +78,35 @@ class MacOSInterface : public ewol::eContext { OS_SetMouseMotion(_id, vec2(_x, _y)); } void MAC_SetKeyboard(ewol::SpecialKey _keyboardMode, int32_t _unichar, bool _isDown, bool _isAReapeateKey) { - if (_unichar == '\r') { - _unichar = '\n'; + if (_unichar == etk::UChar::Delete) { + _unichar = etk::UChar::Suppress; + } else if (_unichar == etk::UChar::Suppress) { + _unichar = etk::UChar::Delete; + } + if (_unichar == etk::UChar::CarrierReturn) { + _unichar = etk::UChar::Return; } EWOL_DEBUG("key: " << _unichar << " up=" << !_isDown); - OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey); + if (_unichar <= 4) { + enum ewol::keyEvent::keyboard move; + switch(_unichar) { + case 0: + move = ewol::keyEvent::keyboardUp; + break; + case 1: + move = ewol::keyEvent::keyboardDown; + break; + case 2: + move = ewol::keyEvent::keyboardLeft; + break; + case 3: + move = ewol::keyEvent::keyboardRight; + break; + } + OS_SetKeyboardMove(_keyboardMode, move, !_isDown, _isAReapeateKey); + } else { + OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey); + } } }; @@ -98,7 +122,7 @@ bool MacOs::draw(bool _displayEveryTime) { return interface->MAC_Draw(_displayEveryTime); } -void MacOs::Resize(float _x, float _y) { +void MacOs::resize(float _x, float _y) { if (interface == NULL) { return; } diff --git a/sources/ewol/renderer/MacOs/Context.h b/sources/ewol/renderer/MacOs/Context.h index 66375081..c7fbcd3e 100644 --- a/sources/ewol/renderer/MacOs/Context.h +++ b/sources/ewol/renderer/MacOs/Context.h @@ -20,7 +20,7 @@ namespace MacOs * @brief The OS inform that the current windows has change his size. * @param[in] _size new size of the windows. */ - void Resize(float _x, float _y); + void resize(float _x, float _y); void setMouseState(int32_t _id, bool _isDown, float _x, float _y); void setMouseMotion(int32_t _id, float _x, float _y); diff --git a/sources/ewol/renderer/MacOs/OpenglView.h b/sources/ewol/renderer/MacOs/OpenglView.h index b938cdc3..e855f170 100644 --- a/sources/ewol/renderer/MacOs/OpenglView.h +++ b/sources/ewol/renderer/MacOs/OpenglView.h @@ -10,7 +10,7 @@ #import -@interface openGLView : NSOpenGLView +@interface OpenGLView : NSOpenGLView { } - (void)prepareOpenGL; diff --git a/sources/ewol/renderer/MacOs/OpenglView.mm b/sources/ewol/renderer/MacOs/OpenglView.mm index a3763257..a58af091 100644 --- a/sources/ewol/renderer/MacOs/OpenglView.mm +++ b/sources/ewol/renderer/MacOs/OpenglView.mm @@ -31,7 +31,7 @@ static ewol::SpecialKey guiKeyBoardMode; NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; CGSize displayPhysicalSize = CGDisplayScreenSize([[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); - ewol::dimension::SetPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width, + ewol::dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width, (float)displayPixelSize.height/(float)displayPhysicalSize.height), ewol::Dimension::Millimeter); @@ -39,7 +39,7 @@ static ewol::SpecialKey guiKeyBoardMode; -(void) drawRect: (NSRect) bounds { - MacOs::Draw(true); + MacOs::draw(true); glFlush(); } @@ -50,7 +50,7 @@ static ewol::SpecialKey guiKeyBoardMode; // but they are floats float width = [self frame].size.width; float height = [self frame].size.height; - MacOs::Resize(width,height); + MacOs::resize(width,height); } @@ -58,22 +58,22 @@ static ewol::SpecialKey guiKeyBoardMode; NSPoint point = [event locationInWindow]; //float x = [event locationInWindow].x; //point.x; //EWOL_INFO("mouseDown : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseState(1, true, point.x, point.y); + MacOs::setMouseState(1, true, point.x, point.y); } -(void)mouseDragged:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("mouseDragged : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseMotion(1, point.x, point.y); + MacOs::setMouseMotion(1, point.x, point.y); } -(void)mouseUp:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("mouseUp : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseState(1, false, point.x, point.y); + MacOs::setMouseState(1, false, point.x, point.y); } -(void)mouseMoved:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("mouseMoved : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseMotion(0, point.x, point.y); + MacOs::setMouseMotion(0, point.x, point.y); } -(void)mouseEntered:(NSEvent *)event { NSPoint point = [event locationInWindow]; @@ -86,17 +86,17 @@ static ewol::SpecialKey guiKeyBoardMode; -(void)rightMouseDown:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("rightMouseDown : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseState(3, true, point.x, point.y); + MacOs::setMouseState(3, true, point.x, point.y); } -(void)rightMouseDragged:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("rightMouseDragged : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseMotion(3, point.x, point.y); + MacOs::setMouseMotion(3, point.x, point.y); } -(void)rightMouseUp:(NSEvent *)event { NSPoint point = [event locationInWindow]; //EWOL_INFO("rightMouseUp : " << (float)point.x << " " << (float)point.y); - MacOs::SetMouseState(3, false, point.x, point.y); + MacOs::setMouseState(3, false, point.x, point.y); } -(void)otherMouseDown:(NSEvent *)event { NSPoint point = [event locationInWindow]; @@ -108,7 +108,14 @@ static ewol::SpecialKey guiKeyBoardMode; } -(void)otherMouseUp:(NSEvent *)event { NSPoint point = [event locationInWindow]; - EWOL_INFO("otherMouseUp : " << (float)point.x << " " << (float)point.y); + int32_t btNumber = [event buttonNumber]; + EWOL_INFO("otherMouseUp : " << (float)point.x << " " << (float)point.y << " bt id=" << btNumber ); + // 2 : Middle button + // 3 : border button DOWN + // 4 : border button UP + // 7 : Red button + // 5 : horizontal scroll Right to left + // 6 : horizontal scroll left to Right } - (void)scrollWheel:(NSEvent *)event { NSPoint point = [event locationInWindow]; @@ -123,8 +130,8 @@ static ewol::SpecialKey guiKeyBoardMode; return; } for (float iii=abs(deltaY) ; iii>=0.0f ; iii-=1.0f) { - MacOs::SetMouseState(idEvent, true , point.x, point.y); - MacOs::SetMouseState(idEvent, false, point.x, point.y); + MacOs::setMouseState(idEvent, true , point.x, point.y); + MacOs::setMouseState(idEvent, false, point.x, point.y); } } /* @@ -155,9 +162,9 @@ static ewol::SpecialKey guiKeyBoardMode; } */ //EWOL_DEBUG("KeyDown " << (char)c); - MacOs::SetKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey); + MacOs::setKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey); if (true==thisIsAReapeateKey) { - MacOs::SetKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey); + MacOs::setKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey); } } @@ -175,9 +182,9 @@ static ewol::SpecialKey guiKeyBoardMode; return; } */ - MacOs::SetKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey); + MacOs::setKeyboard(guiKeyBoardMode, (char)c, false, thisIsAReapeateKey); if (true==thisIsAReapeateKey) { - MacOs::SetKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey); + MacOs::setKeyboard(guiKeyBoardMode, (char)c, true, thisIsAReapeateKey); } }