Changeset 14cbf07 in mainline for uspace/app/display-cfg/display-cfg.c
- Timestamp:
- 2023-05-15T16:19:52Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2b5628c, 8a4ceaa
- Parents:
- aace43d8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/display-cfg/display-cfg.c
raace43d8 r14cbf07 65 65 * 66 66 * @param display_spec Display specification 67 * @param dcfg_svc Display configuration service name or DISPCFG_DEFAULT 67 68 * @param rdcfg Place to store pointer to new display configuration 68 69 * @return EOK on success or an error code … … 82 83 printf("Out of memory.\n"); 83 84 return ENOMEM; 84 }85 86 rc = dispcfg_open(DISPCFG_DEFAULT, NULL, NULL, &dcfg->dispcfg);87 if (rc != EOK) {88 printf("Error opening display configuration service.\n");89 goto error;90 85 } 91 86 … … 150 145 ui_window_add(window, ui_fixed_ctl(dcfg->fixed)); 151 146 152 rc = ui_window_paint(window);153 if (rc != EOK) {154 printf("Error painting window.\n");155 return rc;156 }157 158 147 *rdcfg = dcfg; 159 148 return EOK; … … 167 156 if (dcfg->ui != NULL) 168 157 ui_destroy(ui); 158 free(dcfg); 159 return rc; 160 } 161 162 /** Open display configuration service. 163 * 164 * @param dcfg Display configuration dialog 165 * @param dcfg_svc Display configuration service name or DISPCFG_DEFAULT 166 * @return EOK on success or an error code 167 */ 168 errno_t display_cfg_open(display_cfg_t *dcfg, const char *dcfg_svc) 169 { 170 errno_t rc; 171 172 rc = dispcfg_open(dcfg_svc, NULL, NULL, &dcfg->dispcfg); 173 if (rc != EOK) { 174 printf("Error opening display configuration service.\n"); 175 goto error; 176 } 177 178 return EOK; 179 error: 180 return rc; 181 } 182 183 /** Populate display configuration from isplay configuration service. 184 * 185 * @param dcfg Display configuration dialog 186 * @return EOK on success or an error code 187 */ 188 errno_t display_cfg_populate(display_cfg_t *dcfg) 189 { 190 errno_t rc; 191 192 rc = dcfg_seats_populate(dcfg->seats); 193 if (rc != EOK) 194 return rc; 195 196 rc = ui_window_paint(dcfg->window); 197 if (rc != EOK) { 198 printf("Error painting window.\n"); 199 return rc; 200 } 201 202 return EOK; 203 } 204 205 /** Destroy display configuration dialog. 206 * 207 * @param dcfg Display configuration dialog 208 */ 209 void display_cfg_destroy(display_cfg_t *dcfg) 210 { 169 211 if (dcfg->dispcfg != NULL) 170 212 dispcfg_close(dcfg->dispcfg); 171 free(dcfg);172 return rc;173 }174 175 /** Destroy display configuration dialog.176 *177 * @param dcfg Display configuration dialog178 */179 void display_cfg_destroy(display_cfg_t *dcfg)180 {181 213 ui_window_destroy(dcfg->window); 182 214 ui_destroy(dcfg->ui);
Note:
See TracChangeset
for help on using the changeset viewer.