Fixed CXWindowsScreen to force the event loop to wake up when

exitMainLoop() is called.
This commit is contained in:
crs 2002-10-17 21:37:41 +00:00
parent 09e0750a11
commit 285cc3abc0
1 changed files with 21 additions and 0 deletions

View File

@ -288,6 +288,7 @@ CXWindowsScreen::mainLoop()
// if the thread has been cancelled. poll() should return -1
// with EINTR when the thread is cancelled.
m_mutex.unlock();
CThread::testCancel();
#if HAVE_POLL
poll(pfds, 1, timeout);
#else
@ -358,8 +359,28 @@ CXWindowsScreen::mainLoop()
void
CXWindowsScreen::exitMainLoop()
{
// m_stop should be a condition variable that we signal here
// but we can't wait on both the condition variable and the
// X connection so there's no point. however, we do need
// to wake up the X connection so send ourself some event.
CLock lock(&m_mutex);
m_stop = true;
if (m_display != NULL && m_window != None) {
XEvent event;
event.xclient.type = ClientMessage;
event.xclient.display = m_display;
event.xclient.window = m_window;
event.xclient.message_type = XInternAtom(m_display, "ATOM", False);
event.xclient.format = 32;
event.xclient.data.l[0] = 0;
event.xclient.data.l[1] = 0;
event.xclient.data.l[2] = 0;
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
CXWindowsUtil::CErrorLock lock(m_display);
XSendEvent(m_display, m_window, False, 0, &event);
}
}
void