Make window cloaking and uncloaking trigger occlusion calculation.
This is the right thing to do in general, since we treat cloaked windows
as non-occluding. It also fixes an issue with switching virtual desktops
since that triggers window cloaking and uncloaking events.
(cherry picked from commit f616ef8b645a13a0524645ef26ff7ec277e226b9)
Bug: 1137419
Change-Id: I2b66182bc72c17e69c3f72cd793e2924ba483bb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2478082
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: Jesse McKenna <jessemckenna@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#818031}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487913
Reviewed-by: David Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/branch-heads/4280@{#553}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/ui/aura/native_window_occlusion_tracker_win.cc b/ui/aura/native_window_occlusion_tracker_win.cc
index 6dcc8e61..66fd0b9 100644
--- a/ui/aura/native_window_occlusion_tracker_win.cc
+++ b/ui/aura/native_window_occlusion_tracker_win.cc
@@ -519,6 +519,10 @@
// maximize and native window restore events.
RegisterGlobalEventHook(EVENT_OBJECT_STATECHANGE, EVENT_OBJECT_STATECHANGE);
+ // Cloaking and uncloaking of windows should trigger an occlusion calculation.
+ // In particular, switching virtual desktops seems to generate these events.
+ RegisterGlobalEventHook(EVENT_OBJECT_CLOAKED, EVENT_OBJECT_UNCLOAKED);
+
// Determine which subset of processes to set EVENT_OBJECT_LOCATIONCHANGE on
// because otherwise event throughput is very high, as it generates events
// for location changes of all objects, including the mouse moving on top of a