mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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>
This commit is contained in:
parent
5912745288
commit
1b17f1e9f9
7 changed files with 101 additions and 29 deletions
17
ui/cocoa.m
17
ui/cocoa.m
|
@ -1808,14 +1808,12 @@ static void cocoa_clipboard_request(QemuClipboardInfo *info,
|
|||
|
||||
static QemuClipboardPeer cbpeer = {
|
||||
.name = "cocoa",
|
||||
.update = { .notify = cocoa_clipboard_notify },
|
||||
.notifier = { .notify = cocoa_clipboard_notify },
|
||||
.request = cocoa_clipboard_request
|
||||
};
|
||||
|
||||
static void cocoa_clipboard_notify(Notifier *notifier, void *data)
|
||||
static void cocoa_clipboard_update_info(QemuClipboardInfo *info)
|
||||
{
|
||||
QemuClipboardInfo *info = data;
|
||||
|
||||
if (info->owner == &cbpeer || info->selection != QEMU_CLIPBOARD_SELECTION_CLIPBOARD) {
|
||||
return;
|
||||
}
|
||||
|
@ -1831,6 +1829,17 @@ static void cocoa_clipboard_notify(Notifier *notifier, void *data)
|
|||
qemu_event_set(&cbevent);
|
||||
}
|
||||
|
||||
static void cocoa_clipboard_notify(Notifier *notifier, void *data)
|
||||
{
|
||||
QemuClipboardNotify *notify = data;
|
||||
|
||||
switch (notify->type) {
|
||||
case QEMU_CLIPBOARD_UPDATE_INFO:
|
||||
cocoa_clipboard_update_info(notify->info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void cocoa_clipboard_request(QemuClipboardInfo *info,
|
||||
QemuClipboardType type)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue