cef/libcef/browser/native/cursor_util_linux.cc
Marshall Greenblatt b1cd9d1598 win/linux: Use CursorLoader for loading cursor resources (see issue #3270)
Switch to using aura::CursorLoader which knows how to load system, non-system
and pak cursor resources.

On Windows, cursors will be loaded via LoadCursor first if available with a
fallback to pak file if necessary (like with component builds).

On Linux, all non-system cursor resources will be loaded from pak file. Cursors
may be loaded asynchronously resulting in the default (pointer) cursor being
returned on the first request.
2022-04-14 20:21:21 -04:00

31 lines
898 B
C++

// Copyright 2020 The Chromium Embedded Framework 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 "libcef/browser/native/cursor_util.h"
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/base/x/x11_cursor.h"
#elif defined(USE_OZONE)
#include "ui/ozone/common/bitmap_cursor.h"
#endif
namespace cursor_util {
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
#if BUILDFLAG(OZONE_PLATFORM_X11)
// See https://crbug.com/1029142 for background.
return static_cast<cef_cursor_handle_t>(
ui::X11Cursor::FromPlatformCursor(cursor)->xcursor());
#elif defined(USE_OZONE)
return static_cast<cef_cursor_handle_t>(
ui::BitmapCursor::FromPlatformCursor(cursor)->platform_data());
#else
return 0;
#endif
}
} // namespace cursor_util