diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-07-19 19:42:15 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-12-21 10:50:21 +0400 |
commit | 1b17f1e9f962f5ae9cd559d7f23718ceed71b813 (patch) | |
tree | ee3a19c25c8d55254cc6ff77c01931680f6c283c /ui/clipboard.c | |
parent | 59127452883afe3d603e90824bb33ac57b4dbee1 (diff) |
ui: generalize clipboard notifier
Use a QemuClipboardNotify union type for extendable clipboard events.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/clipboard.c')
-rw-r--r-- | ui/clipboard.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/clipboard.c b/ui/clipboard.c index d7b008d62a..743b39edf4 100644 --- a/ui/clipboard.c +++ b/ui/clipboard.c @@ -8,7 +8,7 @@ static QemuClipboardInfo *cbinfo[QEMU_CLIPBOARD_SELECTION__COUNT]; void qemu_clipboard_peer_register(QemuClipboardPeer *peer) { - notifier_list_add(&clipboard_notifiers, &peer->update); + notifier_list_add(&clipboard_notifiers, &peer->notifier); } void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer) @@ -18,8 +18,7 @@ void qemu_clipboard_peer_unregister(QemuClipboardPeer *peer) for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) { qemu_clipboard_peer_release(peer, i); } - - notifier_remove(&peer->update); + notifier_remove(&peer->notifier); } bool qemu_clipboard_peer_owns(QemuClipboardPeer *peer, @@ -44,10 +43,15 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer, void qemu_clipboard_update(QemuClipboardInfo *info) { + QemuClipboardNotify notify = { + .type = QEMU_CLIPBOARD_UPDATE_INFO, + .info = info, + }; g_autoptr(QemuClipboardInfo) old = NULL; + assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT); - notifier_list_notify(&clipboard_notifiers, info); + notifier_list_notify(&clipboard_notifiers, ¬ify); old = cbinfo[info->selection]; cbinfo[info->selection] = qemu_clipboard_info_ref(info); |