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

Side by Side Diff: chromeos/display/output_configurator.cc

Issue 12496020: Use OutputConfigurator::SetDislpayMode for ctrl-fullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chromeos/display/output_configurator.h" 5 #include "chromeos/display/output_configurator.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 XUngrabServer(display); 615 XUngrabServer(display);
616 616
617 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 617 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
618 SetIsProjecting(is_projecting); 618 SetIsProjecting(is_projecting);
619 } 619 }
620 620
621 void OutputConfigurator::Stop() { 621 void OutputConfigurator::Stop() {
622 configure_display_ = false; 622 configure_display_ = false;
623 } 623 }
624 624
625 bool OutputConfigurator::CycleDisplayMode() {
626 TRACE_EVENT0("chromeos", "OutputConfigurator::CycleDisplayMode");
627 VLOG(1) << "CycleDisplayMode";
628 if (!configure_display_)
629 return false;
630
631 bool did_change = false;
632 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay();
633 CHECK(display != NULL);
634 XGrabServer(display);
635 Window window = DefaultRootWindow(display);
636 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window);
637 CHECK(screen != NULL);
638
639 std::vector<OutputSnapshot> outputs = GetDualOutputs(display, screen);
640 connected_output_count_ = outputs.size();
641 OutputState original = InferCurrentState(display, screen, outputs);
642 OutputState next_state = GetNextState(display, screen, original, outputs);
643 if (original != next_state &&
644 EnterState(display, screen, window, next_state, power_state_, outputs)) {
645 did_change = true;
646 }
647 // We have seen cases where the XRandR data can get out of sync with our own
648 // cache so over-write it with whatever we detected, even if we didn't think
649 // anything changed.
650 output_state_ = next_state;
651
652 XRRFreeScreenResources(screen);
653 XUngrabServer(display);
654
655 if (did_change) {
656 NotifyOnDisplayChanged();
657 } else {
658 FOR_EACH_OBSERVER(
659 Observer, observers_, OnDisplayModeChangeFailed(next_state));
660 }
661 return did_change;
662 }
663
664 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state, 625 bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
665 bool force_probe) { 626 bool force_probe) {
666 TRACE_EVENT0("chromeos", "OutputConfigurator::SetDisplayPower"); 627 TRACE_EVENT0("chromeos", "OutputConfigurator::SetDisplayPower");
667 VLOG(1) << "OutputConfigurator::SetDisplayPower: power_state=" << power_state 628 VLOG(1) << "OutputConfigurator::SetDisplayPower: power_state=" << power_state
668 << " force_probe=" << force_probe; 629 << " force_probe=" << force_probe;
669 630
670 if (!configure_display_) 631 if (!configure_display_)
671 return false; 632 return false;
672 if (power_state == power_state_ && !force_probe) 633 if (power_state == power_state_ && !force_probe)
673 return true; 634 return true;
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 // static 1310 // static
1350 RRMode OutputConfigurator::GetOutputNativeMode( 1311 RRMode OutputConfigurator::GetOutputNativeMode(
1351 const XRROutputInfo* output_info) { 1312 const XRROutputInfo* output_info) {
1352 if (output_info->nmode <= 0) 1313 if (output_info->nmode <= 0)
1353 return None; 1314 return None;
1354 1315
1355 return output_info->modes[0]; 1316 return output_info->modes[0];
1356 } 1317 }
1357 1318
1358 } // namespace chromeos 1319 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698