Changeset 03fc3a9 in mainline for uspace/lib/ui/src/filelist.c


Ignore:
Timestamp:
2022-06-02T12:38:39Z (23 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdf55a3
Parents:
11662bd
git-author:
Jiri Svoboda <jiri@…> (2022-06-01 18:37:42)
git-committer:
Jiri Svoboda <jiri@…> (2022-06-02 12:38:39)
Message:

Correct handling of partially visible file list entry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/filelist.c

    r11662bd r03fc3a9  
    185185        gfx_rect_t rect;
    186186        gfx_rect_t lrect;
     187        gfx_rect_t crect;
    187188        gfx_color_t *bgcolor;
    188189        char *caption;
     
    198199        gfx_text_fmt_init(&fmt);
    199200        fmt.font = font;
    200         rows = ui_file_list_page_size(flist);
     201        rows = ui_file_list_page_size(flist) + 1;
    201202
    202203        /* Do not display entry outside of current page */
     
    245246        rect.p1.y = rect.p0.y + line_height;
    246247
     248        /* Clip to file list interior */
     249        gfx_rect_clip(&rect, &lrect, &crect);
     250
    247251        rc = gfx_set_color(gc, bgcolor);
    248252        if (rc != EOK)
    249253                return rc;
    250254
    251         rc = gfx_fill_rect(gc, &rect);
     255        rc = gfx_fill_rect(gc, &crect);
    252256        if (rc != EOK)
    253257                return rc;
     
    261265         * marker.
    262266         */
    263         rc = gfx_set_clip_rect(gc, &rect);
     267        rc = gfx_set_clip_rect(gc, &crect);
    264268        if (rc != EOK)
    265269                return rc;
     
    325329        }
    326330
    327         lines = ui_file_list_page_size(flist);
     331        lines = ui_file_list_page_size(flist) + 1;
    328332        i = 0;
    329333
     
    477481{
    478482        gfx_coord_t line_height;
     483        gfx_rect_t irect;
    479484
    480485        line_height = ui_file_list_entry_height(flist);
    481         return (flist->rect.p1.y - flist->rect.p0.y) / line_height;
     486        ui_file_list_inside_rect(flist, &irect);
     487        return (irect.p1.y - irect.p0.y) / line_height;
    482488}
    483489
     
    943949        size_t idx;
    944950
    945         assert(n < ui_file_list_page_size(flist));
     951        assert(n <= ui_file_list_page_size(flist));
    946952
    947953        entry = flist->page;
Note: See TracChangeset for help on using the changeset viewer.