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

Side by Side Diff: ash/wm/window_modality_controller.cc

Issue 10763004: ash: Fix touch-event handling for modal windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-win-aura Created 8 years, 5 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 | « ash/wm/window_modality_controller.h ('k') | ash/wm/window_modality_controller_unittest.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 "ash/wm/window_modality_controller.h" 5 #include "ash/wm/window_modality_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 //////////////////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////////////////
75 // WindowModalityController, aura::EventFilter implementation: 75 // WindowModalityController, aura::EventFilter implementation:
76 76
77 bool WindowModalityController::PreHandleKeyEvent(aura::Window* target, 77 bool WindowModalityController::PreHandleKeyEvent(aura::Window* target,
78 aura::KeyEvent* event) { 78 aura::KeyEvent* event) {
79 return !!wm::GetWindowModalTransient(target); 79 return !!wm::GetWindowModalTransient(target);
80 } 80 }
81 81
82 bool WindowModalityController::PreHandleMouseEvent(aura::Window* target, 82 bool WindowModalityController::PreHandleMouseEvent(aura::Window* target,
83 aura::MouseEvent* event) { 83 aura::MouseEvent* event) {
84 aura::Window* modal_transient_child = wm::GetWindowModalTransient(target); 84 return ProcessLocatedEvent(target, event);
85 if (modal_transient_child && event->type() == ui::ET_MOUSE_PRESSED)
86 wm::ActivateWindow(modal_transient_child);
87 return !!modal_transient_child;
88 } 85 }
89 86
90 ui::TouchStatus WindowModalityController::PreHandleTouchEvent( 87 ui::TouchStatus WindowModalityController::PreHandleTouchEvent(
91 aura::Window* target, 88 aura::Window* target,
92 aura::TouchEvent* event) { 89 aura::TouchEvent* event) {
93 // TODO: make touch work with modals. 90 return ProcessLocatedEvent(target, event) ? ui::TOUCH_STATUS_CONTINUE :
94 return ui::TOUCH_STATUS_UNKNOWN; 91 ui::TOUCH_STATUS_UNKNOWN;
95 } 92 }
96 93
97 ui::GestureStatus WindowModalityController::PreHandleGestureEvent( 94 ui::GestureStatus WindowModalityController::PreHandleGestureEvent(
98 aura::Window* target, 95 aura::Window* target,
99 aura::GestureEvent* event) { 96 aura::GestureEvent* event) {
100 // TODO: make gestures work with modals. 97 // TODO: make gestures work with modals.
101 return ui::GESTURE_STATUS_UNKNOWN; 98 return ui::GESTURE_STATUS_UNKNOWN;
102 } 99 }
103 100
104 void WindowModalityController::OnWindowInitialized(aura::Window* window) { 101 void WindowModalityController::OnWindowInitialized(aura::Window* window) {
(...skipping 12 matching lines...) Expand all
117 if (capture_window) 114 if (capture_window)
118 capture_window->ReleaseCapture(); 115 capture_window->ReleaseCapture();
119 } 116 }
120 } 117 }
121 118
122 void WindowModalityController::OnWindowDestroyed(aura::Window* window) { 119 void WindowModalityController::OnWindowDestroyed(aura::Window* window) {
123 windows_.erase(std::find(windows_.begin(), windows_.end(), window)); 120 windows_.erase(std::find(windows_.begin(), windows_.end(), window));
124 window->RemoveObserver(this); 121 window->RemoveObserver(this);
125 } 122 }
126 123
124 bool WindowModalityController::ProcessLocatedEvent(aura::Window* target,
125 aura::LocatedEvent* event) {
126 aura::Window* modal_transient_child = wm::GetWindowModalTransient(target);
127 if (modal_transient_child && (event->type() == ui::ET_MOUSE_PRESSED ||
128 event->type() == ui::ET_TOUCH_PRESSED)) {
129 wm::ActivateWindow(modal_transient_child);
130 }
131 return !!modal_transient_child;
132 }
133
127 } // namespace internal 134 } // namespace internal
128 } // namespace ash 135 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_modality_controller.h ('k') | ash/wm/window_modality_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698