1 --- ui/base/x/x11_cursor_loader.cc.orig	2022-08-31 12:19:35 UTC
2 +++ ui/base/x/x11_cursor_loader.cc
3 @@ -33,7 +33,7 @@
4  #include "ui/gfx/x/xproto.h"
5  #include "ui/gfx/x/xproto_util.h"
6 
7 -#if BUILDFLAG(IS_LINUX)
8 +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
9  #include "ui/linux/linux_ui.h"
10  #endif
11 
12 @@ -139,7 +139,11 @@ std::string CursorPathFromLibXcursor() {
13      void operator()(void* ptr) const { dlclose(ptr); }
14    };
15 
16 +#if defined(OS_BSD)
17 +  std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so", RTLD_LAZY));
18 +#else
19    std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so.1", RTLD_LAZY));
20 +#endif
21    if (!lib)
22      return "";
23 
24 @@ -250,7 +254,7 @@ scoped_refptr<base::RefCountedMemory> ReadCursorFile(
25      const std::string& rm_xcursor_theme) {
26    constexpr const char kDefaultTheme[] = "default";
27    std::string themes[] = {
28 -#if BUILDFLAG(IS_LINUX)
29 +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
30      // The toolkit theme has the highest priority.
31      LinuxUi::instance() ? LinuxUi::instance()->GetCursorThemeName()
32                          : std::string(),
33 @@ -444,7 +448,7 @@ uint32_t XCursorLoader::GetPreferredCursorSize() const
34    if (base::StringToInt(GetEnv(kXcursorSizeEnv), &size) && size > 0)
35      return size;
36 
37 -#if BUILDFLAG(IS_LINUX)
38 +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
39    // Let the toolkit have the next say.
40    auto* linux_ui = LinuxUi::instance();
41    size = linux_ui ? linux_ui->GetCursorThemeSize() : 0;
42