#include "ui/ozone/platform/wayland/host/wayland_cursor_factory.h"
#include <wayland-cursor.h>
#include <cmath>
#include "base/numerics/safe_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "skia/ext/image_operations.h"
#include "ui/base/cursor/platform_cursor.h"
#include "ui/linux/linux_ui.h"
#include "ui/ozone/common/bitmap_cursor.h"
#include "ui/ozone/common/bitmap_cursor_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_buffer_factory.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
namespace ui {
namespace {
const float kCursorScaleFlooringThreshold = …;
float GetRoundedScale(float scale) { … }
}
WaylandCursorFactory::ThemeData::ThemeData() = default;
WaylandCursorFactory::ThemeData::~ThemeData() = default;
void WaylandCursorFactory::ThemeData::AddThemeLoadedCallback(
Callback callback) { … }
void WaylandCursorFactory::ThemeData::SetLoadedTheme(wl_cursor_theme* theme) { … }
WaylandCursorFactory::WaylandCursorFactory(WaylandConnection* connection)
: … { … }
WaylandCursorFactory::~WaylandCursorFactory() { … }
void WaylandCursorFactory::ObserveThemeChanges() { … }
scoped_refptr<PlatformCursor> WaylandCursorFactory::CreateImageCursor(
mojom::CursorType type,
const SkBitmap& bitmap,
const gfx::Point& hotspot,
float scale) { … }
scoped_refptr<PlatformCursor> WaylandCursorFactory::CreateAnimatedCursor(
mojom::CursorType type,
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& hotspot,
float scale,
base::TimeDelta frame_delay) { … }
void WaylandCursorFactory::FinishCursorLoad(
scoped_refptr<WaylandAsyncCursor> cursor,
mojom::CursorType type,
float scale,
wl_cursor_theme* loaded_theme) { … }
scoped_refptr<PlatformCursor> WaylandCursorFactory::GetDefaultCursor(
mojom::CursorType type) { … }
scoped_refptr<PlatformCursor> WaylandCursorFactory::GetDefaultCursor(
mojom::CursorType type,
float scale) { … }
wl_cursor* WaylandCursorFactory::GetCursorFromTheme(wl_cursor_theme* theme,
const std::string& name) { … }
void WaylandCursorFactory::OnCursorThemeNameChanged(
const std::string& cursor_theme_name) { … }
void WaylandCursorFactory::OnCursorThemeSizeChanged(int cursor_theme_size) { … }
void WaylandCursorFactory::OnCursorBufferAttached(wl_cursor* cursor_data) { … }
WaylandCursorFactory::ThemeData* WaylandCursorFactory::GetThemeForScale(
float scale) { … }
void WaylandCursorFactory::FlushThemeCache(bool force) { … }
int WaylandCursorFactory::GetScaledSize(float scale) const { … }
void WaylandCursorFactory::FinishThemeLoad(base::WeakPtr<ThemeData> cache_entry,
wl_cursor_theme* loaded_theme) { … }
}