From a8eb5c06492a0363bc778e29ea34b4416ddb71c6 Mon Sep 17 00:00:00 2001 From: Da Shen Date: Fri, 29 Sep 2023 00:16:45 +0800 Subject: [PATCH] Fix double click open on macOS --- src/Plugins/Qt/QTMGuiHelper.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Plugins/Qt/QTMGuiHelper.cpp b/src/Plugins/Qt/QTMGuiHelper.cpp index bf77071b50..f1b46af0e2 100644 --- a/src/Plugins/Qt/QTMGuiHelper.cpp +++ b/src/Plugins/Qt/QTMGuiHelper.cpp @@ -37,11 +37,13 @@ QTMGuiHelper::eventFilter (QObject *obj, QEvent *event) { if (event->type() == QEvent::FileOpen) { static bool new_window_flag= false; QFileOpenEvent* openEvent = static_cast(event); - const char* s = openEvent->file().toUtf8().constData(); + string s= from_qstring(openEvent->file().toUtf8()); + if (!is_empty (s)) { //qDebug ("File Open Event %s", s); - const char *win= new_window_flag? ":new-window": ":current-window"; - exec_delayed (scheme_cmd (list_object (symbol_object ("load-buffer"), + const char *win= new_window_flag? ":new-window": ":current-window"; + exec_delayed (scheme_cmd (list_object (symbol_object ("load-buffer"), object (url_system (s)), eval (win)))); + } new_window_flag= true; return true; } else {