diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-05 16:47:47 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-05 16:47:47 +0300 |
commit | ab193f5f5d23a1606b23ca0defdd29ad67e44bca (patch) | |
tree | 6acbc0c68807d559400a3a87e653dddc345747b0 /src/ui/listwidget.c | |
parent | 8cdebce00959705de94295bdbb4b32ec08fc4b70 (diff) |
Fixed issues with the refactored sidebar
Diffstat (limited to 'src/ui/listwidget.c')
-rw-r--r-- | src/ui/listwidget.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index 3865becc..7651171b 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -153,7 +153,7 @@ void scrollOffset_ListWidget(iListWidget *d, int offset) { | |||
153 | } | 153 | } |
154 | 154 | ||
155 | static int visCount_ListWidget_(const iListWidget *d) { | 155 | static int visCount_ListWidget_(const iListWidget *d) { |
156 | return iMin(height_Rect(innerBounds_Widget(constAs_Widget(d))) / d->itemHeight, | 156 | return iMin(height_Rect(innerBounds_Widget(constAs_Widget(d))) / d->itemHeight + 1, |
157 | (int) size_PtrArray(&d->items)); | 157 | (int) size_PtrArray(&d->items)); |
158 | } | 158 | } |
159 | 159 | ||
@@ -272,14 +272,16 @@ static void allocVisBuffer_ListWidget_(iListWidget *d) { | |||
272 | } | 272 | } |
273 | 273 | ||
274 | static void draw_ListWidget_(const iListWidget *d) { | 274 | static void draw_ListWidget_(const iListWidget *d) { |
275 | const iWidget *w = constAs_Widget(d); | 275 | const iWidget *w = constAs_Widget(d); |
276 | const iRect bounds = innerBounds_Widget(w); | 276 | const iRect bounds = innerBounds_Widget(w); |
277 | draw_Widget(w); /* background */ | 277 | if (!bounds.size.y || !bounds.size.x) return; |
278 | iPaint p; | 278 | iPaint p; |
279 | init_Paint(&p); | 279 | init_Paint(&p); |
280 | drawBackground_Widget(w); | ||
280 | if (!d->visBufferValid || !isEmpty_IntSet(&d->invalidItems)) { | 281 | if (!d->visBufferValid || !isEmpty_IntSet(&d->invalidItems)) { |
281 | iListWidget *m = iConstCast(iListWidget *, d); | 282 | iListWidget *m = iConstCast(iListWidget *, d); |
282 | allocVisBuffer_ListWidget_(m); | 283 | allocVisBuffer_ListWidget_(m); |
284 | iAssert(d->visBuffer); | ||
283 | beginTarget_Paint(&p, d->visBuffer); | 285 | beginTarget_Paint(&p, d->visBuffer); |
284 | const iRect bufBounds = (iRect){ zero_I2(), bounds.size }; | 286 | const iRect bufBounds = (iRect){ zero_I2(), bounds.size }; |
285 | if (!d->visBufferValid) { | 287 | if (!d->visBufferValid) { |
@@ -310,6 +312,7 @@ static void draw_ListWidget_(const iListWidget *d) { | |||
310 | } | 312 | } |
311 | SDL_RenderCopy( | 313 | SDL_RenderCopy( |
312 | renderer_Window(get_Window()), d->visBuffer, NULL, (const SDL_Rect *) &bounds); | 314 | renderer_Window(get_Window()), d->visBuffer, NULL, (const SDL_Rect *) &bounds); |
315 | drawChildren_Widget(w); | ||
313 | } | 316 | } |
314 | 317 | ||
315 | iBool isMouseDown_ListWidget(const iListWidget *d) { | 318 | iBool isMouseDown_ListWidget(const iListWidget *d) { |