Changeset 8a9a41e in mainline for uspace/lib/ui/src/wdecor.c


Ignore:
Timestamp:
2021-10-24T08:28:43Z (2 years ago)
Author:
GitHub <noreply@…>
Children:
f628215
Parents:
2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
git-committer:
GitHub <noreply@…> (2021-10-24 08:28:43)
Message:

Merge branch 'HelenOS:master' into master

File:
1 edited

Legend:

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

    r2ce943a r8a9a41e  
    6161        wdecor_edge_h = 4,
    6262        wdecor_tbar_h = 22,
    63         wdecor_tbar_h_text = 1,
    6463        wdecor_frame_w = 4,
    6564        wdecor_frame_w_text = 1
     
    170169        gfx_rect_t rect;
    171170        gfx_rect_t trect;
     171        gfx_rect_t text_rect;
    172172        gfx_text_fmt_t fmt;
    173173        gfx_coord2_t pos;
     
    180180
    181181                if (wdecor->res->textmode != false) {
    182                         rc = ui_paint_bevel(wdecor->res->gc, &rect,
    183                             wdecor->res->wnd_frame_hi_color,
    184                             wdecor->res->wnd_frame_sh_color, 1, &rect);
     182                        rc = ui_paint_text_box(wdecor->res, &rect,
     183                            ui_box_double, wdecor->res->wnd_face_color);
    185184                        if (rc != EOK)
    186185                                return rc;
     
    208207                        if (rc != EOK)
    209208                                return rc;
     209
     210                        rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
     211                            wdecor->res->tbar_act_bg_color :
     212                            wdecor->res->tbar_inact_bg_color);
     213                        if (rc != EOK)
     214                                return rc;
     215
     216                        rc = gfx_fill_rect(wdecor->res->gc, &trect);
     217                        if (rc != EOK)
     218                                return rc;
    210219                }
    211 
    212                 rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
    213                     wdecor->res->tbar_act_bg_color :
    214                     wdecor->res->tbar_inact_bg_color);
    215                 if (rc != EOK)
    216                         return rc;
    217 
    218                 rc = gfx_fill_rect(wdecor->res->gc, &trect);
    219                 if (rc != EOK)
    220                         return rc;
    221220
    222221                gfx_text_fmt_init(&fmt);
     
    230229                pos.y = (trect.p0.y + trect.p1.y) / 2;
    231230
     231                if (wdecor->res->textmode) {
     232                        /* Make space around caption text */
     233                        gfx_text_rect(wdecor->res->font, &pos, &fmt,
     234                            wdecor->caption, &text_rect);
     235
     236                        /* Only make space if caption is non-empty */
     237                        if (text_rect.p0.x < text_rect.p1.x) {
     238                                text_rect.p0.x -= 1;
     239                                text_rect.p1.x += 1;
     240                        }
     241
     242                        rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
     243                            wdecor->res->tbar_act_bg_color :
     244                            wdecor->res->tbar_inact_bg_color);
     245                        if (rc != EOK)
     246                                return rc;
     247
     248                        rc = gfx_fill_rect(wdecor->res->gc, &text_rect);
     249                        if (rc != EOK)
     250                                return rc;
     251                }
     252
    232253                rc = gfx_puttext(wdecor->res->font, &pos, &fmt, wdecor->caption);
    233254                if (rc != EOK)
     
    301322{
    302323        gfx_coord_t frame_w;
    303         gfx_coord_t tbar_h;
    304324
    305325        /* Does window have a frame? */
     
    318338        /* Does window have a title bar? */
    319339        if ((wdecor->style & ui_wds_titlebar) != 0) {
    320                 tbar_h = wdecor->res->textmode ?
    321                     wdecor_tbar_h_text : wdecor_tbar_h;
    322 
    323                 geom->title_bar_rect.p0 = geom->interior_rect.p0;
    324                 geom->title_bar_rect.p1.x = geom->interior_rect.p1.x;
    325                 geom->title_bar_rect.p1.y = geom->interior_rect.p0.y + tbar_h;
     340                if (wdecor->res->textmode) {
     341                        geom->title_bar_rect.p0 = wdecor->rect.p0;
     342                        geom->title_bar_rect.p1.x = wdecor->rect.p1.x;
     343                        geom->title_bar_rect.p1.y = wdecor->rect.p0.y + 1;
     344                } else {
     345                        geom->title_bar_rect.p0 = geom->interior_rect.p0;
     346                        geom->title_bar_rect.p1.x = geom->interior_rect.p1.x;
     347                        geom->title_bar_rect.p1.y = geom->interior_rect.p0.y +
     348                            wdecor_tbar_h;
     349                }
    326350
    327351                geom->app_area_rect.p0.x = geom->interior_rect.p0.x;
Note: See TracChangeset for help on using the changeset viewer.