[DEBUG] correct OS request force redraw ==> it work now

This commit is contained in:
Edouard DUPIN 2017-04-28 00:57:21 +02:00
parent 5e65339d82
commit 4266dd1bfe
2 changed files with 11 additions and 6 deletions

View File

@ -633,6 +633,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
} }
gale::openGL::threadHasContext(); gale::openGL::threadHasContext();
echrono::Steady currentTime = echrono::Steady::now(); echrono::Steady currentTime = echrono::Steady::now();
// TODO : Review this ...
// this is to prevent the multiple display at the a high frequency ... // this is to prevent the multiple display at the a high frequency ...
#if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows)) #if (!defined(__TARGET_OS__Android) && !defined(__TARGET_OS__Windows))
if(currentTime - m_previousDisplayTime < echrono::milliseconds(8)) { if(currentTime - m_previousDisplayTime < echrono::milliseconds(8)) {
@ -662,8 +663,6 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
Release the event processing Release the event processing
*/ */
if (m_application != nullptr) { if (m_application != nullptr) {
// Redraw all needed elements // Redraw all needed elements
m_application->onRegenerateDisplay(*this); m_application->onRegenerateDisplay(*this);
@ -713,6 +712,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
m_FpsFlush.tic(); m_FpsFlush.tic();
} }
if (hasDisplayDone == true) { if (hasDisplayDone == true) {
//GALE_INFO("lklklklklk " << _displayEveryTime);
if (m_displayFps == true) { if (m_displayFps == true) {
m_FpsFlush.incrementCounter(); m_FpsFlush.incrementCounter();
} }

View File

@ -799,12 +799,12 @@ class X11Interface : public gale::Context {
// break; // break;
case MapNotify: case MapNotify:
X11_INFO("X11 event : MapNotify"); X11_INFO("X11 event : MapNotify");
specialEventThatNeedARedraw=true; specialEventThatNeedARedraw = true;
OS_Show(); OS_Show();
break; break;
case UnmapNotify: case UnmapNotify:
X11_INFO("X11 event : UnmapNotify"); X11_INFO("X11 event : UnmapNotify");
specialEventThatNeedARedraw=true; specialEventThatNeedARedraw = true;
OS_Hide(); OS_Hide();
break; break;
default: default:
@ -822,9 +822,14 @@ class X11Interface : public gale::Context {
XSync(m_display,0); XSync(m_display,0);
} }
// draw after switch the previous windows ... // draw after switch the previous windows ...
//GALE_DEBUG("specialEventThatNeedARedraw"<<specialEventThatNeedARedraw); if (specialEventThatNeedARedraw == true) {
X11_INFO("specialEventThatNeedARedraw = " << specialEventThatNeedARedraw);
}
hasDisplay = OS_Draw(specialEventThatNeedARedraw); hasDisplay = OS_Draw(specialEventThatNeedARedraw);
specialEventThatNeedARedraw = false; if (hasDisplay == true) {
// need to request it every time needed to have a redrawing (this can take some time if the application filter the drfaw periodicity)
specialEventThatNeedARedraw = false;
}
} }
} }
return 0; return 0;