Fix bug in scrolled single line wxTextCtrl::HitTest() with GTK 3

There seems to be something wrong with the vertical offset returned by
gtk_entry_get_layout_offsets() in GTK 3, so just don't use it at all, as
we don't need it anyhow.
This commit is contained in:
Vadim Zeitlin
2019-07-17 16:07:53 +02:00
parent c1cbacd0ad
commit 9ad8b6d6b7

View File

@@ -1451,7 +1451,17 @@ wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
gtk_entry_get_layout_offsets(GTK_ENTRY(m_text), &ofsX, &ofsY);
x -= ofsX;
// There is something really weird going on with vertical offset under
// GTK 3: normally it is just 0, because a single line control doesn't
// scroll vertically anyhow, but sometimes it can have big positive or
// negative values after scrolling horizontally, resulting in test
// failures in TextCtrlTestCase::HitTestSingleLine::Scrolled. So just
// ignore it completely, as, again, it shouldn't matter for single line
// text controls in any case, and so do not do this:
#ifndef __WXGTK3__
y -= ofsY;
#endif // !__WXGTK3__
// And scale the coordinates for Pango.
x *= PANGO_SCALE;