diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/surface/accelerated_surface_win.cc | 25 | ||||
-rw-r--r-- | ui/surface/accelerated_surface_win.h | 9 |
2 files changed, 33 insertions, 1 deletions
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc index 8e6e809..abd0745 100644 --- a/ui/surface/accelerated_surface_win.cc +++ b/ui/surface/accelerated_surface_win.cc @@ -24,6 +24,7 @@ #include "base/time.h" #include "base/win/wrapped_window_proc.h" #include "ui/base/win/hwnd_util.h" +#include "ui/base/win/shell.h" #include "ui/gfx/rect.h" #include "ui/gl/gl_switches.h" #include "ui/surface/accelerated_surface_transformer_win.h" @@ -253,7 +254,8 @@ AcceleratedPresenter::AcceleratedPresenter(gfx::PluginWindowHandle window) event_(false, false), hidden_(true), do_present_with_GDI_(DoAllShowPresentWithGDI() || - DoFirstShowPresentWithGDI()) { + DoFirstShowPresentWithGDI()), + is_session_locked_(false) { } // static @@ -434,6 +436,10 @@ void AcceleratedPresenter::ReleaseSurface() { this)); } +void AcceleratedPresenter::SetIsSessionLocked(bool locked) { + is_session_locked_ = locked; +} + void AcceleratedPresenter::Invalidate() { // Make any pending or future presentation tasks do nothing. Once the last // last pending task has been ignored, the reference count on the presenter @@ -752,6 +758,19 @@ gfx::Size AcceleratedPresenter::GetWindowSize() { } bool AcceleratedPresenter::CheckDirect3DWillWork() { + // On a composited desktop, when the screen saver or logon screen are + // active, D3D presents never make it to the window but GDI presents + // do. If the session is locked GDI presents can be avoided since + // the window gets a message on unlock and forces a repaint. + if (!is_session_locked_ && ui::win::IsAeroGlassEnabled()) { + // Failure to open the input desktop is a sign of running with a non-default + // desktop. + HDESK input_desktop = ::OpenInputDesktop(0, 0, GENERIC_READ); + if (!input_desktop) + return false; + ::CloseDesktop(input_desktop); + } + gfx::Size window_size = GetWindowSize(); if (window_size != last_window_size_ && last_window_size_.GetArea() != 0) { last_window_size_ = window_size; @@ -799,3 +818,7 @@ void AcceleratedSurface::Suspend() { void AcceleratedSurface::WasHidden() { presenter_->WasHidden(); } + +void AcceleratedSurface::SetIsSessionLocked(bool locked) { + presenter_->SetIsSessionLocked(locked); +} diff --git a/ui/surface/accelerated_surface_win.h b/ui/surface/accelerated_surface_win.h index 67a4542..4dacb87 100644 --- a/ui/surface/accelerated_surface_win.h +++ b/ui/surface/accelerated_surface_win.h @@ -54,6 +54,9 @@ class SURFACE_EXPORT AcceleratedPresenter // Indicates that the presenter has become invisible. void WasHidden(); + // Called when the Windows session is locked or unlocked. + void SetIsSessionLocked(bool locked); + // Schedule the presenter to release its reference to the shared surface. void ReleaseSurface(); @@ -143,6 +146,9 @@ class SURFACE_EXPORT AcceleratedPresenter // with GDI. bool do_present_with_GDI_; + // Set to true when the Windows session is locked. + bool is_session_locked_; + // These are used to detect when the window is resizing. For some reason, // presenting with D3D while the window resizes causes those parts not // drawn with D3D (e.g. with GDI) to flicker visible / invisible. @@ -179,6 +185,9 @@ class SURFACE_EXPORT AcceleratedSurface { // Indicates that the surface has become invisible. void WasHidden(); + // Called when the Windows session in locked or unlocked. + void SetIsSessionLocked(bool locked); + private: const scoped_refptr<AcceleratedPresenter> presenter_; DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |