Changeset 552b69f in mainline
- Timestamp:
- 2021-11-03T20:56:59Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1aa8c86
- Parents:
- ec8a1bf
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/calculator/calculator.c
rec8a1bf r552b69f 787 787 int main(int argc, char *argv[]) 788 788 { 789 const char *display_spec = UI_ DISPLAY_DEFAULT;789 const char *display_spec = UI_ANY_DEFAULT; 790 790 ui_t *ui; 791 791 ui_resource_t *ui_res; -
uspace/app/hello/hello.c
rec8a1bf r552b69f 152 152 int main(int argc, char *argv[]) 153 153 { 154 const char *display_spec = UI_ DISPLAY_DEFAULT;154 const char *display_spec = UI_ANY_DEFAULT; 155 155 errno_t rc; 156 156 int i; -
uspace/app/launcher/launcher.c
rec8a1bf r552b69f 56 56 #define NAME "launcher" 57 57 58 static c har *display_spec = UI_DISPLAY_DEFAULT;58 static const char *display_spec = UI_DISPLAY_DEFAULT; 59 59 60 60 static void wnd_close(ui_window_t *, void *); … … 137 137 *argp++ = app; 138 138 139 if ( display_spec != UI_DISPLAY_DEFAULT) {139 if (str_cmp(display_spec, UI_DISPLAY_DEFAULT) != 0) { 140 140 *argp++ = "-d"; 141 141 *argp++ = display_spec; -
uspace/app/uidemo/uidemo.c
rec8a1bf r552b69f 1019 1019 int main(int argc, char *argv[]) 1020 1020 { 1021 const char *display_spec = UI_ DISPLAY_DEFAULT;1021 const char *display_spec = UI_ANY_DEFAULT; 1022 1022 errno_t rc; 1023 1023 int i; -
uspace/lib/display/src/display.c
rec8a1bf r552b69f 68 68 dsname = SERVICE_NAME_DISPLAY; 69 69 70 rc = loc_service_get_id(dsname, &display_svc, IPC_FLAG_BLOCKING);70 rc = loc_service_get_id(dsname, &display_svc, 0); 71 71 if (rc != EOK) { 72 72 free(display); … … 75 75 76 76 display->sess = loc_service_connect(display_svc, INTERFACE_DISPLAY, 77 IPC_FLAG_BLOCKING);77 0); 78 78 if (display->sess == NULL) { 79 79 free(display); -
uspace/lib/ui/include/types/ui/ui.h
rec8a1bf r552b69f 43 43 44 44 /** Use the default display service (argument to ui_create()) */ 45 #define UI_DISPLAY_DEFAULT NULL45 #define UI_DISPLAY_DEFAULT "disp@" 46 46 /** Use the default console service (argument to ui_create()) */ 47 47 #define UI_CONSOLE_DEFAULT "cons@" 48 /** Use any available service (argument to ui_create()) */ 49 #define UI_ANY_DEFAULT "@" 48 50 /** Use dummy output (argument to ui_create()) */ 49 51 #define UI_DISPLAY_NULL "null@" … … 57 59 /** Console */ 58 60 ui_ws_console, 61 /** Any non-dummy output backend */ 62 ui_ws_any, 59 63 /** Dummy output */ 60 64 ui_ws_null -
uspace/lib/ui/src/ui.c
rec8a1bf r552b69f 69 69 const char *cp; 70 70 71 if (ospec == UI_DISPLAY_DEFAULT) {72 *ws = ui_ws_display;73 *osvc = DISPLAY_DEFAULT;74 return;75 }76 77 71 cp = ospec; 78 72 while (isalpha(*cp)) … … 86 80 } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) { 87 81 *ws = ui_ws_null; 82 } else if (str_lcmp(ospec, "@", str_length("@")) == 0) { 83 *ws = ui_ws_any; 88 84 } else { 89 85 *ws = ui_ws_unknown; … … 123 119 ui_ospec_parse(ospec, &ws, &osvc); 124 120 125 if (ws == ui_ws_display) { 126 rc = display_open(osvc, &display); 121 if (ws == ui_ws_display || ws == ui_ws_any) { 122 rc = display_open(osvc != NULL ? osvc : DISPLAY_DEFAULT, 123 &display); 127 124 if (rc != EOK) 128 return rc;125 goto disp_fail; 129 126 130 127 rc = ui_create_disp(display, &ui); 131 128 if (rc != EOK) { 132 129 display_close(display); 133 return rc; 134 } 135 } else if (ws == ui_ws_console) { 130 goto disp_fail; 131 } 132 133 ui->myoutput = true; 134 *rui = ui; 135 return EOK; 136 } 137 138 disp_fail: 139 if (ws == ui_ws_console || ws == ui_ws_any) { 136 140 console = console_init(stdin, stdout); 137 141 if (console == NULL) 138 return EIO;142 goto cons_fail; 139 143 140 144 rc = console_get_size(console, &cols, &rows); 141 145 if (rc != EOK) { 142 146 console_done(console); 143 return rc;147 goto cons_fail; 144 148 } 145 149 … … 150 154 if (rc != EOK) { 151 155 console_done(console); 152 return rc;156 goto cons_fail; 153 157 } 154 158 … … 157 161 ui_destroy(ui); 158 162 console_done(console); 159 return rc;163 goto cons_fail; 160 164 } 161 165 … … 167 171 168 172 (void) ui_paint(ui); 169 } else if (ws == ui_ws_null) { 173 ui->myoutput = true; 174 *rui = ui; 175 return EOK; 176 } 177 178 cons_fail: 179 if (ws == ui_ws_null) { 170 180 rc = ui_create_disp(NULL, &ui); 171 181 if (rc != EOK) 172 182 return rc; 173 } else { 174 return EINVAL;175 }176 177 ui->myoutput = true;178 *rui = ui; 179 return E OK;183 184 ui->myoutput = true; 185 *rui = ui; 186 return EOK; 187 } 188 189 return EINVAL; 180 190 } 181 191
Note:
See TracChangeset
for help on using the changeset viewer.