chromium/ui/base/x/x11_cursor_loader.cc

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

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

#include <dlfcn.h>

#include <limits>
#include <string>
#include <string_view>

#include "base/compiler_specific.h"
#include "base/containers/fixed_flat_map.h"
#include "base/containers/span.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/no_destructor.h"
#include "base/numerics/byte_conversions.h"
#include "base/numerics/checked_math.h"
#include "base/sequence_checker.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/xproto.h"

#if BUILDFLAG(IS_LINUX)
#include "ui/linux/linux_ui.h"
#endif

extern "C" {
const char* XcursorLibraryPath(void);
}

namespace ui {

namespace {

std::string GetEnv(const std::string& var) {}

NO_SANITIZE("cfi-icall")
std::string CursorPathFromLibXcursor() {}

std::string CursorPathImpl() {}

const std::string& CursorPath() {}

x11::Render::PictFormat GetRenderARGBFormat(
    const x11::Render::QueryPictFormatsReply& formats) {}

std::vector<std::string> GetBaseThemes(const base::FilePath& abspath) {}

base::FilePath CanonicalizePath(base::FilePath path) {}

// Reads the cursor called |name| for the theme named |theme|. Searches  all
// paths in the XCursor path and parent themes.
scoped_refptr<base::RefCountedMemory> ReadCursorFromTheme(
    const std::string& theme,
    const std::string& name) {}

scoped_refptr<base::RefCountedMemory> ReadCursorFile(
    const std::string& name,
    const std::string& rm_xcursor_theme) {}

std::vector<XCursorLoader::Image> ReadCursorImages(
    const std::vector<std::string>& names,
    const std::string& rm_xcursor_theme,
    uint32_t preferred_size) {}

}  // namespace

XCursorLoader::XCursorLoader(x11::Connection* connection,
                             base::RepeatingClosure on_cursor_config_changed)
    :{}

XCursorLoader::~XCursorLoader() {}

scoped_refptr<X11Cursor> XCursorLoader::LoadCursor(
    const std::vector<std::string>& names) {}

scoped_refptr<X11Cursor> XCursorLoader::CreateCursor(
    const std::vector<Image>& images) {}

scoped_refptr<X11Cursor> XCursorLoader::CreateCursor(
    const SkBitmap& bitmap,
    const gfx::Point& hotspot) {}

void XCursorLoader::LoadCursorImpl(
    scoped_refptr<X11Cursor> cursor,
    const std::vector<std::string>& names,
    const std::vector<XCursorLoader::Image>& images) {}

uint32_t XCursorLoader::GetPreferredCursorSize() const {}

void XCursorLoader::ParseXResources(std::string_view resources) {}

uint16_t XCursorLoader::CursorNamesToChar(
    const std::vector<std::string>& names) const {}

bool XCursorLoader::SupportsCreateCursor() const {}

bool XCursorLoader::SupportsCreateAnimCursor() const {}

void XCursorLoader::OnPropertyChanged(x11::Atom property,
                                      const x11::GetPropertyResponse& value) {}

// This is ported from libxcb-cursor's parse_cursor_file.c:
// https://gitlab.freedesktop.org/xorg/lib/libxcb-cursor/-/blob/master/cursor/parse_cursor_file.c
std::vector<XCursorLoader::Image> ParseCursorFile(
    scoped_refptr<base::RefCountedMemory> file,
    uint32_t preferred_size) {}

}  // namespace ui