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

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

Issue 2540313002: Split //ui/display and create //ui/display/manager. (Closed)
Patch Set: Cleanup export header. Created 4 years 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/manager/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/XInput2.h>
10 #include <X11/extensions/Xrandr.h> 11 #include <X11/extensions/Xrandr.h>
11 #include <X11/extensions/XInput2.h>
12 12
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "ui/display/chromeos/x11/display_mode_x11.h" 18 #include "ui/display/manager/chromeos/x11/display_mode_x11.h"
19 #include "ui/display/chromeos/x11/display_snapshot_x11.h" 19 #include "ui/display/manager/chromeos/x11/display_snapshot_x11.h"
20 #include "ui/display/chromeos/x11/display_util_x11.h" 20 #include "ui/display/manager/chromeos/x11/display_util_x11.h"
21 #include "ui/display/chromeos/x11/native_display_event_dispatcher_x11.h" 21 #include "ui/display/manager/chromeos/x11/native_display_event_dispatcher_x11.h"
22 #include "ui/display/types/native_display_observer.h" 22 #include "ui/display/types/native_display_observer.h"
23 #include "ui/display/util/x11/edid_parser_x11.h" 23 #include "ui/display/util/x11/edid_parser_x11.h"
24 #include "ui/events/platform/platform_event_source.h" 24 #include "ui/events/platform/platform_event_source.h"
25 #include "ui/gfx/geometry/rect.h" 25 #include "ui/gfx/geometry/rect.h"
26 #include "ui/gfx/x/x11_error_tracker.h" 26 #include "ui/gfx/x/x11_error_tracker.h"
27 #include "ui/gfx/x/x11_types.h" 27 #include "ui/gfx/x/x11_types.h"
28 28
29 namespace ui { 29 namespace ui {
30 30
31 namespace { 31 namespace {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void NativeDisplayDelegateX11::TakeDisplayControl( 149 void NativeDisplayDelegateX11::TakeDisplayControl(
150 const DisplayControlCallback& callback) { 150 const DisplayControlCallback& callback) {
151 NOTIMPLEMENTED(); 151 NOTIMPLEMENTED();
152 } 152 }
153 153
154 void NativeDisplayDelegateX11::RelinquishDisplayControl( 154 void NativeDisplayDelegateX11::RelinquishDisplayControl(
155 const DisplayControlCallback& callback) { 155 const DisplayControlCallback& callback) {
156 NOTIMPLEMENTED(); 156 NOTIMPLEMENTED();
157 } 157 }
158 158
159 void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); } 159 void NativeDisplayDelegateX11::SyncWithServer() {
160 XSync(display_, 0);
161 }
160 162
161 void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) { 163 void NativeDisplayDelegateX11::SetBackgroundColor(uint32_t color_argb) {
162 background_color_argb_ = color_argb; 164 background_color_argb_ = color_argb;
163 } 165 }
164 166
165 void NativeDisplayDelegateX11::ForceDPMSOn() { 167 void NativeDisplayDelegateX11::ForceDPMSOn() {
166 CHECK(DPMSEnable(display_)); 168 CHECK(DPMSEnable(display_));
167 CHECK(DPMSForceLevel(display_, DPMSModeOn)); 169 CHECK(DPMSForceLevel(display_, DPMSModeOn));
168 } 170 }
169 171
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 nitems == 1) { 586 nitems == 1) {
585 Atom value = reinterpret_cast<Atom*>(values)[0]; 587 Atom value = reinterpret_cast<Atom*>(values)[0];
586 if (full_aspect_atom == value) 588 if (full_aspect_atom == value)
587 return true; 589 return true;
588 } 590 }
589 } 591 }
590 } 592 }
591 return false; 593 return false;
592 } 594 }
593 595
594
595 std::vector<ColorCalibrationProfile> 596 std::vector<ColorCalibrationProfile>
596 NativeDisplayDelegateX11::GetAvailableColorCalibrationProfiles( 597 NativeDisplayDelegateX11::GetAvailableColorCalibrationProfiles(
597 const DisplaySnapshot& output) { 598 const DisplaySnapshot& output) {
598 // TODO(mukai|marcheu): Checks the system data and fills the result. 599 // TODO(mukai|marcheu): Checks the system data and fills the result.
599 // Note that the order would be Dynamic -> Standard -> Movie -> Reading. 600 // Note that the order would be Dynamic -> Standard -> Movie -> Reading.
600 return std::vector<ColorCalibrationProfile>(); 601 return std::vector<ColorCalibrationProfile>();
601 } 602 }
602 603
603 bool NativeDisplayDelegateX11::SetColorCalibrationProfile( 604 bool NativeDisplayDelegateX11::SetColorCalibrationProfile(
604 const DisplaySnapshot& output, 605 const DisplaySnapshot& output,
605 ColorCalibrationProfile new_profile) { 606 ColorCalibrationProfile new_profile) {
606 const DisplaySnapshotX11& x11_output = 607 const DisplaySnapshotX11& x11_output =
607 static_cast<const DisplaySnapshotX11&>(output); 608 static_cast<const DisplaySnapshotX11&>(output);
608 609
609 XRRCrtcGamma* gamma_ramp = CreateGammaRampForProfile(x11_output, new_profile); 610 XRRCrtcGamma* gamma_ramp = CreateGammaRampForProfile(x11_output, new_profile);
610 611
611 if (!gamma_ramp) 612 if (!gamma_ramp)
612 return false; 613 return false;
613 614
614 int gamma_ramp_size = XRRGetCrtcGammaSize(display_, x11_output.crtc()); 615 int gamma_ramp_size = XRRGetCrtcGammaSize(display_, x11_output.crtc());
615 XRRSetCrtcGamma(display_, 616 XRRSetCrtcGamma(display_, x11_output.crtc(),
616 x11_output.crtc(),
617 ResampleGammaRamp(gamma_ramp, gamma_ramp_size)); 617 ResampleGammaRamp(gamma_ramp, gamma_ramp_size));
618 XRRFreeGamma(gamma_ramp); 618 XRRFreeGamma(gamma_ramp);
619 return true; 619 return true;
620 } 620 }
621 621
622 XRRCrtcGamma* NativeDisplayDelegateX11::CreateGammaRampForProfile( 622 XRRCrtcGamma* NativeDisplayDelegateX11::CreateGammaRampForProfile(
623 const DisplaySnapshotX11& x11_output, 623 const DisplaySnapshotX11& x11_output,
624 ColorCalibrationProfile new_profile) { 624 ColorCalibrationProfile new_profile) {
625 // TODO(mukai|marcheu): Creates the appropriate gamma ramp data from the 625 // TODO(mukai|marcheu): Creates the appropriate gamma ramp data from the
626 // profile enum. It would be served by the vendor. 626 // profile enum. It would be served by the vendor.
(...skipping 28 matching lines...) Expand all
655 XSetForeground(display_, gc, color.pixel); 655 XSetForeground(display_, gc, color.pixel);
656 XSetFillStyle(display_, gc, FillSolid); 656 XSetFillStyle(display_, gc, FillSolid);
657 int width = DisplayWidth(display_, DefaultScreen(display_)); 657 int width = DisplayWidth(display_, DefaultScreen(display_));
658 int height = DisplayHeight(display_, DefaultScreen(display_)); 658 int height = DisplayHeight(display_, DefaultScreen(display_));
659 XFillRectangle(display_, window_, gc, 0, 0, width, height); 659 XFillRectangle(display_, window_, gc, 0, 0, width, height);
660 XFreeGC(display_, gc); 660 XFreeGC(display_, gc);
661 XFreeColors(display_, colormap, &color.pixel, 1, 0); 661 XFreeColors(display_, colormap, &color.pixel, 1, 0);
662 } 662 }
663 663
664 } // namespace ui 664 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698