aboutsummaryrefslogtreecommitdiff
path: root/ui/dbus.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-07-22 19:43:29 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-12-21 10:50:22 +0400
commit3e301c8d7ef0259c7e19277ea93a9915b55a1c6d (patch)
tree9baeb150cf45b136e14f958c0262fb528c973833 /ui/dbus.h
parent4085b87ff0a26e6db7d95a82fcdff861046e6308 (diff)
ui/dbus: add chardev backend & interface
Add a new chardev backend which allows D-Bus client to handle the chardev stream & events. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/dbus.h')
-rw-r--r--ui/dbus.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/ui/dbus.h b/ui/dbus.h
index 3e89eafcab..64c77cab44 100644
--- a/ui/dbus.h
+++ b/ui/dbus.h
@@ -24,6 +24,7 @@
#ifndef UI_DBUS_H_
#define UI_DBUS_H_
+#include "chardev/char-socket.h"
#include "qemu/dbus.h"
#include "qom/object.h"
#include "ui/console.h"
@@ -56,11 +57,15 @@ struct DBusDisplay {
QemuDBusDisplay1Clipboard *clipboard;
QemuDBusDisplay1Clipboard *clipboard_proxy;
DBusClipboardRequest clipboard_request[QEMU_CLIPBOARD_SELECTION__COUNT];
+
+ Notifier notifier;
};
#define TYPE_DBUS_DISPLAY "dbus-display"
OBJECT_DECLARE_SIMPLE_TYPE(DBusDisplay, DBUS_DISPLAY)
+void dbus_display_notifier_add(Notifier *notifier);
+
#define DBUS_DISPLAY_TYPE_CONSOLE dbus_display_console_get_type()
G_DECLARE_FINAL_TYPE(DBusDisplayConsole,
dbus_display_console,
@@ -95,6 +100,45 @@ dbus_display_listener_get_bus_name(DBusDisplayListener *ddl);
extern const DisplayChangeListenerOps dbus_gl_dcl_ops;
extern const DisplayChangeListenerOps dbus_dcl_ops;
+#define TYPE_CHARDEV_DBUS "chardev-dbus"
+
+typedef struct DBusChardevClass {
+ SocketChardevClass parent_class;
+
+ void (*parent_chr_be_event)(Chardev *s, QEMUChrEvent event);
+} DBusChardevClass;
+
+DECLARE_CLASS_CHECKERS(DBusChardevClass, DBUS_CHARDEV,
+ TYPE_CHARDEV_DBUS)
+
+typedef struct DBusChardev {
+ SocketChardev parent;
+
+ bool exported;
+ QemuDBusDisplay1Chardev *iface;
+} DBusChardev;
+
+DECLARE_INSTANCE_CHECKER(DBusChardev, DBUS_CHARDEV, TYPE_CHARDEV_DBUS)
+
+#define CHARDEV_IS_DBUS(chr) \
+ object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_DBUS)
+
+typedef enum {
+ DBUS_DISPLAY_CHARDEV_OPEN,
+ DBUS_DISPLAY_CHARDEV_CLOSE,
+} DBusDisplayEventType;
+
+typedef struct DBusDisplayEvent {
+ DBusDisplayEventType type;
+ union {
+ DBusChardev *chardev;
+ };
+} DBusDisplayEvent;
+
+void dbus_display_notify(DBusDisplayEvent *event);
+
+void dbus_chardev_init(DBusDisplay *dpy);
+
void dbus_clipboard_init(DBusDisplay *dpy);
#endif /* UI_DBUS_H_ */