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

Side by Side Diff: ash/display/screen_position_controller.cc

Issue 440133002: [Ozone] Fix ScreenPositionControllerTest.ConvertHostPointToScreen* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | 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/display/screen_position_controller.h" 5 #include "ash/display/screen_position_controller.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // function usually returns |window->GetRootWindow()|, but if the mouse pointer 65 // function usually returns |window->GetRootWindow()|, but if the mouse pointer
66 // is moved outside the |window|'s root while the mouse is captured, it returns 66 // is moved outside the |window|'s root while the mouse is captured, it returns
67 // the other root window. 67 // the other root window.
68 std::pair<aura::Window*, gfx::Point> GetRootWindowRelativeToWindow( 68 std::pair<aura::Window*, gfx::Point> GetRootWindowRelativeToWindow(
69 aura::Window* window, 69 aura::Window* window,
70 const gfx::Point& location) { 70 const gfx::Point& location) {
71 aura::Window* root_window = window->GetRootWindow(); 71 aura::Window* root_window = window->GetRootWindow();
72 gfx::Point location_in_root(location); 72 gfx::Point location_in_root(location);
73 aura::Window::ConvertPointToTarget(window, root_window, &location_in_root); 73 aura::Window::ConvertPointToTarget(window, root_window, &location_in_root);
74 74
75 #if defined(USE_X11) 75 #if defined(USE_X11) || defined(USE_OZONE)
76 if (!root_window->ContainsPointInRoot(location_in_root)) { 76 if (!root_window->ContainsPointInRoot(location_in_root)) {
77 // This conversion is necessary to deal with X's passive input 77 // This conversion is necessary to deal with X's passive input
78 // grab while dragging window. For example, if we have two 78 // grab while dragging window. For example, if we have two
oshima 2014/08/06 19:49:23 so ozone does passive grab too? if so, can you upd
dnicoara 2014/08/06 21:54:06 Done. For now that's how it is done, though we're
oshima 2014/08/06 21:59:33 cool, thanks.
79 // displays, say 1000x1000 (primary) and 500x500 (extended one 79 // displays, say 1000x1000 (primary) and 500x500 (extended one
80 // on the right), and start dragging a window at (999, 123), and 80 // on the right), and start dragging a window at (999, 123), and
81 // then move the pointer to the right, the pointer suddenly 81 // then move the pointer to the right, the pointer suddenly
82 // warps to the extended display. The destination is (0, 123) in 82 // warps to the extended display. The destination is (0, 123) in
83 // the secondary root window's coordinates, or (1000, 123) in 83 // the secondary root window's coordinates, or (1000, 123) in
84 // the screen coordinates. However, since the mouse is captured 84 // the screen coordinates. However, since the mouse is captured
85 // by X during drag, a weird LocatedEvent, something like (0, 1123) 85 // by X during drag, a weird LocatedEvent, something like (0, 1123)
86 // in the *primary* root window's coordinates, is sent to Chrome 86 // in the *primary* root window's coordinates, is sent to Chrome
87 // (Remember that in the native X11 world, the two root windows 87 // (Remember that in the native X11 world, the two root windows
88 // are always stacked vertically regardless of the display 88 // are always stacked vertically regardless of the display
(...skipping 11 matching lines...) Expand all
100 if (native_bounds.Contains(location_in_native)) { 100 if (native_bounds.Contains(location_in_native)) {
101 root_window = root_windows[i]; 101 root_window = root_windows[i];
102 location_in_root = location_in_native; 102 location_in_root = location_in_native;
103 host->ConvertPointFromNativeScreen(&location_in_root); 103 host->ConvertPointFromNativeScreen(&location_in_root);
104 break; 104 break;
105 } 105 }
106 } 106 }
107 } 107 }
108 #else 108 #else
109 // TODO(yusukes): Support non-X11 platforms if necessary. 109 // TODO(yusukes): Support non-X11 platforms if necessary.
110 NOTIMPLEMENTED();
110 #endif 111 #endif
111 112
112 return std::make_pair(root_window, location_in_root); 113 return std::make_pair(root_window, location_in_root);
113 } 114 }
114 115
115 } // namespace 116 } // namespace
116 117
117 void ScreenPositionController::ConvertPointToScreen( 118 void ScreenPositionController::ConvertPointToScreen(
118 const aura::Window* window, 119 const aura::Window* window,
119 gfx::Point* point) { 120 gfx::Point* point) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 220 }
220 } 221 }
221 gfx::Point origin(bounds.origin()); 222 gfx::Point origin(bounds.origin());
222 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( 223 const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow(
223 window).bounds().origin(); 224 window).bounds().origin();
224 origin.Offset(-display_origin.x(), -display_origin.y()); 225 origin.Offset(-display_origin.x(), -display_origin.y());
225 window->SetBounds(gfx::Rect(origin, bounds.size())); 226 window->SetBounds(gfx::Rect(origin, bounds.size()));
226 } 227 }
227 228
228 } // namespace ash 229 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698