Merge branch 'msw-wakeup-no-msg'

Restore using event objects, instead of posting WM_NULL messages, for
idle wakeup under MSW.
This commit is contained in:
Vadim Zeitlin
2018-01-14 13:38:04 +01:00
10 changed files with 123 additions and 125 deletions

View File

@@ -128,8 +128,9 @@ public:
// idle handling
// -------------
// make sure that idle events are sent again
virtual void WakeUpIdle();
// make sure that idle events are sent again: this is just an obsolete
// synonym for WakeUp()
void WakeUpIdle() { WakeUp(); }
// this virtual function is called when the application
// becomes idle and by default it forwards to wxApp::ProcessIdle() and

View File

@@ -103,6 +103,10 @@ public:
// use it.
static wxLayoutDirection MSWGetDefaultLayout(wxWindow* parent = NULL);
// Call ProcessPendingEvents() but only if we need to do it, i.e. there was
// a recent call to WakeUpIdle().
void MSWProcessPendingEventsIfNeeded();
protected:
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT

View File

@@ -53,7 +53,6 @@ public:
// override/implement base class virtuals
virtual bool Dispatch() wxOVERRIDE;
virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE;
virtual void WakeUp() wxOVERRIDE;
protected:
virtual void OnNextIteration() wxOVERRIDE;

View File

@@ -15,9 +15,24 @@ class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual
{
public:
wxMSWEventLoopBase();
virtual ~wxMSWEventLoopBase();
// implement base class pure virtuals
virtual bool Pending() const wxOVERRIDE;
virtual void WakeUp() wxOVERRIDE;
#if wxUSE_THREADS
// MSW-specific method to wait for the termination of the specified (by its
// native handle) thread or any input message arriving (in GUI case).
//
// Return value is WAIT_OBJECT_0 if the thread terminated, WAIT_OBJECT_0+1
// if a message arrived with anything else indicating an error.
WXDWORD MSWWaitForThread(WXHANDLE hThread);
#endif // wxUSE_THREADS
// Return true if wake up was requested and not handled yet, i.e. if
// m_heventWake is signaled.
bool MSWIsWakeUpRequested();
protected:
// get the next message from queue and return true or return false if we
@@ -25,8 +40,13 @@ protected:
bool GetNextMessage(WXMSG *msg);
// same as above but with a timeout and return value can be -1 meaning that
// time out expired in addition to
// time out expired in addition to true/false
int GetNextMessageTimeout(WXMSG *msg, unsigned long timeout);
private:
// An auto-reset Win32 event which is signalled when we need to wake up the
// main thread waiting in GetNextMessage[Timeout]().
WXHANDLE m_heventWake;
};
#if wxUSE_CONSOLE_EVENTLOOP
@@ -39,7 +59,6 @@ public:
// override/implement base class virtuals
virtual bool Dispatch() wxOVERRIDE;
virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE;
virtual void WakeUp() wxOVERRIDE;
// Windows-specific function to process a single message
virtual void ProcessMessage(WXMSG *msg);