From 9b025cee66f3c5aac7a2c8e877ea7a2daa750fc1 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 22 May 2013 21:28:45 +0200 Subject: [PATCH] [DEBUG correction of the half pixel display on the widget --- external/etk | 2 +- sources/ewol/widget/ContextMenu.cpp | 4 ++- sources/ewol/widget/Menu.cpp | 6 +++-- sources/ewol/widget/Widget.cpp | 39 ++++++++++++----------------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/external/etk b/external/etk index b433625d..a2c5f8ac 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit b433625df8188ca5d27d5adb1eedbf42c4590744 +Subproject commit a2c5f8ac4e73a0981316099b400ee0b627054cab diff --git a/sources/ewol/widget/ContextMenu.cpp b/sources/ewol/widget/ContextMenu.cpp index c5814198..988bf31f 100644 --- a/sources/ewol/widget/ContextMenu.cpp +++ b/sources/ewol/widget/ContextMenu.cpp @@ -199,8 +199,10 @@ void widget::ContextMenu::OnRegenerateDisplay(void) } bool widget::ContextMenu::OnEventInput(const ewol::EventInput& _event) { - //EWOL_INFO("Event ouside the context menu"); if (_event.GetId() > 0) { + if (NULL != widget::Container::GetWidgetAtPos(_event.GetPos())) { + return false; + } if( _event.GetStatus() == ewol::keyEvent::statusDown || _event.GetStatus() == ewol::keyEvent::statusMove || _event.GetStatus() == ewol::keyEvent::statusSingle diff --git a/sources/ewol/widget/Menu.cpp b/sources/ewol/widget/Menu.cpp index 618ea812..848d9eb4 100644 --- a/sources/ewol/widget/Menu.cpp +++ b/sources/ewol/widget/Menu.cpp @@ -120,10 +120,11 @@ void widget::Menu::AddSpacer(void) void widget::Menu::OnReceiveMessage(const ewol::EMessage& _msg) { /* - if (true == ewol::Sizer$::OnReceiveMessage(_msg) { + if (true == ewol::Sizer::OnReceiveMessage(_msg) { return true; } */ + EWOL_ERROR(" receive message : " << _msg); if (_msg.GetMessage() == widget::Button::eventPressed) { for(int32_t iii=0; iiim_widgetPointer) { @@ -173,8 +174,8 @@ void widget::Menu::OnReceiveMessage(const ewol::EMessage& _msg) widget::Sizer * mySizer = NULL; widget::Button * myButton = NULL; - // TODO : Set a gird ... mySizer = new widget::Sizer(widget::Sizer::modeVert); + if (NULL != mySizer) { mySizer->LockExpand(vec2(true,true)); // set it in the pop-up-system : m_widgetContextMenu->SetSubWidget(mySizer); @@ -209,6 +210,7 @@ void widget::Menu::OnReceiveMessage(const ewol::EMessage& _msg) } } } + } ewol::WindowsPopUpAdd(m_widgetContextMenu); } return; diff --git a/sources/ewol/widget/Widget.cpp b/sources/ewol/widget/Widget.cpp index 126c88e9..5e45ec24 100644 --- a/sources/ewol/widget/Widget.cpp +++ b/sources/ewol/widget/Widget.cpp @@ -279,24 +279,24 @@ void ewol::Widget::SystemDraw(const DrawProperty& _displayProp) return; } - glViewport( tmpSize.m_origin.x(), - tmpSize.m_origin.y(), - tmpSize.m_size.x(), - tmpSize.m_size.y()); + glViewport( (int32_t)tmpSize.m_origin.x(), + (int32_t)tmpSize.m_origin.y(), + (int32_t)tmpSize.m_size.x(), + (int32_t)tmpSize.m_size.y()); // special case, when origin < display origin, we need to cut the display : ivec2 downOffset = m_origin - tmpSize.m_origin; downOffset.setMin(ivec2(0,0)); - mat4 tmpTranslate = etk::matTranslate(vec3(-tmpSize.m_size.x()/2+m_offset.x() + downOffset.x(), - -tmpSize.m_size.y()/2+m_offset.y() + downOffset.y(), - -1.0f)); + mat4 tmpTranslate = etk::matTranslate(vec3ClipInt32(vec3(-tmpSize.m_size.x()/2+m_offset.x() + downOffset.x(), + -tmpSize.m_size.y()/2+m_offset.y() + downOffset.y(), + -1.0f))); mat4 tmpScale = etk::matScale(vec3(m_zoom, m_zoom, 1.0f)); - mat4 tmpProjection = etk::matOrtho(-tmpSize.m_size.x()/2, - tmpSize.m_size.x()/2, - -tmpSize.m_size.y()/2, - tmpSize.m_size.y()/2, - -1, - 1); + mat4 tmpProjection = etk::matOrtho((int32_t)(-tmpSize.m_size.x())>>1, + (int32_t)( tmpSize.m_size.x())>>1, + (int32_t)(-tmpSize.m_size.y())>>1, + (int32_t)( tmpSize.m_size.y())>>1, + (int32_t)(-1), + (int32_t)( 1)); mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate; ewol::openGL::Push(); @@ -307,8 +307,7 @@ void ewol::Widget::SystemDraw(const DrawProperty& _displayProp) #ifdef old_PLOP if( (_displayProp.m_origin.x() > m_origin.x()) - || (_displayProp.m_origin.x() + _displayewol::Widget::Prop.m_size.x() < m_size.x() + m_origin.x()) ) { - EWOL_CRITICAL("plop"); + || (_displayProp.m_origin.x() + _displayProp.m_size.x() < m_size.x() + m_origin.x()) ) { // here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left int32_t tmpOriginX = etk_max(_displayProp.m_origin.x(), m_origin.x()); int32_t tmppp1 = _displayProp.m_origin.x() + _displayProp.m_size.x(); @@ -330,11 +329,8 @@ void ewol::Widget::SystemDraw(const DrawProperty& _displayProp) mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); - // Call the widget drawing methode - _displayProp.m_origin.setValue(tmpOriginX, tmpOriginY); - _displayProp.m_size.setValue(tmpclipX, m_size.y()); //int64_t ___startTime = ewol::GetTime(); - OnDraw(_displayProp); + OnDraw(); //float ___localTime = (float)(ewol::GetTime() - ___startTime) / 1000.0f; //EWOL_DEBUG(" Widget1 : " << ___localTime << "ms "); } else { @@ -349,11 +345,8 @@ void ewol::Widget::SystemDraw(const DrawProperty& _displayProp) mat4 tmpMat = tmpProjection * tmpScale * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); - // Call the widget drawing methode - _displayProp.m_origin = m_origin; - _displayProp.m_size = m_size; //int64_t ___startTime = ewol::GetTime(); - OnDraw(_displayProp); + OnDraw(); //float ___localTime = (float)(ewol::GetTime() - ___startTime) / 1000.0f; //EWOL_DEBUG(" Widget2 : " << ___localTime << "ms "); }