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

Unified Diff: ash/wm/window_cycle_event_filter_aura.cc

Issue 2642273002: CrOS - Make it possible to Alt+Tab while dragging a tab (Closed)
Patch Set: fix tests Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/window_cycle_event_filter_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_cycle_event_filter_aura.cc
diff --git a/ash/wm/window_cycle_event_filter_aura.cc b/ash/wm/window_cycle_event_filter_aura.cc
index e9879b524f7005f9be2261aba4139640fdcb0daa..a8dadb9a8c8c068a8dc41e96875b5f7c9f792eb9 100644
--- a/ash/wm/window_cycle_event_filter_aura.cc
+++ b/ash/wm/window_cycle_event_filter_aura.cc
@@ -14,10 +14,16 @@ namespace ash {
WindowCycleEventFilterAura::WindowCycleEventFilterAura() {
Shell::GetInstance()->AddPreTargetHandler(this);
+ // Handling release of "Alt" must come before other pretarget handlers
+ // (specifically, the partial screenshot handler). See crbug.com/651939
+ // We can't do all key event handling that early though because it prevents
+ // other accelerators (like triggering a partial screenshot) from working.
+ Shell::GetInstance()->PrependPreTargetHandler(&alt_release_handler_);
}
WindowCycleEventFilterAura::~WindowCycleEventFilterAura() {
Shell::GetInstance()->RemovePreTargetHandler(this);
+ Shell::GetInstance()->RemovePreTargetHandler(&alt_release_handler_);
}
void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
@@ -28,12 +34,7 @@ void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
event->type() != ui::ET_KEY_PRESSED) {
event->StopPropagation();
}
- // Views uses VKEY_MENU for both left and right Alt keys.
- if (event->key_code() == ui::VKEY_MENU &&
- event->type() == ui::ET_KEY_RELEASED) {
- WmShell::Get()->window_cycle_controller()->CompleteCycling();
- // Warning: |this| will be deleted from here on.
- } else if (event->key_code() == ui::VKEY_TAB) {
+ if (event->key_code() == ui::VKEY_TAB) {
if (event->type() == ui::ET_KEY_RELEASED) {
repeat_timer_.Stop();
} else if (event->type() == ui::ET_KEY_PRESSED && event->is_repeat() &&
@@ -51,4 +52,28 @@ void WindowCycleEventFilterAura::OnKeyEvent(ui::KeyEvent* event) {
}
}
+void WindowCycleEventFilterAura::OnMouseEvent(ui::MouseEvent* event) {
+ // Prevent mouse clicks from doing anything while the Alt+Tab UI is active
+ // <crbug.com/641171> but don't interfere with drag and drop operations
+ // <crbug.com/660945>.
+ if (event->type() != ui::ET_MOUSE_DRAGGED &&
+ event->type() != ui::ET_MOUSE_RELEASED) {
+ event->StopPropagation();
+ }
+}
+
+WindowCycleEventFilterAura::AltReleaseHandler::AltReleaseHandler() {}
+
+WindowCycleEventFilterAura::AltReleaseHandler::~AltReleaseHandler() {}
+
+void WindowCycleEventFilterAura::AltReleaseHandler::OnKeyEvent(
+ ui::KeyEvent* event) {
+ // Views uses VKEY_MENU for both left and right Alt keys.
+ if (event->key_code() == ui::VKEY_MENU &&
+ event->type() == ui::ET_KEY_RELEASED) {
+ WmShell::Get()->window_cycle_controller()->CompleteCycling();
+ // Warning: |this| will be deleted from here on.
+ }
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/window_cycle_event_filter_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698