Path: blob/master/thirdparty/sdl/core/linux/SDL_dbus.h
10279 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/2021#include "SDL_internal.h"2223#ifndef SDL_dbus_h_24#define SDL_dbus_h_2526#ifdef HAVE_DBUS_DBUS_H27#define SDL_USE_LIBDBUS 128#include <dbus/dbus.h>2930#ifndef DBUS_TIMEOUT_USE_DEFAULT31#define DBUS_TIMEOUT_USE_DEFAULT -132#endif33#ifndef DBUS_TIMEOUT_INFINITE34#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)35#endif3637typedef struct SDL_DBusContext38{39DBusConnection *session_conn;40DBusConnection *system_conn;4142DBusConnection *(*bus_get_private)(DBusBusType, DBusError *);43dbus_bool_t (*bus_register)(DBusConnection *, DBusError *);44void (*bus_add_match)(DBusConnection *, const char *, DBusError *);45DBusConnection *(*connection_open_private)(const char *, DBusError *);46void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);47dbus_bool_t (*connection_get_is_connected)(DBusConnection *);48dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction);49dbus_bool_t (*connection_remove_filter)(DBusConnection *, DBusHandleMessageFunction, void *);50dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,51const DBusObjectPathVTable *, void *, DBusError *);52dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);53DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *);54void (*connection_close)(DBusConnection *);55void (*connection_ref)(DBusConnection *);56void (*connection_unref)(DBusConnection *);57void (*connection_flush)(DBusConnection *);58dbus_bool_t (*connection_read_write)(DBusConnection *, int);59DBusDispatchStatus (*connection_dispatch)(DBusConnection *);60dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *);61dbus_bool_t (*message_has_path)(DBusMessage *, const char *);62DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);63dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);64dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);65void (*message_iter_init_append)(DBusMessage *, DBusMessageIter *);66dbus_bool_t (*message_iter_open_container)(DBusMessageIter *, int, const char *, DBusMessageIter *);67dbus_bool_t (*message_iter_append_basic)(DBusMessageIter *, int, const void *);68dbus_bool_t (*message_iter_close_container)(DBusMessageIter *, DBusMessageIter *);69dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...);70dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list);71dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *);72dbus_bool_t (*message_iter_next)(DBusMessageIter *);73void (*message_iter_get_basic)(DBusMessageIter *, void *);74int (*message_iter_get_arg_type)(DBusMessageIter *);75void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);76void (*message_unref)(DBusMessage *);77dbus_bool_t (*threads_init_default)(void);78void (*error_init)(DBusError *);79dbus_bool_t (*error_is_set)(const DBusError *);80void (*error_free)(DBusError *);81char *(*get_local_machine_id)(void);82char *(*try_get_local_machine_id)(DBusError *);83void (*free)(void *);84void (*free_string_array)(char **);85void (*shutdown)(void);8687} SDL_DBusContext;8889extern void SDL_DBus_Init(void);90extern void SDL_DBus_Quit(void);91extern SDL_DBusContext *SDL_DBus_GetContext(void);9293// These use the built-in Session connection.94extern bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...);95extern bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...);96extern bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result);9798// These use whatever connection you like.99extern bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);100extern bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);101extern bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result);102103extern void SDL_DBus_ScreensaverTickle(void);104extern bool SDL_DBus_ScreensaverInhibit(bool inhibit);105106extern void SDL_DBus_PumpEvents(void);107extern char *SDL_DBus_GetLocalMachineId(void);108109extern char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *files_count);110111#endif // HAVE_DBUS_DBUS_H112113#endif // SDL_dbus_h_114115116