From 3f8cdda4851796e5f5f5bcd82d9e867a30581a6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 31 Jan 2009 10:58:10 +0000 Subject: [PATCH] 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 --- Makefile.in | 18 -------------- build/bakefiles/files.bkl | 2 -- include/wx/unix/evtloop.h | 38 ++++++++-------------------- src/unix/evtloopunix.cpp | 52 +++++++++++++++++++++++++++++++++------ 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Makefile.in b/Makefile.in index c5c79ff9f8..c6ee928f4e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -595,8 +595,6 @@ ALL_PORTS_BASE_HEADERS = \ wx/meta/if.h \ wx/meta/int2type.h \ wx/meta/movable.h \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2073,8 +2071,6 @@ COND_TOOLKIT_X11_BASE_OSX_SRC = \ src/osx/core/utilsexc_base.cpp @COND_TOOLKIT_X11@BASE_OSX_SRC = $(COND_TOOLKIT_X11_BASE_OSX_SRC) COND_TOOLKIT__BASE_OSX_HDR = \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2095,8 +2091,6 @@ COND_TOOLKIT__BASE_OSX_HDR = \ wx/osx/core/private/strconv_cf.h @COND_TOOLKIT_@BASE_OSX_HDR = $(COND_TOOLKIT__BASE_OSX_HDR) COND_TOOLKIT_COCOA_BASE_OSX_HDR = \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2117,8 +2111,6 @@ COND_TOOLKIT_COCOA_BASE_OSX_HDR = \ wx/osx/core/private/strconv_cf.h @COND_TOOLKIT_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_COCOA_BASE_OSX_HDR) COND_TOOLKIT_GTK_BASE_OSX_HDR = \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2139,8 +2131,6 @@ COND_TOOLKIT_GTK_BASE_OSX_HDR = \ wx/osx/core/private/strconv_cf.h @COND_TOOLKIT_GTK@BASE_OSX_HDR = $(COND_TOOLKIT_GTK_BASE_OSX_HDR) COND_TOOLKIT_MOTIF_BASE_OSX_HDR = \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2168,8 +2158,6 @@ COND_TOOLKIT_OSX_CARBON_BASE_OSX_HDR = \ wx/osx/core/private.h \ wx/osx/core/stdpaths.h \ wx/osx/core/private/strconv_cf.h \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2188,8 +2176,6 @@ COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR = \ wx/osx/core/private.h \ wx/osx/core/stdpaths.h \ wx/osx/core/private/strconv_cf.h \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2201,8 +2187,6 @@ COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR = \ wx/unix/tls.h @COND_TOOLKIT_OSX_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR) COND_TOOLKIT_X11_BASE_OSX_HDR = \ - wx/private/fdiodispatcher.h \ - wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ wx/unix/apptrait.h \ @@ -2236,8 +2220,6 @@ COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR = \ wx/os2/wxrsc.h @COND_PLATFORM_OS2_1@BASE_PLATFORM_HDR = $(COND_PLATFORM_OS2_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/apptbase.h \ wx/unix/apptrait.h \ diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index ce89734eec..a68221526b 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -72,8 +72,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - wx/private/fdiodispatcher.h - wx/private/selectdispatcher.h wx/unix/app.h wx/unix/apptbase.h wx/unix/apptrait.h diff --git a/include/wx/unix/evtloop.h b/include/wx/unix/evtloop.h index ddb101516f..ab5a5f9a40 100644 --- a/include/wx/unix/evtloop.h +++ b/include/wx/unix/evtloop.h @@ -13,18 +13,23 @@ #if wxUSE_CONSOLE_EVENTLOOP -#include "wx/private/fdiodispatcher.h" -#include "wx/unix/pipe.h" - // ---------------------------------------------------------------------------- -// wxEventLoop +// wxConsoleEventLoop // ---------------------------------------------------------------------------- +class wxFDIODispatcher; + +namespace wxPrivate +{ + class PipeIOHandler; +}; + class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual { public: // initialize the event loop, use IsOk() to check if we were successful wxConsoleEventLoop(); + virtual ~wxConsoleEventLoop(); // implement base class pure virtuals virtual bool Pending() const; @@ -39,30 +44,7 @@ protected: private: // 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; - }; - - PipeIOHandler m_wakeupPipe; + wxPrivate::PipeIOHandler *m_wakeupPipe; // either wxSelectDispatcher or wxEpollDispatcher wxFDIODispatcher *m_dispatcher; diff --git a/src/unix/evtloopunix.cpp b/src/unix/evtloopunix.cpp index b439c4d466..99d9c1e34e 100644 --- a/src/unix/evtloopunix.cpp +++ b/src/unix/evtloopunix.cpp @@ -31,6 +31,7 @@ #include "wx/evtloop.h" #include "wx/thread.h" #include "wx/module.h" +#include "wx/unix/pipe.h" #include "wx/unix/private/timer.h" #include "wx/unix/private/epolldispatcher.h" #include "wx/private/selectdispatcher.h" @@ -41,11 +42,39 @@ // 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 // ---------------------------------------------------------------------------- -bool wxConsoleEventLoop::PipeIOHandler::Create() +bool PipeIOHandler::Create() { if ( !m_pipe.Create() ) { @@ -72,7 +101,7 @@ bool wxConsoleEventLoop::PipeIOHandler::Create() // wakeup handling // ---------------------------------------------------------------------------- -void wxConsoleEventLoop::PipeIOHandler::WakeUp() +void PipeIOHandler::WakeUp() { 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 // 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 } +} // namespace wxPrivate + // =========================================================================== // wxEventLoop implementation // =========================================================================== @@ -122,8 +153,10 @@ void wxConsoleEventLoop::PipeIOHandler::OnReadWaiting() wxConsoleEventLoop::wxConsoleEventLoop() { - if ( !m_wakeupPipe.Create() ) + m_wakeupPipe = new wxPrivate::PipeIOHandler(); + if ( !m_wakeupPipe->Create() ) { + wxDELETE(m_wakeupPipe); m_dispatcher = NULL; return; } @@ -134,12 +167,17 @@ wxConsoleEventLoop::wxConsoleEventLoop() m_dispatcher->RegisterFD ( - m_wakeupPipe.GetReadFd(), - &m_wakeupPipe, + m_wakeupPipe->GetReadFd(), + m_wakeupPipe, wxFDIO_INPUT ); } +wxConsoleEventLoop::~wxConsoleEventLoop() +{ + delete m_wakeupPipe; +} + //----------------------------------------------------------------------------- // events dispatch and loop handling //----------------------------------------------------------------------------- @@ -191,7 +229,7 @@ int wxConsoleEventLoop::DispatchTimeout(unsigned long timeout) void wxConsoleEventLoop::WakeUp() { - m_wakeupPipe.WakeUp(); + m_wakeupPipe->WakeUp(); } void wxConsoleEventLoop::OnNextIteration() -- 2.47.2