OpenGL renderer: handling subwindow messages

On windows we need to have a thread on the renderer process
which handles windows messages sent to the subwindow
we are creating during framebuffer initialization.
We run this message pump in the main renderer thread
and the server listener on a seperate thread.
This commit is contained in:
Amit Feller
2011-06-30 11:13:58 +03:00
committed by Guy Zadickario
parent 4672adab3f
commit 15680c5e69
2 changed files with 26 additions and 1 deletions

View File

@@ -125,7 +125,32 @@ int main(int argc, char *argv[])
return -1;
}
#ifndef _WIN32
//
// run the server listener loop
//
server->Main(); // never returns
#else
//
// on windows we need to handle messages for the
// created subwindow. So we run the server on a seperate
// thread and running the windows message pump loop
// in this main thread.
//
server->start();
//
// Dispatch events for the subwindow
//
MSG msg;
HWND hWnd = FrameBuffer::getFB()->getSubWindow();
bool done = 0;
while(!done) {
GetMessage(&msg, hWnd, 0, 0);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
#endif
return 0;
}