From: Vadim Zeitlin Date: Fri, 1 Sep 2006 22:23:51 +0000 (+0000) Subject: always let GtkTextView have mouse release events to avoid assertion failures in gtk_t... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8312c461b8bae95adf2f75c7be4e6bab3b1ceb47?ds=sidebyside;hp=97687291129883f7e5581cdbf1b5e79c5ec63bc4 always let GtkTextView have mouse release events to avoid assertion failures in gtk_text_view_start_selection_drag() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h index 9f1c6eddd2..f22b710ee5 100644 --- a/include/wx/gtk/textctrl.h +++ b/include/wx/gtk/textctrl.h @@ -167,6 +167,9 @@ public: // should we mark the control as dirty? always resets the flag bool MarkDirtyOnChange(); + // always let GTK have mouse release events for multiline controls + virtual bool GTKProcessEvent(wxEvent& event) const; + static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index cd4b62035b..703ceccd9c 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1817,6 +1817,18 @@ void wxTextCtrl::OnUrlMouseEvent(wxMouseEvent& event) GetEventHandler()->ProcessEvent(url_event); } +bool wxTextCtrl::GTKProcessEvent(wxEvent& event) const +{ + bool rc = wxTextCtrlBase::GTKProcessEvent(event); + + // GtkTextView starts a drag operation when left mouse button is pressed + // and ends it when it is released and if it doesn't get the release event + // the next click on a control results in an assertion failure inside + // gtk_text_view_start_selection_drag() which simply *kills* the program + // without anything we can do about it, so always let GTK+ have this event + return rc && (IsSingleLine() || event.GetEventType() != wxEVT_LEFT_UP); +} + // static wxVisualAttributes wxTextCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))