Atlas - SDL_dbus.h

Home / ext / SDL / src / core / linux Lines: 1 | Size: 6694 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2026 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21 22#include "SDL_internal.h" 23 24#ifndef SDL_dbus_h_ 25#define SDL_dbus_h_ 26 27#ifdef HAVE_DBUS_DBUS_H 28#define SDL_USE_LIBDBUS 1 29#include <dbus/dbus.h> 30 31#ifndef DBUS_TIMEOUT_USE_DEFAULT 32#define DBUS_TIMEOUT_USE_DEFAULT -1 33#endif 34#ifndef DBUS_TIMEOUT_INFINITE 35#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff) 36#endif 37#ifndef DBUS_TYPE_UNIX_FD 38#define DBUS_TYPE_UNIX_FD ((int) 'h') 39#endif 40 41typedef struct SDL_DBusContext 42{ 43 DBusConnection *session_conn; 44 DBusConnection *system_conn; 45 46 DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); 47 dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); 48 void (*bus_add_match)(DBusConnection *, const char *, DBusError *); 49 void (*bus_remove_match)(DBusConnection *, const char *, DBusError *); 50 const char *(*bus_get_unique_name)(DBusConnection *); 51 DBusConnection *(*connection_open_private)(const char *, DBusError *); 52 void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); 53 dbus_bool_t (*connection_get_is_connected)(DBusConnection *); 54 dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction); 55 dbus_bool_t (*connection_remove_filter)(DBusConnection *, DBusHandleMessageFunction, void *); 56 dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *, 57 const DBusObjectPathVTable *, void *, DBusError *); 58 dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *); 59 DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *); 60 void (*connection_close)(DBusConnection *); 61 void (*connection_ref)(DBusConnection *); 62 void (*connection_unref)(DBusConnection *); 63 void (*connection_flush)(DBusConnection *); 64 dbus_bool_t (*connection_read_write)(DBusConnection *, int); 65 dbus_bool_t (*connection_read_write_dispatch)(DBusConnection *, int); 66 DBusDispatchStatus (*connection_dispatch)(DBusConnection *); 67 dbus_bool_t (*type_is_fixed)(int); 68 dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); 69 dbus_bool_t (*message_has_path)(DBusMessage *, const char *); 70 DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); 71 DBusMessage *(*message_new_signal)(const char *, const char *, const char *); 72 void (*message_set_no_reply)(DBusMessage *, dbus_bool_t); 73 dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); 74 dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); 75 void (*message_iter_init_append)(DBusMessage *, DBusMessageIter *); 76 dbus_bool_t (*message_iter_open_container)(DBusMessageIter *, int, const char *, DBusMessageIter *); 77 dbus_bool_t (*message_iter_append_basic)(DBusMessageIter *, int, const void *); 78 dbus_bool_t (*message_iter_close_container)(DBusMessageIter *, DBusMessageIter *); 79 dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); 80 dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); 81 dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); 82 dbus_bool_t (*message_iter_next)(DBusMessageIter *); 83 void (*message_iter_get_basic)(DBusMessageIter *, void *); 84 int (*message_iter_get_arg_type)(DBusMessageIter *); 85 void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); 86 void (*message_unref)(DBusMessage *); 87 dbus_bool_t (*threads_init_default)(void); 88 void (*error_init)(DBusError *); 89 dbus_bool_t (*error_is_set)(const DBusError *); 90 dbus_bool_t (*error_has_name)(const DBusError *, const char *); 91 void (*error_free)(DBusError *); 92 char *(*get_local_machine_id)(void); 93 char *(*try_get_local_machine_id)(DBusError *); 94 void (*free)(void *); 95 void (*free_string_array)(char **); 96 void (*shutdown)(void); 97 98} SDL_DBusContext; 99 100extern void SDL_DBus_Init(void); 101extern void SDL_DBus_Quit(void); 102extern SDL_DBusContext *SDL_DBus_GetContext(void); 103 104// These use the built-in Session connection. 105extern bool SDL_DBus_CallMethod(DBusMessage **save_reply, const char *node, const char *path, const char *interface, const char *method, ...); 106extern bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); 107// save_reply must be non-NULL if it's a string property 108extern bool SDL_DBus_QueryProperty(DBusMessage **save_reply, const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result); 109 110// These use whatever connection you like. 111extern bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, DBusMessage **save_reply, const char *node, const char *path, const char *interface, const char *method, ...); 112extern bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); 113// save_reply must be non-NULL if it's a string property 114extern bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, DBusMessage **save_reply, const char *node, const char *path, const char *interface, const char *property, int expectedtype, void *result); 115 116// Used to free any reply returned from SDL_DBus_CallMethod() and SDL_DBus_QueryProperty() 117extern void SDL_DBus_FreeReply(DBusMessage **saved_reply); 118 119extern void SDL_DBus_ScreensaverTickle(void); 120extern bool SDL_DBus_ScreensaverInhibit(bool inhibit); 121 122extern void SDL_DBus_PumpEvents(void); 123extern char *SDL_DBus_GetLocalMachineId(void); 124 125extern char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *files_count); 126 127extern int SDL_DBus_CameraPortalRequestAccess(void); 128 129#endif // HAVE_DBUS_DBUS_H 130 131#endif // SDL_dbus_h_ 132
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.