forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If the user clicks on a key on the accessibility virtual keyboard the…
… cursor disappears, which makes typing the next key difficult. This patch disables the hide cursor whenever the accessibility keyboard is enabled. Added class ash::ash_cursor_manager which extends wm::cursor_manager, and moved the logic of whether or not to hide the cursor on key events to here. Follow up bug to add unittest: crbug.com/359324 BUG=355094 Review URL: https://codereview.chromium.org/213743013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262299 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
rsadam@chromium.org
committed
Apr 8, 2014
1 parent
62b1b6c
commit e76096a
Showing
12 changed files
with
150 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/wm/cursor_manager_chromeos.h" | ||
|
||
#include "base/logging.h" | ||
#include "ui/keyboard/keyboard_util.h" | ||
#include "ui/wm/core/cursor_manager.h" | ||
#include "ui/wm/core/native_cursor_manager.h" | ||
|
||
namespace ash { | ||
|
||
CursorManager::CursorManager( | ||
scoped_ptr< ::wm::NativeCursorManager> delegate) | ||
: ::wm::CursorManager(delegate.Pass()) { | ||
} | ||
|
||
CursorManager::~CursorManager() { | ||
} | ||
|
||
bool CursorManager::ShouldHideCursorOnKeyEvent( | ||
const ui::KeyEvent& event) const { | ||
// Clicking on a key when the accessibility virtual keyboard is enabled should | ||
// not hide the cursor. | ||
if (keyboard::GetAccessibilityKeyboardEnabled()) | ||
return false; | ||
// All alt and control key commands are ignored. | ||
if (event.IsAltDown() || event.IsControlDown()) | ||
return false; | ||
|
||
ui::KeyboardCode code = event.key_code(); | ||
if (code >= ui::VKEY_F1 && code <= ui::VKEY_F24) | ||
return false; | ||
if (code >= ui::VKEY_BROWSER_BACK && code <= ui::VKEY_MEDIA_LAUNCH_APP2) | ||
return false; | ||
switch (code) { | ||
// Modifiers. | ||
case ui::VKEY_SHIFT: | ||
case ui::VKEY_CONTROL: | ||
case ui::VKEY_MENU: | ||
// Search key == VKEY_LWIN. | ||
case ui::VKEY_LWIN: | ||
case ui::VKEY_WLAN: | ||
case ui::VKEY_POWER: | ||
case ui::VKEY_BRIGHTNESS_DOWN: | ||
case ui::VKEY_BRIGHTNESS_UP: | ||
case ui::VKEY_KBD_BRIGHTNESS_UP: | ||
case ui::VKEY_KBD_BRIGHTNESS_DOWN: | ||
return false; | ||
default: | ||
return true; | ||
} | ||
} | ||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_WM_CURSOR_MANAGER_CHROMEOS_H_ | ||
#define ASH_WM_CURSOR_MANAGER_CHROMEOS_H_ | ||
|
||
#include "ash/ash_export.h" | ||
#include "base/basictypes.h" | ||
#include "base/compiler_specific.h" | ||
#include "base/memory/scoped_ptr.h" | ||
#include "ui/wm/core/cursor_manager.h" | ||
#include "ui/wm/core/native_cursor_manager_delegate.h" | ||
|
||
namespace ui { | ||
class KeyEvent; | ||
} | ||
|
||
namespace wm { | ||
class NativeCursorManager; | ||
} | ||
|
||
namespace ash { | ||
|
||
// This class overrides the cursor hiding behaviour on ChromeOS. The cursor is | ||
// hidden on certain key events only if the accessibility keyboard is not | ||
// enabled. | ||
class ASH_EXPORT CursorManager : public ::wm::CursorManager { | ||
public: | ||
explicit CursorManager( | ||
scoped_ptr< ::wm::NativeCursorManager> delegate); | ||
virtual ~CursorManager(); | ||
|
||
// aura::client::CursorClient: | ||
virtual bool ShouldHideCursorOnKeyEvent( | ||
const ui::KeyEvent& event) const OVERRIDE; | ||
private: | ||
DISALLOW_COPY_AND_ASSIGN(CursorManager); | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_WM_CURSOR_MANAGER_CHROMEOS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters