Changeset 3d10a2f in mainline
- Timestamp:
- 2021-10-04T12:25:43Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cd981f2a, e0e1b3d
- Parents:
- 6d172f6
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-03 17:25:36)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-10-04 12:25:43)
- Location:
- uspace/lib/ui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/include/types/ui/ui.h
r6d172f6 r3d10a2f 46 46 /** Use the default console service (argument to ui_create()) */ 47 47 #define UI_CONSOLE_DEFAULT "cons@" 48 /** Use dummy output (argument to ui_create()) */ 49 #define UI_DISPLAY_NULL "null@" 48 50 49 51 /** Window system */ … … 54 56 ui_ws_display, 55 57 /** Console */ 56 ui_ws_console 58 ui_ws_console, 59 /** Dummy output */ 60 ui_ws_null 57 61 } ui_winsys_t; 58 62 -
uspace/lib/ui/include/ui/window.h
r6d172f6 r3d10a2f 56 56 extern ui_window_t *ui_window_get_active(ui_t *); 57 57 extern errno_t ui_window_resize(ui_window_t *, gfx_rect_t *); 58 extern ui_t *ui_window_get_ui(ui_window_t *); 58 59 extern ui_resource_t *ui_window_get_res(ui_window_t *); 59 60 extern gfx_context_t *ui_window_get_gc(ui_window_t *); -
uspace/lib/ui/src/ui.c
r6d172f6 r3d10a2f 55 55 * 56 56 * Output specification has the form <proto>@<service> where proto is 57 * eiher 'disp' for display service or 'cons' for console. Service58 * is a location ID service name (e.g. hid/display).57 * eiher 'disp' for display service, 'cons' for console, 'null' 58 * for dummy output. Service is a location ID service name (e.g. hid/display). 59 59 * 60 60 * @param ospec Output specification … … 82 82 } else if (str_lcmp(ospec, "cons@", str_length("cons@")) == 0) { 83 83 *ws = ui_ws_console; 84 } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) { 85 *ws = ui_ws_null; 84 86 } else { 85 87 *ws = ui_ws_unknown; … … 99 101 * 100 102 * @param ospec Output specification or @c UI_DISPLAY_DEFAULT to use 101 * the default output 103 * the default display service, UI_CONSOLE_DEFAULT to use 104 * the default console service, UI_DISPLAY_NULL to use 105 * dummy output. 102 106 * @param rui Place to store pointer to new UI 103 107 * @return EOK on success or an error code … … 161 165 162 166 (void) ui_paint(ui); 167 } else if (ws == ui_ws_null) { 168 rc = ui_create_disp(NULL, &ui); 169 if (rc != EOK) 170 return rc; 163 171 } else { 164 172 return EINVAL; -
uspace/lib/ui/src/window.c
r6d172f6 r3d10a2f 601 601 } 602 602 603 /** Get window's containing UI. 604 * 605 * @param window Window 606 * @return Containing UI 607 */ 608 ui_t *ui_window_get_ui(ui_window_t *window) 609 { 610 return window->ui; 611 } 612 603 613 /** Get UI resource from window. 604 614 * -
uspace/lib/ui/test/window.c
r6d172f6 r3d10a2f 258 258 } 259 259 260 /** ui_window_get_ui() returns containing UI */ 261 PCUT_TEST(get_ui) 262 { 263 errno_t rc; 264 ui_t *ui = NULL; 265 ui_t *rui; 266 ui_wnd_params_t params; 267 ui_window_t *window = NULL; 268 269 rc = ui_create_disp(NULL, &ui); 270 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 271 272 ui_wnd_params_init(¶ms); 273 params.caption = "Hello"; 274 275 rc = ui_window_create(ui, ¶ms, &window); 276 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 277 PCUT_ASSERT_NOT_NULL(window); 278 279 rui = ui_window_get_ui(window); 280 PCUT_ASSERT_EQUALS(ui, rui); 281 282 ui_window_destroy(window); 283 ui_destroy(ui); 284 } 285 260 286 /** ui_window_get_res/gc/rect() return valid objects */ 261 287 PCUT_TEST(get_res_gc_rect)
Note:
See TracChangeset
for help on using the changeset viewer.