mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
4085b87ff0
commit
3e301c8d7e
8 changed files with 476 additions and 0 deletions
44
ui/dbus.h
44
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_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue