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

Side by Side Diff: ash/display/display_change_observer_x11.cc

Issue 12505005: Store rotation/ui scale to local state. (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 | « ash/display/display_change_observer_x11.h ('k') | ash/display/display_controller.h » ('j') | 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 "ash/display/display_change_observer_x11.h" 5 #include "ash/display/display_change_observer_x11.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include <X11/extensions/Xrandr.h> 12 #include <X11/extensions/Xrandr.h>
13 13
14 #include "ash/display/display_info.h" 14 #include "ash/display/display_info.h"
15 #include "ash/display/display_manager.h" 15 #include "ash/display/display_manager.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "base/message_pump_aurax11.h" 17 #include "base/message_pump_aurax11.h"
18 #include "ash/display/display_controller.h"
18 #include "grit/ash_strings.h" 19 #include "grit/ash_strings.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/x/x11_util.h" 21 #include "ui/base/x/x11_util.h"
21 #include "ui/compositor/dip_util.h" 22 #include "ui/compositor/dip_util.h"
22 #include "ui/gfx/display.h" 23 #include "ui/gfx/display.h"
23 24
24 namespace ash { 25 namespace ash {
25 namespace internal { 26 namespace internal {
26 27
27 namespace { 28 namespace {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 id == gfx::Display::kInvalidDisplayID ? output_index : id); 122 id == gfx::Display::kInvalidDisplayID ? output_index : id);
122 break; 123 break;
123 } 124 }
124 } 125 }
125 XRRFreeScreenResources(screen_resources); 126 XRRFreeScreenResources(screen_resources);
126 } 127 }
127 128
128 DisplayChangeObserverX11::~DisplayChangeObserverX11() { 129 DisplayChangeObserverX11::~DisplayChangeObserverX11() {
129 } 130 }
130 131
132 chromeos::OutputState DisplayChangeObserverX11::GetStateForOutputs(
133 const std::vector<RROutput>& outputs) const {
134 CHECK(outputs.size() == 2);
135 DisplayIdPair pair = std::make_pair(GetDisplayId(outputs[0], 0),
136 GetDisplayId(outputs[1], 1));
137 DisplayLayout layout = Shell::GetInstance()->display_controller()->
138 GetRegisteredDisplayLayout(pair);
139 return layout.mirrored ?
140 chromeos::STATE_DUAL_MIRROR : chromeos::STATE_DUAL_EXTENDED;
141 }
142
131 void DisplayChangeObserverX11::OnDisplayModeChanged() { 143 void DisplayChangeObserverX11::OnDisplayModeChanged() {
132 XRRScreenResources* screen_resources = 144 XRRScreenResources* screen_resources =
133 XRRGetScreenResources(xdisplay_, x_root_window_); 145 XRRGetScreenResources(xdisplay_, x_root_window_);
134 std::map<XID, XRRCrtcInfo*> crtc_info_map; 146 std::map<XID, XRRCrtcInfo*> crtc_info_map;
135 147
136 for (int c = 0; c < screen_resources->ncrtc; c++) { 148 for (int c = 0; c < screen_resources->ncrtc; c++) {
137 XID crtc_id = screen_resources->crtcs[c]; 149 XID crtc_id = screen_resources->crtcs[c];
138 XRRCrtcInfo *crtc_info = 150 XRRCrtcInfo *crtc_info =
139 XRRGetCrtcInfo(xdisplay_, screen_resources, crtc_id); 151 XRRGetCrtcInfo(xdisplay_, screen_resources, crtc_id);
140 crtc_info_map[crtc_id] = crtc_info; 152 crtc_info_map[crtc_id] = crtc_info;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 XRRFreeCrtcInfo(iter->second); 217 XRRFreeCrtcInfo(iter->second);
206 } 218 }
207 XRRFreeScreenResources(screen_resources); 219 XRRFreeScreenResources(screen_resources);
208 220
209 // DisplayManager can be null during the boot. 221 // DisplayManager can be null during the boot.
210 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); 222 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays);
211 } 223 }
212 224
213 } // namespace internal 225 } // namespace internal
214 } // namespace ash 226 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_change_observer_x11.h ('k') | ash/display/display_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698