Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: ui/aura/env.cc

Issue 10829180: Move cursor when it's hidden so that UX can update correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test for windows Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/root_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/env.h" 5 #include "ui/aura/env.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/client/screen_position_client.h" 8 #include "ui/aura/client/screen_position_client.h"
9 #include "ui/aura/env_observer.h" 9 #include "ui/aura/env_observer.h"
10 #include "ui/aura/event_filter.h" 10 #include "ui/aura/event_filter.h"
(...skipping 10 matching lines...) Expand all
21 namespace aura { 21 namespace aura {
22 22
23 // static 23 // static
24 Env* Env::instance_ = NULL; 24 Env* Env::instance_ = NULL;
25 25
26 //////////////////////////////////////////////////////////////////////////////// 26 ////////////////////////////////////////////////////////////////////////////////
27 // Env, public: 27 // Env, public:
28 28
29 Env::Env() 29 Env::Env()
30 : mouse_button_flags_(0), 30 : mouse_button_flags_(0),
31 is_cursor_hidden_(false),
31 is_touch_down_(false), 32 is_touch_down_(false),
32 render_white_bg_(true), 33 render_white_bg_(true),
33 stacking_client_(NULL) { 34 stacking_client_(NULL) {
34 } 35 }
35 36
36 Env::~Env() { 37 Env::~Env() {
37 ui::Compositor::Terminate(); 38 ui::Compositor::Terminate();
38 } 39 }
39 40
40 // static 41 // static
(...skipping 21 matching lines...) Expand all
62 63
63 void Env::SetLastMouseLocation(const Window& window, 64 void Env::SetLastMouseLocation(const Window& window,
64 const gfx::Point& location_in_root) { 65 const gfx::Point& location_in_root) {
65 last_mouse_location_ = location_in_root; 66 last_mouse_location_ = location_in_root;
66 client::ScreenPositionClient* client = 67 client::ScreenPositionClient* client =
67 client::GetScreenPositionClient(window.GetRootWindow()); 68 client::GetScreenPositionClient(window.GetRootWindow());
68 if (client) 69 if (client)
69 client->ConvertPointToScreen(&window, &last_mouse_location_); 70 client->ConvertPointToScreen(&window, &last_mouse_location_);
70 } 71 }
71 72
73 void Env::SetCursorShown(bool cursor_shown) {
74 if (cursor_shown) {
75 // Protect against restoring a position that hadn't been saved.
76 if (is_cursor_hidden_)
77 last_mouse_location_ = hidden_cursor_location_;
78 is_cursor_hidden_ = false;
79 } else {
80 hidden_cursor_location_ = last_mouse_location_;
81 last_mouse_location_ = gfx::Point(-10000, -10000);
sky 2012/08/14 16:01:00 Won't this cause all sorts of weirdness if the hid
82 is_cursor_hidden_ = true;
83 }
84 }
85
72 void Env::SetDisplayManager(DisplayManager* display_manager) { 86 void Env::SetDisplayManager(DisplayManager* display_manager) {
73 display_manager_.reset(display_manager); 87 display_manager_.reset(display_manager);
74 #if defined(USE_X11) 88 #if defined(USE_X11)
75 // Update the display manager with latest info. 89 // Update the display manager with latest info.
76 display_change_observer_->NotifyDisplayChange(); 90 display_change_observer_->NotifyDisplayChange();
77 #endif 91 #endif
78 } 92 }
79 93
80 void Env::SetEventFilter(EventFilter* event_filter) { 94 void Env::SetEventFilter(EventFilter* event_filter) {
81 event_filter_.reset(event_filter); 95 event_filter_.reset(event_filter);
(...skipping 18 matching lines...) Expand all
100 ui::Compositor::Initialize( 114 ui::Compositor::Initialize(
101 CommandLine::ForCurrentProcess()->HasSwitch( 115 CommandLine::ForCurrentProcess()->HasSwitch(
102 switches::kUIEnableThreadedCompositing)); 116 switches::kUIEnableThreadedCompositing));
103 } 117 }
104 118
105 void Env::NotifyWindowInitialized(Window* window) { 119 void Env::NotifyWindowInitialized(Window* window) {
106 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window)); 120 FOR_EACH_OBSERVER(EnvObserver, observers_, OnWindowInitialized(window));
107 } 121 }
108 122
109 } // namespace aura 123 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/root_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698