Ejemplo n.º 1
0
void
COSXScreen::hideCursor()
{
	LOG((CLOG_DEBUG "hiding cursor"));

	CFStringRef propertyString = CFStringCreateWithCString(
		NULL, "SetsCursorInBackground", kCFStringEncodingMacRoman);

	CGSSetConnectionProperty(
		_CGSDefaultConnection(), _CGSDefaultConnection(),
		propertyString, kCFBooleanTrue);

	CFRelease(propertyString);

	CGError error = CGDisplayHideCursor(m_displayID);
	if (error != kCGErrorSuccess) {
		LOG((CLOG_ERR "failed to hide cursor, error=%d", error));
	}

	// appears to fix "mouse randomly not hiding" bug
	CGAssociateMouseAndMouseCursorPosition(true);

	if (CGCursorIsVisible()) {
		LOG((CLOG_WARN "cursor may be still visible"));
	}

	m_cursorHidden = true;
}
void FOutputDeviceMacError::HandleError()
{
	// make sure we don't report errors twice
	static int32 CallCount = 0;
	int32 NewCallCount = FPlatformAtomics::InterlockedIncrement(&CallCount);
	if (NewCallCount != 1)
	{
		UE_LOG(LogMac, Error, TEXT("HandleError re-entered.") );
		return;
	}

	// Trigger the OnSystemFailure hook if it exists
	FCoreDelegates::OnHandleSystemError.Broadcast();

	try
	{
		GIsGuarded				= 0;
		GIsRunning				= 0;
		GIsCriticalError		= 1;
		GLogConsole				= NULL;
		GErrorHist[ARRAY_COUNT(GErrorHist)-1]=0;

		// Dump the error and flush the log.
		UE_LOG(LogMac, Log, TEXT("=== Critical error: ===") LINE_TERMINATOR TEXT("%s") LINE_TERMINATOR, GErrorExceptionDescription);
		UE_LOG(LogMac, Log, GErrorHist);

		GLog->Flush();

		// Unhide the mouse.
		while (!CGCursorIsVisible())
		{
			CGDisplayShowCursor(kCGDirectMainDisplay);
		}
		// Release capture and allow mouse to freely roam around.
		CGAssociateMouseAndMouseCursorPosition(true);

		FPlatformMisc::ClipboardCopy(GErrorHist);

		FPlatformMisc::SubmitErrorReport( GErrorHist, EErrorReportMode::Interactive );

		FCoreDelegates::OnShutdownAfterError.Broadcast();
	}
	catch( ... )
	{}
}