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

Side by Side Diff: ui/aura/shared/compound_event_filter.cc

Issue 10982040: Fix mouse lock on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comment Created 8 years, 2 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
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/shared/compound_event_filter.h" 5 #include "ui/aura/shared/compound_event_filter.h"
6 6
7 #include "ui/aura/client/activation_client.h" 7 #include "ui/aura/client/activation_client.h"
8 #include "ui/aura/client/cursor_client.h" 8 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/client/drag_drop_client.h" 9 #include "ui/aura/client/drag_drop_client.h"
10 #include "ui/aura/env.h" 10 #include "ui/aura/env.h"
(...skipping 19 matching lines...) Expand all
30 DCHECK(window->GetRootWindow()); 30 DCHECK(window->GetRootWindow());
31 return client::GetActivationClient(window->GetRootWindow())-> 31 return client::GetActivationClient(window->GetRootWindow())->
32 GetActiveWindow(); 32 GetActiveWindow();
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
38 // CompoundEventFilter, public: 38 // CompoundEventFilter, public:
39 39
40 CompoundEventFilter::CompoundEventFilter() : update_cursor_visibility_(true) { 40 CompoundEventFilter::CompoundEventFilter() : cursor_hidden_by_filter_(false) {
41 } 41 }
42 42
43 CompoundEventFilter::~CompoundEventFilter() { 43 CompoundEventFilter::~CompoundEventFilter() {
44 // Additional filters are not owned by CompoundEventFilter and they 44 // Additional filters are not owned by CompoundEventFilter and they
45 // should all be removed when running here. |filters_| has 45 // should all be removed when running here. |filters_| has
46 // check_empty == true and will DCHECK failure if it is not empty. 46 // check_empty == true and will DCHECK failure if it is not empty.
47 } 47 }
48 48
49 // static 49 // static
50 gfx::NativeCursor CompoundEventFilter::CursorForWindowComponent( 50 gfx::NativeCursor CompoundEventFilter::CursorForWindowComponent(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 (filter = it.GetNext()) != NULL) { 140 (filter = it.GetNext()) != NULL) {
141 status = filter->OnTouchEvent(event); 141 status = filter->OnTouchEvent(event);
142 } 142 }
143 } 143 }
144 return status; 144 return status;
145 } 145 }
146 146
147 void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target, 147 void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
148 ui::Event* event, 148 ui::Event* event,
149 bool show) { 149 bool show) {
150 if (update_cursor_visibility_ && !(event->flags() & ui::EF_IS_SYNTHESIZED)) { 150 if (!(event->flags() & ui::EF_IS_SYNTHESIZED)) {
151 client::CursorClient* client = 151 client::CursorClient* client =
152 client::GetCursorClient(target->GetRootWindow()); 152 client::GetCursorClient(target->GetRootWindow());
153 if (client) 153 if (client) {
154 client->ShowCursor(show); 154 if (show && cursor_hidden_by_filter_) {
155 cursor_hidden_by_filter_ = false;
156 client->ShowCursor(true);
157 } else if (client->IsCursorVisible() && !show &&
158 !cursor_hidden_by_filter_) {
159 cursor_hidden_by_filter_ = true;
160 client->ShowCursor(false);
161 }
162 }
155 } 163 }
156 } 164 }
157 165
158 //////////////////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////////////////
159 // CompoundEventFilter, EventFilter implementation: 167 // CompoundEventFilter, EventFilter implementation:
160 168
161 ui::TouchStatus CompoundEventFilter::PreHandleTouchEvent( 169 ui::TouchStatus CompoundEventFilter::PreHandleTouchEvent(
162 Window* target, 170 Window* target,
163 ui::TouchEvent* event) { 171 ui::TouchEvent* event) {
164 // TODO(sad): Move the implementation into OnTouchEvent once touch-events are 172 // TODO(sad): Move the implementation into OnTouchEvent once touch-events are
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 GetActiveWindow(window) != window) { 250 GetActiveWindow(window) != window) {
243 window->GetFocusManager()->SetFocusedWindow( 251 window->GetFocusManager()->SetFocusedWindow(
244 FindFocusableWindowFor(window), event); 252 FindFocusableWindowFor(window), event);
245 } 253 }
246 254
247 return static_cast<ui::EventResult>(result); 255 return static_cast<ui::EventResult>(result);
248 } 256 }
249 257
250 } // namespace shared 258 } // namespace shared
251 } // namespace aura 259 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/shared/compound_event_filter.h ('k') | ui/aura/shared/compound_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698