void GonkDiskSpaceWatcher::OnFileCanReadWithoutBlocking(int aFd) { struct fanotify_event_metadata* fem = nullptr; char buf[4096]; struct statfs sfs; int32_t len, rc; do { len = read(aFd, buf, sizeof(buf)); } while(len == -1 && errno == EINTR); // Bail out if the file is busy. if (len < 0 && errno == ETXTBSY) { return; } // We should get an exact multiple of fanotify_event_metadata if (len <= 0 || (len % FAN_EVENT_METADATA_LEN != 0)) { MOZ_CRASH("About to crash: fanotify_event_metadata read error."); } fem = reinterpret_cast<fanotify_event_metadata *>(buf); while (FAN_EVENT_OK(fem, len)) { rc = fstatfs(fem->fd, &sfs); if (rc < 0) { NS_WARNING("Unable to stat fan_notify fd"); } else { bool firstRun = mFreeSpace == UINT64_MAX; mFreeSpace = sfs.f_bavail * sfs.f_bsize; // We change from full <-> free depending on the free space and the // low and high thresholds. // Once we are in 'full' mode we send updates for all size changes with // a minimum of time between messages or when we cross a size change // threshold. if (firstRun) { mIsDiskFull = mFreeSpace <= mLowThreshold; // Always notify the current state at first run. NotifyUpdate(); } else if (!mIsDiskFull && (mFreeSpace <= mLowThreshold)) { mIsDiskFull = true; NotifyUpdate(); } else if (mIsDiskFull && (mFreeSpace > mHighThreshold)) { mIsDiskFull = false; NotifyUpdate(); } else if (mIsDiskFull) { if (mTimeout < TimeStamp::Now() - mLastTimestamp || mSizeDelta < llabs(mFreeSpace - mLastFreeSpace)) { NotifyUpdate(); } } } close(fem->fd); fem = FAN_EVENT_NEXT(fem, len); } }
void CBreakPointWindow::LoadAll() { IniFile ini; BreakPoints::TBreakPointsStr newbps; MemChecks::TMemChecksStr newmcs; if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini", false)) { return; } if (ini.GetLines("BreakPoints", &newbps, false)) { PowerPC::breakpoints.Clear(); PowerPC::breakpoints.AddFromStrings(newbps); } if (ini.GetLines("MemoryBreakPoints", &newmcs, false)) { PowerPC::memchecks.Clear(); PowerPC::memchecks.AddFromStrings(newmcs); } NotifyUpdate(); }
STDMETHODIMP UIFrameBufferQGL::RequestResize (ULONG aScreenId, ULONG aPixelFormat, BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine, ULONG aWidth, ULONG aHeight, BOOL *aFinished) { aWidth = VBOXQGL_PROF_WIDTH; aHeight = VBOXQGL_PROF_HEIGHT; VBoxFrameBuffer::RequestResize (aScreenId, aPixelFormat, aVRAM, aBitsPerPixel, aBytesPerLine, aWidth, aHeight, aFinished); // if(aVRAM) { for(;;) { ULONG aX = 0; ULONG aY = 0; ULONG aW = aWidth; ULONG aH = aHeight; NotifyUpdate (aX, aY, aW, aH); RTThreadSleep(40); } } return S_OK; }
// Clear all breakpoints and memchecks void CBreakPointWindow::OnClear(wxCommandEvent& WXUNUSED(event)) { PowerPC::debug_interface.ClearAllBreakpoints(); PowerPC::debug_interface.ClearAllMemChecks(); NotifyUpdate(); }
void CFunction::OnUpdate() { if (!m_isChanged) { m_isChanged = true; NotifyUpdate(); } }
void CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event)) { MemoryCheckDlg memDlg(this); if (memDlg.ShowModal() == wxID_OK) { NotifyUpdate(); } }
void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& WXUNUSED(event)) { BreakPointDlg bpDlg(this); if (bpDlg.ShowModal() == wxID_OK) { NotifyUpdate(); } }
void CRegisterWindow::CreateGUIControls() { wxBoxSizer* sGrid = new wxBoxSizer(wxVERTICAL); m_GPRGridView = new CRegisterView(this); sGrid->Add(m_GPRGridView, 1, wxEXPAND); SetSizer(sGrid); NotifyUpdate(); }
void CBreakPointWindow::LoadAll(wxCommandEvent& WXUNUSED(event)) { IniFile ini; BreakPoints::TBreakPointsStr newbps; MemChecks::TMemChecksStr newmcs; if (!ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX))) return; if (ini.GetLines("BreakPoints", newbps, false)) PowerPC::breakpoints.AddFromStrings(newbps); if (ini.GetLines("MemoryChecks", newmcs, false)) PowerPC::memchecks.AddFromStrings(newmcs); NotifyUpdate(); }
// InitControl -------------------------------------------------------------- void CCodeTipCtrl::InitControl() { // Ask the parent window to initialize the tooltip contents before it is // displayed. NotifyUpdate( CMN_CODETIPINITIALIZE ); // Watch out - the application could have destroyed the tooltip window // inside its CodeTipInitialize handler. if( !::IsWindow( GetSafeHwnd() ) ) return; // Initialize tooltip font using system font. Note that this will also // set the size and position of the tooltip window to fit on the screen // in the WM_SETFONT handler. // SendMessage( WM_SETFONT, (WPARAM)__GetFont() ); }
void CWatchWindow::LoadAll() { IniFile ini; Watches::TWatchesStr watches; if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", false)) { return; } if (ini.GetLines("Watches", &watches, false)) { PowerPC::watches.Clear(); PowerPC::watches.AddFromStrings(watches); } NotifyUpdate(); }
void CWatchWindow::LoadAll() { IniFile ini; std::vector<std::string> watches; if (!ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().GetGameID() + ".ini", false)) { return; } if (ini.GetLines("Watches", &watches, false)) { PowerPC::debug_interface.ClearWatches(); PowerPC::debug_interface.LoadWatchesFromStrings(watches); } NotifyUpdate(); }
// AutoSizeControl ---------------------------------------------------------- void CCodeTipCtrl::AutoSizeControl() { // Notify the parent window that the tooltip is about to be updated so it // can make any changes necessary... NotifyUpdate(); // Watch out - the application could have destroyed the tooltip window // inside its CodeTipUpdate handler. if( !::IsWindow( GetSafeHwnd() ) ) return; // Save original window area so we can tell if it changes... CRect rOld; GetWindowRect( &rOld ); // Figure out how big a line of text is based on the current font int y = 17; HWND hEdit = m_pEdit->GetWindow(); HFONT hFont = (HFONT)::SendMessage( hEdit, WM_GETFONT, 0, 0 ); if( hFont ) { LOGFONT lf = {0}; HDC hdc = ::GetDC( hEdit ); GetObject( hFont, sizeof(LOGFONT), &lf ); y = -MulDiv( lf.lfHeight, GetDeviceCaps( hdc, LOGPIXELSY ), 72 ); ::ReleaseDC( hEdit, hdc ); } // Get the caret position POINT ptCaret = {0}; ::GetCaretPos( &ptCaret ); ::ClientToScreen( hEdit, &ptCaret ); // Initially position tooltip below caret position. CRect rClient; rClient.top = ptCaret.y + y; rClient.bottom = rClient.top + 10; // If the caret position has moved toward the left edge of the screen, // we'll move the tooltip to the left as well. CRect rTmp; GetClientRect( &rTmp ); ClientToScreen( &rTmp ); rClient.left = ( ptCaret.x < rTmp.left ) ? ptCaret.x : rTmp.left; // Set the right side so that it does not expand past the visible area on // the screen. When we calculate the client area, it should automatically // wrap at this point & expand the bottom of the rectangle as needed. // CRect rScreen; ::SystemParametersInfo( SPI_GETWORKAREA, 0, (LPVOID)&rScreen, 0 ); rScreen.DeflateRect( 4, 4 ); rClient.right = rScreen.right; // Calculate the client area needed for the text HDC hdc = GetDC(); DrawTipText( hdc, rClient, TRUE ); // Make sure we don't overflow the right edge of the screen. if( rClient.right > rScreen.right ) { rClient.left = rScreen.right - rClient.Width(); rClient.right = rScreen.right; } // If we overflow the bottom of the screen, move the tip up a line above // the caret instead. // if( rClient.bottom > rScreen.bottom ) { int h = rClient.Height(); rClient.bottom = ptCaret.y - y; rClient.top = rClient.bottom - h; // But watch out - we may we go off the top of the screen now. if( rClient.top < rScreen.top ) { // Recalculate the window size using the full screen width, and // starting below the caret. rClient.top = ptCaret.y + y; rClient.left = rScreen.left; rClient.right = rScreen.right; DrawTipText( hdc, rClient, TRUE ); } } // If the tip still goes off the bottom of the screen, we'll have one // last stab at placing it above the caret. If that still doesn't help, // then tough noogies buddy - shorten your tooltip text! if( rClient.bottom > rScreen.bottom ) { int h = rClient.Height(); rClient.bottom = ptCaret.y - y; rClient.top = rClient.bottom - h; } ReleaseDC( hdc ); // Convert client calculated area to screen area ::AdjustWindowRectEx( &rClient, GetWindowLong( GWL_STYLE ), FALSE, GetWindowLong( GWL_EXSTYLE ) ); // Okay - one last thing to do before we update the tooltip position: If // the caret position is to the right of the tooltip's left edge, and the // tooltip doesn't expand all the way across the screen, we'll bump the // tip to the right as close to the caret position as possible without // going off the screen... // if( ptCaret.x > rClient.left && rClient.right < rScreen.right ) { // How far do we need to move the tooltip window to align it with the // caret position? int deltaX = ptCaret.x - rClient.left; // Now, how far can we actually move the tooltip without overflowing // the right edge of the screen? if( rClient.right + deltaX > rScreen.right ) deltaX = rScreen.right - rClient.right; // Bump the tooltip to the right! rClient.left += deltaX; rClient.right += deltaX; } // Update the window position / size - but only if it has changed if( rOld.left != rClient.left || rOld.right != rClient.right || rOld.top != rClient.top || rOld.bottom != rClient.bottom ) { if( IsWindowVisible( m_hWnd ) ) MoveWindow( &rClient ); else { SetWindowPos( m_hWnd, NULL, rClient.left, rClient.top, rClient.Width(), rClient.Height(), SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOREDRAW ); } } // Always refresh the window, in case the tip has changed but the window // size has not. InvalidateRect( NULL ); UpdateWindow(); }
// Clear all breakpoints and memchecks void CBreakPointWindow::OnClear(wxCommandEvent& WXUNUSED(event)) { PowerPC::breakpoints.Clear(); PowerPC::memchecks.Clear(); NotifyUpdate(); }
void AxisAlignedBBSystem::OnEntityUpdate(LibCommon::Entity* ent, Components::IComponent*) { updateAABB(ent); auto aabb = ent->Get<Components::AxisAlignedBB>(); NotifyUpdate(ent, aabb); }
void GuiBindableListView::ItemSource::NotifyAllItemsUpdate() { NotifyUpdate(0, Count()); }
void AxisAlignedBBSystem::OnEntityAdd(LibCommon::Entity* e) { updateAABB(e); auto aabb = e->Get<Components::AxisAlignedBB>(); NotifyUpdate(e, aabb); }
void CHTTPControl::HTTPFinish_RegID() { YL_Log("log_httpr.txt",LOG_DEBUG,"HTTP-Finish","RegID"); SetEvent( s_EventRegID ); NotifyUpdate(2); }
void CHTTPControl::HTTPFinish_BangDan() { YL_Log("log_httpr.txt",LOG_DEBUG,"HTTP-Finish","BangDan"); SetEvent( s_EventBangDan ); NotifyUpdate(3); }
void CHTTPControl::HTTPFinish_TodayRecommend() { YL_Log("log_httpr.txt",LOG_DEBUG,"HTTP-Finish","TodayRecommand"); SetEvent( s_EventTodayRecommend ); NotifyUpdate(1); }