Skip to content

Commit

Permalink
Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu
Browse files Browse the repository at this point in the history
… into staging

UI-related fixes

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmXPY24cHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5RROD/0csnOJ99i8XMbz44Ys
# +NMjIoBcJoyULYxL1AM4N/3rx0rn2JJyjijxRRY++8cED515SYmHGwF66mvT/ybB
# GA+s3uuVThgQr0R0rTBUSFURrbwiEh70Hv+aWQIpcL5Uc+QzCcZzSU2PUEzdl6De
# X/8oA/sSp9XGz+J/c1GkrVWVUWl8e6dMjnRz4ns3m9n2Byh2Jxm32GFhSL/o6T5i
# 424TWFZA7F8fqeGPMT6W25nKfy8APUbtRIwcE3qO0RDsP5Fbah7TJGIqj/ioXNKU
# 8Aa70rXWDQl05bw5I8cHYlg0kY2nOB00G2WWACpDFqBL831optKZ3iSbwrwYgOLU
# yzImjs2mWLoPZ1tLR35VA5wDFekt/iknwfVqqUvAfPwccIg61hYt+LmRQp4s8pTm
# XTdNwLeB2iytdOtJ6G8IuYT60skf7L80u/gpvIo36oq6VQ9mf9U6KDmX2vGyZjzO
# bxtR0+adzAfd3+DY0gJvoBibAUitkXOi5mvWM0wWB9BhOufiDPN2ILosK8AVvpbB
# BVxe7qnA4S0MEhyWxhImxGnPLmNPnBddO3XI5vaLFuAwHRXREg6QLyPgyXNcrwzZ
# gSHujxN2ByPIO2+mldijjcm8ZQ85hi+2dY/Pl5p4otTm/IneV4BctK7WBsynmCsP
# Kmh+9cxZBXm2d46UduXhJRoKPw==
# =HWZz
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 16 Feb 2024 13:30:22 GMT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  tests/qtest: Depend on dbus_display1_dep
  meson: Explicitly specify dbus-display1.h dependency
  audio: Depend on dbus_display1_dep
  ui/console: Fix console resize with placeholder surface
  ui/clipboard: add asserts for update and request
  ui/clipboard: mark type as not available when there is no data
  ui: reject extended clipboard message if not activated

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Feb 20, 2024
2 parents da96ad4 + 186acfb commit 8bef947
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
3 changes: 2 additions & 1 deletion audio/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ endforeach

if dbus_display
module_ss = ss.source_set()
module_ss.add(when: [gio, pixman], if_true: files('dbusaudio.c'))
module_ss.add(when: [gio, dbus_display1_dep, pixman],
if_true: files('dbusaudio.c'))
audio_modules += {'dbus': module_ss}
endif

Expand Down
2 changes: 1 addition & 1 deletion tests/qtest/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ if vnc.found()
endif

if dbus_display
qtests += {'dbus-display-test': [dbus_display1, gio]}
qtests += {'dbus-display-test': [dbus_display1_dep, gio]}
endif

qtest_executables = {}
Expand Down
26 changes: 23 additions & 3 deletions ui/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,24 @@ bool qemu_clipboard_check_serial(QemuClipboardInfo *info, bool client)

void qemu_clipboard_update(QemuClipboardInfo *info)
{
uint32_t type;
QemuClipboardNotify notify = {
.type = QEMU_CLIPBOARD_UPDATE_INFO,
.info = info,
};
assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);

for (type = 0; type < QEMU_CLIPBOARD_TYPE__COUNT; type++) {
/*
* If data is missing, the clipboard owner's 'request' callback needs to
* be set. Otherwise, there is no way to get the clipboard data and
* qemu_clipboard_request() cannot be called.
*/
if (info->types[type].available && !info->types[type].data) {
assert(info->owner && info->owner->request);
}
}

notifier_list_notify(&clipboard_notifiers, &notify);

if (cbinfo[info->selection] != info) {
Expand Down Expand Up @@ -132,6 +144,8 @@ void qemu_clipboard_request(QemuClipboardInfo *info,
!info->owner)
return;

assert(info->owner->request);

info->types[type].requested = true;
info->owner->request(info, type);
}
Expand Down Expand Up @@ -163,9 +177,15 @@ void qemu_clipboard_set_data(QemuClipboardPeer *peer,
}

g_free(info->types[type].data);
info->types[type].data = g_memdup(data, size);
info->types[type].size = size;
info->types[type].available = true;
if (size) {
info->types[type].data = g_memdup2(data, size);
info->types[type].size = size;
info->types[type].available = true;
} else {
info->types[type].data = NULL;
info->types[type].size = 0;
info->types[type].available = false;
}

if (update) {
qemu_clipboard_update(info);
Expand Down
2 changes: 1 addition & 1 deletion ui/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
assert(QEMU_IS_GRAPHIC_CONSOLE(s));

if ((s->scanout.kind != SCANOUT_SURFACE ||
(surface && surface->flags & QEMU_ALLOCATED_FLAG)) &&
(surface && !is_buffer_shared(surface) && !is_placeholder(surface))) &&
qemu_console_get_width(s, -1) == width &&
qemu_console_get_height(s, -1) == height) {
return;
Expand Down
2 changes: 1 addition & 1 deletion ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if dbus_display
'--c-namespace', 'QemuDBus',
'--generate-c-code', '@BASENAME@'])
dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, include_directories: include_directories('.'))
dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, sources: dbus_display1[0])
dbus_ss.add(when: [gio, dbus_display1_dep],
if_true: [files(
'dbus-chardev.c',
Expand Down
5 changes: 5 additions & 0 deletions ui/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2445,6 +2445,11 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
}

if (read_s32(data, 4) < 0) {
if (!vnc_has_feature(vs, VNC_FEATURE_CLIPBOARD_EXT)) {
error_report("vnc: extended clipboard message while disabled");
vnc_client_error(vs);
break;
}
if (dlen < 4) {
error_report("vnc: malformed payload (header less than 4 bytes)"
" in extended clipboard pseudo-encoding.");
Expand Down

0 comments on commit 8bef947

Please sign in to comment.