Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 749828
Collapse All | Expand All

(-)a/ui/base/x/x11_cursor_loader.cc (-1 / +35 lines)
Lines 4-9 Link Here
4
4
5
#include "ui/base/x/x11_cursor_loader.h"
5
#include "ui/base/x/x11_cursor_loader.h"
6
6
7
#include <dlfcn.h>
8
7
#include <limits>
9
#include <limits>
8
#include <string>
10
#include <string>
9
11
Lines 13-18 Link Here
13
#include "base/files/file_util.h"
15
#include "base/files/file_util.h"
14
#include "base/memory/ref_counted_memory.h"
16
#include "base/memory/ref_counted_memory.h"
15
#include "base/memory/scoped_refptr.h"
17
#include "base/memory/scoped_refptr.h"
18
#include "base/no_destructor.h"
16
#include "base/sequence_checker.h"
19
#include "base/sequence_checker.h"
17
#include "base/stl_util.h"
20
#include "base/stl_util.h"
18
#include "base/strings/string_number_conversions.h"
21
#include "base/strings/string_number_conversions.h"
Lines 28-33 Link Here
28
#include "ui/gfx/x/connection.h"
31
#include "ui/gfx/x/connection.h"
29
#include "ui/gfx/x/xproto.h"
32
#include "ui/gfx/x/xproto.h"
30
33
34
extern "C" {
35
const char* XcursorLibraryPath(void);
36
}
37
31
namespace ui {
38
namespace ui {
32
39
33
namespace {
40
namespace {
Lines 120-132 Link Here
120
  return value;
127
  return value;
121
}
128
}
122
129
123
std::string CursorPath() {
130
std::string CursorPathFromLibXcursor() {
131
  struct DlCloser {
132
    void operator()(void* ptr) const { dlclose(ptr); }
133
  };
134
135
  std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so.1", RTLD_LAZY));
136
  if (!lib)
137
    return "";
138
139
  if (auto* sym = reinterpret_cast<decltype(&XcursorLibraryPath)>(
140
          dlsym(lib.get(), "XcursorLibraryPath"))) {
141
    if (const char* path = sym())
142
      return path;
143
  }
144
  return "";
145
}
146
147
std::string CursorPathImpl() {
124
  constexpr const char kDefaultPath[] =
148
  constexpr const char kDefaultPath[] =
125
      "~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons";
149
      "~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons";
150
151
  auto libxcursor_path = CursorPathFromLibXcursor();
152
  if (!libxcursor_path.empty())
153
    return libxcursor_path;
154
126
  std::string path = GetEnv("XCURSOR_PATH");
155
  std::string path = GetEnv("XCURSOR_PATH");
127
  return path.empty() ? kDefaultPath : path;
156
  return path.empty() ? kDefaultPath : path;
128
}
157
}
129
158
159
const std::string& CursorPath() {
160
  static base::NoDestructor<std::string> path(CursorPathImpl());
161
  return *path;
162
}
163
130
x11::Render::PictFormat GetRenderARGBFormat(
164
x11::Render::PictFormat GetRenderARGBFormat(
131
    const x11::Render::QueryPictFormatsReply& formats) {
165
    const x11::Render::QueryPictFormatsReply& formats) {
132
  for (const auto& format : formats.formats) {
166
  for (const auto& format : formats.formats) {

Return to bug 749828