SDL 2.0
SDL_dbus.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
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 "SDL_stdinc.h"
30#include <dbus/dbus.h>
31
32
33typedef struct SDL_DBusContext {
34 DBusConnection *session_conn;
35 DBusConnection *system_conn;
36
37 DBusConnection *(*bus_get_private)(DBusBusType, DBusError *);
38 dbus_bool_t (*bus_register)(DBusConnection *, DBusError *);
39 void (*bus_add_match)(DBusConnection *, const char *, DBusError *);
40 DBusConnection * (*connection_open_private)(const char *, DBusError *);
41 void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);
42 dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
43 dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction);
44 dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,
45 const DBusObjectPathVTable *, void *, DBusError *);
46 dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
47 DBusMessage *(*connection_send_with_reply_and_block)(DBusConnection *, DBusMessage *, int, DBusError *);
48 void (*connection_close)(DBusConnection *);
49 void (*connection_unref)(DBusConnection *);
50 void (*connection_flush)(DBusConnection *);
51 dbus_bool_t (*connection_read_write)(DBusConnection *, int);
52 DBusDispatchStatus (*connection_dispatch)(DBusConnection *);
53 dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *);
54 DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);
55 dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
56 dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);
57 dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...);
58 dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list);
59 dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *);
60 dbus_bool_t (*message_iter_next)(DBusMessageIter *);
61 void (*message_iter_get_basic)(DBusMessageIter *, void *);
62 int (*message_iter_get_arg_type)(DBusMessageIter *);
63 void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
64 void (*message_unref)(DBusMessage *);
65 void (*error_init)(DBusError *);
66 dbus_bool_t (*error_is_set)(const DBusError *);
67 void (*error_free)(DBusError *);
68 char *(*get_local_machine_id)(void);
69 void (*free)(void *);
70 void (*free_string_array)(char **);
71 void (*shutdown)(void);
72
73} SDL_DBusContext;
74
75extern void SDL_DBus_Init(void);
76extern void SDL_DBus_Quit(void);
77extern SDL_DBusContext * SDL_DBus_GetContext(void);
78
79/* These use the built-in Session connection. */
80extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...);
81extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...);
82extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
83
84/* These use whatever connection you like. */
85extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
86extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...);
87extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result);
88
89extern void SDL_DBus_ScreensaverTickle(void);
90extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit);
91
92#endif /* HAVE_DBUS_DBUS_H */
93
94#endif /* SDL_dbus_h_ */
95
96/* vi: set ts=4 sw=4 expandtab: */
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
SDL_EventEntry * free
Definition: SDL_events.c:82
GLuint64EXT * result
GLsizei const GLchar *const * path
SDL_bool
Definition: SDL_stdinc.h:162