Example #1
0
	virtual bool winEvent(MSG* msg, long* result)
	{
		switch (msg->message)
		{
		case WM_SETTINGCHANGE:
			// Refresh Launchy's environment on settings changes
			if (msg->lParam && _tcscmp((TCHAR*)msg->lParam, _T("Environment")) == 0)
			{
				UpdateEnvironment();
			}
			break;

		case WM_ENDSESSION:
			// Ensure settings are saved
			saveSettings();
			break;

		// Might need to capture these two messages if Vista gives any problems with alpha borders
		// when restoring from standby
		case WM_POWERBROADCAST:
			break;
		case WM_WTSSESSION_CHANGE:
			break;

		default:
			if (msg->message == commandMessageId)
			{
				// A Launchy startup command
				executeStartupCommand(msg->wParam);
			}
			break;
		}
		return LaunchyWidget::winEvent(msg, result);
	}
Example #2
0
// Return true if the caller should proceed to guard for crashes. False if
// the environment has not changed. We persist the "changed" status across
// calls, so that after an environment changes, all guards for the new
// session are activated rather than just the first.
bool
DriverCrashGuard::CheckOrRefreshEnvironment()
{
  // Our result can be cached statically since we don't check live prefs.
  static bool sBaseInfoChanged = false;
  static bool sBaseInfoChecked = false;

  if (!sBaseInfoChecked) {
    // None of the prefs we care about, so we cache the result statically.
    sBaseInfoChecked = true;
    sBaseInfoChanged = UpdateBaseEnvironment();
  }

  // Always update the full environment, even if the base info didn't change.
  return UpdateEnvironment() ||
         sBaseInfoChanged ||
         GetStatus() == DriverInitStatus::Unknown;
}