vcl/unx/gtk3/fpicker/SalGtkPicker.cxx | 7 ------ vcl/unx/gtk3/gtksys.cxx | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-)
New commits: commit a9a9d66ec8fb07df7d5b08d94b6e0878006b6004 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue May 11 16:31:53 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue May 11 18:23:40 2021 +0200 gtk4: replace gtk_dialog_run with effectively the same thing, so still a loop within a loop. File Dialog now appears and is semi-functional Change-Id: Ibd7584c5e41b5de84975c3cb7886fe97a74d8587 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115438 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx index 76c7739b723a..441cc8183402 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkPicker.cxx @@ -188,13 +188,6 @@ namespace }; } -#if GTK_CHECK_VERSION(4, 0, 0) -gint gtk_dialog_run(GtkDialog*) -{ - return 0; -} -#endif - gint RunDialog::run() { if (mxToolkit.is()) diff --git a/vcl/unx/gtk3/gtksys.cxx b/vcl/unx/gtk3/gtksys.cxx index cf5461fef023..6a3701e10686 100644 --- a/vcl/unx/gtk3/gtksys.cxx +++ b/vcl/unx/gtk3/gtksys.cxx @@ -18,6 +18,7 @@ */ #include <gtk/gtk.h> +#include <unx/gtk/gtkdata.hxx> #include <unx/gtk/gtkinst.hxx> #include <unx/gtk/gtksys.hxx> #include <unx/gtk/gtkbackend.hxx> @@ -257,6 +258,44 @@ static OString MapToGtkAccelerator(const OUString &rStr) return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); } +#if GTK_CHECK_VERSION(4, 0, 0) + +namespace +{ + struct DialogLoop + { + GMainLoop* m_pLoop = nullptr; + gint nResponseId = GTK_RESPONSE_NONE; + + static void DialogResponse(GtkDialog*, gint nResponseId, gpointer data) + { + DialogLoop* pDialogLoop = static_cast<DialogLoop*>(data); + pDialogLoop->nResponseId = nResponseId; + g_main_loop_quit(pDialogLoop->m_pLoop); + } + + int run(GtkDialog *pDialog) + { + gulong nSignalResponseId = g_signal_connect(pDialog, "response", G_CALLBACK(DialogResponse), this); + gtk_window_present(GTK_WINDOW(pDialog)); + m_pLoop = g_main_loop_new(nullptr, false); + main_loop_run(m_pLoop); + g_main_loop_unref(m_pLoop); + g_signal_handler_disconnect(pDialog, nSignalResponseId); + return nResponseId; + } + + }; +} + +gint gtk_dialog_run(GtkDialog* pDialog) +{ + DialogLoop aDialogLoop; + return aDialogLoop.run(pDialog); +} + +#endif + int GtkSalSystem::ShowNativeDialog (const OUString& rTitle, const OUString& rMessage, const std::vector< OUString >& rButtonNames) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits