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
This commit is contained in:
Paul Cornett
2013-12-15 01:29:56 +00:00
parent a0761842f1
commit f2dbd85dac
2 changed files with 41 additions and 28 deletions

View File

@@ -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;
}
// ----------------------------------------------------------------------------

View File

@@ -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