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

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

Issue 2341483004: Fix event dispatching and window resizing in high-dpi mode. (Closed)
Patch Set: remove client area changes Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host) 67 WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host)
68 : host_(host), 68 : host_(host),
69 mouse_pressed_handler_(NULL), 69 mouse_pressed_handler_(NULL),
70 mouse_moved_handler_(NULL), 70 mouse_moved_handler_(NULL),
71 event_dispatch_target_(NULL), 71 event_dispatch_target_(NULL),
72 old_dispatch_target_(NULL), 72 old_dispatch_target_(NULL),
73 synthesize_mouse_move_(false), 73 synthesize_mouse_move_(false),
74 move_hold_count_(0), 74 move_hold_count_(0),
75 dispatching_held_event_(nullptr), 75 dispatching_held_event_(nullptr),
76 observer_manager_(this), 76 observer_manager_(this),
77 transform_events_(true),
78 env_controller_(new EnvInputStateController), 77 env_controller_(new EnvInputStateController),
79 repost_event_factory_(this), 78 repost_event_factory_(this),
80 held_event_factory_(this) { 79 held_event_factory_(this) {
81 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); 80 ui::GestureRecognizer::Get()->AddGestureEventHelper(this);
82 Env::GetInstance()->AddObserver(this); 81 Env::GetInstance()->AddObserver(this);
83 } 82 }
84 83
85 WindowEventDispatcher::~WindowEventDispatcher() { 84 WindowEventDispatcher::~WindowEventDispatcher() {
86 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); 85 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor");
87 Env::GetInstance()->RemoveObserver(this); 86 Env::GetInstance()->RemoveObserver(this);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 //////////////////////////////////////////////////////////////////////////////// 415 ////////////////////////////////////////////////////////////////////////////////
417 // WindowEventDispatcher, ui::EventProcessor implementation: 416 // WindowEventDispatcher, ui::EventProcessor implementation:
418 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { 417 ui::EventTarget* WindowEventDispatcher::GetRootTarget() {
419 return window(); 418 return window();
420 } 419 }
421 420
422 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { 421 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) {
423 // The held events are already in |window()|'s coordinate system. So it is 422 // The held events are already in |window()|'s coordinate system. So it is
424 // not necessary to apply the transform to convert from the host's 423 // not necessary to apply the transform to convert from the host's
425 // coordinate system to |window()|'s coordinate system. 424 // coordinate system to |window()|'s coordinate system.
426 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event) && 425 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event))
427 transform_events_) {
428 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); 426 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event));
429 }
430 } 427 }
431 428
432 //////////////////////////////////////////////////////////////////////////////// 429 ////////////////////////////////////////////////////////////////////////////////
433 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation: 430 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation:
434 431
435 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { 432 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) {
436 return event_dispatch_target_ == target; 433 return event_dispatch_target_ == target;
437 } 434 }
438 435
439 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent( 436 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent(
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 } 861 }
865 862
866 // This flag is set depending on the gestures recognized in the call above, 863 // This flag is set depending on the gestures recognized in the call above,
867 // and needs to propagate with the forwarded event. 864 // and needs to propagate with the forwarded event.
868 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); 865 event->set_may_cause_scrolling(orig_event.may_cause_scrolling());
869 866
870 return PreDispatchLocatedEvent(target, event); 867 return PreDispatchLocatedEvent(target, event);
871 } 868 }
872 869
873 } // namespace aura 870 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698