Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: ui/display/chromeos/x11/native_display_delegate_x11.cc

Issue 1861593002: chromeos: Turn off displays on suspend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chromeos: Add functions for configuring cached displays Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_delegate_x11.h ('k') | ui/display/types/native_display_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698