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

Side by Side Diff: ui/views/widget/desktop_screen_position_client.cc

Issue 10939006: Make cursors work on win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 3 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/views/widget/desktop_screen_position_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/widget/desktop_screen_position_client.h"
6
7 #include "ui/aura/root_window.h"
8
9 namespace views {
10
11 DesktopScreenPositionClient::DesktopScreenPositionClient() {
12 }
13
14 DesktopScreenPositionClient::~DesktopScreenPositionClient() {
15 }
16
17 void DesktopScreenPositionClient::ConvertPointToScreen(
18 const aura::Window* window, gfx::Point* point) {
19 const aura::RootWindow* root_window = window->GetRootWindow();
20 aura::Window::ConvertPointToTarget(window, root_window, point);
21 gfx::Point origin = root_window->GetHostOrigin();
22 point->Offset(origin.x(), origin.y());
23 }
24
25 void DesktopScreenPositionClient::ConvertPointFromScreen(
26 const aura::Window* window, gfx::Point* point) {
27 const aura::RootWindow* root_window = window->GetRootWindow();
28 gfx::Point origin = root_window->GetHostOrigin();
29 point->Offset(-origin.x(), -origin.y());
30 aura::Window::ConvertPointToTarget(root_window, window, point);
31 }
32
33 void DesktopScreenPositionClient::SetBounds(
34 aura::Window* window,
35 const gfx::Rect& bounds,
36 const gfx::Display& display) {
37 // TODO: Use the 3rd parameter, |display|.
38 gfx::Point origin = bounds.origin();
39 aura::RootWindow* root = window->GetRootWindow();
40 aura::Window::ConvertPointToTarget(window->parent(), root, &origin);
41
42 #if !defined(OS_WIN)
43 if (window->type() == aura::client::WINDOW_TYPE_CONTROL) {
44 window->SetBounds(gfx::Rect(origin, bounds.size()));
45 return;
46 } else if (window->type() == aura::client::WINDOW_TYPE_POPUP) {
47 // The caller expects windows we consider "embedded" to be placed in the
48 // screen coordinate system. So we need to offset the root window's
49 // position (which is in screen coordinates) from these bounds.
50 gfx::Point host_origin = root->GetHostOrigin();
51 origin.Offset(-host_origin.x(), -host_origin.y());
52 window->SetBounds(gfx::Rect(origin, bounds.size()));
53 return;
54 }
55 #endif // !defined(OS_WIN)
56 }
57
58 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_screen_position_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698