10 #ifdef WITH_GHOST_WAYLAND_DBUS
11 # include <dbus/dbus.h>
14 #ifdef WITH_GHOST_WAYLAND_DBUS
15 static DBusMessage *get_setting_sync(DBusConnection *
const connection,
24 dbus_error_init(&
error);
26 message = dbus_message_new_method_call(
"org.freedesktop.portal.Desktop",
27 "/org/freedesktop/portal/desktop",
28 "org.freedesktop.portal.Settings",
31 success = dbus_message_append_args(
32 message, DBUS_TYPE_STRING, &key, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID);
38 reply = dbus_connection_send_with_reply_and_block(
39 connection, message, DBUS_TIMEOUT_USE_DEFAULT, &
error);
41 dbus_message_unref(message);
43 if (dbus_error_is_set(&
error)) {
50 static bool parse_type(DBusMessage *
const reply,
const int type,
void *value)
52 DBusMessageIter iter[3];
54 dbus_message_iter_init(reply, &iter[0]);
55 if (dbus_message_iter_get_arg_type(&iter[0]) != DBUS_TYPE_VARIANT) {
59 dbus_message_iter_recurse(&iter[0], &iter[1]);
60 if (dbus_message_iter_get_arg_type(&iter[1]) != DBUS_TYPE_VARIANT) {
64 dbus_message_iter_recurse(&iter[1], &iter[2]);
65 if (dbus_message_iter_get_arg_type(&iter[2]) !=
type) {
69 dbus_message_iter_get_basic(&iter[2], value);
77 #ifdef WITH_GHOST_WAYLAND_DBUS
78 static const char name[] =
"org.gnome.desktop.interface";
79 static const char key_theme[] =
"cursor-theme";
80 static const char key_size[] =
"cursor-size";
83 DBusConnection *connection;
85 const char *value_theme =
nullptr;
87 dbus_error_init(&
error);
89 connection = dbus_bus_get(DBUS_BUS_SESSION, &
error);
91 if (dbus_error_is_set(&
error)) {
95 reply = get_setting_sync(connection, name, key_theme);
100 if (!parse_type(reply, DBUS_TYPE_STRING, &value_theme)) {
101 dbus_message_unref(reply);
105 theme = std::string(value_theme);
107 dbus_message_unref(reply);
109 reply = get_setting_sync(connection, name, key_size);
114 if (!parse_type(reply, DBUS_TYPE_INT32, &
size)) {
115 dbus_message_unref(reply);
119 dbus_message_unref(reply);
static bool get_cursor_settings(std::string &theme, int &size)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SyclQueue void void size_t num_bytes void
static void error(const char *str)