From: Stefan Neis <Stefan.Neis@t-online.de>
Date: Sun, 7 Sep 2003 17:50:12 +0000 (+0000)
Subject: Insure that messages are posted to the main threads event loop,
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d4ca5c8c7b1c87e5989a3638f665061aef8e2732?ds=sidebyside;hp=ad0500fb78615f351bea58e6aa7e4f46bd091546

Insure that messages are posted to the main threads event loop,
        instead of sending them to the thread-local event loop
        (which typically does not exist under wxWindows).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23421 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/include/wx/os2/private.h b/include/wx/os2/private.h
index 3f8256b982..74c0a023d6 100644
--- a/include/wx/os2/private.h
+++ b/include/wx/os2/private.h
@@ -268,6 +268,20 @@ WXDLLEXPORT HINSTANCE wxGetInstance();
 
 WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
 
+#include "wx/thread.h"
+static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid,
+                                MPARAM mpParam1, MPARAM mpParam2)
+{
+    MRESULT vRes;
+    vRes = ::WinSendMsg(hwnd, ulMsgid, mpParam1, mpParam2);
+#if wxUSE_THREADS
+    if (!wxThread::IsMain())
+        ::WinPostMsg(hwnd, ulMsgid, mpParam1, mpParam2);
+#endif
+    return vRes;
+}
+#define WinSendMsg MySendMsg
+
 #if wxUSE_GUI
 
 WXDLLEXPORT void wxDrawBorder( HPS     hPS