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

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

Issue 11363124: Move DisplayManager and DisplayChangeObserverX11 from aura to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix rebase Created 8 years, 1 month 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 "ui/aura/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_manager.h"
15 #include "ash/shell.h"
14 #include "base/message_pump_aurax11.h" 16 #include "base/message_pump_aurax11.h"
15 #include "ui/aura/env.h"
16 #include "ui/aura/display_manager.h"
17 #include "ui/base/x/x11_util.h" 17 #include "ui/base/x/x11_util.h"
18 #include "ui/compositor/dip_util.h" 18 #include "ui/compositor/dip_util.h"
19 #include "ui/gfx/display.h" 19 #include "ui/gfx/display.h"
20 20
21 namespace aura { 21 namespace ash {
22 namespace internal { 22 namespace internal {
23 23
24 namespace { 24 namespace {
25 25
26 // The DPI threshold to detect high density screen. 26 // The DPI threshold to detect high density screen.
27 // Higher DPI than this will use device_scale_factor=2. 27 // Higher DPI than this will use device_scale_factor=2.
28 // Note: This value has to be kept in sync with the mouse/touchpad driver 28 // Note: This value has to be kept in sync with the mouse/touchpad driver
29 // which controls mouse pointer acceleration. If you need to update this value, 29 // which controls mouse pointer acceleration. If you need to update this value,
30 // please update the bug (crosbug.com/31628) first and make sure that the 30 // please update the bug (crosbug.com/31628) first and make sure that the
31 // driver will use the same value. 31 // driver will use the same value.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 bool DisplayChangeObserverX11::Dispatch(const base::NativeEvent& event) { 94 bool DisplayChangeObserverX11::Dispatch(const base::NativeEvent& event) {
95 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { 95 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) {
96 NotifyDisplayChange(); 96 NotifyDisplayChange();
97 } 97 }
98 return true; 98 return true;
99 } 99 }
100 100
101 void DisplayChangeObserverX11::NotifyDisplayChange() { 101 void DisplayChangeObserverX11::NotifyDisplayChange() {
102 if (!DisplayManager::use_fullscreen_host_window())
103 return; // Use the default display that display manager determined.
104
105 XRRScreenResources* screen_resources = 102 XRRScreenResources* screen_resources =
106 XRRGetScreenResources(xdisplay_, x_root_window_); 103 XRRGetScreenResources(xdisplay_, x_root_window_);
107 std::map<XID, XRRCrtcInfo*> crtc_info_map; 104 std::map<XID, XRRCrtcInfo*> crtc_info_map;
108 105
109 for (int c = 0; c < screen_resources->ncrtc; c++) { 106 for (int c = 0; c < screen_resources->ncrtc; c++) {
110 XID crtc_id = screen_resources->crtcs[c]; 107 XID crtc_id = screen_resources->crtcs[c];
111 XRRCrtcInfo *crtc_info = 108 XRRCrtcInfo *crtc_info =
112 XRRGetCrtcInfo(xdisplay_, screen_resources, crtc_id); 109 XRRGetCrtcInfo(xdisplay_, screen_resources, crtc_id);
113 crtc_info_map[crtc_id] = crtc_info; 110 crtc_info_map[crtc_id] = crtc_info;
114 } 111 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // coordinates. 175 // coordinates.
179 std::sort(displays.begin(), displays.end(), CompareDisplayY); 176 std::sort(displays.begin(), displays.end(), CompareDisplayY);
180 int64 id = 0; 177 int64 id = 0;
181 for (std::vector<gfx::Display>::iterator iter = displays.begin(); 178 for (std::vector<gfx::Display>::iterator iter = displays.begin();
182 iter != displays.end(); ++iter) { 179 iter != displays.end(); ++iter) {
183 if (iter->id() == gfx::Display::kInvalidDisplayID) { 180 if (iter->id() == gfx::Display::kInvalidDisplayID) {
184 iter->set_id(id); 181 iter->set_id(id);
185 ++id; 182 ++id;
186 } 183 }
187 } 184 }
188 185 // DisplayManager can be null during the boot.
189 Env::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays); 186 Shell::GetInstance()->display_manager()->OnNativeDisplaysChanged(displays);
190 } 187 }
191 188
192 } // namespace internal 189 } // namespace internal
193 } // namespace aura 190 } // 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