OLD | NEW |
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/views/widget/desktop_aura/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
6 | 6 |
7 #include <X11/extensions/Xrandr.h> | 7 #include <X11/extensions/Xrandr.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // It clashes with out RootWindow. | 10 // It clashes with out RootWindow. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 187 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
188 // can't because |window| (and the associated RootWindow*) can be partially | 188 // can't because |window| (and the associated RootWindow*) can be partially |
189 // initialized at this point; RootWindow initializations call through into | 189 // initialized at this point; RootWindow initializations call through into |
190 // GetDisplayNearestWindow(). But the X11 resources are created before we | 190 // GetDisplayNearestWindow(). But the X11 resources are created before we |
191 // create the aura::RootWindow. So we ask what the DRWHX11 believes the | 191 // create the aura::RootWindow. So we ask what the DRWHX11 believes the |
192 // window bounds are instead of going through the aura::Window's screen | 192 // window bounds are instead of going through the aura::Window's screen |
193 // bounds. | 193 // bounds. |
194 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); | 194 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); |
195 if (dispatcher) { | 195 if (dispatcher) { |
196 DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( | 196 DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( |
197 dispatcher->GetAcceleratedWidget()); | 197 dispatcher->host()->GetAcceleratedWidget()); |
198 if (rwh) | 198 if (rwh) |
199 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); | 199 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); |
200 } | 200 } |
201 | 201 |
202 return GetPrimaryDisplay(); | 202 return GetPrimaryDisplay(); |
203 } | 203 } |
204 | 204 |
205 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( | 205 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( |
206 const gfx::Point& point) const { | 206 const gfx::Point& point) const { |
207 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); | 207 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 ProcessDisplayChange(new_displays); | 348 ProcessDisplayChange(new_displays); |
349 } | 349 } |
350 | 350 |
351 //////////////////////////////////////////////////////////////////////////////// | 351 //////////////////////////////////////////////////////////////////////////////// |
352 | 352 |
353 gfx::Screen* CreateDesktopScreen() { | 353 gfx::Screen* CreateDesktopScreen() { |
354 return new DesktopScreenX11; | 354 return new DesktopScreenX11; |
355 } | 355 } |
356 | 356 |
357 } // namespace views | 357 } // namespace views |
OLD | NEW |