summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/shell.cc4
-rw-r--r--ash/shell.h8
-rw-r--r--ash/wm/root_window_event_filter.cc10
-rw-r--r--chrome/browser/chrome_browser_main_extra_parts_aura.cc4
-rw-r--r--ui/aura/root_window.cc2
-rw-r--r--ui/base/events.h3
6 files changed, 27 insertions, 4 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,
diff --git a/chrome/browser/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/chrome_browser_main_extra_parts_aura.cc
index eb38eaf..6dd359a 100644
--- a/chrome/browser/chrome_browser_main_extra_parts_aura.cc
+++ b/chrome/browser/chrome_browser_main_extra_parts_aura.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/ui/views/aura/ime_controller_chromeos.h"
#include "chrome/browser/ui/views/aura/volume_controller_chromeos.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
+#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/system/runtime_environment.h"
#endif
@@ -38,6 +39,9 @@ void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
switches::kAuraHostWindowUseFullscreen)) {
aura::RootWindow::set_use_fullscreen_host_window(true);
aura::RootWindow::set_hide_host_cursor(true);
+ // Hide the mouse cursor completely at boot.
+ if (!chromeos::UserManager::Get()->user_is_logged_in())
+ ash::Shell::set_initially_hide_cursor(true);
}
#endif
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index e411982..aaec097 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -832,7 +832,7 @@ void RootWindow::SynthesizeMouseMoveEvent() {
MouseEvent event(ui::ET_MOUSE_MOVED,
orig_mouse_location,
orig_mouse_location,
- 0);
+ ui::EF_IS_SYNTHESIZED);
DispatchMouseEvent(&event);
#endif
}
diff --git a/ui/base/events.h b/ui/base/events.h
index 0334d10..1545be3 100644
--- a/ui/base/events.h
+++ b/ui/base/events.h
@@ -74,7 +74,8 @@ enum EventFlags {
enum MouseEventFlags {
EF_IS_DOUBLE_CLICK = 1 << 16,
EF_IS_TRIPLE_CLICK = 1 << 17,
- EF_IS_NON_CLIENT = 1 << 18
+ EF_IS_NON_CLIENT = 1 << 18,
+ EF_IS_SYNTHESIZED = 1 << 19, // Only for Aura. See ui/aura/root_window.h
};
enum TouchStatus {