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

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

Issue 10310067: Remove ui-enable-dip option (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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/monitor_change_observer_x11.cc ('k') | ui/compositor/compositor.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/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 client::EventClient* client = client::GetEventClient(GetRootWindow()); 273 client::EventClient* client = client::GetEventClient(GetRootWindow());
274 if (client && !client->CanProcessEventsWithinSubtree(focused_window_)) { 274 if (client && !client->CanProcessEventsWithinSubtree(focused_window_)) {
275 SetFocusedWindow(NULL, NULL); 275 SetFocusedWindow(NULL, NULL);
276 return false; 276 return false;
277 } 277 }
278 return ProcessKeyEvent(focused_window_, &translated_event); 278 return ProcessKeyEvent(focused_window_, &translated_event);
279 } 279 }
280 280
281 bool RootWindow::DispatchScrollEvent(ScrollEvent* event) { 281 bool RootWindow::DispatchScrollEvent(ScrollEvent* event) {
282 DispatchHeldMouseMove(); 282 DispatchHeldMouseMove();
283 if (ui::IsDIPEnabled()) { 283 float scale = ui::GetDeviceScaleFactor(layer());
284 float scale = ui::GetDeviceScaleFactor(layer()); 284 ui::Transform transform = layer()->transform();
285 ui::Transform transform = layer()->transform(); 285 transform.ConcatScale(scale, scale);
286 transform.ConcatScale(scale, scale); 286 event->UpdateForRootTransform(transform);
287 event->UpdateForRootTransform(transform);
288 } else {
289 event->UpdateForRootTransform(layer()->transform());
290 }
291 287
292 last_mouse_location_ = event->location(); 288 last_mouse_location_ = event->location();
293 synthesize_mouse_move_ = false; 289 synthesize_mouse_move_ = false;
294 290
295 Window* target = 291 Window* target =
296 mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_; 292 mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_;
297 if (!target) 293 if (!target)
298 target = GetEventHandlerForPoint(event->location()); 294 target = GetEventHandlerForPoint(event->location());
299 295
300 if (target && target->delegate()) { 296 if (target && target->delegate()) {
301 int flags = event->flags(); 297 int flags = event->flags();
302 gfx::Point location_in_window = event->location(); 298 gfx::Point location_in_window = event->location();
303 Window::ConvertPointToWindow(this, target, &location_in_window); 299 Window::ConvertPointToWindow(this, target, &location_in_window);
304 if (IsNonClientLocation(target, location_in_window)) 300 if (IsNonClientLocation(target, location_in_window))
305 flags |= ui::EF_IS_NON_CLIENT; 301 flags |= ui::EF_IS_NON_CLIENT;
306 ScrollEvent translated_event(*event, this, target, event->type(), flags); 302 ScrollEvent translated_event(*event, this, target, event->type(), flags);
307 return ProcessMouseEvent(target, &translated_event); 303 return ProcessMouseEvent(target, &translated_event);
308 } 304 }
309 return false; 305 return false;
310 } 306 }
311 307
312 bool RootWindow::DispatchTouchEvent(TouchEvent* event) { 308 bool RootWindow::DispatchTouchEvent(TouchEvent* event) {
313 DispatchHeldMouseMove(); 309 DispatchHeldMouseMove();
314 if (ui::IsDIPEnabled()) { 310 float scale = ui::GetDeviceScaleFactor(layer());
315 float scale = ui::GetDeviceScaleFactor(layer()); 311 ui::Transform transform = layer()->transform();
316 ui::Transform transform = layer()->transform(); 312 transform.ConcatScale(scale, scale);
317 transform.ConcatScale(scale, scale); 313 event->UpdateForRootTransform(transform);
318 event->UpdateForRootTransform(transform);
319 } else {
320 event->UpdateForRootTransform(layer()->transform());
321 }
322 bool handled = false; 314 bool handled = false;
323 ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN; 315 ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN;
324 Window* target = capture_window_; 316 Window* target = capture_window_;
325 if (!target) { 317 if (!target) {
326 target = ConsumerToWindow( 318 target = ConsumerToWindow(
327 gesture_recognizer_->GetTouchLockedTarget(event)); 319 gesture_recognizer_->GetTouchLockedTarget(event));
328 if (!target) { 320 if (!target) {
329 target = ConsumerToWindow( 321 target = ConsumerToWindow(
330 gesture_recognizer_->GetTargetForLocation(event->GetLocation())); 322 gesture_recognizer_->GetTargetForLocation(event->GetLocation()));
331 } 323 }
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 919
928 Window* RootWindow::GetFocusedWindow() { 920 Window* RootWindow::GetFocusedWindow() {
929 return focused_window_; 921 return focused_window_;
930 } 922 }
931 923
932 bool RootWindow::IsFocusedWindow(const Window* window) const { 924 bool RootWindow::IsFocusedWindow(const Window* window) const {
933 return focused_window_ == window; 925 return focused_window_ == window;
934 } 926 }
935 927
936 bool RootWindow::DispatchMouseEventImpl(MouseEvent* event) { 928 bool RootWindow::DispatchMouseEventImpl(MouseEvent* event) {
937 if (ui::IsDIPEnabled()) { 929 float scale = ui::GetDeviceScaleFactor(layer());
938 float scale = ui::GetDeviceScaleFactor(layer()); 930 ui::Transform transform = layer()->transform();
939 ui::Transform transform = layer()->transform(); 931 transform.ConcatScale(scale, scale);
940 transform.ConcatScale(scale, scale); 932 event->UpdateForRootTransform(transform);
941 event->UpdateForRootTransform(transform);
942 } else {
943 event->UpdateForRootTransform(layer()->transform());
944 }
945 Window* target = 933 Window* target =
946 mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_; 934 mouse_pressed_handler_ ? mouse_pressed_handler_ : capture_window_;
947 if (!target) 935 if (!target)
948 target = GetEventHandlerForPoint(event->location()); 936 target = GetEventHandlerForPoint(event->location());
949 return DispatchMouseEventToTarget(event, target); 937 return DispatchMouseEventToTarget(event, target);
950 } 938 }
951 939
952 bool RootWindow::DispatchMouseEventToTarget(MouseEvent* event, 940 bool RootWindow::DispatchMouseEventToTarget(MouseEvent* event,
953 Window* target) { 941 Window* target) {
954 static const int kMouseButtonFlagMask = 942 static const int kMouseButtonFlagMask =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 void RootWindow::UnlockCompositor() { 1017 void RootWindow::UnlockCompositor() {
1030 DCHECK(compositor_lock_); 1018 DCHECK(compositor_lock_);
1031 compositor_lock_ = NULL; 1019 compositor_lock_ = NULL;
1032 if (draw_on_compositor_unlock_) { 1020 if (draw_on_compositor_unlock_) {
1033 draw_on_compositor_unlock_ = false; 1021 draw_on_compositor_unlock_ = false;
1034 ScheduleDraw(); 1022 ScheduleDraw();
1035 } 1023 }
1036 } 1024 }
1037 1025
1038 } // namespace aura 1026 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/monitor_change_observer_x11.cc ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698