Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadz committed Mar 2, 2015
1 parent c477605 commit c4f569e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changes.txt
Expand Up @@ -597,6 +597,7 @@ wxGTK:
target window.
- Fix crashes in wxGTK3 when running with non-X11 backend (Marco Trevisan).
- Fix coordinates of wxSetCursorEvent propagated to parent windows.
- Fix GTK+ warnings when refreshing wxListCtrl items (Scott Talbert).

wxMSW:

Expand Down
7 changes: 7 additions & 0 deletions src/generic/listctrl.cpp
Expand Up @@ -1935,6 +1935,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo )
size_t 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 )
lineFrom = visibleFrom;
if ( lineTo > visibleTo )
Expand Down

0 comments on commit c4f569e

Please sign in to comment.