Changeset 211fd68 in mainline for uspace/lib/ui/src/wdecor.c


Ignore:
Timestamp:
2024-03-08T10:41:31Z (10 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
0a411bbf
Parents:
cd27cd1
git-author:
Jiri Svoboda <jiri@…> (2024-03-07 18:41:21)
git-committer:
Jiri Svoboda <jiri@…> (2024-03-08 10:41:31)
Message:

Add text mode support to Barber

File:
1 edited

Legend:

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

    rcd27cd1 r211fd68  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4545#include <ui/paint.h>
    4646#include <ui/pbutton.h>
     47#include <ui/ui.h>
    4748#include <ui/wdecor.h>
    4849#include "../private/resource.h"
     
    9495        /** Window resizing edge height */
    9596        wdecor_edge_h = 4,
     97        /** Window resizing edge witdth */
     98        wdecor_edge_w_text = 1,
     99        /** Window resizing edge height */
     100        wdecor_edge_h_text = 1,
    96101        /** Title bar height */
    97102        wdecor_tbar_h = 22,
     
    860865 * and its decoration.
    861866 *
     867 * @param ui UI
    862868 * @param style Decoration style
    863869 * @param app Application area rectangle
    864870 * @param rect Place to store (outer) window decoration rectangle
    865871 */
    866 void ui_wdecor_rect_from_app(ui_wdecor_style_t style, gfx_rect_t *app,
    867     gfx_rect_t *rect)
    868 {
     872void ui_wdecor_rect_from_app(ui_t *ui, ui_wdecor_style_t style,
     873    gfx_rect_t *app, gfx_rect_t *rect)
     874{
     875        bool textmode;
     876        gfx_coord_t edge_w, edge_h;
    869877        *rect = *app;
    870878
     879        textmode = ui_is_textmode(ui);
     880        if (textmode) {
     881                edge_w = wdecor_edge_w_text;
     882                edge_h = wdecor_edge_h_text;
     883        } else {
     884                edge_w = wdecor_edge_w;
     885                edge_h = wdecor_edge_h;
     886        }
     887
    871888        if ((style & ui_wds_frame) != 0) {
    872                 rect->p0.x -= wdecor_edge_w;
    873                 rect->p0.y -= wdecor_edge_h;
    874                 rect->p1.x += wdecor_edge_w;
    875                 rect->p1.y += wdecor_edge_h;
    876         }
    877 
    878         if ((style & ui_wds_titlebar) != 0)
    879                 rect->p0.y -= 22;
     889                rect->p0.x -= edge_w;
     890                rect->p0.y -= edge_h;
     891                rect->p1.x += edge_w;
     892                rect->p1.y += edge_h;
     893        }
     894
     895        if ((style & ui_wds_titlebar) != 0 && !textmode)
     896                rect->p0.y -= wdecor_tbar_h;
    880897}
    881898
Note: See TracChangeset for help on using the changeset viewer.