Changeset dcfd422 in mainline for uspace/lib
- Timestamp:
- 2020-10-23T13:45:18Z (5 years ago)
- 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)
- Location:
- uspace/lib/ui
- Files:
-
- 3 edited
-
include/ui/wdecor.h (modified) (1 diff)
-
src/wdecor.c (modified) (1 diff)
-
test/wdecor.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/ui/wdecor.h
r26653c9 rdcfd422 52 52 extern errno_t ui_wdecor_paint(ui_wdecor_t *); 53 53 extern void ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *); 54 extern void ui_wdecor_rect_from_app(gfx_rect_t *, gfx_rect_t *); 54 55 55 56 #endif -
uspace/lib/ui/src/wdecor.c
r26653c9 rdcfd422 271 271 } 272 272 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 */ 282 void 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 273 290 /** Handle window decoration position event. 274 291 * -
uspace/lib/ui/test/wdecor.c
r26653c9 rdcfd422 310 310 } 311 311 312 /** ui_wdecor_get_geom() produces the correct geometry */ 312 313 PCUT_TEST(get_geom) 313 314 { … … 349 350 350 351 ui_wdecor_destroy(wdecor); 352 } 353 354 /** ui_wdecor_rect_from_app() correctly converts application to window rect */ 355 PCUT_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); 351 371 } 352 372
Note:
See TracChangeset
for help on using the changeset viewer.
