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

Side by Side Diff: ash/host/ash_window_tree_host_x11.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 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
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 "ash/host/ash_window_tree_host_x11.h" 5 #include "ash/host/ash_window_tree_host_x11.h"
6 6
7 #include <X11/extensions/Xfixes.h> 7 #include <X11/extensions/Xfixes.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Check if we are in the grace area of the bottom side. 117 // Check if we are in the grace area of the bottom side.
118 // Note: We might not want to do this when the gesture is locked? 118 // Note: We might not want to do this when the gesture is locked?
119 if (y > resolution_y - top_ && 119 if (y > resolution_y - top_ &&
120 y < resolution_y - top_ + bottom_ * kGraceAreaFraction) 120 y < resolution_y - top_ + bottom_ * kGraceAreaFraction)
121 y = resolution_y - top_; 121 y = resolution_y - top_;
122 // Scale the screen area back to the full resolution of the screen. 122 // Scale the screen area back to the full resolution of the screen.
123 y = (y * resolution_y) / (resolution_y - (bottom_ + top_)); 123 y = (y * resolution_y) / (resolution_y - (bottom_ + top_));
124 } 124 }
125 125
126 // Set the modified coordinate back to the event. 126 // Set the modified coordinate back to the event.
127 if (event->root_location() == event->location()) { 127 if (event->root_location() == gfx::ToFlooredPoint(event->location())) {
128 // Usually those will be equal, 128 // Usually those will be equal,
129 // if not, I am not sure what the correct value should be. 129 // if not, I am not sure what the correct value should be.
130 event->set_root_location(gfx::Point(x, y)); 130 event->set_root_location(gfx::Point(x, y));
131 } 131 }
132 event->set_location(gfx::Point(x, y)); 132 event->set_location(gfx::Point(x, y));
133 #endif // defined(USE_XI2_MT) 133 #endif // defined(USE_XI2_MT)
134 } 134 }
135 135
136 private: 136 private:
137 // ui::PlatformEventObserver: 137 // ui::PlatformEventObserver:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 #endif // defined(USE_XI2_MT) 334 #endif // defined(USE_XI2_MT)
335 } 335 }
336 break; 336 break;
337 } 337 }
338 default: { 338 default: {
339 aura::Window* root_window = window(); 339 aura::Window* root_window = window();
340 aura::client::ScreenPositionClient* screen_position_client = 340 aura::client::ScreenPositionClient* screen_position_client =
341 aura::client::GetScreenPositionClient(root_window); 341 aura::client::GetScreenPositionClient(root_window);
342 gfx::Rect local(bounds().size()); 342 gfx::Rect local(bounds().size());
343 343
344 if (screen_position_client && !local.Contains(event->location())) { 344 if (screen_position_client &&
345 gfx::Point location(event->location()); 345 !local.Contains(gfx::ToFlooredPoint(event->location()))) {
346 gfx::Point location(gfx::ToFlooredPoint(event->location()));
346 // In order to get the correct point in screen coordinates 347 // In order to get the correct point in screen coordinates
347 // during passive grab, we first need to find on which host window 348 // during passive grab, we first need to find on which host window
348 // the mouse is on, and find out the screen coordinates on that 349 // the mouse is on, and find out the screen coordinates on that
349 // host window, then convert it back to this host window's coordinate. 350 // host window, then convert it back to this host window's coordinate.
350 screen_position_client->ConvertHostPointToScreen(root_window, 351 screen_position_client->ConvertHostPointToScreen(root_window,
351 &location); 352 &location);
352 screen_position_client->ConvertPointFromScreen(root_window, &location); 353 screen_position_client->ConvertPointFromScreen(root_window, &location);
353 ConvertPointToHost(&location); 354 ConvertPointToHost(&location);
354 event->set_location(location); 355 event->set_location(location);
355 event->set_root_location(location); 356 event->set_root_location(location);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 1); 410 1);
410 } 411 }
411 } 412 }
412 } 413 }
413 414
414 AshWindowTreeHost* AshWindowTreeHost::Create(const gfx::Rect& initial_bounds) { 415 AshWindowTreeHost* AshWindowTreeHost::Create(const gfx::Rect& initial_bounds) {
415 return new AshWindowTreeHostX11(initial_bounds); 416 return new AshWindowTreeHostX11(initial_bounds);
416 } 417 }
417 418
418 } // namespace ash 419 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698