From 980fb1f66a087b8e4a6a00472e1e55f97c09fb5f Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Mon, 13 May 2024 19:39:53 +0100 Subject: [PATCH] refactor: move SDL_MOUSE_FOCUS_CLICKTHROUGH config to display_param_check() --- quickemu | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/quickemu b/quickemu index 35d14f3..16a8019 100755 --- a/quickemu +++ b/quickemu @@ -1284,10 +1284,6 @@ function vm_boot() { SHELL_ARGS="${SHELL_ARGS//Quickemu Project/\"Quickemu Project\"}" if [ -z "${VM_PID}" ]; then - # Enable grab-on-hover for SDL: https://github.com/quickemu-project/quickemu/issues/541 - case "${display}" in - sdl) export SDL_MOUSE_FOCUS_CLICKTHROUGH=1;; - esac echo "${QEMU}" "${SHELL_ARGS}" "2>/dev/null" >> "${VMDIR}/${VMNAME}.sh" sed -i -e 's/ -/ \\\n -/g' "${VMDIR}/${VMNAME}.sh" ${QEMU} "${args[@]}" &> "${VMDIR}/${VMNAME}.log" & @@ -1418,15 +1414,20 @@ function usage() { } function display_param_check() { + # Braille support requires SDL. Override $display if braille was requested. + if [ -n "${BRAILLE}" ]; then + display="sdl" + fi + if [ "${display}" != "gtk" ] && [ "${display}" != "none" ] && [ "${display}" != "sdl" ] && [ "${display}" != "spice" ] && [ "${display}" != "spice-app" ]; then echo "ERROR! Requested output '${display}' is not recognised." exit 1 fi - # Braille support requires SDL. Override $display if braille was requested. - if [ -n "${BRAILLE}" ]; then - display="sdl" - fi + # Enable grab-on-hover for SDL: https://github.com/quickemu-project/quickemu/issues/541 + case "${display}" in + sdl) export SDL_MOUSE_FOCUS_CLICKTHROUGH=1;; + esac # Set the default 3D acceleration. if [ -z "${gl}" ]; then