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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 int DesktopScreenX11::GetNumDisplays() const { | 165 int DesktopScreenX11::GetNumDisplays() const { |
166 return displays_.size(); | 166 return displays_.size(); |
167 } | 167 } |
168 | 168 |
169 std::vector<display::Display> DesktopScreenX11::GetAllDisplays() const { | 169 std::vector<display::Display> DesktopScreenX11::GetAllDisplays() const { |
170 return displays_; | 170 return displays_; |
171 } | 171 } |
172 | 172 |
| 173 bool DesktopScreenX11::GetDisplayWithDisplayId( |
| 174 int64_t display_id, |
| 175 display::Display* display) const { |
| 176 for (const display::Display& display_in_list : displays_) { |
| 177 if (display_in_list.id() == display_id) { |
| 178 *display = display_in_list; |
| 179 return true; |
| 180 } |
| 181 } |
| 182 return false; |
| 183 } |
| 184 |
173 display::Display DesktopScreenX11::GetDisplayNearestWindow( | 185 display::Display DesktopScreenX11::GetDisplayNearestWindow( |
174 gfx::NativeView window) const { | 186 gfx::NativeView window) const { |
175 if (!window) | 187 if (!window) |
176 return GetPrimaryDisplay(); | 188 return GetPrimaryDisplay(); |
177 | 189 |
178 // Getting screen bounds here safely is hard. | 190 // Getting screen bounds here safely is hard. |
179 // | 191 // |
180 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 192 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
181 // can't because |window| (and the associated WindowEventDispatcher*) can be | 193 // can't because |window| (and the associated WindowEventDispatcher*) can be |
182 // partially initialized at this point; WindowEventDispatcher initializations | 194 // partially initialized at this point; WindowEventDispatcher initializations |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 GetPrimaryDisplay().device_scale_factor()); | 416 GetPrimaryDisplay().device_scale_factor()); |
405 } | 417 } |
406 | 418 |
407 //////////////////////////////////////////////////////////////////////////////// | 419 //////////////////////////////////////////////////////////////////////////////// |
408 | 420 |
409 display::Screen* CreateDesktopScreen() { | 421 display::Screen* CreateDesktopScreen() { |
410 return new DesktopScreenX11; | 422 return new DesktopScreenX11; |
411 } | 423 } |
412 | 424 |
413 } // namespace views | 425 } // namespace views |
OLD | NEW |