[PATCH v5 0/2] Fix and re-enable GTK clipboard

Jindřich Makovička posted 2 patches 3 weeks, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260427-gtk-clipboard-v5-0-6968feb31a5d@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>
meson.build        |  4 ----
meson_options.txt  |  7 -------
qapi/ui.json       |  6 +++++-
qemu-options.hx    |  9 ++++++---
ui/gtk-clipboard.c | 53 ++++++++++++++++++++++++++++++++++++++++-------------
ui/gtk.c           |  8 +++++---
ui/meson.build     |  4 +---
7 files changed, 57 insertions(+), 34 deletions(-)
[PATCH v5 0/2] Fix and re-enable GTK clipboard
Posted by Jindřich Makovička 3 weeks, 6 days ago
The following patches change blocking clipboard retrieval function
calls in gtk-clipboard.c to non-blocking variants using callbacks to
avoid UI lockup. It is a follow-up to the patch proposed in the GitLab
issue

https://gitlab.com/qemu-project/qemu/-/work_items/1150

This version adds a similar change to gd_clipboard_request that also
uses the blocking clipboard API.

The second patch removes the gtk-clipboard compile flag, keeping the
GTK clipboard always compiled in. By default, clipboard is off,
can be enabled by -display gtk,clipboard=on .

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
---
Changes in v5:
- Runtime option added, clipboard still off by default
- Link to v4: https://lore.kernel.org/qemu-devel/20260427-gtk-clipboard-v4-0-176ad9919931@gmail.com

Changes in v4:
- Replace gtk_clipboard_request_contents with
  gtk_clipboard_request_targets which can utilize GTK's target cache
- Link to v3: https://lore.kernel.org/qemu-devel/20260426-gtk-clipboard-v3-0-09555aaeda34@gmail.com

Changes in v3:
- Use gtk_clipboard_request_contents to avoid text conversion
  when we only need to check if the text is available.
- Link to v2: https://lore.kernel.org/qemu-devel/20260425-gtk-clipboard-v2-0-b098f3cf69cc@gmail.com

Changes in v2:
- Removed forgotten gtk-clipboard comment in meson_options.txt
- Link to v1: https://lore.kernel.org/qemu-devel/20260425-gtk-clipboard-v1-0-6bd99e708e14@gmail.com

---
Jindřich Makovička (2):
      ui/gtk: Use non-blocking clipboard retrieval
      ui/gtk: Turn clipboard flag into runtime option

 meson.build        |  4 ----
 meson_options.txt  |  7 -------
 qapi/ui.json       |  6 +++++-
 qemu-options.hx    |  9 ++++++---
 ui/gtk-clipboard.c | 53 ++++++++++++++++++++++++++++++++++++++++-------------
 ui/gtk.c           |  8 +++++---
 ui/meson.build     |  4 +---
 7 files changed, 57 insertions(+), 34 deletions(-)
---
base-commit: aa15257174da180c6a8a9d58f87319cfe61c5520
change-id: 20260425-gtk-clipboard-fdf99db13ac0

Best regards,
-- 
Jindrich Makovicka


Re: [PATCH v5 0/2] Fix and re-enable GTK clipboard
Posted by Marc-André Lureau 3 weeks, 6 days ago
Hi

On Tue, Apr 28, 2026 at 12:06 AM Jindřich Makovička <makovick@gmail.com> wrote:
>
> The following patches change blocking clipboard retrieval function
> calls in gtk-clipboard.c to non-blocking variants using callbacks to
> avoid UI lockup. It is a follow-up to the patch proposed in the GitLab
> issue
>
> https://gitlab.com/qemu-project/qemu/-/work_items/1150
>
> This version adds a similar change to gd_clipboard_request that also
> uses the blocking clipboard API.
>
> The second patch removes the gtk-clipboard compile flag, keeping the
> GTK clipboard always compiled in. By default, clipboard is off,
> can be enabled by -display gtk,clipboard=on .
>
> Signed-off-by: Jindrich Makovicka <makovick@gmail.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
> Changes in v5:
> - Runtime option added, clipboard still off by default
> - Link to v4: https://lore.kernel.org/qemu-devel/20260427-gtk-clipboard-v4-0-176ad9919931@gmail.com
>
> Changes in v4:
> - Replace gtk_clipboard_request_contents with
>   gtk_clipboard_request_targets which can utilize GTK's target cache
> - Link to v3: https://lore.kernel.org/qemu-devel/20260426-gtk-clipboard-v3-0-09555aaeda34@gmail.com
>
> Changes in v3:
> - Use gtk_clipboard_request_contents to avoid text conversion
>   when we only need to check if the text is available.
> - Link to v2: https://lore.kernel.org/qemu-devel/20260425-gtk-clipboard-v2-0-b098f3cf69cc@gmail.com
>
> Changes in v2:
> - Removed forgotten gtk-clipboard comment in meson_options.txt
> - Link to v1: https://lore.kernel.org/qemu-devel/20260425-gtk-clipboard-v1-0-6bd99e708e14@gmail.com
>
> ---
> Jindřich Makovička (2):
>       ui/gtk: Use non-blocking clipboard retrieval
>       ui/gtk: Turn clipboard flag into runtime option
>
>  meson.build        |  4 ----
>  meson_options.txt  |  7 -------
>  qapi/ui.json       |  6 +++++-
>  qemu-options.hx    |  9 ++++++---
>  ui/gtk-clipboard.c | 53 ++++++++++++++++++++++++++++++++++++++++-------------
>  ui/gtk.c           |  8 +++++---
>  ui/meson.build     |  4 +---
>  7 files changed, 57 insertions(+), 34 deletions(-)
> ---
> base-commit: aa15257174da180c6a8a9d58f87319cfe61c5520
> change-id: 20260425-gtk-clipboard-fdf99db13ac0
>
> Best regards,
> --
> Jindrich Makovicka
>