#include "remoting/host/x11_crtc_resizer.h"
#include <iterator>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/containers/adapters.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/x/future.h"
namespace {
constexpr auto kInvalidMode = …;
constexpr auto kDisabledCrtc = …;
}
namespace remoting {
X11CrtcResizer::CrtcInfo::CrtcInfo() = default;
X11CrtcResizer::CrtcInfo::CrtcInfo(
x11::RandR::Crtc crtc,
int16_t x,
int16_t y,
uint16_t width,
uint16_t height,
x11::RandR::Mode mode,
x11::RandR::Rotation rotation,
const std::vector<x11::RandR::Output>& outputs)
: … { … }
X11CrtcResizer::CrtcInfo::CrtcInfo(const X11CrtcResizer::CrtcInfo&) = default;
X11CrtcResizer::CrtcInfo::CrtcInfo(X11CrtcResizer::CrtcInfo&&) = default;
X11CrtcResizer::CrtcInfo& X11CrtcResizer::CrtcInfo::operator=(
const X11CrtcResizer::CrtcInfo&) = default;
X11CrtcResizer::CrtcInfo& X11CrtcResizer::CrtcInfo::operator=(
X11CrtcResizer::CrtcInfo&&) = default;
X11CrtcResizer::CrtcInfo::~CrtcInfo() = default;
bool X11CrtcResizer::CrtcInfo::OffsetsChanged() const { … }
X11CrtcResizer::X11CrtcResizer(
x11::RandR::GetScreenResourcesCurrentReply* resources,
x11::Connection* connection)
: … { … }
X11CrtcResizer::~X11CrtcResizer() = default;
void X11CrtcResizer::FetchActiveCrtcs() { … }
x11::RandR::Crtc X11CrtcResizer::GetCrtcForOutput(
x11::RandR::Output output) const { … }
void X11CrtcResizer::DisableCrtc(x11::RandR::Crtc crtc) { … }
void X11CrtcResizer::UpdateActiveCrtcs(x11::RandR::Crtc crtc,
x11::RandR::Mode mode,
const gfx::Size& new_size) { … }
void X11CrtcResizer::UpdateActiveCrtc(x11::RandR::Crtc crtc,
x11::RandR::Mode mode,
const gfx::Rect& new_rect) { … }
void X11CrtcResizer::AddActiveCrtc(
x11::RandR::Crtc crtc,
x11::RandR::Mode mode,
const std::vector<x11::RandR::Output>& outputs,
const gfx::Rect& new_rect) { … }
void X11CrtcResizer::RemoveActiveCrtc(x11::RandR::Crtc crtc) { … }
void X11CrtcResizer::RelayoutCrtcs(x11::RandR::Crtc crtc_to_resize,
const gfx::Size& new_size) { … }
void X11CrtcResizer::DisableChangedCrtcs() { … }
void X11CrtcResizer::NormalizeCrtcs() { … }
void X11CrtcResizer::MoveApplicationWindows() { … }
gfx::Size X11CrtcResizer::GetBoundingBox() const { … }
void X11CrtcResizer::ApplyActiveCrtcs() { … }
void X11CrtcResizer::SetCrtcsForTest(
std::vector<x11::RandR::GetCrtcInfoReply> crtcs) { … }
std::vector<gfx::Rect> X11CrtcResizer::GetCrtcsForTest() const { … }
void X11CrtcResizer::AddCrtcFromReply(
x11::RandR::Crtc crtc,
const x11::RandR::GetCrtcInfoReply& reply) { … }
bool X11CrtcResizer::LayoutIsVertical() const { … }
void X11CrtcResizer::PackVertically(const gfx::Size& new_size,
x11::RandR::Crtc resized_crtc) { … }
void X11CrtcResizer::PackHorizontally(const gfx::Size& new_size,
x11::RandR::Crtc resized_crtc) { … }
void X11CrtcResizer::Transpose() { … }
void X11CrtcResizer::MoveWindow(x11::Window window,
const x11::GetWindowAttributesReply& attributes,
gfx::Point top_left) { … }
x11::Window X11CrtcResizer::FindAppWindow(
x11::Window window,
const x11::GetWindowAttributesReply& attributes) { … }
}