Changeset dcfd422 in mainline for uspace/lib


Ignore:
Timestamp:
2020-10-23T13:45:18Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a43bd0
Parents:
26653c9
git-author:
Jiri Svoboda <jiri@…> (2020-10-22 19:44:59)
git-committer:
Jiri Svoboda <jiri@…> (2020-10-23 13:45:18)
Message:

Decorate terminal window

Location:
uspace/lib/ui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/include/ui/wdecor.h

    r26653c9 rdcfd422  
    5252extern errno_t ui_wdecor_paint(ui_wdecor_t *);
    5353extern void ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *);
     54extern void ui_wdecor_rect_from_app(gfx_rect_t *, gfx_rect_t *);
    5455
    5556#endif
  • uspace/lib/ui/src/wdecor.c

    r26653c9 rdcfd422  
    271271}
    272272
     273/** Get outer rectangle from application area rectangle.
     274 *
     275 * Note that this needs to work just based on a UI, without having an actual
     276 * window decoration, since we need it in order to create the window
     277 * and its decoration.
     278 *
     279 * @param app Application area rectangle
     280 * @param rect Place to store (outer) window decoration rectangle
     281 */
     282void ui_wdecor_rect_from_app(gfx_rect_t *app, gfx_rect_t *rect)
     283{
     284        rect->p0.x = app->p0.x - 4;
     285        rect->p0.y = app->p0.y - 22 - 4;
     286        rect->p1.x = app->p1.x + 4;
     287        rect->p1.y = app->p1.y + 4;
     288}
     289
    273290/** Handle window decoration position event.
    274291 *
  • uspace/lib/ui/test/wdecor.c

    r26653c9 rdcfd422  
    310310}
    311311
     312/** ui_wdecor_get_geom() produces the correct geometry */
    312313PCUT_TEST(get_geom)
    313314{
     
    349350
    350351        ui_wdecor_destroy(wdecor);
     352}
     353
     354/** ui_wdecor_rect_from_app() correctly converts application to window rect */
     355PCUT_TEST(rect_from_app)
     356{
     357        gfx_rect_t arect;
     358        gfx_rect_t rect;
     359
     360        arect.p0.x = 14;
     361        arect.p0.y = 46;
     362        arect.p1.x = 96;
     363        arect.p1.y = 196;
     364
     365        ui_wdecor_rect_from_app(&arect, &rect);
     366
     367        PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
     368        PCUT_ASSERT_INT_EQUALS(20, rect.p0.y);
     369        PCUT_ASSERT_INT_EQUALS(100, rect.p1.x);
     370        PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
    351371}
    352372
Note: See TracChangeset for help on using the changeset viewer.