| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 gfx::NativeView window) const { | 180 gfx::NativeView window) const { |
| 181 // Getting screen bounds here safely is hard. | 181 // Getting screen bounds here safely is hard. |
| 182 // | 182 // |
| 183 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 183 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
| 184 // can't because |window| (and the associated RootWindow*) can be partially | 184 // can't because |window| (and the associated RootWindow*) can be partially |
| 185 // initialized at this point; RootWindow initializations call through into | 185 // initialized at this point; RootWindow initializations call through into |
| 186 // GetDisplayNearestWindow(). But the X11 resources are created before we | 186 // GetDisplayNearestWindow(). But the X11 resources are created before we |
| 187 // create the aura::RootWindow. So we ask what the DRWHX11 believes the | 187 // create the aura::RootWindow. So we ask what the DRWHX11 believes the |
| 188 // window bounds are instead of going through the aura::Window's screen | 188 // window bounds are instead of going through the aura::Window's screen |
| 189 // bounds. | 189 // bounds. |
| 190 aura::RootWindow* root_window = window->GetRootWindow(); | 190 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); |
| 191 if (root_window) { | 191 if (dispatcher) { |
| 192 DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( | 192 DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( |
| 193 root_window->GetAcceleratedWidget()); | 193 dispatcher->GetAcceleratedWidget()); |
| 194 if (rwh) | 194 if (rwh) |
| 195 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); | 195 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 return GetPrimaryDisplay(); | 198 return GetPrimaryDisplay(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( | 201 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( |
| 202 const gfx::Point& point) const { | 202 const gfx::Point& point) const { |
| 203 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); | 203 for (std::vector<gfx::Display>::const_iterator it = displays_.begin(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 ProcessDisplayChange(new_displays); | 344 ProcessDisplayChange(new_displays); |
| 345 } | 345 } |
| 346 | 346 |
| 347 //////////////////////////////////////////////////////////////////////////////// | 347 //////////////////////////////////////////////////////////////////////////////// |
| 348 | 348 |
| 349 gfx::Screen* CreateDesktopScreen() { | 349 gfx::Screen* CreateDesktopScreen() { |
| 350 return new DesktopScreenX11; | 350 return new DesktopScreenX11; |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace views | 353 } // namespace views |
| OLD | NEW |