Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 140453002: Repaint windows on screen unlock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/views/win/hwnd_message_handler.h ('K') | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 190af84fb10f45f60582c4b25c731669369a96e2..6edf5baa6d5c2203608c40725253380dc9a19910 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -6,6 +6,8 @@
#include <dwmapi.h>
#include <shellapi.h>
+#include <wtsapi32.h>
+#pragma comment(lib, "wtsapi32.lib")
#include "base/bind.h"
#include "base/debug/trace_event.h"
@@ -1385,6 +1387,8 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
scroll_styles_set_ = true;
}
#endif
+ WTSRegisterSessionNotification(hwnd(), NOTIFY_FOR_THIS_SESSION);
sky 2014/01/16 16:36:37 Docs indicate you need to unregister.
+
// TODO(beng): move more of NWW::OnCreate here.
return 0;
}
@@ -2321,6 +2325,35 @@ void HWNDMessageHandler::OnWindowPosChanged(WINDOWPOS* window_pos) {
SetMsgHandled(FALSE);
}
+void HWNDMessageHandler::ForceRedrawWindow(int attempts) {
+ HDESK input_desktop = ::OpenInputDesktop(0, 0, GENERIC_READ);
+ if (!input_desktop) {
cpu_(ooo_6.6-7.5) 2014/01/16 18:35:08 son, I am not sure what you are trying to do here
+ // Presents will continue to fail as long as the input desktop is
+ // unavailable.
+ if (--attempts <= 0)
+ return;
+ base::MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&HWNDMessageHandler::ForceRedrawWindow,
+ weak_factory_.GetWeakPtr(),
+ attempts),
+ base::TimeDelta::FromMilliseconds(500));
+ return;
+ }
+ ::CloseDesktop(input_desktop);
+ InvalidateRect(hwnd(), NULL, FALSE);
+}
+
+void HWNDMessageHandler::OnSessionChange(WPARAM status_code,
+ PWTSSESSION_NOTIFICATION session_id) {
+ // Direct3D presents are ignored while the screen is locked, so force the
+ // window to be redrawn on unlock.
+ if (status_code == WTS_SESSION_UNLOCK)
+ ForceRedrawWindow(10);
+
+ SetMsgHandled(FALSE);
+}
+
void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
for (size_t i = 0; i < touch_events.size() && ref; ++i)
« ui/views/win/hwnd_message_handler.h ('K') | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698