bool MainWindow::OnTimer(WindowTimer &_timer) { if (_timer != timer) return SingleWindow::OnTimer(_timer); ProcessTimer(); UpdateGaugeVisibility(); if (!CommonInterface::GetUISettings().enable_thermal_assistant_gauge) { thermal_assistant.Clear(); } else if (!CommonInterface::Calculated().circling || InputEvents::IsFlavour(_T("TA"))) { thermal_assistant.Hide(); } else if (!HasDialog()) { if (!thermal_assistant.IsDefined()) thermal_assistant.Set(new GaugeThermalAssistant(CommonInterface::GetLiveBlackboard(), look->thermal_assistant_gauge)); if (!thermal_assistant.IsVisible()) { thermal_assistant.Show(); GaugeThermalAssistant *widget = (GaugeThermalAssistant *)thermal_assistant.Get(); widget->Raise(); } } battery_timer.Process(); return true; }
/* Our main update function - called every time we go through our main loop */ void UpdateFrame(void) { /* our timing information */ unsigned int fps; float dt; /* force another redraw, so we are always drawing as much as possible */ glutPostRedisplay(); /* adjust our timer, which we might use for transforming our objects */ dt = GetPreviousFrameDeltaInSeconds(); dt = dt * (float) DistPaths; gPacmanTimer += dt; gGhostTimer += ghostRate * dt; // update ghosts current node when timer goes DistPaths pixels if (gGhostTimer > (float) DistPaths) { gGhostTimer = 0.; updateGhosts(); } // update pacmans current node when timer goes DistPaths pixels if (gPacmanTimer > (float) DistPaths) { gPacmanTimer = 0.; refreshPacman(); } // printf("gan: %d\n", (int) gPacmanTimer); /* timing information */ if (ProcessTimer(&fps)) { /* update our frame rate display */ printf("FPS: %d\n", fps); } }
void CoroutineServiceHandler::Process(StageData<ServiceHandler>* data) { while (data->running) { ProcessTimer(); ProcessMessage(data); coro::Schedule(coro::Current()); coro::Yield(); } }
bool LogServer::Start() { while(!IsTerminate()) { ProcessNetEvent(10); int64_t nNowMS = XTime::MSTime(); Service::Update(nNowMS); ProcessTimer(nNowMS); ProcessHttpMessage(); } return true; }
void IOHandler::Run(StageData<IOHandler>* data) { prctl(PR_SET_NAME, "io_handler"); current_io_handler_ = this; EventMessage message; while (data->running) { ProcessTimer(); if (!data->queue->Pop(&message, 2)) { continue; } Handle(message); } }
void WndMain::OnTimer() { // WM_TIMER is run at about 2hz. LKHearthBeats++; // 100213 if (ProgramStarted > psInitInProgress) { if (SIMMODE) { SIMProcessTimer(); } else { ProcessTimer(); } if (ProgramStarted == psFirstDrawDone) { AfterStartup(); ProgramStarted = psNormalOp; StartupStore(_T(". ProgramStarted=NormalOp %s%s"), WhatTimeIsIt(), NEWLINE); StartupLogFreeRamAndStorage(); } } }
MythNotificationScreen::MythNotificationScreen(MythScreenStack *stack, const MythNotificationScreen &s) : MythScreenType(stack, "mythnotification"), m_duration(-1), m_progress(-1.0), m_fullscreen(false), m_added(false), m_created(false), m_content(kNone), m_update(kAll), m_type(MythNotification::New), m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL), m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL), m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL), m_timer(new QTimer(this)), m_visibility(MythNotification::kAll), m_priority(MythNotification::kDefault), m_refresh(true) { *this = s; connect(m_timer, SIGNAL(timeout()), this, SLOT(ProcessTimer())); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { long wdata; switch (message) { case WM_ERASEBKGND: return TRUE; // JMW trying to reduce screen flicker break; case WM_COMMAND: return MainMenu(hWnd, message, wParam, lParam); break; case WM_CTLCOLORSTATIC: wdata = GetWindowLong((HWND)lParam, GWL_USERDATA); switch(wdata) { case 0: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00)); return (LRESULT)hBrushUnselected; case 1: SetBkColor((HDC)wParam, ColorSelected); SetTextColor((HDC)wParam, RGB(0x00,0x00,0x00)); return (LRESULT)hBrushSelected; case 2: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, ColorWarning); return (LRESULT)hBrushUnselected; case 3: SetBkColor((HDC)wParam, ColorUnselected); SetTextColor((HDC)wParam, ColorOK); return (LRESULT)hBrushUnselected; case 4: // black on light green SetTextColor((HDC)wParam, RGB_BLACK); SetBkColor((HDC)wParam, ColorButton); return (LRESULT)hBrushButton; case 5: // grey on light green SetBkColor((HDC)wParam, ColorButton); SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80)); return (LRESULT)hBrushButton; #ifdef LXMINIMAP case 6: // black on dark yellow SetTextColor((HDC)wParam, RGB_BLACK); SetBkColor((HDC)wParam, ColorButtonHasFocus); return (LRESULT)hBrushButtonHasFocus; case 7: // grey on dark yellow SetTextColor((HDC)wParam, RGB(0x80,0x80,0x80)); SetBkColor((HDC)wParam, ColorButtonHasFocus); return (LRESULT)hBrushButtonHasFocus; #endif } break; case WM_CREATE: #ifdef HAVE_ACTIVATE_INFO memset (&s_sai, 0, sizeof (s_sai)); s_sai.cbSize = sizeof (s_sai); #endif if (iTimerID == 0) { iTimerID = SetTimer(hWnd,1000,500,NULL); // 500ms 2 times per second } break; case WM_ACTIVATE: if(LOWORD(wParam) != WA_INACTIVE) { SetWindowPos(hWndMainWindow,HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); #ifdef HAVE_ACTIVATE_INFO SHFullScreen(hWndMainWindow,SHFS_HIDETASKBAR|SHFS_HIDESIPBUTTON|SHFS_HIDESTARTICON); #endif } #ifdef HAVE_ACTIVATE_INFO if (api_has_SHHandleWMActivate) { SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE); } else { #ifdef TESTBENCH StartupStore(TEXT("... SHHandleWMActivate not available%s"),NEWLINE); #endif return DefWindowProc(hWnd, message, wParam, lParam); } #endif break; case WM_SETTINGCHANGE: #ifdef HAVE_ACTIVATE_INFO if (api_has_SHHandleWMSettingChange) { SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); } else { #ifdef TESTBENCH StartupStore(TEXT("... SHHandleWMSettingChange not available%s"),NEWLINE); #endif return DefWindowProc(hWnd, message, wParam, lParam); } #endif break; #if DEBUG_FOCUS case WM_KILLFOCUS: // This is happening when focus is given to another window, either internally inside LK // or externally, for example to explorer.. // SO: if we select MapWindow, we get here a KILLFOCUS from it. // When we select another process/program, or click on the desktop, the old window having focus is // receiving KILLFOCUS. So in case MapWindow was working, the signal will be sent over there, not here. // StartupStore(_T("............ WNDPROC LOST FOCUS (KILLFOCUS)\n")); break; #endif case WM_SETFOCUS: // When explorer/desktop is giving focus to LK, this is where we get the signal. // But we must return focus to previous windows otherwise keys will not be working. // Mouse is another story, because mouse click is pertinent to a screen area which is mapped. // A mouse click will be sent to the window in the background, whose handler will receive the event. // // Each event handler receiving focus has to save it in hWndWithFocus, in LK. // Each event handler must thus handle SETFOCUS! // #if DEBUG_FOCUS StartupStore(_T("............ WNDPROC HAS FOCUS (SETFOCUS)\n")); if (hWndWithFocus==NULL) StartupStore(_T(".....(no Wnd to give focus to)\n")); else StartupStore(_T(".....(passing focus to other window)\n")); #endif if (hWndWithFocus!=NULL) SetFocus(hWndWithFocus); break; case WM_KEYUP: break; case WM_TIMER: // WM_TIMER is run at about 2hz. LKHearthBeats++; // 100213 // ASSERT(hWnd==hWndMainWindow); if (ProgramStarted > psInitInProgress) { if (SIMMODE) SIMProcessTimer(); else ProcessTimer(); if (ProgramStarted==psFirstDrawDone) { AfterStartup(); ProgramStarted = psNormalOp; StartupStore(_T(". ProgramStarted=NormalOp %s%s"), WhatTimeIsIt(),NEWLINE); StartupLogFreeRamAndStorage(); } } break; case WM_INITMENUPOPUP: if (ProgramStarted > psInitInProgress) { CheckMenuItem((HMENU) wParam,IDM_FILE_LOCK,MF_CHECKED|MF_BYCOMMAND); if(LoggerActive) CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_CHECKED|MF_BYCOMMAND); else CheckMenuItem((HMENU) wParam,IDM_FILE_LOGGER,MF_UNCHECKED|MF_BYCOMMAND); } break; case WM_CLOSE: LKASSERT(hWnd==hWndMainWindow); if((hWnd==hWndMainWindow) && (MessageBoxX(hWndMainWindow, // LKTOKEN _@M198_ = "Confirm Exit?" gettext(TEXT("_@M198_")), TEXT("LK8000"), MB_YESNO|MB_ICONQUESTION) == IDYES)) { if(iTimerID) { KillTimer(hWnd,iTimerID); iTimerID = 0; } Shutdown(); } break; case WM_DESTROY: if (hWnd==hWndMainWindow) { PostQuitMessage(0); } break; #ifdef PNA #if TESTBENCH case WM_DEVICECHANGE: TCHAR serr[50]; static WPARAM oldwparam=0; StartupStore(_T("DEVICE CHANGE DETECTED, CODE=0x%x%s"),wParam,NEWLINE); if (wParam!=oldwparam) { oldwparam=wParam; wsprintf(serr,_T("DEVICE CHANGE DETECTED\nCODE=0x%x"),wParam); DoStatusMessage(serr); // MessageBoxX(hWndMainWindow, serr, TEXT("LK8000"), MB_OK|MB_ICONQUESTION, true); oldwparam=0; } return TRUE; // acknowledge break; #endif #endif default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }