opengles emulator: Fixed Windows renderer termination
Make the event pump loop in the renderer process we do on Windows exit when the Framebuffer's subwindow is destroyed. Fixed TcpStream to close the socket using 'closesocket' on windows, otherwise the other end of the socket does not sense that the socket is closed. + Use WS_DISABLED to ensure that our GL subwindow doesn't receive any input events. Change-Id: Icb477b3e1d7993a8880acb5e01bc5da29309ae50
This commit is contained in:
committed by
David 'Digit' Turner
parent
6bb9511365
commit
ded8587d2d
@@ -91,6 +91,10 @@ void FrameBuffer::finalize(){
|
|||||||
s_egl.eglMakeCurrent(s_theFrameBuffer->m_eglDisplay, NULL, NULL, NULL);
|
s_egl.eglMakeCurrent(s_theFrameBuffer->m_eglDisplay, NULL, NULL, NULL);
|
||||||
s_egl.eglDestroySurface(s_theFrameBuffer->m_eglDisplay,s_theFrameBuffer->m_eglSurface);
|
s_egl.eglDestroySurface(s_theFrameBuffer->m_eglDisplay,s_theFrameBuffer->m_eglSurface);
|
||||||
s_egl.eglDestroyContext(s_theFrameBuffer->m_eglDisplay,s_theFrameBuffer->m_eglContext);
|
s_egl.eglDestroyContext(s_theFrameBuffer->m_eglDisplay,s_theFrameBuffer->m_eglContext);
|
||||||
|
if (s_theFrameBuffer->m_subWin) {
|
||||||
|
destroySubWindow(s_theFrameBuffer->m_subWinDisplay,
|
||||||
|
s_theFrameBuffer->m_subWin);
|
||||||
|
}
|
||||||
delete s_theFrameBuffer;
|
delete s_theFrameBuffer;
|
||||||
s_theFrameBuffer = NULL;
|
s_theFrameBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,11 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
|||||||
|
|
||||||
RegisterClass(&wc);
|
RegisterClass(&wc);
|
||||||
printf("creating window %d %d %d %d\n",x,y,width,height);
|
printf("creating window %d %d %d %d\n",x,y,width,height);
|
||||||
EGLNativeWindowType ret = CreateWindow("subWin",
|
EGLNativeWindowType ret = CreateWindowEx(
|
||||||
|
WS_EX_NOPARENTNOTIFY, // do not bother our parent window
|
||||||
|
"subWin",
|
||||||
"sub",
|
"sub",
|
||||||
WS_CHILD,
|
WS_CHILD|WS_DISABLED,
|
||||||
x,y,width,height,
|
x,y,width,height,
|
||||||
p_window,
|
p_window,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -51,5 +53,5 @@ EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
|
void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){
|
||||||
DestroyWindow(win);
|
PostMessage(win, WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
|||||||
//
|
//
|
||||||
// run the server listener loop
|
// run the server listener loop
|
||||||
//
|
//
|
||||||
server->Main(); // never returns
|
server->Main();
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// on windows we need to handle messages for the
|
// on windows we need to handle messages for the
|
||||||
@@ -152,24 +152,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Dispatch events for the subwindow
|
// Dispatch events for the subwindow
|
||||||
|
// During termination of the render server, the FrameBuffer
|
||||||
|
// will be finalized, the Framebuffer subwindow will
|
||||||
|
// get destroyed and the following loop will exit.
|
||||||
//
|
//
|
||||||
MSG msg;
|
MSG msg;
|
||||||
HWND hWnd = FrameBuffer::getFB()->getSubWindow();
|
HWND hWnd = FrameBuffer::getFB()->getSubWindow();
|
||||||
bool done = 0;
|
while( GetMessage(&msg, hWnd, 0, 0) > 0 ) {
|
||||||
while(!done) {
|
|
||||||
GetMessage(&msg, hWnd, 0, 0);
|
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
|
||||||
//
|
|
||||||
// if server thread has exiting
|
|
||||||
// wait for it to exit and done.
|
|
||||||
//
|
|
||||||
if (server->isExiting()) {
|
|
||||||
int exitStatus;
|
|
||||||
server->wait(&exitStatus);
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ TcpStream::TcpStream(int sock, size_t bufSize) :
|
|||||||
TcpStream::~TcpStream()
|
TcpStream::~TcpStream()
|
||||||
{
|
{
|
||||||
if (m_sock >= 0) {
|
if (m_sock >= 0) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
closesocket(m_sock);
|
||||||
|
#else
|
||||||
::close(m_sock);
|
::close(m_sock);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (m_buf != NULL) {
|
if (m_buf != NULL) {
|
||||||
free(m_buf);
|
free(m_buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user