bool OBStereoFacade::HasTetrahedralStereo(unsigned long atomId) { EnsureInit(); if (m_tetrahedralMap.find(atomId) != m_tetrahedralMap.end()) return true; return false; }
void KeyFlush() { if (EnsureInit ()) { ULONG cElements = INFINITE; ULONG kcKey; // HRESULT hr = IDirectInputDevice_GetDeviceData ( g_lpdidKeybd, sizeof (DIDEVICEOBJECTDATA), NULL, (int *) &cElements, 0); for (kcKey = 0; kcKey < 256; kcKey ++) { g_rgtimeElapsed [kcKey] = 0; g_rgcDowns [kcKey] = 0; g_rgcUps [kcKey] = 0; keyd_pressed [kcKey] = 0; } FlushQueue (); } }
bool OBStereoFacade::HasSquarePlanarStereo(unsigned long atomId) { EnsureInit(); if (m_squarePlanarMap.find(atomId) != m_squarePlanarMap.end()) return true; return false; }
bool OBStereoFacade::HasCisTransStereo(unsigned long bondId) { EnsureInit(); if (m_cistransMap.find(bondId) != m_cistransMap.end()) return true; return false; }
NS_IMETHODIMP nsScreenManagerGtk :: ScreenForNativeWidget (void *aWidget, nsIScreen **outScreen) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForNativeWidget"); return rv; } if (mCachedScreenArray.Count() > 1) { // I don't know how to go from GtkWindow to nsIScreen, especially // given xinerama and stuff, so let's just do this gint x, y, width, height, depth; x = y = width = height = 0; gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height, &depth); gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y); rv = ScreenForRect(x, y, width, height, outScreen); } else { rv = GetPrimaryScreen(outScreen); } return rv; }
const TStrV& TTmInfo::GetDayOfWeekNmV(const TLoc& Loc) { EnsureInit(); switch (Loc){ case lUs: return UsDayOfWeekNmV; case lSi: return SiDayOfWeekNmV; default: Fail; return UsDayOfWeekNmV; } }
NS_IMETHODIMP nsCacheEntryDescriptor:: nsOutputStreamWrapper::Flush() { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mOutput->Flush(); }
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Read(char *buf, PRUint32 count, PRUint32 *countRead) { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mInput->Read(buf, count, countRead); }
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Available(PRUint32 *avail) { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mInput->Available(avail); }
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Close() { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mInput->Close(); }
const TStrV& TTmInfo::GetMonthNmV(const TLoc& Loc) { EnsureInit(); switch (Loc){ case lUs: return UsMonthNmV; case lSi: return SiMonthNmV; default: Fail; return UsMonthNmV; } }
TStr TTmInfo::GetMonthNm(const int& MonthN, const TLoc& Loc){ EnsureInit(); IAssert((1<=MonthN)&&(MonthN<=12)); switch (Loc){ case lUs: return UsMonthNmV[MonthN-1]; case lSi: return SiMonthNmV[MonthN-1]; default: Fail; return TStr(); } }
TStr TTmInfo::GetDayOfWeekNm(const int& DayOfWeekN, const TLoc& Loc){ EnsureInit(); IAssert((1<=DayOfWeekN)&&(DayOfWeekN<=7)); switch (Loc){ case lUs: return UsDayOfWeekNmV[DayOfWeekN-1]; case lSi: return SiDayOfWeekNmV[DayOfWeekN-1]; default: Fail; return TStr(); } }
int TTmInfo::GetMonthN(const TStr& MonthNm, const TLoc& Loc){ EnsureInit(); int MonthN=-1; switch (Loc){ case lUs: MonthN=UsMonthNmV.SearchForw(MonthNm.GetLc()); break; case lSi: MonthN=SiMonthNmV.SearchForw(MonthNm.GetLc()); break; default: Fail; } if (MonthN==-1){return -1;} else {return MonthN+1;} }
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Available(uint64_t *avail) { mozilla::MutexAutoLock lock(mLock); nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mInput->Available(avail); }
int TTmInfo::GetDayOfWeekN(const TStr& DayOfWeekNm, const TLoc& Loc){ EnsureInit(); int DayOfWeekN=-1; switch (Loc){ case lUs: DayOfWeekN=UsDayOfWeekNmV.SearchForw(DayOfWeekNm.GetLc()); break; case lSi: DayOfWeekN=SiDayOfWeekNmV.SearchForw(DayOfWeekNm.GetLc()); break; default: Fail; } if (DayOfWeekN==-1){return -1;} else {return DayOfWeekN+1;} }
NS_IMETHODIMP nsCacheEntryDescriptor:: nsOutputStreamWrapper::Flush() { mozilla::MutexAutoLock lock(mLock); nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; return mOutput->Flush(); }
// // GetNumberOfScreens // // Returns how many physical screens are available. // NS_IMETHODIMP nsScreenManagerGtk :: GetNumberOfScreens(PRUint32 *aNumberOfScreens) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetNumberOfScreens"); return rv; } *aNumberOfScreens = mCachedScreenArray.Count(); return NS_OK; } // GetNumberOfScreens
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Read_Locked(char *buf, uint32_t count, uint32_t *countRead) { nsresult rv = EnsureInit(); if (NS_SUCCEEDED(rv)) rv = mInput->Read(buf, count, countRead); CACHE_LOG_DEBUG(("nsInputStreamWrapper::Read " "[entry=%p, wrapper=%p, mInput=%p, rv=%d]", mDescriptor, this, mInput.get(), rv)); return rv; }
nsresult nsCacheEntryDescriptor:: nsOutputStreamWrapper::Write_Locked(const char * buf, uint32_t count, uint32_t * result) { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; rv = OnWrite(count); if (NS_FAILED(rv)) return rv; return mOutput->Write(buf, count, result); }
NS_IMETHODIMP nsCacheEntryDescriptor:: nsOutputStreamWrapper::Write(const char * buf, PRUint32 count, PRUint32 * result) { nsresult rv = EnsureInit(); if (NS_FAILED(rv)) return rv; rv = OnWrite(count); if (NS_FAILED(rv)) return rv; return mOutput->Write(buf, count, result); }
// // GetPrimaryScreen // // The screen with the menubar/taskbar. This shouldn't be needed very // often. // NS_IMETHODIMP nsScreenManagerGtk :: GetPrimaryScreen(nsIScreen * *aPrimaryScreen) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from GetPrimaryScreen"); return rv; } *aPrimaryScreen = mCachedScreenArray.SafeObjectAt(0); NS_IF_ADDREF(*aPrimaryScreen); return NS_OK; } // GetPrimaryScreen
nsresult nsCacheEntryDescriptor:: nsInputStreamWrapper::Close_Locked() { nsresult rv = EnsureInit(); if (NS_SUCCEEDED(rv)) { rv = mInput->Close(); } else { NS_ASSERTION(!mInput, "Shouldn't have mInput when EnsureInit() failed"); } // Call CloseInternal() even when EnsureInit() failed, e.g. in case we are // closing streams with nsCacheService::CloseAllStream() CloseInternal(); return rv; }
/// <summary> /// Create new process and attach to it /// </summary> /// <param name="path">Executable path</param> /// <param name="suspended">Leave process in suspended state. To resume process one should resume its main thread</param> /// <param name="forceInit">If 'suspended' is true, this flag will enforce process initialization via second thread</param> /// <param name="cmdLine">Process command line</param> /// <param name="currentDir">Startup directory</param> /// <param name="pStartup">Additional startup params</param> /// <returns>Status code</returns> NTSTATUS Process::CreateAndAttach( const std::wstring& path, bool suspended /*= false*/, bool forceInit /*= true*/, const std::wstring& cmdLine /*= L""*/, const wchar_t* currentDir /*= nullptr*/, STARTUPINFOW* pStartup /*= nullptr*/ ) { Detach(); STARTUPINFOW si = { 0 }; PROCESS_INFORMATION pi = { 0 }; if (!pStartup) pStartup = &si; if (!CreateProcessW( path.c_str(), const_cast<LPWSTR>(cmdLine.c_str()), NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, currentDir, pStartup, &pi )) { return LastNtStatus(); } // Get handle ownership auto status = _core.Open( pi.hProcess ); if (NT_SUCCESS( status )) { _nativeLdr.Init(); // Check if process must be left in suspended mode if (suspended) { // Create new thread to make sure LdrInitializeProcess gets called if (forceInit) EnsureInit(); } else ResumeThread( pi.hThread ); } // Close unneeded handles CloseHandle( pi.hThread ); return status; }
// // ScreenForRect // // Returns the screen that contains the rectangle. If the rect overlaps // multiple screens, it picks the screen with the greatest area of intersection. // // The coordinates are in desktop pixels. // NS_IMETHODIMP nsScreenManagerGtk::ScreenForRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, nsIScreen **aOutScreen) { nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForRect"); return rv; } // which screen ( index from zero ) should we return? uint32_t which = 0; // Optimize for the common case. If the number of screens is only // one then this will fall through with which == 0 and will get the // primary screen. if (mCachedScreenArray.Count() > 1) { // walk the list of screens and find the one that has the most // surface area. uint32_t area = 0; nsIntRect windowRect(aX, aY, aWidth, aHeight); for (int32_t i = 0, i_end = mCachedScreenArray.Count(); i < i_end; ++i) { int32_t x, y, width, height; x = y = width = height = 0; mCachedScreenArray[i]->GetRect(&x, &y, &width, &height); // calculate the surface area nsIntRect screenRect(x, y, width, height); screenRect.IntersectRect(screenRect, windowRect); uint32_t tempArea = screenRect.width * screenRect.height; if (tempArea >= area) { which = i; area = tempArea; } } } *aOutScreen = mCachedScreenArray.SafeObjectAt(which); NS_IF_ADDREF(*aOutScreen); return NS_OK; } // ScreenForRect
IOEventRef IOEventLoop::AddEvent(int fd_or_sig, int16_t events, timeval* timeout, const std::function<bool()>& callback) { if (!EnsureInit()) { return nullptr; } std::unique_ptr<IOEvent> e(new IOEvent(this, callback)); e->e = event_new(ebase_, fd_or_sig, events, EventCallbackFn, e.get()); if (e->e == nullptr) { LOG(ERROR) << "event_new() failed"; return nullptr; } if (event_add(e->e, timeout) != 0) { LOG(ERROR) << "event_add() failed"; return nullptr; } if (timeout != nullptr) { e->timeout = *timeout; } e->enabled = true; events_.push_back(std::move(e)); return events_.back().get(); }
NS_IMETHODIMP nsScreenManagerGtk :: ScreenForId ( uint32_t aId, nsIScreen **outScreen ) { *outScreen = nullptr; nsresult rv; rv = EnsureInit(); if (NS_FAILED(rv)) { NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForId"); return rv; } for (int32_t i = 0, i_end = mCachedScreenArray.Count(); i < i_end; ++i) { uint32_t id; rv = mCachedScreenArray[i]->GetId(&id); if (NS_SUCCEEDED(rv) && id == aId) { NS_IF_ADDREF(*outScreen = mCachedScreenArray[i]); return NS_OK; } } return NS_ERROR_FAILURE; }
unsigned int OBStereoFacade::NumSquarePlanarStereo() { EnsureInit(); return static_cast<unsigned int> (m_squarePlanarMap.size()); }
PDMFactory::PDMFactory() { EnsureInit(); CreatePDMs(); CreateNullPDM(); }
PDMFactory::PDMFactory() { EnsureInit(); CreatePDMs(); CreateBlankPDM(); }