Changeset c632c96 in mainline for uspace/lib/ui
- Timestamp:
- 2021-10-25T00:32:45Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 39ab17c
- Parents:
- f59212cc
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-20 22:22:04)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-10-25 00:32:45)
- Location:
- uspace/lib/ui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/ui/ui.h
rf59212cc rc632c96 52 52 extern bool ui_is_textmode(ui_t *); 53 53 extern bool ui_is_fullscreen(ui_t *); 54 extern errno_t ui_suspend(ui_t *); 55 extern errno_t ui_resume(ui_t *); 54 56 55 57 #endif -
uspace/lib/ui/src/ui.c
rf59212cc rc632c96 40 40 #include <fibril.h> 41 41 #include <gfx/color.h> 42 #include <gfx/cursor.h> 42 43 #include <gfx/render.h> 43 44 #include <io/console.h> … … 355 356 } 356 357 358 /** Free up console for other users. 359 * 360 * Release console resources for another application (that the current 361 * task is starting). After the other application finishes, resume 362 * operation with ui_resume(). No calls to UI must happen inbetween 363 * and no events must be processed (i.e. the calling function must not 364 * return control to UI. 365 * 366 * @param ui UI 367 * @return EOK on success or an error code 368 */ 369 errno_t ui_suspend(ui_t *ui) 370 { 371 if (ui->cgc == NULL) 372 return EOK; 373 374 return console_gc_suspend(ui->cgc); 375 } 376 377 /** Resume suspended UI. 378 * 379 * Reclaim console resources (after child application has finished running) 380 * and restore UI operation previously suspended by calling ui_suspend(). 381 * 382 * @param ui UI 383 * @return EOK on success or an error code 384 */ 385 errno_t ui_resume(ui_t *ui) 386 { 387 errno_t rc; 388 389 if (ui->cgc == NULL) 390 return EOK; 391 392 rc = console_gc_resume(ui->cgc); 393 if (rc != EOK) 394 return rc; 395 396 return gfx_cursor_set_visible(console_gc_get_ctx(ui->cgc), false); 397 } 398 357 399 /** Terminate user interface. 358 400 * -
uspace/lib/ui/test/ui.c
rf59212cc rc632c96 67 67 { 68 68 ui_destroy(NULL); 69 } 70 71 /** ui_suspend() / ui_resume() do nothing if we don't have a console */ 72 PCUT_TEST(suspend_resume) 73 { 74 ui_t *ui = NULL; 75 errno_t rc; 76 77 rc = ui_create_disp(NULL, &ui); 78 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 79 PCUT_ASSERT_NOT_NULL(ui); 80 81 rc = ui_suspend(ui); 82 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 83 rc = ui_resume(ui); 84 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 85 86 ui_destroy(ui); 69 87 } 70 88
Note:
See TracChangeset
for help on using the changeset viewer.