wxDFB: use Unix event loop and timers (fixes #10408)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,12 +21,12 @@
|
||||
# error "wxFileConfig is required by wxDFB port"
|
||||
#endif
|
||||
|
||||
#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER
|
||||
#if wxUSE_SOCKETS && !wxUSE_CONSOLE_EVENTLOOP
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxSocket requires wxSelectDispatcher in wxDFB"
|
||||
# else
|
||||
# undef wxUSE_SELECT_DISPATCHER
|
||||
# define wxUSE_SELECT_DISPATCHER 1
|
||||
# undef wxUSE_CONSOLE_EVENTLOOP
|
||||
# define wxUSE_CONSOLE_EVENTLOOP 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@@ -12,44 +12,35 @@
|
||||
#define _WX_DFB_EVTLOOP_H_
|
||||
|
||||
#include "wx/dfb/dfbptr.h"
|
||||
#include "wx/unix/evtloop.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBEventBuffer);
|
||||
struct wxDFBEvent;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxEventLoop
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopManual
|
||||
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxConsoleEventLoop
|
||||
{
|
||||
public:
|
||||
wxGUIEventLoop();
|
||||
|
||||
virtual bool Pending() const;
|
||||
virtual bool Dispatch();
|
||||
virtual int DispatchTimeout(unsigned long timeout);
|
||||
|
||||
// returns DirectFB event buffer used by wx
|
||||
static wxIDirectFBEventBufferPtr GetDirectFBEventBuffer();
|
||||
|
||||
private:
|
||||
// wxYield implementation: iterate the loop as long as there are any
|
||||
// pending events
|
||||
void Yield();
|
||||
|
||||
protected:
|
||||
virtual void WakeUp();
|
||||
virtual void OnNextIteration();
|
||||
|
||||
virtual void HandleDFBEvent(const wxDFBEvent& event);
|
||||
|
||||
private:
|
||||
static void InitBuffer();
|
||||
static void CleanUp();
|
||||
|
||||
friend class wxApp; // calls CleanUp() and WakeUp()
|
||||
friend class wxApp; // calls CleanUp()
|
||||
|
||||
private:
|
||||
static wxIDirectFBEventBufferPtr ms_buffer;
|
||||
static int ms_bufferFd;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxGUIEventLoop)
|
||||
};
|
||||
|
@@ -18,6 +18,7 @@
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBWindow);
|
||||
class wxDfbQueuedPaintRequests;
|
||||
struct wxDFBWindowEvent;
|
||||
class wxDFBEventsHandler;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxNonOwnedWindow
|
||||
@@ -118,8 +119,8 @@ private:
|
||||
// are we currently painting some area of this TLW?
|
||||
bool m_isPainting;
|
||||
|
||||
friend class wxGUIEventLoop; // for HandleDFBWindowEvent
|
||||
friend class wxWindowDFB; // for SetDfbFocus
|
||||
friend class wxDFBEventsHandler; // for HandleDFBWindowEvent
|
||||
friend class wxWindowDFB; // for SetDfbFocus
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_NONOWNEDWND_H_
|
||||
|
@@ -368,39 +368,9 @@ struct wxIDirectFBEventBuffer : public wxDfbWrapper<IDirectFBEventBuffer>
|
||||
{
|
||||
wxIDirectFBEventBuffer(IDirectFBEventBuffer *s) { Init(s); }
|
||||
|
||||
bool WakeUp()
|
||||
bool CreateFileDescriptor(int *ret_fd)
|
||||
{
|
||||
return Check(m_ptr->WakeUp(m_ptr));
|
||||
}
|
||||
|
||||
bool HasEvent()
|
||||
{
|
||||
// returns DFB_OK if there is >=1 event, DFB_BUFFEREMPTY otherwise
|
||||
DFBResult r = m_ptr->HasEvent(m_ptr);
|
||||
|
||||
// NB: Check() also returns true for DFB_BUFFEREMPTY, so we can't just
|
||||
// return it's return value:
|
||||
Check(r);
|
||||
return (r == DFB_OK);
|
||||
}
|
||||
|
||||
bool WaitForEventWithTimeout(unsigned secs, unsigned millisecs)
|
||||
{
|
||||
DFBResult r = m_ptr->WaitForEventWithTimeout(m_ptr, secs, millisecs);
|
||||
|
||||
// DFB_TIMEOUT is not an error in this function:
|
||||
if ( r == DFB_TIMEOUT )
|
||||
{
|
||||
m_lastResult = DFB_TIMEOUT;
|
||||
return true;
|
||||
}
|
||||
|
||||
return Check(r);
|
||||
}
|
||||
|
||||
bool GetEvent(wxDFBEvent& event)
|
||||
{
|
||||
return Check(m_ptr->GetEvent(m_ptr, &event));
|
||||
return Check(m_ptr->CreateFileDescriptor(m_ptr, ret_fd));
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -23,7 +23,9 @@ typedef wxMilliClock_t wxUsecClock_t;
|
||||
// wxTimer implementation class for Unix platforms
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxUnixTimerImpl : public wxTimerImpl
|
||||
// NB: we have to export at least this symbol from the shared library, because
|
||||
// it's used by wxDFB's wxCore
|
||||
class WXDLLIMPEXP_BASE wxUnixTimerImpl : public wxTimerImpl
|
||||
{
|
||||
public:
|
||||
wxUnixTimerImpl(wxTimer *timer);
|
||||
|
Reference in New Issue
Block a user