chromium/ui/base/x/x11_display_util.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/base/x/x11_display_util.h"

#include <dlfcn.h>

#include <bit>
#include <bitset>
#include <numeric>
#include <queue>
#include <unordered_set>

#include "base/bits.h"
#include "base/command_line.h"
#include "base/containers/flat_map.h"
#include "base/logging.h"
#include "base/numerics/clamped_math.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/x/x11_util.h"
#include "ui/display/util/display_util.h"
#include "ui/display/util/edid_parser.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/switches.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/randr.h"
#include "ui/strings/grit/ui_strings.h"

namespace ui {

namespace {

// Need at least xrandr version 1.3
constexpr std::pair<uint32_t, uint32_t> kMinVersionXrandr{};

constexpr const char kRandrEdidProperty[] =;

std::map<x11::RandR::Output, size_t> GetMonitors(
    const x11::Response<x11::RandR::GetMonitorsReply>& reply) {}

x11::Future<x11::GetPropertyReply> GetWorkAreaFuture(
    x11::Connection* connection) {}

gfx::Rect GetWorkAreaSync(x11::Future<x11::GetPropertyReply> future) {}

x11::Future<x11::GetPropertyReply> GetIccProfileFuture(
    x11::Connection* connection,
    size_t monitor) {}

gfx::ICCProfile GetIccProfileSync(x11::Future<x11::GetPropertyReply> future) {}

x11::Future<x11::RandR::GetOutputPropertyReply> GetEdidFuture(
    x11::Connection* connection,
    x11::RandR::Output output) {}

// Sets the work area on a list of displays.  The work area for each display
// must already be initialized to the display bounds.  At most one display out
// of |displays| will be affected.
void ClipWorkArea(std::vector<display::Display>* displays,
                  size_t primary_display_index,
                  const gfx::Rect& net_workarea) {}

float GetRefreshRateFromXRRModeInfo(
    const std::vector<x11::RandR::ModeInfo>& modes,
    x11::RandR::Mode current_mode_id) {}

int DefaultBitsPerComponent() {}

// Get the EDID data from the `output` and stores to `edid`.
std::vector<uint8_t> GetEdidProperty(
    x11::Response<x11::RandR::GetOutputPropertyReply> response) {}

float GetDisplayScale(const gfx::Rect& bounds,
                      const display::DisplayConfig& display_config) {}

gfx::PointF DisplayOriginPxToDip(const display::Display& parent,
                                 const display::Display& child,
                                 const gfx::PointF& parent_origin_dip) {}

}  // namespace

std::vector<display::Display> GetFallbackDisplayList(
    float scale,
    size_t* primary_display_index_out) {}

std::vector<display::Display> BuildDisplaysFromXRandRInfo(
    const display::DisplayConfig& display_config,
    size_t* primary_display_index_out) {}

base::TimeDelta GetPrimaryDisplayRefreshIntervalFromXrandr() {}

int RangeDistance(int min1, int max1, int min2, int max2) {}

std::pair<int, int> RectDistance(const gfx::Rect& p, const gfx::Rect& q) {}

void ConvertDisplayBoundsToDips(std::vector<display::Display>* displays,
                                size_t primary_display_index) {}

}  // namespace ui