From: Jindřich Makovička <[email protected]> - Compile the GTK clipboard support unconditionally
- Introduce GTK clipboard option, defaulting to off Signed-off-by: Jindrich Makovicka <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Reviewed-by: Daniel P. Berrangé <[email protected]> Message-ID: <[email protected]> --- meson.build | 4 ---- qapi/ui.json | 6 +++++- ui/gtk.c | 8 +++++--- meson_options.txt | 7 ------- qemu-options.hx | 9 ++++++--- scripts/meson-buildoptions.sh | 3 --- ui/meson.build | 4 +--- 7 files changed, 17 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index 7d25b1ec7ef..4176d020c21 100644 --- a/meson.build +++ b/meson.build @@ -1932,7 +1932,6 @@ endif gtk = not_found gtkx11 = not_found vte = not_found -have_gtk_clipboard = get_option('gtk_clipboard').enabled() if get_option('gtk') \ .disable_auto_if(not have_system) \ @@ -1954,8 +1953,6 @@ if get_option('gtk') \ method: 'pkg-config', required: get_option('vte')) endif - elif have_gtk_clipboard - error('GTK clipboard requested, but GTK not found') endif endif @@ -2475,7 +2472,6 @@ if glusterfs.found() endif config_host_data.set('CONFIG_GTK', gtk.found()) config_host_data.set('CONFIG_VTE', vte.found()) -config_host_data.set('CONFIG_GTK_CLIPBOARD', have_gtk_clipboard) config_host_data.set('CONFIG_HEXAGON_IDEF_PARSER', get_option('hexagon_idef_parser')) config_host_data.set('CONFIG_LIBATTR', have_old_libattr) config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) diff --git a/qapi/ui.json b/qapi/ui.json index e3da77632a8..b2c42a7f578 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1319,6 +1319,9 @@ # # GTK display options. # +# @clipboard: Enable host-guest clipboard sharing. Defaults to "off". +# (Since 11.1) +# # @grab-on-hover: Grab keyboard input on mouse hover. # # @zoom-to-fit: Zoom guest display to fit into the host window. When @@ -1344,7 +1347,8 @@ # Since: 2.12 ## { 'struct' : 'DisplayGTK', - 'data' : { '*grab-on-hover' : 'bool', + 'data' : { '*clipboard' : 'bool', + '*grab-on-hover' : 'bool', '*zoom-to-fit' : 'bool', '*show-tabs' : 'bool', '*show-menubar' : 'bool', diff --git a/ui/gtk.c b/ui/gtk.c index 8fd39c90c29..ec95f0f294a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2601,9 +2601,11 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts) opts->u.gtk.show_tabs) { gtk_menu_item_activate(GTK_MENU_ITEM(s->show_tabs_item)); } -#ifdef CONFIG_GTK_CLIPBOARD - gd_clipboard_init(s); -#endif /* CONFIG_GTK_CLIPBOARD */ + + if (opts->u.gtk.has_clipboard && + opts->u.gtk.clipboard) { + gd_clipboard_init(s); + } /* GTK's event polling must happen on the main thread. */ qemu_main = NULL; diff --git a/meson_options.txt b/meson_options.txt index 31d5916cfce..286461129bd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -262,13 +262,6 @@ option('vnc_sasl', type : 'feature', value : 'auto', description: 'SASL authentication for VNC server') option('vte', type : 'feature', value : 'auto', description: 'vte support for the gtk UI') - -# GTK Clipboard implementation is disabled by default, since it may cause hangs -# of the guest VCPUs. See gitlab issue 1150: -# https://gitlab.com/qemu-project/qemu/-/issues/1150 - -option('gtk_clipboard', type: 'feature', value : 'disabled', - description: 'clipboard support for the gtk UI (EXPERIMENTAL, MAY HANG)') option('xkbcommon', type : 'feature', value : 'auto', description: 'xkbcommon support') option('zstd', type : 'feature', value : 'auto', diff --git a/qemu-options.hx b/qemu-options.hx index 21972f83268..e780bc2ac06 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2209,9 +2209,9 @@ DEF("display", HAS_ARG, QEMU_OPTION_display, " [,window-close=on|off]\n" #endif #if defined(CONFIG_GTK) - "-display gtk[,full-screen=on|off][,gl=on|off][,grab-on-hover=on|off]\n" - " [,show-tabs=on|off][,show-cursor=on|off][,window-close=on|off]\n" - " [,show-menubar=on|off][,zoom-to-fit=on|off]\n" + "-display gtk[,clipboard=on|off][,full-screen=on|off][,gl=on|off]\n" + " [,grab-on-hover=on|off][,show-tabs=on|off][,show-cursor=on|off]\n" + " [,window-close=on|off][,show-menubar=on|off][,zoom-to-fit=on|off]\n" #endif #if defined(CONFIG_VNC) "-display vnc=<display>[,<optargs>]\n" @@ -2295,6 +2295,9 @@ SRST drop-down menus and other UI elements to configure and control the VM during runtime. Valid parameters are: + ``clipboard=on|off`` : Enable host-guest clipboard sharing, + defaults to "off" + ``full-screen=on|off`` : Start in fullscreen mode ``gl=on|off`` : Use OpenGL for displaying diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index ca5b113119a..80de8c4af42 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -124,7 +124,6 @@ meson_options_help() { printf "%s\n" ' glusterfs Glusterfs block device driver' printf "%s\n" ' gnutls GNUTLS cryptography support' printf "%s\n" ' gtk GTK+ user interface' - printf "%s\n" ' gtk-clipboard clipboard support for the gtk UI (EXPERIMENTAL, MAY HANG)' printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' printf "%s\n" ' hv-balloon hv-balloon driver (requires Glib 2.68+ GTree API)' @@ -336,8 +335,6 @@ _meson_option_parse() { --disable-gnutls) printf "%s" -Dgnutls=disabled ;; --enable-gtk) printf "%s" -Dgtk=enabled ;; --disable-gtk) printf "%s" -Dgtk=disabled ;; - --enable-gtk-clipboard) printf "%s" -Dgtk_clipboard=enabled ;; - --disable-gtk-clipboard) printf "%s" -Dgtk_clipboard=disabled ;; --enable-guest-agent) printf "%s" -Dguest_agent=enabled ;; --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;; --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;; diff --git a/ui/meson.build b/ui/meson.build index 3d15ff96287..ceaf110683d 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -112,9 +112,7 @@ if gtk.found() gtk_ss = ss.source_set() gtk_ss.add(gtk, vte, pixman, files('gtk.c')) - if have_gtk_clipboard - gtk_ss.add(files('gtk-clipboard.c')) - endif + gtk_ss.add(files('gtk-clipboard.c')) gtk_ss.add(when: x11, if_true: files('x_keymap.c')) gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c')) gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c')) -- 2.54.0
