Major change in ncCEvent, I made another encapsulation layer called

nsCPhEvent


git-svn-id: svn://10.0.0.236/trunk@46394 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Jerry.Kirk%Nexwarecorp.com
1999-09-08 20:11:24 +00:00
parent a6c8a5cc24
commit 2cb20d8fee
9 changed files with 246 additions and 45 deletions

View File

@@ -22,8 +22,12 @@
*/
#include "nsCPlatformBaseLoop.h"
#include "nsCPhEvent.h"
#include "nsCPhFilter.h"
#include "nsPhEventLog.h"
#include <Pt.h>
//*****************************************************************************
//*** nsCPlatformBaseLoop: Object Management
//*****************************************************************************
@@ -32,10 +36,13 @@ nsCPlatformBaseLoop::nsCPlatformBaseLoop(nsEventLoopType type) :
nsCBaseLoop(type)
{
m_PhThreadId = pthread_self();
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::nsCPlatformBaseLoop nsEventLoopType=<%d> m_PhThreadId=<%d>\n", type, m_PhThreadId));
}
nsCPlatformBaseLoop::~nsCPlatformBaseLoop()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::~nsCPlatformBaseLoop m_PhThreadId=<%d>\n", m_PhThreadId));
}
//*****************************************************************************
@@ -46,17 +53,49 @@ nsCPlatformBaseLoop::~nsCPlatformBaseLoop()
nsresult nsCPlatformBaseLoop::PlatformGetNextEvent(void* platformFilterData,
void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent platformFilterData=<%p> platformEventData=<%p>\n", platformFilterData, platformEventData));
nsCPhFilter* filter=(nsCPhFilter*)platformFilterData;
PhEvent_t* pEvent = (PhEvent_t*) platformEventData;
if(::GetMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax))
return NS_OK;
return NS_COMFALSE;
nsCPhEvent* pEvent = (nsCPhEvent*) platformEventData;
PRBool done = PR_FALSE;
if(filter != NULL)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent Filters not supported\n"));
return NS_COMFALSE;
}
while(!done)
{
switch( PhEventNext(pEvent->m_msg, pEvent->GetEventBufferSize()))
{
case Ph_EVENT_MSG:
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent GetMessage\n"));
done = PR_TRUE;
break;
case Ph_RESIZE_MSG:
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent Resize Message from <%d> to <%d>\n", pEvent->GetEventBufferSize(), pEvent->GetEventSize()));
pEvent->ResizeEvent(pEvent->GetEventSize());
break;
}
}
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformPeekNextEvent(void* platformFilterData,
void* platformEventData, PRBool fRemoveEvent)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPeekNextEvent platformFilterData=<%p> platformEventData=<%p> fRemoveEvent=<%d>\n", platformFilterData, platformEventData, fRemoveEvent));
if(fRemoveEvent == PR_FALSE)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPeekNextEvent Leaving the element on the queue is not supported\n"));
return NS_COMFALSE;
}
#if 0
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
@@ -67,32 +106,51 @@ nsresult nsCPlatformBaseLoop::PlatformPeekNextEvent(void* platformFilterData,
if(::PeekMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax, filter->wRemoveFlags))
return NS_OK;
#endif
return NS_COMFALSE;
}
nsresult nsCPlatformBaseLoop::PlatformTranslateEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformTranslateEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
::TranslateMessage(pMsg);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformDispatchEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformDispatchEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
::DispatchMessage(pMsg);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformSendLoopEvent(void* platformEventData, PRInt32* result)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformSendLoopEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
*result = ::SendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam,pMsg->lParam);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformPostLoopEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPostLoopEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
if(!pMsg->hwnd)
{
@@ -102,21 +160,29 @@ nsresult nsCPlatformBaseLoop::PlatformPostLoopEvent(void* platformEventData)
}
else if(!::PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam))
return NS_ERROR_FAILURE;
#endif
return NS_OK;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetEventType()
{
return nsNativeEventDataTypes::WinMsgStruct;
return nsNativeEventDataTypes::PhotonMsgStruct;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetFilterType()
{
return nsNativeFilterDataTypes::WinFilter;
return nsNativeFilterDataTypes::PhotonFilter;
}
PRInt32 nsCPlatformBaseLoop::PlatformGetReturnCode(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetReturnCode platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
return pMsg->wParam;
#endif
return -1;
}