diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_WaylandCursorSettings.h')
-rw-r--r-- | intern/ghost/intern/GHOST_WaylandCursorSettings.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_WaylandCursorSettings.h b/intern/ghost/intern/GHOST_WaylandCursorSettings.h index 1e8cc2ac8a9..f5649d20850 100644 --- a/intern/ghost/intern/GHOST_WaylandCursorSettings.h +++ b/intern/ghost/intern/GHOST_WaylandCursorSettings.h @@ -5,9 +5,13 @@ */ #pragma once -#include <dbus/dbus.h> #include <string> +#ifdef WITH_GHOST_WAYLAND_DBUS +# include <dbus/dbus.h> +#endif + +#ifdef WITH_GHOST_WAYLAND_DBUS static DBusMessage *get_setting_sync(DBusConnection *const connection, const char *key, const char *value) @@ -28,7 +32,7 @@ static DBusMessage *get_setting_sync(DBusConnection *const connection, message, DBUS_TYPE_STRING, &key, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID); if (!success) { - return NULL; + return nullptr; } reply = dbus_connection_send_with_reply_and_block( @@ -37,7 +41,7 @@ static DBusMessage *get_setting_sync(DBusConnection *const connection, dbus_message_unref(message); if (dbus_error_is_set(&error)) { - return NULL; + return nullptr; } return reply; @@ -66,9 +70,11 @@ static bool parse_type(DBusMessage *const reply, const int type, void *value) return true; } +#endif /* WITH_GHOST_WAYLAND_DBUS */ static bool get_cursor_settings(std::string &theme, int &size) { +#ifdef WITH_GHOST_WAYLAND_DBUS static const char name[] = "org.gnome.desktop.interface"; static const char key_theme[] = "cursor-theme"; static const char key_size[] = "cursor-size"; @@ -76,7 +82,7 @@ static bool get_cursor_settings(std::string &theme, int &size) DBusError error; DBusConnection *connection; DBusMessage *reply; - const char *value_theme = NULL; + const char *value_theme = nullptr; dbus_error_init(&error); @@ -113,4 +119,11 @@ static bool get_cursor_settings(std::string &theme, int &size) dbus_message_unref(reply); return true; +#else + /* NOTE: eventually we could have alternative ways to access the theme, + * this uses the "default" theme which is functional (instead of a user-defined theme). */ + (void)theme; + (void)size; + return false; +#endif /* !WITH_GHOST_WAYLAND_DBUS */ } |