コード例 #1
0
void DesktopApp::onMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	if (!Engine::instance().isInit()) return;
	if (message == WM_SIZE)
	{
		UpdateForWindowSizeChange();
		Engine::instance().onWindowResizeInternals();
		m_mainClass->onWindowResize();

		//case WM_SIZING:
		//	m_mainClass->onResizeWindowInternals(rc->right - rc->left, rc->bottom - rc->top);
		//	m_mainClass->onWindowResize();
		//	UpdateForWindowSizeChange();
		//	break;
	}
	else if (message == WM_SYSCOMMAND)
	{
		switch (wParam)
		{
		case SC_CLOSE:
			//m_mainClass->onSuspending();
			break;
		case SC_MINIMIZE:
			m_suspended = true;
			Utils::print("Window is minimized => suspending the app\n");
			break;
		case SC_RESTORE:
			m_suspended = false;
			Utils::print("Window is restored => unsuspending the app\n");
			break;
		}
	}
	else
	{
		if (m_isCrashedState) return;
		m_desktopAppControls.onMessage(message, wParam, lParam, m_mainClass, reinterpret_cast<const DesktopWindow*>(getWindow())->getHwnd());
	}
}
コード例 #2
0
bool
FrameworkView::Render(const nsIntRegion& aInvalidRegion)
{
  NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");

  if (mShuttingDown || mPainting || !mWidget) {
    return false;
  }

  // If we haven't created the layer manager, then create it now.
  // The swap buffer will be resized automatically by the layer manager.
  if (!mWidget->mLayerManager) {
    (void)mWidget->GetLayerManager();
    if (!mWidget->mLayerManager) {
      NS_WARNING("mWidget->GetLayerManager() failed!");
      return false;
    }
  }

  if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI) ||
      IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH32) ||
      IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_STRETCH24)) {
    NS_WARNING("Unsupported render mode, can't draw. Needs to be D2D.");
    return false;
  }

  if (mWidget->GetTransparencyMode() != eTransparencyOpaque) {
    NS_WARNING("transparency modes other than eTransparencyOpaque unsupported, can't draw.");
    return false;
  }

  AutoRestore<bool> painting(mPainting);
  mPainting = true;
  UpdateForWindowSizeChange();
  gfxWindowsPlatform::GetPlatform()->UpdateRenderMode();
  mWidget->Paint(aInvalidRegion);
  return true;
}