OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/chromeos/x11/native_display_delegate_x11.h" | 5 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) { | 163 void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) { |
164 background_color_argb_ = color_argb; | 164 background_color_argb_ = color_argb; |
165 } | 165 } |
166 | 166 |
167 void NativeDisplayDelegateX11::ForceDPMSOn() { | 167 void NativeDisplayDelegateX11::ForceDPMSOn() { |
168 CHECK(DPMSEnable(display_)); | 168 CHECK(DPMSEnable(display_)); |
169 CHECK(DPMSForceLevel(display_, DPMSModeOn)); | 169 CHECK(DPMSForceLevel(display_, DPMSModeOn)); |
170 } | 170 } |
171 | 171 |
| 172 void NativeDisplayDelegateX11::GetCachedDisplays( |
| 173 const GetDisplaysCallback& callback) { |
| 174 callback.Run(cached_outputs_.get()); |
| 175 } |
| 176 |
172 void NativeDisplayDelegateX11::GetDisplays( | 177 void NativeDisplayDelegateX11::GetDisplays( |
173 const GetDisplaysCallback& callback) { | 178 const GetDisplaysCallback& callback) { |
174 CHECK(screen_) << "Server not grabbed"; | 179 CHECK(screen_) << "Server not grabbed"; |
175 | 180 |
176 cached_outputs_.clear(); | 181 cached_outputs_.clear(); |
177 std::set<RRCrtc> last_used_crtcs; | 182 std::set<RRCrtc> last_used_crtcs; |
178 | 183 |
179 InitModes(); | 184 InitModes(); |
180 for (int i = 0; i < screen_->noutput; ++i) { | 185 for (int i = 0; i < screen_->noutput; ++i) { |
181 RROutput output_id = screen_->outputs[i]; | 186 RROutput output_id = screen_->outputs[i]; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 XSetForeground(display_, gc, color.pixel); | 660 XSetForeground(display_, gc, color.pixel); |
656 XSetFillStyle(display_, gc, FillSolid); | 661 XSetFillStyle(display_, gc, FillSolid); |
657 int width = DisplayWidth(display_, DefaultScreen(display_)); | 662 int width = DisplayWidth(display_, DefaultScreen(display_)); |
658 int height = DisplayHeight(display_, DefaultScreen(display_)); | 663 int height = DisplayHeight(display_, DefaultScreen(display_)); |
659 XFillRectangle(display_, window_, gc, 0, 0, width, height); | 664 XFillRectangle(display_, window_, gc, 0, 0, width, height); |
660 XFreeGC(display_, gc); | 665 XFreeGC(display_, gc); |
661 XFreeColors(display_, colormap, &color.pixel, 1, 0); | 666 XFreeColors(display_, colormap, &color.pixel, 1, 0); |
662 } | 667 } |
663 | 668 |
664 } // namespace ui | 669 } // namespace ui |
OLD | NEW |