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
27 #include "chardev/char-socket.h"
28 #include "qemu/dbus.h"
29 #include "qom/object.h"
30 #include "ui/console.h"
31 #include "ui/clipboard.h"
33 #include "dbus-display1.h"
35 typedef struct DBusClipboardRequest
{
36 GDBusMethodInvocation
*invocation
;
37 QemuClipboardType type
;
39 } DBusClipboardRequest
;
44 DisplayGLMode gl_mode
;
51 GDBusObjectManagerServer
*server
;
52 QemuDBusDisplay1VM
*iface
;
54 GCancellable
*add_client_cancellable
;
56 QemuClipboardPeer clipboard_peer
;
57 QemuDBusDisplay1Clipboard
*clipboard
;
58 QemuDBusDisplay1Clipboard
*clipboard_proxy
;
59 DBusClipboardRequest clipboard_request
[QEMU_CLIPBOARD_SELECTION__COUNT
];
64 #define TYPE_DBUS_DISPLAY "dbus-display"
65 OBJECT_DECLARE_SIMPLE_TYPE(DBusDisplay
, DBUS_DISPLAY
)
67 void dbus_display_notifier_add(Notifier
*notifier
);
69 #define DBUS_DISPLAY_TYPE_CONSOLE dbus_display_console_get_type()
70 G_DECLARE_FINAL_TYPE(DBusDisplayConsole
,
77 dbus_display_console_new(DBusDisplay
*display
, QemuConsole
*con
);
80 dbus_display_console_get_index(DBusDisplayConsole
*ddc
);
82 #define DBUS_DISPLAY_TYPE_LISTENER dbus_display_listener_get_type()
83 G_DECLARE_FINAL_TYPE(DBusDisplayListener
,
84 dbus_display_listener
,
90 dbus_display_listener_new(const char *bus_name
,
91 GDBusConnection
*conn
,
92 DBusDisplayConsole
*console
);
95 dbus_display_listener_get_console(DBusDisplayListener
*ddl
);
98 dbus_display_listener_get_bus_name(DBusDisplayListener
*ddl
);
100 extern const DisplayChangeListenerOps dbus_gl_dcl_ops
;
101 extern const DisplayChangeListenerOps dbus_dcl_ops
;
103 #define TYPE_CHARDEV_DBUS "chardev-dbus"
105 typedef struct DBusChardevClass
{
106 SocketChardevClass parent_class
;
108 void (*parent_chr_be_event
)(Chardev
*s
, QEMUChrEvent event
);
111 DECLARE_CLASS_CHECKERS(DBusChardevClass
, DBUS_CHARDEV
,
114 typedef struct DBusChardev
{
115 SocketChardev parent
;
118 QemuDBusDisplay1Chardev
*iface
;
121 DECLARE_INSTANCE_CHECKER(DBusChardev
, DBUS_CHARDEV
, TYPE_CHARDEV_DBUS
)
123 #define CHARDEV_IS_DBUS(chr) \
124 object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_DBUS)
127 DBUS_DISPLAY_CHARDEV_OPEN
,
128 DBUS_DISPLAY_CHARDEV_CLOSE
,
129 } DBusDisplayEventType
;
131 typedef struct DBusDisplayEvent
{
132 DBusDisplayEventType type
;
134 DBusChardev
*chardev
;
138 void dbus_display_notify(DBusDisplayEvent
*event
);
140 void dbus_chardev_init(DBusDisplay
*dpy
);
142 void dbus_clipboard_init(DBusDisplay
*dpy
);
144 #endif /* UI_DBUS_H_ */