Commit 0af15452 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Release capture when locking screen

The capture window will not receive events while locked because
there is an extra mechanism to block events in locked state, but
having capture window in locked state will make lock UI unusable
by mouse/touch.

Explicitly release capture so that mouse/touch event works
when locked.

BUG=788782
TEST=covered by unittest

Change-Id: I01849f71ec0f059a21b433295fbdf816962d44d4
Reviewed-on: https://chromium-review.googlesource.com/1112938Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570100}
parent 7f9d9cc4
......@@ -26,6 +26,7 @@
#include "ui/compositor/layer.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/wm/core/capture_controller.h"
namespace ash {
namespace {
......@@ -71,6 +72,9 @@ LockScreen* LockScreen::Get() {
// static
void LockScreen::Show(ScreenType type) {
CHECK(!instance_);
// Capture should be released when locked.
::wm::CaptureController::Get()->SetCapture(nullptr);
instance_ = new LockScreen(type);
instance_->window_ = new LockWindow();
......
......@@ -9,6 +9,7 @@
#include "ash/login/ui/login_big_user_view.h"
#include "ash/login/ui/login_keyboard_test_base.h"
#include "ash/login/ui/login_test_utils.h"
#include "ui/wm/core/capture_controller.h"
namespace ash {
......@@ -31,4 +32,13 @@ TEST_F(LockWindowVirtualKeyboardTest, VirtualKeyboardDoesNotCoverAuthView) {
auth_view->GetBoundsInScreen().Intersects(GetKeyboardBoundsInScreen()));
}
TEST_F(LockWindowVirtualKeyboardTest, ReleaseCapture) {
std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
::wm::CaptureController::Get()->SetCapture(window0.get());
ASSERT_EQ(window0.get(), ::wm::CaptureController::Get()->GetCaptureWindow());
ASSERT_NO_FATAL_FAILURE(ShowLockScreen());
EXPECT_FALSE(::wm::CaptureController::Get()->GetCaptureWindow());
}
} // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment