Remove the test for y mouse position in wxListHeaderWindow

This test was apparently supposed to check if the mouse was inside the
header, vertically, but this should always be the case unless the mouse
is captured and when it is captured in this code, m_isDragging is set to
true meaning that the code in the "else" branch of the test for it can't
be executed at all, so checking the vertical position seems completely
unnecessary.

Worse, it was actively harmful when using GTK 2 with DPI scaling, as in
this case the height of the window could be different from 22 (e.g. 44
for 2x scaling).

Closes #18713.
This commit is contained in:
Vadim Zeitlin 2020-07-10 18:06:32 +02:00
parent fa6680be4d
commit 96acdae1e6

View File

@ -1223,7 +1223,6 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
// we want to work with logical coords
int x;
parent->CalcUnscrolledPosition(event.GetX(), 0, &x, NULL);
int y = event.GetY();
if (m_isDragging)
{
@ -1276,7 +1275,7 @@ void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
xpos += m_owner->GetColumnWidth( col );
m_column = col;
if ( (abs(x-xpos) < 3) && (y < 22) )
if ( abs(x-xpos) < 3 )
{
// near the column border
hit_border = true;