Пример #1
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  if (!render_projection.IsValid())
    return false;

  if (idle_robin == unsigned(-1)) {
    /* draw the first frame as quickly as possible, so the user can
       start interacting with XCSoar immediately */
    idle_robin = 2;
    return true;
  }

  if (!IsUserIdle(2500))
    /* don't hold back the UI thread while the user is interacting */
    return true;

  PeriodClock clock;
  clock.Update();

  bool still_dirty;
  bool topography_dirty = true; /* scan topography in every Idle() call */
  bool terrain_dirty = true;
  bool weather_dirty = true;

  do {
    idle_robin = (idle_robin + 1) % 3;
    switch (idle_robin) {
    case 0:
      topography_dirty = UpdateTopography(1) > 0;
      break;

    case 1:
      terrain_dirty = UpdateTerrain();
      break;

    case 2:
      weather_dirty = UpdateWeather();
      break;
    }

    still_dirty = terrain_dirty || topography_dirty || weather_dirty;
  } while (!clock.Check(700) && /* stop after 700ms */
#ifndef ENABLE_OPENGL
           !draw_thread->IsTriggered() &&
#endif
           IsUserIdle(2500) &&
           still_dirty);

  return still_dirty;
}
Пример #2
0
gcc_pure
static unsigned
GetQuantisation()
{
  if (IsUserIdle(2000))
    /* full terrain resolution when the user is idle */
    return 1;
  else if (IsUserIdle(1000))
    /* reduced terrain resolution when the user has interacted with
       XCSoar recently */
    return 2;
  else
    /* the user is actively operating XCSoar: reduce UI latency */
    return Layout::FastScale(2);
}
Пример #3
0
/**
 * This idle function allows progressive scanning of visibility etc
 */
bool
GlueMapWindow::Idle()
{
  if (!render_projection.IsValid())
    return false;

  if (skip_idle) {
    /* draw the first frame as quickly as possible, so the user can
       start interacting with XCSoar immediately */
    skip_idle = false;
    return true;
  }

  /* hack: update RASP weather maps as quickly as possible; they only
     ever need to be updated after the user has selected a new map, so
     this is not a UI latency problem (quite contrary, don't let the
     user wait until he sees the new map) */
  UpdateWeather();

  if (!IsUserIdle(2500))
    /* don't hold back the UI thread while the user is interacting */
    return true;

  PeriodClock clock;
  clock.Update();

  bool still_dirty;

  do {
    still_dirty = UpdateWeather() || UpdateTerrain();
  } while (!clock.Check(700) && /* stop after 700ms */
#ifndef ENABLE_OPENGL
           !draw_thread->IsTriggered() &&
#endif
           IsUserIdle(2500) &&
           still_dirty);

  return still_dirty;
}
Пример #4
0
bool
GlueMapWindow::OnTimer(WindowTimer &timer)
{
    if (timer == map_item_timer) {
        map_item_timer.Cancel();
        if (!InputEvents::IsDefault() && !IsPanning()) {
            InputEvents::HideMenu();
            return true;
        }
        ShowMapItems(drag_start_geopoint, false);
        return true;
#ifdef ENABLE_OPENGL
    } else if (timer == kinetic_timer) {
        if (kinetic_x.IsSteady() && kinetic_y.IsSteady()) {
            kinetic_timer.Cancel();
        } else {
            auto location = drag_projection.ScreenToGeo(kinetic_x.GetPosition(),
                            kinetic_y.GetPosition());
            location = drag_projection.GetGeoLocation() +
                       drag_start_geopoint - location;

            SetLocation(location);
            QuickRedraw();
        }

        return true;
    } else if (timer == data_timer) {
        if (!IsUserIdle(2500))
            /* user is still active; try again later */
            return true;

        Invalidate();
        return false;
#endif
    } else
        return MapWindow::OnTimer(timer);
}
Пример #5
0
VOID CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
{
	if (hTimer == idEvent && !g_bWindowHidden && ((g_wMaskAdv & (OPT_HIDEIFWINIDLE | OPT_HIDEIFMIRIDLE) && IsUserIdle()) ||
		(g_wMaskAdv & OPT_HIDEIFSCRSVR) && IsScreenSaverRunning()))
		BossKeyHideMiranda(0, 0);
}