Avoid refreshing not currently visible items in generic wxListCtrl.

This is useless at best and resulted in GTK+ warnings because we ended up
(somehow -- is there another bug lurking here?) with negative items height in
this case.

Closes #16862.
This commit is contained in:
Vadim Zeitlin
2015-03-02 14:39:45 +01:00
parent c477605bda
commit c4f569ed60
2 changed files with 8 additions and 0 deletions

View File

@@ -597,6 +597,7 @@ wxGTK:
target window. target window.
- Fix crashes in wxGTK3 when running with non-X11 backend (Marco Trevisan). - Fix crashes in wxGTK3 when running with non-X11 backend (Marco Trevisan).
- Fix coordinates of wxSetCursorEvent propagated to parent windows. - Fix coordinates of wxSetCursorEvent propagated to parent windows.
- Fix GTK+ warnings when refreshing wxListCtrl items (Scott Talbert).
wxMSW: wxMSW:

View File

@@ -1935,6 +1935,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo )
size_t visibleFrom, visibleTo; size_t visibleFrom, visibleTo;
GetVisibleLinesRange(&visibleFrom, &visibleTo); GetVisibleLinesRange(&visibleFrom, &visibleTo);
if ( lineFrom > visibleTo || lineTo < visibleFrom )
{
// None of these lines are currently visible at all, don't bother
// doing anything.
return;
}
if ( lineFrom < visibleFrom ) if ( lineFrom < visibleFrom )
lineFrom = visibleFrom; lineFrom = visibleFrom;
if ( lineTo > visibleTo ) if ( lineTo > visibleTo )