コード例 #1
0
ファイル: nsAppShell.cpp プロジェクト: amyvmiwei/firefox
bool
nsAppShell::event (QEvent *e)
{
    if (e->type() == sPokeEvent) {
        NativeEventCallback();
        return true;
    }

    return false;
}
コード例 #2
0
ファイル: nsAppShell.cpp プロジェクト: sahlberg/timberwolf
PRBool nsAppShell::ProcessNextNativeEvent(PRBool mayWait)
{
	PRBool gotMessage = PR_FALSE;
	struct Message *m;

	if (!mAppShellPort)
		return PR_FALSE;

	LOGAPPSHELL(("ProcessNextNativeEvent in %p, mayWait = %s\n", IExec->FindTask(NULL), mayWait ? "true" : "false"));

	// Call the native event callback
	while (mAppShellPort && (m = IExec->GetMsg(mAppShellPort)))
	{
		//gotMessage = PR_TRUE;
		NativeEventCallback();
		IExec->ItemPoolFree(mMessageItemPool, (void *)m);
	}

	// Process window messages
	struct IntuiMessage *imsg;

	while (mSharedWindowPort &&
			(imsg = reinterpret_cast<struct IntuiMessage *>(IExec->GetMsg(mSharedWindowPort))))
	{
		gotMessage = PR_TRUE;

		LOGAPPSHELL(("Got IDCMP message\n"));

		PRBool didHandle = TRUE;
		if (imsg->IDCMPWindow)
		{
			nsWindow *win = reinterpret_cast<nsWindow *>(imsg->IDCMPWindow->UserData);
			didHandle = win->HandleAmigaIDCMP(imsg);
		}
		else
		{
			LOGAPPSHELL(("Stray IDCMP\n"));
		}

		if (didHandle == PR_FALSE)
		{
			// See what else we can do with this message
		}
		IExec->ReplyMsg(reinterpret_cast<struct Message *>(imsg));
	}

	// Process internal port
	struct AppShellInternalMessage *im;
	while (mInternalPort &&
			(im = reinterpret_cast<struct AppShellInternalMessage *>(IExec->GetMsg(mInternalPort))))
	{
		//gotMessage = PR_TRUE;
		if (im->data1 == 0)
		{
			nsWindow *w = reinterpret_cast<nsWindow *>(im->data2);
			if (nsWindow::ValidateWindow(w))
				w->DrawDamagedRegions();
		}
		IExec->ItemPoolFree(mMessageItemPool, (void *)im);
	}

	if (mayWait)
	{
		uint32 sigMask =
				  (1L << mAppShellPort->mp_SigBit)
				| (1L << mSharedWindowPort->mp_SigBit)
				| (1l << mInternalPort->mp_SigBit)
				| SIGBREAKF_CTRL_C
				;

		IExec->Wait(sigMask);
	}

	return gotMessage;
}