fix missing/incorrect GTK runtime version checks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2013-12-15 01:29:56 +00:00
parent 6adf2efa20
commit 286727db5b
2 changed files with 45 additions and 34 deletions

View File

@@ -842,26 +842,24 @@ GtkEntry *wxTextCtrl::GetEntry() const
int wxTextCtrl::GTKIMFilterKeypress(GdkEventKey* event) 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, 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() ) result = gtk_text_view_im_context_filter_keypress(GTK_TEXT_VIEW(m_text), event);
{
return wxTextEntry::GTKIMFilterKeypress(event);
}
else
{
return gtk_text_view_im_context_filter_keypress(
GTK_TEXT_VIEW(m_text),
event
);
}
} }
#else // GTK+ < 2.22 #else // GTK+ < 2.22
wxUnusedVar(event); wxUnusedVar(event);
result = false;
#endif // GTK+ 2.22+ #endif // GTK+ 2.22+
return FALSE; return result;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -417,14 +417,21 @@ void wxTextEntry::SendMaxLenEvent()
int wxTextEntry::GTKIMFilterKeypress(GdkEventKey* event) const int wxTextEntry::GTKIMFilterKeypress(GdkEventKey* event) const
{ {
int result;
#if GTK_CHECK_VERSION(2, 22, 0) #if GTK_CHECK_VERSION(2, 22, 0)
if ( gtk_check_version(2, 12, 0) == 0 ) #ifndef __WXGTK3__
return gtk_entry_im_context_filter_keypress(GetEntry(), event); result = false;
if (gtk_check_version(2,22,0) == NULL)
#endif
{
result = gtk_entry_im_context_filter_keypress(GetEntry(), event);
}
#else // GTK+ < 2.22 #else // GTK+ < 2.22
wxUnusedVar(event); wxUnusedVar(event);
result = false;
#endif // GTK+ 2.22+ #endif // GTK+ 2.22+
return FALSE; return result;
} }
void wxTextEntry::GTKConnectInsertTextSignal(GtkEntry* entry) void wxTextEntry::GTKConnectInsertTextSignal(GtkEntry* entry)
@@ -449,6 +456,10 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins)
if ( !entry ) if ( !entry )
return false; return false;
#ifndef __WXGTK3__
if (gtk_check_version(2,10,0))
return false;
#endif
const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry); const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry);
GtkBorder* newBorder; GtkBorder* newBorder;
@@ -497,21 +508,25 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins)
wxPoint wxTextEntry::DoGetMargins() const wxPoint wxTextEntry::DoGetMargins() const
{ {
wxPoint point(-1, -1);
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0)
GtkEntry* entry = GetEntry(); GtkEntry* entry = GetEntry();
if (entry)
if ( !entry ) {
return wxPoint(-1, -1); #ifndef __WXGTK3__
if (gtk_check_version(2,10,0) == NULL)
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);
#endif #endif
{
const GtkBorder* border = gtk_entry_get_inner_border(entry);
if (border)
{
point.x = border->left;
point.y = border->top;
}
}
}
#endif
return point;
} }
#ifdef __WXGTK3__ #ifdef __WXGTK3__
@@ -519,25 +534,23 @@ bool wxTextEntry::SetHint(const wxString& hint)
{ {
#if GTK_CHECK_VERSION(3,2,0) #if GTK_CHECK_VERSION(3,2,0)
GtkEntry *entry = GetEntry(); GtkEntry *entry = GetEntry();
if ( entry ) if (entry && gtk_check_version(3,2,0) == NULL)
{ {
gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint)); gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint));
return true; return true;
} }
else
#endif #endif
return wxTextEntryBase::SetHint(hint); return wxTextEntryBase::SetHint(hint);
} }
wxString wxTextEntry::GetHint() const wxString wxTextEntry::GetHint() const
{ {
#if GTK_CHECK_VERSION(3,2,0) #if GTK_CHECK_VERSION(3,2,0)
GtkEntry *entry = GetEntry(); GtkEntry *entry = GetEntry();
if ( entry ) if (entry && gtk_check_version(3,2,0) == NULL)
return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry)); return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry));
else
#endif #endif
return wxTextEntryBase::GetHint(); return wxTextEntryBase::GetHint();
} }
#endif // __WXGTK3__ #endif // __WXGTK3__