Avoid gtk_entry_{get,set}_inner_border() with GTK+4

This commit is contained in:
Paul Cornett
2017-12-19 10:42:47 -08:00
parent 9d837f7556
commit de273046a4

View File

@@ -521,7 +521,7 @@ bool wxTextEntry::GTKEntryOnInsertText(const char* text)
bool wxTextEntry::DoSetMargins(const wxPoint& margins) bool wxTextEntry::DoSetMargins(const wxPoint& margins)
{ {
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0) && !defined(__WXGTK4__)
GtkEntry* entry = GetEntry(); GtkEntry* entry = GetEntry();
if ( !entry ) if ( !entry )
@@ -529,6 +529,7 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins)
if ( !wx_is_at_least_gtk2(10) ) if ( !wx_is_at_least_gtk2(10) )
return false; return false;
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry); const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry);
GtkBorder newBorder; GtkBorder newBorder;
@@ -553,6 +554,7 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins)
newBorder.top = margins.y; newBorder.top = margins.y;
gtk_entry_set_inner_border(entry, &newBorder); gtk_entry_set_inner_border(entry, &newBorder);
wxGCC_WARNING_RESTORE()
return true; return true;
#else #else
@@ -564,13 +566,15 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins)
wxPoint wxTextEntry::DoGetMargins() const wxPoint wxTextEntry::DoGetMargins() const
{ {
wxPoint point(-1, -1); wxPoint point(-1, -1);
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0) && !defined(__WXGTK4__)
GtkEntry* entry = GetEntry(); GtkEntry* entry = GetEntry();
if (entry) if (entry)
{ {
if (wx_is_at_least_gtk2(10)) if (wx_is_at_least_gtk2(10))
{ {
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
const GtkBorder* border = gtk_entry_get_inner_border(entry); const GtkBorder* border = gtk_entry_get_inner_border(entry);
wxGCC_WARNING_RESTORE()
if (border) if (border)
{ {
point.x = border->left; point.x = border->left;