Android: using wait_for_expose to sync screen and windows

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12718 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2018-03-07 21:07:35 +00:00
parent dcc10a6a0a
commit f058d3a99c
3 changed files with 22 additions and 2 deletions

View File

@ -23,6 +23,7 @@
*/
#include "Fl_Android_Application.H"
#include "Fl_Android_Window_Driver.H"
#include <jni.h>
@ -238,6 +239,7 @@ void Fl_Android_Application::pre_exec_cmd(int8_t cmd)
pNativeWindow = pPendingWindow;
pthread_cond_broadcast(&pCond);
pthread_mutex_unlock(&pMutex);
Fl_Android_Window_Driver::expose_all();
break;
case APP_CMD_TERM_WINDOW:
@ -416,10 +418,11 @@ bool Fl_Android_Application::copy_screen()
src += srcStride;
dst += dstStride;
}
unlock_and_post_screen();
ret = true;
} else {
Fl::damage(FL_DAMAGE_EXPOSE);
// wait for screen buffer to be created
}
return ret;
}

View File

@ -134,6 +134,8 @@ public:
#endif
void wait_for_expose() { wait_for_expose_value = 1; }
static void expose_all();
// Leuwer: 0171 473 1850
};

View File

@ -69,13 +69,28 @@ void Fl_Android_Window_Driver::show()
i(x);
x->next = Fl_X::first;
Fl_X::first = x;
if (Fl_Android_Application::native_window()) {
pWindow->redraw();
} else {
pWindow->wait_for_expose();
}
} else {
// bring window to front
}
}
void Fl_Android_Window_Driver::expose_all()
{
for (Fl_X *x = Fl_X::first; x; x = x->next) {
Fl_Window *win = x->w;
win->driver()->wait_for_expose_value = 0;
win->damage(FL_DAMAGE_EXPOSE);
win->redraw();
}
}
void Fl_Android_Window_Driver::make_current()
{
((Fl_Android_Screen_Driver*)Fl::screen_driver())->pScreenContentChanged = true;