Example #1
0
bool QWidgetPrivate::stealMouseGrab(bool grab)
{
    // This is like a combination of grab/releaseMouse() but with error checking
    // and it has no effect on the result of mouseGrabber().
    Q_Q(QWidget);
    QWindow *window = grabberWindow(q);
    return window ? window->setMouseGrabEnabled(grab) : false;
}
Example #2
0
bool ErrorReport::Initialize() {
	
	try {
		
		// Create a shared memory object.
		m_SharedMemory = boost::interprocess::shared_memory_object(boost::interprocess::open_only, m_SharedMemoryName.toStdString().c_str(), boost::interprocess::read_write);
		
		// Map the whole shared memory in this process
		m_MemoryMappedRegion = boost::interprocess::mapped_region(m_SharedMemory, boost::interprocess::read_write);
		
		// Our SharedCrashInfo will be stored in this shared memory.
		m_pCrashInfo = static_cast<CrashInfo *>(m_MemoryMappedRegion.get_address());
		
		#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
		if(m_pCrashInfo->window) {
			QWindow * window = QWindow::fromWinId(m_pCrashInfo->window);
			if(window) {
				window->showMinimized();
				window->hide();
				window->setMouseGrabEnabled(true);
				window->setMouseGrabEnabled(false);
			}
		}
		#endif
		
	} catch(...) {
		m_pCrashInfo = NULL;
		m_DetailedError = "We encountered an unexpected error while collecting crash information!";
		return false;
	}
	
	if(!m_pCrashInfo || m_MemoryMappedRegion.get_size() != sizeof(CrashInfo)) {
		m_DetailedError = "The size of the memory mapped region does not match the size of the CrashInfo structure.";
		return false;
	}
	
	m_pCrashInfo->reporterStarted.post();
	
	return true;
}