diff options
author | larryh%netscape.com <devnull@localhost> | 1999-02-24 19:19:21 +0000 |
---|---|---|
committer | larryh%netscape.com <devnull@localhost> | 1999-02-24 19:19:21 +0000 |
commit | fa283bebd9045ac56e6a878912a7b797f5a96518 (patch) | |
tree | 0d73cb736cfb2625fbfe09991b48293ca3db4900 | |
parent | 2862b355a0d28eb3d788a2c48f23ee2b129cfc55 (diff) | |
download | nspr-hg-fa283bebd9045ac56e6a878912a7b797f5a96518.tar.gz |
mumble. restore to 3.11
-rw-r--r-- | lib/ds/plevent.c | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/lib/ds/plevent.c b/lib/ds/plevent.c index 6742f1f7..938c9073 100644 --- a/lib/ds/plevent.c +++ b/lib/ds/plevent.c @@ -90,6 +90,8 @@ static void _md_CreateEventQueue( PLEventQueue *eventQueue ); #if defined(_WIN32) || defined(WIN16) || defined(XP_OS2) +PLEventQueue * _pr_MainEventQueue; + #if defined(XP_OS2) ULONG _pr_PostEventMsgId; static char *_pr_eventWindowClass = "NSPR:EventWindow"; @@ -603,8 +605,15 @@ _pl_CleanupNativeNotifier(PLEventQueue* self) static PRStatus _pl_NativeNotify(PLEventQueue* self) { - PostMessage( self->eventReceiverWindow, _pr_PostEventMsgId, - (WPARAM)0, (LPARAM)self); + /* + ** Post a message to the NSPR window on the main thread requesting + ** it to process the pending events. This is only necessary for the + ** main event queue, since the main thread is waiting for OS events. + */ + if (self == _pr_MainEventQueue ) { + PostMessage( self->eventReceiverWindow, _pr_PostEventMsgId, + (WPARAM)0, (LPARAM)self); + } return PR_SUCCESS; }/* --- end _pl_NativeNotify() --- */ #endif @@ -747,6 +756,13 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) #if defined(WIN16) || defined(_WIN32) || defined(XP_OS2) +PR_IMPLEMENT(PLEventQueue *) + PL_GetMainEventQueue( void ) +{ + PR_ASSERT( _pr_MainEventQueue ); + + return _pr_MainEventQueue; +} #ifdef XP_OS2 MRESULT EXPENTRY _md_EventReceiverProc(HWND hwnd, ULONG uMsg, MPARAM wParam, MPARAM lParam) @@ -760,15 +776,19 @@ _md_EventReceiverProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (_pr_PostEventMsgId == uMsg ) { - PREventQueue *queue = (PREventQueue *)lParam; - - PR_ProcessPendingEvents(queue); + PREventQueue *queue = (PREventQueue *)lParam; + + PR_ASSERT(queue == PL_GetMainEventQueue()); + if (queue == PL_GetMainEventQueue()) + { + PR_ProcessPendingEvents(queue); #ifdef XP_OS2 return MRFROMLONG(TRUE); #else return TRUE; #endif } + } return DefWindowProc(hwnd, uMsg, wParam, lParam); } @@ -792,10 +812,41 @@ static PRStatus InitEventLib( void ) return PR_SUCCESS; } /* end InitWinEventLib() */ + +PR_IMPLEMENT(void) + PL_InitializeEventsLib( char *name ) +{ + PLEventQueue *eventQueue; + + PR_CallOnce( &once, InitEventLib ); + + PR_Lock( initLock ); + if ( isInitialized == PR_FALSE ) + { + isInitialized = PR_TRUE; + + eventQueue = PL_CreateEventQueue( name, PR_GetCurrentThread() ); + _pr_MainEventQueue = eventQueue; + } + PR_Unlock( initLock ); + + PR_LOG(event_lm, PR_LOG_DEBUG,("PL_InitializeeventsLib(). Done!\n")); + return; +} #endif /* Win16, Win32, OS2 */ #if defined(_WIN32) || defined(WIN16) || defined(XP_OS2) +PR_IMPLEMENT(HWND) + PR_GetEventReceiverWindow( void ) +{ + HWND eventReceiver = _pr_MainEventQueue->eventReceiverWindow; + + if( eventReceiver != 0 ) + return eventReceiver; + else + return 0; +} #endif #if defined(_WIN32) || defined(WIN16) |