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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 gfx::NativeView window) const { | 242 gfx::NativeView window) const { |
243 // Getting screen bounds here safely is hard. | 243 // Getting screen bounds here safely is hard. |
244 // | 244 // |
245 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 245 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
246 // can't because |window| (and the associated WindowEventDispatcher*) can be | 246 // can't because |window| (and the associated WindowEventDispatcher*) can be |
247 // partially initialized at this point; WindowEventDispatcher initializations | 247 // partially initialized at this point; WindowEventDispatcher initializations |
248 // call through into GetDisplayNearestWindow(). But the X11 resources are | 248 // call through into GetDisplayNearestWindow(). But the X11 resources are |
249 // created before we create the aura::WindowEventDispatcher. So we ask what | 249 // created before we create the aura::WindowEventDispatcher. So we ask what |
250 // the DRWHX11 believes the window bounds are instead of going through the | 250 // the DRWHX11 believes the window bounds are instead of going through the |
251 // aura::Window's screen bounds. | 251 // aura::Window's screen bounds. |
252 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); | 252 aura::WindowTreeHost* host = window->GetHost(); |
253 if (dispatcher) { | 253 if (host) { |
254 DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( | 254 DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( |
255 dispatcher->host()->GetAcceleratedWidget()); | 255 host->GetAcceleratedWidget()); |
256 if (rwh) | 256 if (rwh) |
257 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); | 257 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); |
258 } | 258 } |
259 | 259 |
260 return GetPrimaryDisplay(); | 260 return GetPrimaryDisplay(); |
261 } | 261 } |
262 | 262 |
263 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( | 263 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( |
264 const gfx::Point& point) const { | 264 const gfx::Point& point) const { |
265 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); | 265 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ProcessDisplayChange(new_displays); | 418 ProcessDisplayChange(new_displays); |
419 } | 419 } |
420 | 420 |
421 //////////////////////////////////////////////////////////////////////////////// | 421 //////////////////////////////////////////////////////////////////////////////// |
422 | 422 |
423 gfx::Screen* CreateDesktopScreen() { | 423 gfx::Screen* CreateDesktopScreen() { |
424 return new DesktopScreenX11; | 424 return new DesktopScreenX11; |
425 } | 425 } |
426 | 426 |
427 } // namespace views | 427 } // namespace views |
OLD | NEW |