Merge SOC2009_FSWATCHER branch into trunk.
Merges everything from the branch with only some minor changes, mostly renamed
wxUSE_FSWATCHER_{INOTIFY,KQUEUE} to wxHAS_{INOTIFY,KQUEUE}.
Add wxFileSystemWatcher and related classes.
Also introduces wxEventLoopSource.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -187,6 +187,70 @@ wxConsoleEventLoop::~wxConsoleEventLoop()
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// adding & removing sources
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_EVENTLOOP_SOURCE
|
||||
|
||||
// This class is a temporary bridge between event loop sources and
|
||||
// FDIODispatcher. It is going to be removed soon, when all subject interfaces
|
||||
// are modified
|
||||
class wxFDIOEventLoopSourceHandler : public wxFDIOHandler
|
||||
{
|
||||
public:
|
||||
wxFDIOEventLoopSourceHandler(wxEventLoopSourceHandler* handler) :
|
||||
m_impl(handler) { }
|
||||
|
||||
virtual void OnReadWaiting()
|
||||
{
|
||||
m_impl->OnReadWaiting();
|
||||
}
|
||||
virtual void OnWriteWaiting()
|
||||
{
|
||||
m_impl->OnWriteWaiting();
|
||||
}
|
||||
|
||||
virtual void OnExceptionWaiting()
|
||||
{
|
||||
m_impl->OnExceptionWaiting();
|
||||
}
|
||||
|
||||
protected:
|
||||
wxEventLoopSourceHandler* m_impl;
|
||||
};
|
||||
|
||||
bool wxConsoleEventLoop::DoAddSource(wxAbstractEventLoopSource* src)
|
||||
{
|
||||
Source* source = dynamic_cast<Source*>(src);
|
||||
wxCHECK_MSG( source, false, "Invalid source type" );
|
||||
|
||||
wxLogTrace(wxTRACE_EVT_SOURCE,
|
||||
"wxConsoleEventLoop::AddSource() source=%d",
|
||||
source->GetResource());
|
||||
|
||||
// translating into wxFDIOHandler
|
||||
// XXX this is a memory leak of course, but this is really temporary, so
|
||||
// we are not creating another map of handlers
|
||||
wxFDIOHandler* h = new wxFDIOEventLoopSourceHandler(source->GetHandler());
|
||||
|
||||
return m_dispatcher->RegisterFD(source->GetResource(), h,
|
||||
source->GetFlags());
|
||||
}
|
||||
|
||||
bool wxConsoleEventLoop::DoRemoveSource(wxAbstractEventLoopSource* src)
|
||||
{
|
||||
Source* source = dynamic_cast<Source*>(src);
|
||||
wxCHECK_MSG( source, false, "Invalid source type" );
|
||||
|
||||
wxLogTrace(wxTRACE_EVT_SOURCE,
|
||||
"wxConsoleEventLoop::RemoveSource() source=%d",
|
||||
source->GetResource());
|
||||
|
||||
return m_dispatcher->UnregisterFD(source->GetResource());
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// events dispatch and loop handling
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user