Fixed sockets under X11.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-11-12 18:19:01 +00:00
parent 6011930cb0
commit 20951f66bf
3 changed files with 24 additions and 17 deletions

View File

@@ -1231,6 +1231,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
wxEventLoop::SetActive(newEventLoop);
}
// Call dispatch at least once so that sockets
// can be tested
wxTheApp->Dispatch();
while (wxTheApp && wxTheApp->Pending())
wxTheApp->Dispatch();

View File

@@ -387,7 +387,7 @@ int wxEventLoop::Run()
#endif
if (!m_impl->SendIdleEvent())
{
#if wxUSE_THREADS
#if 0 // wxUSE_THREADS
// leave the main loop to give other threads a chance to
// perform their GUI work
wxMutexGuiLeave();
@@ -430,8 +430,8 @@ void wxEventLoop::Exit(int rc)
bool wxEventLoop::Pending() const
{
XFlush((Display*) wxGetDisplay());
return (XPending((Display*) wxGetDisplay()) > 0);
XFlush( wxGlobalDisplay() );
return (XPending( wxGlobalDisplay() ) > 0);
}
bool wxEventLoop::Dispatch()
@@ -447,7 +447,7 @@ bool wxEventLoop::Dispatch()
// often, so we should probably limit idle processing to
// not be repeated more than every N milliseconds.
if (XPending((Display*) wxGetDisplay()) == 0)
if (XPending( wxGlobalDisplay() ) == 0)
{
#if wxUSE_NANOX
GR_TIMEOUT timeout = 10; // Milliseconds
@@ -462,7 +462,8 @@ bool wxEventLoop::Dispatch()
struct timeval tv;
tv.tv_sec=0;
tv.tv_usec=10000; // TODO make this configurable
int fd = ConnectionNumber((Display*) wxGetDisplay());
int fd = ConnectionNumber( wxGlobalDisplay() );
fd_set readset;
fd_set writeset;
int highest = fd;
@@ -485,7 +486,7 @@ bool wxEventLoop::Dispatch()
{
// An X11 event was pending, so get it
if (FD_ISSET( fd, &readset ))
XNextEvent((Display*) wxGetDisplay(), & event);
XNextEvent( wxGlobalDisplay(), &event );
#if wxUSE_SOCKETS
// Check if any socket events were pending,
@@ -495,10 +496,12 @@ bool wxEventLoop::Dispatch()
#endif
}
#endif
} else
{
XNextEvent((Display*) wxGetDisplay(), & event);
}
else
{
XNextEvent( wxGlobalDisplay(), &event );
}
(void) m_impl->ProcessEvent( &event );
return TRUE;