From f2dbd85dac05dc51faf968d27a56d725599db24c Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 15 Dec 2013 01:29:56 +0000 Subject: [PATCH] fix missing/incorrect GTK runtime version checks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/textctrl.cpp | 24 +++++++++++------------ src/gtk/textentry.cpp | 45 ++++++++++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index bce644abf4..9e5735a48b 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -842,26 +842,24 @@ GtkEntry *wxTextCtrl::GetEntry() const int wxTextCtrl::GTKIMFilterKeypress(GdkEventKey* event) const { + if (IsSingleLine()) + return wxTextEntry::GTKIMFilterKeypress(event); + + int result; #if GTK_CHECK_VERSION(2, 22, 0) - if ( gtk_check_version(2, 12, 0) == 0 ) +#ifndef __WXGTK3__ + result = false; + if (gtk_check_version(2,22,0) == NULL) +#endif { - if ( IsSingleLine() ) - { - return wxTextEntry::GTKIMFilterKeypress(event); - } - else - { - return gtk_text_view_im_context_filter_keypress( - GTK_TEXT_VIEW(m_text), - event - ); - } + result = gtk_text_view_im_context_filter_keypress(GTK_TEXT_VIEW(m_text), event); } #else // GTK+ < 2.22 wxUnusedVar(event); + result = false; #endif // GTK+ 2.22+ - return FALSE; + return result; } // ---------------------------------------------------------------------------- diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index 0c15570343..339c86bd44 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -417,14 +417,21 @@ void wxTextEntry::SendMaxLenEvent() int wxTextEntry::GTKIMFilterKeypress(GdkEventKey* event) const { + int result; #if GTK_CHECK_VERSION(2, 22, 0) - if ( gtk_check_version(2, 12, 0) == 0 ) - return gtk_entry_im_context_filter_keypress(GetEntry(), event); +#ifndef __WXGTK3__ + result = false; + if (gtk_check_version(2,22,0) == NULL) +#endif + { + result = gtk_entry_im_context_filter_keypress(GetEntry(), event); + } #else // GTK+ < 2.22 wxUnusedVar(event); + result = false; #endif // GTK+ 2.22+ - return FALSE; + return result; } void wxTextEntry::GTKConnectInsertTextSignal(GtkEntry* entry) @@ -449,6 +456,10 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins) if ( !entry ) return false; +#ifndef __WXGTK3__ + if (gtk_check_version(2,10,0)) + return false; +#endif const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry); GtkBorder* newBorder; @@ -497,21 +508,25 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins) wxPoint wxTextEntry::DoGetMargins() const { + wxPoint point(-1, -1); #if GTK_CHECK_VERSION(2,10,0) GtkEntry* entry = GetEntry(); - - if ( !entry ) - return wxPoint(-1, -1); - - const GtkBorder* border = gtk_entry_get_inner_border(entry); - - if ( !border ) - return wxPoint(-1, -1); - - return wxPoint((wxCoord) border->left, (wxCoord) border->top); -#else - return wxPoint(-1, -1); + if (entry) + { +#ifndef __WXGTK3__ + if (gtk_check_version(2,10,0) == NULL) #endif + { + const GtkBorder* border = gtk_entry_get_inner_border(entry); + if (border) + { + point.x = border->left; + point.y = border->top; + } + } + } +#endif + return point; } #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX