don't include private headers from wx/unix/evtloop.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
18
Makefile.in
18
Makefile.in
@@ -595,8 +595,6 @@ ALL_PORTS_BASE_HEADERS = \
|
|||||||
wx/meta/if.h \
|
wx/meta/if.h \
|
||||||
wx/meta/int2type.h \
|
wx/meta/int2type.h \
|
||||||
wx/meta/movable.h \
|
wx/meta/movable.h \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2073,8 +2071,6 @@ COND_TOOLKIT_X11_BASE_OSX_SRC = \
|
|||||||
src/osx/core/utilsexc_base.cpp
|
src/osx/core/utilsexc_base.cpp
|
||||||
@COND_TOOLKIT_X11@BASE_OSX_SRC = $(COND_TOOLKIT_X11_BASE_OSX_SRC)
|
@COND_TOOLKIT_X11@BASE_OSX_SRC = $(COND_TOOLKIT_X11_BASE_OSX_SRC)
|
||||||
COND_TOOLKIT__BASE_OSX_HDR = \
|
COND_TOOLKIT__BASE_OSX_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2095,8 +2091,6 @@ COND_TOOLKIT__BASE_OSX_HDR = \
|
|||||||
wx/osx/core/private/strconv_cf.h
|
wx/osx/core/private/strconv_cf.h
|
||||||
@COND_TOOLKIT_@BASE_OSX_HDR = $(COND_TOOLKIT__BASE_OSX_HDR)
|
@COND_TOOLKIT_@BASE_OSX_HDR = $(COND_TOOLKIT__BASE_OSX_HDR)
|
||||||
COND_TOOLKIT_COCOA_BASE_OSX_HDR = \
|
COND_TOOLKIT_COCOA_BASE_OSX_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2117,8 +2111,6 @@ COND_TOOLKIT_COCOA_BASE_OSX_HDR = \
|
|||||||
wx/osx/core/private/strconv_cf.h
|
wx/osx/core/private/strconv_cf.h
|
||||||
@COND_TOOLKIT_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_COCOA_BASE_OSX_HDR)
|
@COND_TOOLKIT_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_COCOA_BASE_OSX_HDR)
|
||||||
COND_TOOLKIT_GTK_BASE_OSX_HDR = \
|
COND_TOOLKIT_GTK_BASE_OSX_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2139,8 +2131,6 @@ COND_TOOLKIT_GTK_BASE_OSX_HDR = \
|
|||||||
wx/osx/core/private/strconv_cf.h
|
wx/osx/core/private/strconv_cf.h
|
||||||
@COND_TOOLKIT_GTK@BASE_OSX_HDR = $(COND_TOOLKIT_GTK_BASE_OSX_HDR)
|
@COND_TOOLKIT_GTK@BASE_OSX_HDR = $(COND_TOOLKIT_GTK_BASE_OSX_HDR)
|
||||||
COND_TOOLKIT_MOTIF_BASE_OSX_HDR = \
|
COND_TOOLKIT_MOTIF_BASE_OSX_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2168,8 +2158,6 @@ COND_TOOLKIT_OSX_CARBON_BASE_OSX_HDR = \
|
|||||||
wx/osx/core/private.h \
|
wx/osx/core/private.h \
|
||||||
wx/osx/core/stdpaths.h \
|
wx/osx/core/stdpaths.h \
|
||||||
wx/osx/core/private/strconv_cf.h \
|
wx/osx/core/private/strconv_cf.h \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2188,8 +2176,6 @@ COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR = \
|
|||||||
wx/osx/core/private.h \
|
wx/osx/core/private.h \
|
||||||
wx/osx/core/stdpaths.h \
|
wx/osx/core/stdpaths.h \
|
||||||
wx/osx/core/private/strconv_cf.h \
|
wx/osx/core/private/strconv_cf.h \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2201,8 +2187,6 @@ COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR = \
|
|||||||
wx/unix/tls.h
|
wx/unix/tls.h
|
||||||
@COND_TOOLKIT_OSX_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR)
|
@COND_TOOLKIT_OSX_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR)
|
||||||
COND_TOOLKIT_X11_BASE_OSX_HDR = \
|
COND_TOOLKIT_X11_BASE_OSX_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
@@ -2236,8 +2220,6 @@ COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR = \
|
|||||||
wx/os2/wxrsc.h
|
wx/os2/wxrsc.h
|
||||||
@COND_PLATFORM_OS2_1@BASE_PLATFORM_HDR = $(COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR)
|
@COND_PLATFORM_OS2_1@BASE_PLATFORM_HDR = $(COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR)
|
||||||
COND_PLATFORM_UNIX_1_BASE_PLATFORM_HDR = \
|
COND_PLATFORM_UNIX_1_BASE_PLATFORM_HDR = \
|
||||||
wx/private/fdiodispatcher.h \
|
|
||||||
wx/private/selectdispatcher.h \
|
|
||||||
wx/unix/app.h \
|
wx/unix/app.h \
|
||||||
wx/unix/apptbase.h \
|
wx/unix/apptbase.h \
|
||||||
wx/unix/apptrait.h \
|
wx/unix/apptrait.h \
|
||||||
|
@@ -72,8 +72,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
</set>
|
</set>
|
||||||
|
|
||||||
<set var="BASE_UNIX_AND_DARWIN_HDR" hints="files">
|
<set var="BASE_UNIX_AND_DARWIN_HDR" hints="files">
|
||||||
wx/private/fdiodispatcher.h
|
|
||||||
wx/private/selectdispatcher.h
|
|
||||||
wx/unix/app.h
|
wx/unix/app.h
|
||||||
wx/unix/apptbase.h
|
wx/unix/apptbase.h
|
||||||
wx/unix/apptrait.h
|
wx/unix/apptrait.h
|
||||||
|
@@ -13,18 +13,23 @@
|
|||||||
|
|
||||||
#if wxUSE_CONSOLE_EVENTLOOP
|
#if wxUSE_CONSOLE_EVENTLOOP
|
||||||
|
|
||||||
#include "wx/private/fdiodispatcher.h"
|
// ----------------------------------------------------------------------------
|
||||||
#include "wx/unix/pipe.h"
|
// wxConsoleEventLoop
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
class wxFDIODispatcher;
|
||||||
// wxEventLoop
|
|
||||||
// ----------------------------------------------------------------------------
|
namespace wxPrivate
|
||||||
|
{
|
||||||
|
class PipeIOHandler;
|
||||||
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual
|
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// initialize the event loop, use IsOk() to check if we were successful
|
// initialize the event loop, use IsOk() to check if we were successful
|
||||||
wxConsoleEventLoop();
|
wxConsoleEventLoop();
|
||||||
|
virtual ~wxConsoleEventLoop();
|
||||||
|
|
||||||
// implement base class pure virtuals
|
// implement base class pure virtuals
|
||||||
virtual bool Pending() const;
|
virtual bool Pending() const;
|
||||||
@@ -39,30 +44,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
// pipe used for wake up messages: when a child thread wants to wake up
|
// pipe used for wake up messages: when a child thread wants to wake up
|
||||||
// the event loop in the main thread it writes to this pipe
|
// the event loop in the main thread it writes to this pipe
|
||||||
class PipeIOHandler : public wxFDIOHandler
|
wxPrivate::PipeIOHandler *m_wakeupPipe;
|
||||||
{
|
|
||||||
public:
|
|
||||||
// default ctor does nothing, call Create() to really initialize the
|
|
||||||
// object
|
|
||||||
PipeIOHandler() { }
|
|
||||||
|
|
||||||
bool Create();
|
|
||||||
|
|
||||||
// this method can be, and normally is, called from another thread
|
|
||||||
void WakeUp();
|
|
||||||
|
|
||||||
int GetReadFd() { return m_pipe[wxPipe::Read]; }
|
|
||||||
|
|
||||||
// implement wxFDIOHandler pure virtual methods
|
|
||||||
virtual void OnReadWaiting();
|
|
||||||
virtual void OnWriteWaiting() { }
|
|
||||||
virtual void OnExceptionWaiting() { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxPipe m_pipe;
|
|
||||||
};
|
|
||||||
|
|
||||||
PipeIOHandler m_wakeupPipe;
|
|
||||||
|
|
||||||
// either wxSelectDispatcher or wxEpollDispatcher
|
// either wxSelectDispatcher or wxEpollDispatcher
|
||||||
wxFDIODispatcher *m_dispatcher;
|
wxFDIODispatcher *m_dispatcher;
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "wx/evtloop.h"
|
#include "wx/evtloop.h"
|
||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
#include "wx/module.h"
|
#include "wx/module.h"
|
||||||
|
#include "wx/unix/pipe.h"
|
||||||
#include "wx/unix/private/timer.h"
|
#include "wx/unix/private/timer.h"
|
||||||
#include "wx/unix/private/epolldispatcher.h"
|
#include "wx/unix/private/epolldispatcher.h"
|
||||||
#include "wx/private/selectdispatcher.h"
|
#include "wx/private/selectdispatcher.h"
|
||||||
@@ -41,11 +42,39 @@
|
|||||||
// wxEventLoop::PipeIOHandler implementation
|
// wxEventLoop::PipeIOHandler implementation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
namespace wxPrivate
|
||||||
|
{
|
||||||
|
|
||||||
|
// pipe used for wake up messages: when a child thread wants to wake up
|
||||||
|
// the event loop in the main thread it writes to this pipe
|
||||||
|
class PipeIOHandler : public wxFDIOHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// default ctor does nothing, call Create() to really initialize the
|
||||||
|
// object
|
||||||
|
PipeIOHandler() { }
|
||||||
|
|
||||||
|
bool Create();
|
||||||
|
|
||||||
|
// this method can be, and normally is, called from another thread
|
||||||
|
void WakeUp();
|
||||||
|
|
||||||
|
int GetReadFd() { return m_pipe[wxPipe::Read]; }
|
||||||
|
|
||||||
|
// implement wxFDIOHandler pure virtual methods
|
||||||
|
virtual void OnReadWaiting();
|
||||||
|
virtual void OnWriteWaiting() { }
|
||||||
|
virtual void OnExceptionWaiting() { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxPipe m_pipe;
|
||||||
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// initialization
|
// initialization
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxConsoleEventLoop::PipeIOHandler::Create()
|
bool PipeIOHandler::Create()
|
||||||
{
|
{
|
||||||
if ( !m_pipe.Create() )
|
if ( !m_pipe.Create() )
|
||||||
{
|
{
|
||||||
@@ -72,7 +101,7 @@ bool wxConsoleEventLoop::PipeIOHandler::Create()
|
|||||||
// wakeup handling
|
// wakeup handling
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxConsoleEventLoop::PipeIOHandler::WakeUp()
|
void PipeIOHandler::WakeUp()
|
||||||
{
|
{
|
||||||
if ( write(m_pipe[wxPipe::Write], "s", 1) != 1 )
|
if ( write(m_pipe[wxPipe::Write], "s", 1) != 1 )
|
||||||
{
|
{
|
||||||
@@ -82,7 +111,7 @@ void wxConsoleEventLoop::PipeIOHandler::WakeUp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxConsoleEventLoop::PipeIOHandler::OnReadWaiting()
|
void PipeIOHandler::OnReadWaiting()
|
||||||
{
|
{
|
||||||
// got wakeup from child thread: read all data available in pipe just to
|
// got wakeup from child thread: read all data available in pipe just to
|
||||||
// make it empty (even though we write one byte at a time from WakeUp(),
|
// make it empty (even though we write one byte at a time from WakeUp(),
|
||||||
@@ -112,6 +141,8 @@ void wxConsoleEventLoop::PipeIOHandler::OnReadWaiting()
|
|||||||
// else needs to be done
|
// else needs to be done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace wxPrivate
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// wxEventLoop implementation
|
// wxEventLoop implementation
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -122,8 +153,10 @@ void wxConsoleEventLoop::PipeIOHandler::OnReadWaiting()
|
|||||||
|
|
||||||
wxConsoleEventLoop::wxConsoleEventLoop()
|
wxConsoleEventLoop::wxConsoleEventLoop()
|
||||||
{
|
{
|
||||||
if ( !m_wakeupPipe.Create() )
|
m_wakeupPipe = new wxPrivate::PipeIOHandler();
|
||||||
|
if ( !m_wakeupPipe->Create() )
|
||||||
{
|
{
|
||||||
|
wxDELETE(m_wakeupPipe);
|
||||||
m_dispatcher = NULL;
|
m_dispatcher = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,12 +167,17 @@ wxConsoleEventLoop::wxConsoleEventLoop()
|
|||||||
|
|
||||||
m_dispatcher->RegisterFD
|
m_dispatcher->RegisterFD
|
||||||
(
|
(
|
||||||
m_wakeupPipe.GetReadFd(),
|
m_wakeupPipe->GetReadFd(),
|
||||||
&m_wakeupPipe,
|
m_wakeupPipe,
|
||||||
wxFDIO_INPUT
|
wxFDIO_INPUT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxConsoleEventLoop::~wxConsoleEventLoop()
|
||||||
|
{
|
||||||
|
delete m_wakeupPipe;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// events dispatch and loop handling
|
// events dispatch and loop handling
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -191,7 +229,7 @@ int wxConsoleEventLoop::DispatchTimeout(unsigned long timeout)
|
|||||||
|
|
||||||
void wxConsoleEventLoop::WakeUp()
|
void wxConsoleEventLoop::WakeUp()
|
||||||
{
|
{
|
||||||
m_wakeupPipe.WakeUp();
|
m_wakeupPipe->WakeUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxConsoleEventLoop::OnNextIteration()
|
void wxConsoleEventLoop::OnNextIteration()
|
||||||
|
Reference in New Issue
Block a user