Changeset 2f106b0 in mainline for uspace/app/taskbar/wndlist.c


Ignore:
Timestamp:
2022-11-12T20:48:05Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a5c7b865
Parents:
c48192e
Message:

Do not show window buttons that do not fit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/wndlist.c

    rc48192e r2f106b0  
    6464};
    6565
     66enum {
     67        /** X distance between left edges of two consecutive buttons */
     68        wndlist_button_pitch = 145,
     69        /** X distance between left edges of two consecutive buttons (text) */
     70        wndlist_button_pitch_text = 17,
     71        /** Padding between buttons */
     72        wndlist_button_pad = 5,
     73        /** Padding between buttons (text) */
     74        wndlist_button_pad_text = 1
     75};
     76
    6677/** Create task bar window list.
    6778 *
     
    91102error:
    92103        return rc;
     104}
     105
     106/** Set window list rectangle.
     107 *
     108 * @param wndlist Window list
     109 * @param rect Rectangle
     110 */
     111void wndlist_set_rect(wndlist_t *wndlist, gfx_rect_t *rect)
     112{
     113        wndlist->rect = *rect;
    93114}
    94115
     
    287308        gfx_rect_t rect;
    288309        ui_resource_t *res;
     310        gfx_coord_t pitch;
     311        gfx_coord_t pad;
    289312        size_t idx;
    290313
     
    301324
    302325        if (ui_resource_is_textmode(res)) {
    303                 rect.p0.x = 17 * idx + 9;
     326                pitch = wndlist_button_pitch_text;
     327                pad = wndlist_button_pad_text;
     328        } else {
     329                pitch = wndlist_button_pitch;
     330                pad = wndlist_button_pad;
     331        }
     332
     333        rect.p0.x = wndlist->rect.p0.x + pitch * idx;
     334        rect.p0.y = wndlist->rect.p0.y;
     335        rect.p1.x = wndlist->rect.p0.x + pitch * (idx + 1) - pad;
     336        rect.p1.y = wndlist->rect.p1.y;
     337
     338        /* Entry does not fit? */
     339        if (rect.p1.x > wndlist->rect.p1.x) {
     340                /* Make entry invisible */
     341                rect.p0.x = 0;
    304342                rect.p0.y = 0;
    305                 rect.p1.x = 17 * idx + 25;
    306                 rect.p1.y = 1;
    307         } else {
    308                 rect.p0.x = 145 * idx + 90;
    309                 rect.p0.y = 4;
    310                 rect.p1.x = 145 * idx + 230;
    311                 rect.p1.y = 28;
     343                rect.p1.x = 0;
     344                rect.p1.y = 0;
    312345        }
    313346
Note: See TracChangeset for help on using the changeset viewer.