Applied patch [ 824244 ] wxMSW event loop fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,6 +53,8 @@
|
|||||||
#include "wx/ownerdrw.h"
|
#include "wx/ownerdrw.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -5683,3 +5685,54 @@ bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
|
|
||||||
#endif // wxUSE_HOTKEY
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
|
// Not verified for WinCE
|
||||||
|
#ifndef __WXWINCE__
|
||||||
|
/*
|
||||||
|
* wxEventFixModule (needs a better name) allows message handling to continute while a menu
|
||||||
|
* is being shown - ie, to continue processing messages from a worker thread.
|
||||||
|
*
|
||||||
|
* Code originally by Jason W. from wx-dev, reworked into a wxModule by Chris Mellon
|
||||||
|
*/
|
||||||
|
|
||||||
|
class wxEventFixModule : public wxModule {
|
||||||
|
public:
|
||||||
|
//base class virtuals
|
||||||
|
virtual bool OnInit() {
|
||||||
|
wxEventFixModule::s_hMsgHookProc = SetWindowsHookEx(
|
||||||
|
WH_GETMESSAGE,
|
||||||
|
&wxEventFixModule::MsgHookProc,
|
||||||
|
NULL,
|
||||||
|
GetCurrentThreadId());
|
||||||
|
wxLogDebug(_T("Loaded event fix module"));
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
virtual void OnExit() {
|
||||||
|
UnhookWindowsHookEx(wxEventFixModule::s_hMsgHookProc);
|
||||||
|
|
||||||
|
};
|
||||||
|
static LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||||
|
MSG *msg = (MSG*)lParam;
|
||||||
|
switch (msg->message)
|
||||||
|
{
|
||||||
|
case WM_NULL:
|
||||||
|
static bool bInHookProc = false;
|
||||||
|
if (!bInHookProc)
|
||||||
|
{
|
||||||
|
bInHookProc = true;
|
||||||
|
wxTheApp->ProcessPendingEvents();
|
||||||
|
bInHookProc = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CallNextHookEx(wxEventFixModule::s_hMsgHookProc, nCode, wParam, lParam);
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
static HHOOK s_hMsgHookProc;
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxEventFixModule)
|
||||||
|
};
|
||||||
|
HHOOK wxEventFixModule::s_hMsgHookProc = 0;
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxEventFixModule, wxModule)
|
||||||
|
#endif
|
||||||
|
// __WXWINCE__
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user