summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-29 18:32:37 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-29 18:32:37 +0000
commit9488d4d8bfc8837dcbc414680a01594e2e75ba7d (patch)
tree9cd8bc85d84a357a754a35387e5332ade4bd1817 /ash
parent4643a0330edce20abbc8a2d217f9f0b6d42ad56c (diff)
downloadchromium_src-9488d4d8bfc8837dcbc414680a01594e2e75ba7d.zip
chromium_src-9488d4d8bfc8837dcbc414680a01594e2e75ba7d.tar.gz
chromium_src-9488d4d8bfc8837dcbc414680a01594e2e75ba7d.tar.bz2
Hide the mouse cursor when it boots in ChromeOS.
This is originally implemented in CrOS's platform/window-manager but ported here for Aura. BUG=111385 TEST=manually Review URL: http://codereview.chromium.org/9416091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124207 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shell.cc4
-rw-r--r--ash/shell.h8
-rw-r--r--ash/wm/root_window_event_filter.cc10
3 files changed, 20 insertions, 2 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 97cefc0..4eb8a21 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -223,6 +223,8 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
Shell* Shell::instance_ = NULL;
// static
bool Shell::compact_window_mode_for_test_ = false;
+// static
+bool Shell::initially_hide_cursor_ = false;
////////////////////////////////////////////////////////////////////////////////
// Shell::TestApi
@@ -355,6 +357,8 @@ void Shell::Init() {
aura::RootWindow* root_window = GetRootWindow();
root_window->SetCursor(aura::kCursorPointer);
+ if (initially_hide_cursor_)
+ root_window->ShowCursor(false);
activation_controller_.reset(new internal::ActivationController);
diff --git a/ash/shell.h b/ash/shell.h
index 4462ae8..ab26d49 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -206,6 +206,10 @@ class ASH_EXPORT Shell {
SystemTray* tray() const { return tray_.get(); }
+ static void set_initially_hide_cursor(bool hide) {
+ initially_hide_cursor_ = hide;
+ }
+
// Made available for tests.
internal::ShadowController* shadow_controller() {
return shadow_controller_.get();
@@ -242,6 +246,10 @@ class ASH_EXPORT Shell {
// overridden without modifying the global command line.
static bool compact_window_mode_for_test_;
+ // If set before the Shell is initialized, the mouse cursor will be hidden
+ // when the screen is initially created.
+ static bool initially_hide_cursor_;
+
internal::RootWindowEventFilter* root_filter_; // not owned
std::vector<WindowAndBoundsPair> to_restore_;
diff --git a/ash/wm/root_window_event_filter.cc b/ash/wm/root_window_event_filter.cc
index 2652f68..7fcaa74 100644
--- a/ash/wm/root_window_event_filter.cc
+++ b/ash/wm/root_window_event_filter.cc
@@ -108,7 +108,12 @@ bool RootWindowEventFilter::PreHandleMouseEvent(aura::Window* target,
aura::MouseEvent* event) {
// We must always update the cursor, otherwise the cursor can get stuck if an
// event filter registered with us consumes the event.
- if (event->type() == ui::ET_MOUSE_MOVED) {
+ // It should also update the cursor for clicking and wheels for ChromeOS boot.
+ // When ChromeOS is booted, it hides the mouse cursor but immediate mouse
+ // operation will show the cursor.
+ if (event->type() == ui::ET_MOUSE_MOVED ||
+ event->type() == ui::ET_MOUSE_PRESSED ||
+ event->type() == ui::ET_MOUSEWHEEL) {
if (update_cursor_visibility_)
SetCursorVisible(target, event, true);
@@ -169,7 +174,8 @@ void RootWindowEventFilter::UpdateCursor(aura::Window* target,
void RootWindowEventFilter::SetCursorVisible(aura::Window* target,
aura::LocatedEvent* event,
bool show) {
- Shell::GetRootWindow()->ShowCursor(show);
+ if (!(event->flags() & ui::EF_IS_SYNTHESIZED))
+ Shell::GetRootWindow()->ShowCursor(show);
}
bool RootWindowEventFilter::FilterKeyEvent(aura::Window* target,