Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 795c6f7 in mainline


Ignore:
Timestamp:
2022-12-01T14:44:00Z (2 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
29a5a99
Parents:
c4a53280
git-author:
Jiri Svoboda <jiri@…> (2022-11-30 18:43:58)
git-committer:
Jiri Svoboda <jiri@…> (2022-12-01 14:44:00)
Message:

Fix rendering of very small buttons

In text mode we have some narrow buttons (scrollbar, close button etc.)
where if we subtract shadow width and padding with we arrive at negative
width. Trying to format the text to negative width causes trouble.
While somewhat hackish, we allow at least one character to be printed
even for very small buttons.

This fixes e.g. Navigator not starting.

File:
1 edited

Legend:

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

    rc4a53280 r795c6f7  
    450450        fmt.abbreviate = true;
    451451        fmt.width = rect.p1.x - rect.p0.x - 2 * ui_pb_pad_x_text;
     452        if (fmt.width < 1)
     453                fmt.width = 1;
    452454
    453455        rc = gfx_puttext(&pos, &fmt, pbutton->caption);
Note: See TracChangeset for help on using the changeset viewer.