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

Side by Side Diff: ui/aura/desktop/desktop_screen_x11.cc

Issue 10540091: Rename gfx::Monitor to gfx::Display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 (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/desktop/desktop_screen.h" 5 #include "ui/aura/desktop/desktop_screen.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 8
9 // It clashes with out RootWindow. 9 // It clashes with out RootWindow.
10 #undef RootWindow 10 #undef RootWindow
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
14 #include "ui/aura/root_window_host.h" 14 #include "ui/aura/root_window_host.h"
15 #include "ui/base/x/x11_util.h" 15 #include "ui/base/x/x11_util.h"
16 #include "ui/gfx/monitor.h" 16 #include "ui/gfx/display.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/screen_impl.h" 18 #include "ui/gfx/screen_impl.h"
19 19
20 namespace { 20 namespace {
21 21
22 // TODO(erg): This method is a temporary hack, until we can reliably extract 22 // TODO(erg): This method is a temporary hack, until we can reliably extract
23 // location data out of XRandR. 23 // location data out of XRandR.
24 gfx::Size GetPrimaryMonitorSize() { 24 gfx::Size GetPrimaryMonitorSize() {
25 ::Display* display = ui::GetXDisplay(); 25 ::Display* display = ui::GetXDisplay();
26 ::Screen* screen = DefaultScreenOfDisplay(display); 26 ::Screen* screen = DefaultScreenOfDisplay(display);
27 int width = WidthOfScreen(screen); 27 int width = WidthOfScreen(screen);
28 int height = HeightOfScreen(screen); 28 int height = HeightOfScreen(screen);
29 29
30 return gfx::Size(width, height); 30 return gfx::Size(width, height);
31 } 31 }
32 32
33 class DesktopScreenX11 : public gfx::ScreenImpl { 33 class DesktopScreenX11 : public gfx::ScreenImpl {
34 public: 34 public:
35 DesktopScreenX11(); 35 DesktopScreenX11();
36 virtual ~DesktopScreenX11(); 36 virtual ~DesktopScreenX11();
37 37
38 // Overridden from gfx::ScreenImpl: 38 // Overridden from gfx::ScreenImpl:
39 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; 39 virtual gfx::Point GetCursorScreenPoint() OVERRIDE;
40 virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; 40 virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE;
41 virtual int GetNumMonitors() OVERRIDE; 41 virtual int GetNumMonitors() OVERRIDE;
42 virtual gfx::Monitor GetMonitorNearestWindow( 42 virtual gfx::Display GetMonitorNearestWindow(
43 gfx::NativeView window) const OVERRIDE; 43 gfx::NativeView window) const OVERRIDE;
44 virtual gfx::Monitor GetMonitorNearestPoint( 44 virtual gfx::Display GetMonitorNearestPoint(
45 const gfx::Point& point) const OVERRIDE; 45 const gfx::Point& point) const OVERRIDE;
46 virtual gfx::Monitor GetPrimaryMonitor() const OVERRIDE; 46 virtual gfx::Display GetPrimaryMonitor() const OVERRIDE;
47 47
48 private: 48 private:
49 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); 49 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11);
50 }; 50 };
51 51
52 //////////////////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////////
53 // DesktopScreenX11, public: 53 // DesktopScreenX11, public:
54 54
55 DesktopScreenX11::DesktopScreenX11() { 55 DesktopScreenX11::DesktopScreenX11() {
56 } 56 }
(...skipping 28 matching lines...) Expand all
85 // http://codereview.chromium.org/10279005/ 85 // http://codereview.chromium.org/10279005/
86 return NULL; 86 return NULL;
87 } 87 }
88 88
89 int DesktopScreenX11::GetNumMonitors() { 89 int DesktopScreenX11::GetNumMonitors() {
90 // TODO(erg): Figure this out with oshima or piman because I have no clue 90 // TODO(erg): Figure this out with oshima or piman because I have no clue
91 // about the XRandR implications here. 91 // about the XRandR implications here.
92 return 1; 92 return 1;
93 } 93 }
94 94
95 gfx::Monitor DesktopScreenX11::GetMonitorNearestWindow( 95 gfx::Display DesktopScreenX11::GetMonitorNearestWindow(
96 gfx::NativeView window) const { 96 gfx::NativeView window) const {
97 // TODO(erg): Do the right thing once we know what that is. 97 // TODO(erg): Do the right thing once we know what that is.
98 return gfx::Monitor(0, gfx::Rect(GetPrimaryMonitorSize())); 98 return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize()));
99 } 99 }
100 100
101 gfx::Monitor DesktopScreenX11::GetMonitorNearestPoint( 101 gfx::Display DesktopScreenX11::GetMonitorNearestPoint(
102 const gfx::Point& point) const { 102 const gfx::Point& point) const {
103 // TODO(erg): Do the right thing once we know what that is. 103 // TODO(erg): Do the right thing once we know what that is.
104 return gfx::Monitor(0, gfx::Rect(GetPrimaryMonitorSize())); 104 return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize()));
105 } 105 }
106 106
107 gfx::Monitor DesktopScreenX11::GetPrimaryMonitor() const { 107 gfx::Display DesktopScreenX11::GetPrimaryMonitor() const {
108 // TODO(erg): Do the right thing once we know what that is. 108 // TODO(erg): Do the right thing once we know what that is.
109 return gfx::Monitor(0, gfx::Rect(GetPrimaryMonitorSize())); 109 return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize()));
110 } 110 }
111 111
112 } // namespace 112 } // namespace
113 113
114 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
115 115
116 namespace aura { 116 namespace aura {
117 117
118 gfx::ScreenImpl* CreateDesktopScreen() { 118 gfx::ScreenImpl* CreateDesktopScreen() {
119 return new DesktopScreenX11; 119 return new DesktopScreenX11;
120 } 120 }
121 121
122 } // namespace aura 122 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698