| 1 |
/* |
| 2 |
* Copyright (C) 2017-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <cstdint> |
| 12 |
#include <string> |
| 13 |
|
| 14 |
#include <wayland-client.hpp> |
| 15 |
#include <wayland-cursor.hpp> |
| 16 |
|
| 17 |
namespace KODI |
| 18 |
{ |
| 19 |
namespace WINDOWING |
| 20 |
{ |
| 21 |
namespace WAYLAND |
| 22 |
{ |
| 23 |
|
| 24 |
struct WaylandCPtrCompare |
| 25 |
{ |
| 26 |
bool operator()(wayland::proxy_t const& p1, wayland::proxy_t const& p2) const |
| 27 |
{ |
| 28 |
return reinterpret_cast<std::uintptr_t>(p1.c_ptr()) < reinterpret_cast<std::uintptr_t>(p2.c_ptr()); |
| 29 |
} |
| 30 |
}; |
| 31 |
|
| 32 |
class CCursorUtil |
| 33 |
{ |
| 34 |
public: |
| 35 |
/** |
| 36 |
* Load a cursor from a theme with automatic fallback |
| 37 |
* |
| 38 |
* Modern cursor themes use CSS names for the cursors as defined in |
| 39 |
* the XDG cursor-spec (draft at the moment), but older themes |
| 40 |
* might still use the cursor names that were popular with X11. |
| 41 |
* This function tries to load a cursor by the given CSS name and |
| 42 |
* automatically falls back to the corresponding X11 name if the |
| 43 |
* load fails. |
| 44 |
* |
| 45 |
* \param theme cursor theme to load from |
| 46 |
* \param name CSS cursor name to load |
| 47 |
* \return requested cursor |
| 48 |
*/ |
| 49 |
static wayland::cursor_t LoadFromTheme(wayland::cursor_theme_t const& theme, std::string const& name); |
| 50 |
}; |
| 51 |
|
| 52 |
} |
| 53 |
} |
| 54 |
} |