4 * Copyright (c) 2021 Marc-André Lureau <marcandre.lureau@redhat.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 #include "chardev/char-socket.h"
29 #include "qemu/dbus.h"
30 #include "qom/object.h"
31 #include "ui/console.h"
32 #include "ui/clipboard.h"
34 #include "ui/dbus-display1.h"
36 typedef struct DBusClipboardRequest
{
37 GDBusMethodInvocation
*invocation
;
38 QemuClipboardType type
;
40 } DBusClipboardRequest
;
45 DisplayGLMode gl_mode
;
52 GDBusObjectManagerServer
*server
;
53 QemuDBusDisplay1VM
*iface
;
55 GCancellable
*add_client_cancellable
;
57 QemuClipboardPeer clipboard_peer
;
58 QemuDBusDisplay1Clipboard
*clipboard
;
59 QemuDBusDisplay1Clipboard
*clipboard_proxy
;
60 DBusClipboardRequest clipboard_request
[QEMU_CLIPBOARD_SELECTION__COUNT
];
65 #define TYPE_DBUS_DISPLAY "dbus-display"
66 OBJECT_DECLARE_SIMPLE_TYPE(DBusDisplay
, DBUS_DISPLAY
)
68 void dbus_display_notifier_add(Notifier
*notifier
);
70 #define DBUS_DISPLAY_TYPE_CONSOLE dbus_display_console_get_type()
71 G_DECLARE_FINAL_TYPE(DBusDisplayConsole
,
78 dbus_display_console_new(DBusDisplay
*display
, QemuConsole
*con
);
81 dbus_display_console_get_index(DBusDisplayConsole
*ddc
);
84 extern const DisplayChangeListenerOps dbus_console_dcl_ops
;
86 #define DBUS_DISPLAY_TYPE_LISTENER dbus_display_listener_get_type()
87 G_DECLARE_FINAL_TYPE(DBusDisplayListener
,
88 dbus_display_listener
,
94 dbus_display_listener_new(const char *bus_name
,
95 GDBusConnection
*conn
,
96 DBusDisplayConsole
*console
);
99 dbus_display_listener_get_console(DBusDisplayListener
*ddl
);
102 dbus_display_listener_get_bus_name(DBusDisplayListener
*ddl
);
104 extern const DisplayChangeListenerOps dbus_gl_dcl_ops
;
105 extern const DisplayChangeListenerOps dbus_dcl_ops
;
107 #define TYPE_CHARDEV_DBUS "chardev-dbus"
109 typedef struct DBusChardevClass
{
110 SocketChardevClass parent_class
;
112 void (*parent_chr_be_event
)(Chardev
*s
, QEMUChrEvent event
);
115 DECLARE_CLASS_CHECKERS(DBusChardevClass
, DBUS_CHARDEV
,
118 typedef struct DBusChardev
{
119 SocketChardev parent
;
122 QemuDBusDisplay1Chardev
*iface
;
125 DECLARE_INSTANCE_CHECKER(DBusChardev
, DBUS_CHARDEV
, TYPE_CHARDEV_DBUS
)
127 #define CHARDEV_IS_DBUS(chr) \
128 object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_DBUS)
131 DBUS_DISPLAY_CHARDEV_OPEN
,
132 DBUS_DISPLAY_CHARDEV_CLOSE
,
133 } DBusDisplayEventType
;
135 typedef struct DBusDisplayEvent
{
136 DBusDisplayEventType type
;
138 DBusChardev
*chardev
;
142 void dbus_display_notify(DBusDisplayEvent
*event
);
144 void dbus_chardev_init(DBusDisplay
*dpy
);
146 void dbus_clipboard_init(DBusDisplay
*dpy
);
148 #endif /* UI_DBUS_H */