diff options
author | spang <spang@chromium.org> | 2015-05-07 12:15:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-07 19:16:18 +0000 |
commit | 1a4908a60b90eeaf713a43d812c1d5584ef0ffa9 (patch) | |
tree | bb8daca1679fd384c874b694075afb35b6ab75c8 | |
parent | 199f66b202c942421e25ced69471f7d9d1f2c4a7 (diff) | |
download | chromium_src-1a4908a60b90eeaf713a43d812c1d5584ef0ffa9.zip chromium_src-1a4908a60b90eeaf713a43d812c1d5584ef0ffa9.tar.gz chromium_src-1a4908a60b90eeaf713a43d812c1d5584ef0ffa9.tar.bz2 |
remoting: Remove last X11 dependency from ozone build
It's not possible to use Xrandr to configure the display in ozone
builds. This code does not work anyway, so replace it with a stub so
that we can actually compile without putting X into the build
environment.
BUG=484324
TEST=build for chromebook pixel with
https://chromium-review.googlesource.com/#/c/269135/
Review URL: https://codereview.chromium.org/1120753009
Cr-Commit-Position: refs/heads/master@{#328813}
-rw-r--r-- | remoting/host/BUILD.gn | 7 | ||||
-rw-r--r-- | remoting/host/desktop_resizer_ozone.cc | 55 | ||||
-rw-r--r-- | remoting/host/desktop_resizer_x11.cc (renamed from remoting/host/desktop_resizer_linux.cc) | 30 | ||||
-rw-r--r-- | remoting/remoting_host_srcs.gypi | 3 |
4 files changed, 79 insertions, 16 deletions
diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn index 722b935..114f849 100644 --- a/remoting/host/BUILD.gn +++ b/remoting/host/BUILD.gn @@ -71,6 +71,7 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. } else { sources -= [ "clipboard_x11.cc", + "desktop_resizer_x11.cc", "input_injector_x11.cc", "local_input_monitor_x11.cc", ] @@ -83,6 +84,10 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. } } + if (!use_ozone) { + sources -= [ "desktop_resizer_ozone.cc" ] + } + if (is_chromeos) { # TODO(GYP): crbug.com/481627. These should only be included # when enable_me2me_host is true. @@ -106,9 +111,11 @@ if (is_mac) { # TODO(GYP) Mac build of remoting host. if (use_ozone) { deps += [ "//ui/ozone" ] + sources -= [ "desktop_resizer_ozone.cc" ] } else { sources -= [ "clipboard_x11.cc", + "desktop_resizer_x11.cc", "input_injector_chromeos.cc", "input_injector_chromeos.h", "linux/x_server_clipboard.cc", diff --git a/remoting/host/desktop_resizer_ozone.cc b/remoting/host/desktop_resizer_ozone.cc new file mode 100644 index 0000000..20106f0 --- /dev/null +++ b/remoting/host/desktop_resizer_ozone.cc @@ -0,0 +1,55 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "remoting/host/desktop_resizer.h" + +#include "base/logging.h" + +namespace remoting { + +class DesktopResizerOzone : public DesktopResizer { + public: + DesktopResizerOzone(); + ~DesktopResizerOzone() override; + + // DesktopResizer: + ScreenResolution GetCurrentResolution() override; + std::list<ScreenResolution> GetSupportedResolutions( + const ScreenResolution& preferred) override; + void SetResolution(const ScreenResolution& resolution) override; + void RestoreResolution(const ScreenResolution& original) override; + + private: + DISALLOW_COPY_AND_ASSIGN(DesktopResizerOzone); +}; + +DesktopResizerOzone::DesktopResizerOzone() { +} + +DesktopResizerOzone::~DesktopResizerOzone() { +} + +ScreenResolution DesktopResizerOzone::GetCurrentResolution() { + NOTIMPLEMENTED(); + return ScreenResolution(); +} + +std::list<ScreenResolution> DesktopResizerOzone::GetSupportedResolutions( + const ScreenResolution& preferred) { + NOTIMPLEMENTED(); + return std::list<ScreenResolution>(); +} + +void DesktopResizerOzone::SetResolution(const ScreenResolution& resolution) { + NOTIMPLEMENTED(); +} + +void DesktopResizerOzone::RestoreResolution(const ScreenResolution& original) { +} + +scoped_ptr<DesktopResizer> DesktopResizer::Create() { + return make_scoped_ptr(new DesktopResizerOzone); +} + +} // namespace remoting diff --git a/remoting/host/desktop_resizer_linux.cc b/remoting/host/desktop_resizer_x11.cc index 0afb32a..1df858c 100644 --- a/remoting/host/desktop_resizer_linux.cc +++ b/remoting/host/desktop_resizer_x11.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include "remoting/host/desktop_resizer.h" -#include "remoting/host/linux/x11_util.h" #include <string.h> #include <X11/extensions/Xrandr.h> @@ -11,6 +10,7 @@ #include "base/command_line.h" #include "remoting/base/logging.h" +#include "remoting/host/linux/x11_util.h" // On Linux, we use the xrandr extension to change the desktop resolution. For // now, we only support resize-to-client for Xvfb-based servers that can match @@ -121,10 +121,10 @@ class ScreenResources { }; -class DesktopResizerLinux : public DesktopResizer { +class DesktopResizerX11 : public DesktopResizer { public: - DesktopResizerLinux(); - ~DesktopResizerLinux() override; + DesktopResizerX11(); + ~DesktopResizerX11() override; // DesktopResizer interface ScreenResolution GetCurrentResolution() override; @@ -153,10 +153,10 @@ class DesktopResizerLinux : public DesktopResizer { ScreenResources resources_; bool exact_resize_; - DISALLOW_COPY_AND_ASSIGN(DesktopResizerLinux); + DISALLOW_COPY_AND_ASSIGN(DesktopResizerX11); }; -DesktopResizerLinux::DesktopResizerLinux() +DesktopResizerX11::DesktopResizerX11() : display_(XOpenDisplay(nullptr)), screen_(DefaultScreen(display_)), root_(RootWindow(display_, screen_)), @@ -165,11 +165,11 @@ DesktopResizerLinux::DesktopResizerLinux() XRRSelectInput(display_, root_, RRScreenChangeNotifyMask); } -DesktopResizerLinux::~DesktopResizerLinux() { +DesktopResizerX11::~DesktopResizerX11() { XCloseDisplay(display_); } -ScreenResolution DesktopResizerLinux::GetCurrentResolution() { +ScreenResolution DesktopResizerX11::GetCurrentResolution() { if (!exact_resize_) { // TODO(jamiewalch): Remove this early return if we decide to support // non-Xvfb servers. @@ -199,7 +199,7 @@ ScreenResolution DesktopResizerLinux::GetCurrentResolution() { return result; } -std::list<ScreenResolution> DesktopResizerLinux::GetSupportedResolutions( +std::list<ScreenResolution> DesktopResizerX11::GetSupportedResolutions( const ScreenResolution& preferred) { std::list<ScreenResolution> result; if (exact_resize_) { @@ -225,7 +225,7 @@ std::list<ScreenResolution> DesktopResizerLinux::GetSupportedResolutions( return result; } -void DesktopResizerLinux::SetResolution(const ScreenResolution& resolution) { +void DesktopResizerX11::SetResolution(const ScreenResolution& resolution) { if (!exact_resize_) { // TODO(jamiewalch): Remove this early return if we decide to support // non-Xvfb servers. @@ -274,14 +274,14 @@ void DesktopResizerLinux::SetResolution(const ScreenResolution& resolution) { DeleteMode(kTempModeName); } -void DesktopResizerLinux::RestoreResolution(const ScreenResolution& original) { +void DesktopResizerX11::RestoreResolution(const ScreenResolution& original) { // Since the desktop is only visible via a remote connection, the original // resolution of the desktop will never been seen and there's no point // restoring it; if we did, we'd just risk messing up the user's window // layout. } -void DesktopResizerLinux::CreateMode(const char* name, int width, int height) { +void DesktopResizerX11::CreateMode(const char* name, int width, int height) { XRRModeInfo mode; memset(&mode, 0, sizeof(mode)); mode.width = width; @@ -300,7 +300,7 @@ void DesktopResizerLinux::CreateMode(const char* name, int width, int height) { XRRAddOutputMode(display_, resources_.GetOutput(), mode_id); } -void DesktopResizerLinux::DeleteMode(const char* name) { +void DesktopResizerX11::DeleteMode(const char* name) { RRMode mode_id = resources_.GetIdForMode(name); if (mode_id) { XRRDeleteOutputMode(display_, resources_.GetOutput(), mode_id); @@ -309,7 +309,7 @@ void DesktopResizerLinux::DeleteMode(const char* name) { } } -void DesktopResizerLinux::SwitchToMode(const char* name) { +void DesktopResizerX11::SwitchToMode(const char* name) { RRMode mode_id = None; RROutput* outputs = nullptr; int number_of_outputs = 0; @@ -324,7 +324,7 @@ void DesktopResizerLinux::SwitchToMode(const char* name) { } scoped_ptr<DesktopResizer> DesktopResizer::Create() { - return make_scoped_ptr(new DesktopResizerLinux); + return make_scoped_ptr(new DesktopResizerX11); } } // namespace remoting diff --git a/remoting/remoting_host_srcs.gypi b/remoting/remoting_host_srcs.gypi index 7d0b4a6..930dcd7 100644 --- a/remoting/remoting_host_srcs.gypi +++ b/remoting/remoting_host_srcs.gypi @@ -71,9 +71,10 @@ 'host/desktop_process.cc', 'host/desktop_process.h', 'host/desktop_resizer.h', - 'host/desktop_resizer_linux.cc', 'host/desktop_resizer_mac.cc', + 'host/desktop_resizer_ozone.cc', 'host/desktop_resizer_win.cc', + 'host/desktop_resizer_x11.cc', 'host/desktop_session.cc', 'host/desktop_session.h', 'host/desktop_session_agent.cc', |