OLD | NEW |
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 "remoting/host/desktop_resizer.h" | 5 #include "remoting/host/desktop_resizer.h" |
6 #include "remoting/host/linux/x11_util.h" | 6 #include "remoting/host/linux/x11_util.h" |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 #include <X11/extensions/Xrandr.h> | 9 #include <X11/extensions/Xrandr.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ScreenResources resources_; | 153 ScreenResources resources_; |
154 bool exact_resize_; | 154 bool exact_resize_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(DesktopResizerLinux); | 156 DISALLOW_COPY_AND_ASSIGN(DesktopResizerLinux); |
157 }; | 157 }; |
158 | 158 |
159 DesktopResizerLinux::DesktopResizerLinux() | 159 DesktopResizerLinux::DesktopResizerLinux() |
160 : display_(XOpenDisplay(NULL)), | 160 : display_(XOpenDisplay(NULL)), |
161 screen_(DefaultScreen(display_)), | 161 screen_(DefaultScreen(display_)), |
162 root_(RootWindow(display_, screen_)), | 162 root_(RootWindow(display_, screen_)), |
163 exact_resize_(CommandLine::ForCurrentProcess()-> | 163 exact_resize_(base::CommandLine::ForCurrentProcess()-> |
164 HasSwitch("server-supports-exact-resize")) { | 164 HasSwitch("server-supports-exact-resize")) { |
165 XRRSelectInput (display_, root_, RRScreenChangeNotifyMask); | 165 XRRSelectInput(display_, root_, RRScreenChangeNotifyMask); |
166 } | 166 } |
167 | 167 |
168 DesktopResizerLinux::~DesktopResizerLinux() { | 168 DesktopResizerLinux::~DesktopResizerLinux() { |
169 XCloseDisplay(display_); | 169 XCloseDisplay(display_); |
170 } | 170 } |
171 | 171 |
172 ScreenResolution DesktopResizerLinux::GetCurrentResolution() { | 172 ScreenResolution DesktopResizerLinux::GetCurrentResolution() { |
173 if (!exact_resize_) { | 173 if (!exact_resize_) { |
174 // TODO(jamiewalch): Remove this early return if we decide to support | 174 // TODO(jamiewalch): Remove this early return if we decide to support |
175 // non-Xvfb servers. | 175 // non-Xvfb servers. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 XRRSetCrtcConfig(display_, resources_.get(), resources_.GetCrtc(), | 322 XRRSetCrtcConfig(display_, resources_.get(), resources_.GetCrtc(), |
323 CurrentTime, 0, 0, mode_id, 1, outputs, number_of_outputs); | 323 CurrentTime, 0, 0, mode_id, 1, outputs, number_of_outputs); |
324 } | 324 } |
325 | 325 |
326 scoped_ptr<DesktopResizer> DesktopResizer::Create() { | 326 scoped_ptr<DesktopResizer> DesktopResizer::Create() { |
327 return scoped_ptr<DesktopResizer>(new DesktopResizerLinux); | 327 return scoped_ptr<DesktopResizer>(new DesktopResizerLinux); |
328 } | 328 } |
329 | 329 |
330 } // namespace remoting | 330 } // namespace remoting |
OLD | NEW |