From f65efb1e2680fd9d27748035788894f8aeb531f4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 31 Mar 2014 02:16:01 +0000 Subject: [PATCH] use wxDialog::ShowModal() rather than gtk_dialog_run() so all the things wxDialog::ShowModal() does are not bypassed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/colordlg.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index 781a2316e1..aa395f2374 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -18,7 +18,6 @@ #if wxUSE_COLOURDLG #include "wx/colordlg.h" -#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -39,6 +38,13 @@ extern "C" { } #endif // wxUSE_LIBHILDON2 +extern "C" { +static void response(GtkDialog*, int response_id, wxColourDialog* win) +{ + win->EndModal(response_id == GTK_RESPONSE_OK ? wxID_OK : wxID_CANCEL); +} +} + IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) @@ -83,30 +89,16 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { - WX_HOOK_MODAL_DIALOG(); - ColourDataToDialog(); - wxOpenModalDialogLocker modalLocker; + gulong id = g_signal_connect(m_widget, "response", G_CALLBACK(response), this); + int rc = wxDialog::ShowModal(); + g_signal_handler_disconnect(m_widget, id); - gint result = gtk_dialog_run(GTK_DIALOG(m_widget)); - gtk_widget_hide(m_widget); + if (rc == wxID_OK) + DialogToColourData(); - switch (result) - { - default: - wxFAIL_MSG(wxT("unexpected GtkColorSelectionDialog return code")); - // fall through - - case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: - case GTK_RESPONSE_CLOSE: - return wxID_CANCEL; - - case GTK_RESPONSE_OK: - DialogToColourData(); - return wxID_OK; - } + return rc; } void wxColourDialog::ColourDataToDialog()