Changeset d30e067 in mainline for uspace/app
- Timestamp:
- 2025-03-02T20:02:33Z (8 months ago)
- Children:
- 8cdf360
- Parents:
- 7debda3 (diff), 4285f384 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 2 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dltest/dltest.c
r7debda3 rd30e067 944 944 return 1; 945 945 946 #ifndef STATIC_EXE 946 #ifndef STATIC_EXE // FIXME: this define is not set anywhere 947 947 948 948 if (!test_dlfcn_dl_get_private_fib_var()) -
uspace/app/nav/menu.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 55 55 ui_menu_t *mfile; 56 56 ui_menu_entry_t *mopen; 57 ui_menu_entry_t *medit; 57 58 ui_menu_entry_t *mfsep; 58 59 ui_menu_entry_t *mexit; … … 82 83 83 84 ui_menu_entry_set_cb(mopen, nav_menu_file_open, (void *) menu); 85 86 rc = ui_menu_entry_create(mfile, "~E~dit", "Ctrl-E", &medit); 87 if (rc != EOK) 88 goto error; 89 90 ui_menu_entry_set_cb(medit, nav_menu_file_edit, (void *) menu); 84 91 85 92 rc = ui_menu_entry_sep_create(mfile, &mfsep); … … 154 161 } 155 162 163 /** File / Edit menu entry selected. 164 * 165 * @param mentry Menu entry 166 * @param arg Argument (navigator_t *) 167 */ 168 void nav_menu_file_edit(ui_menu_entry_t *mentry, void *arg) 169 { 170 nav_menu_t *menu = (nav_menu_t *)arg; 171 172 if (menu->cb != NULL && menu->cb->file_edit != NULL) 173 menu->cb->file_edit(menu->cb_arg); 174 } 175 156 176 /** File / Exit menu entry selected. 157 177 * -
uspace/app/nav/menu.h
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 47 47 extern ui_control_t *nav_menu_ctl(nav_menu_t *); 48 48 extern void nav_menu_file_open(ui_menu_entry_t *, void *); 49 extern void nav_menu_file_edit(ui_menu_entry_t *, void *); 49 50 extern void nav_menu_file_exit(ui_menu_entry_t *, void *); 50 51 -
uspace/app/nav/nav.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <stdlib.h> 40 40 #include <str.h> 41 #include <task.h> 41 42 #include <ui/fixed.h> 42 43 #include <ui/filelist.h> … … 48 49 #include "panel.h" 49 50 51 #define EDITOR_CMD "/app/edit" 52 50 53 static void wnd_close(ui_window_t *, void *); 51 54 static void wnd_kbd(ui_window_t *, void *, kbd_event_t *); … … 57 60 58 61 static void navigator_file_open(void *); 62 static void navigator_file_edit(void *); 59 63 static void navigator_file_exit(void *); 60 64 61 65 static nav_menu_cb_t navigator_menu_cb = { 62 66 .file_open = navigator_file_open, 67 .file_edit = navigator_file_edit, 63 68 .file_exit = navigator_file_exit 64 69 }; 65 70 66 71 static void navigator_panel_activate_req(void *, panel_t *); 72 static void navigator_panel_file_open(void *, panel_t *, const char *); 67 73 68 74 static panel_cb_t navigator_panel_cb = { 69 .activate_req = navigator_panel_activate_req 75 .activate_req = navigator_panel_activate_req, 76 .file_open = navigator_panel_file_open 70 77 }; 71 78 … … 97 104 (event->mods & KM_CTRL) != 0) { 98 105 switch (event->key) { 106 case KC_E: 107 navigator_file_edit((void *)navigator); 108 break; 99 109 case KC_Q: 100 110 ui_quit(navigator->ui); … … 318 328 } 319 329 330 /** Open file in text editor. 331 * 332 * @param navigator Navigator 333 * @param fname File name 334 * 335 * @return EOK on success or an error code 336 */ 337 static errno_t navigator_edit_file(navigator_t *navigator, const char *fname) 338 { 339 task_id_t id; 340 task_wait_t wait; 341 task_exit_t texit; 342 int retval; 343 errno_t rc; 344 345 /* Free up and clean console for the child task. */ 346 rc = ui_suspend(navigator->ui); 347 if (rc != EOK) 348 return rc; 349 350 rc = task_spawnl(&id, &wait, EDITOR_CMD, EDITOR_CMD, fname, NULL); 351 if (rc != EOK) 352 goto error; 353 354 rc = task_wait(&wait, &texit, &retval); 355 if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) 356 goto error; 357 358 /* Resume UI operation */ 359 rc = ui_resume(navigator->ui); 360 if (rc != EOK) 361 return rc; 362 363 (void) ui_paint(navigator->ui); 364 return EOK; 365 error: 366 (void) ui_resume(navigator->ui); 367 (void) ui_paint(navigator->ui); 368 return rc; 369 } 370 371 /** Execute file entry. 372 * 373 * @param navigator Navigator 374 * @param fname File name 375 * 376 * @return EOK on success or an error code 377 */ 378 static errno_t navigator_exec_file(navigator_t *navigator, const char *fname) 379 { 380 task_id_t id; 381 task_wait_t wait; 382 task_exit_t texit; 383 int retval; 384 errno_t rc; 385 386 /* Free up and clean console for the child task. */ 387 rc = ui_suspend(navigator->ui); 388 if (rc != EOK) 389 return rc; 390 391 rc = task_spawnl(&id, &wait, fname, fname, NULL); 392 if (rc != EOK) 393 goto error; 394 395 rc = task_wait(&wait, &texit, &retval); 396 if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) 397 goto error; 398 399 /* Resume UI operation */ 400 rc = ui_resume(navigator->ui); 401 if (rc != EOK) 402 return rc; 403 404 (void) ui_paint(navigator->ui); 405 return EOK; 406 error: 407 (void) ui_resume(navigator->ui); 408 (void) ui_paint(navigator->ui); 409 return rc; 410 } 411 412 /** Open panel file entry. 413 * 414 * Perform Open action on a file entry (based on extension). 415 * 416 * @param navigator Navigator 417 * @param fname File name 418 * 419 * @return EOK on success or an error code 420 */ 421 static errno_t navigator_open_file(navigator_t *navigator, const char *fname) 422 { 423 const char *ext; 424 425 ext = str_rchr(fname, '.'); 426 if (ext != NULL) { 427 if (str_casecmp(ext, ".txt") == 0) 428 return navigator_edit_file(navigator, fname); 429 } 430 431 return navigator_exec_file(navigator, fname); 432 } 433 434 /** File / Edit menu entry selected */ 435 static void navigator_file_edit(void *arg) 436 { 437 navigator_t *navigator = (navigator_t *)arg; 438 ui_file_list_entry_t *entry; 439 ui_file_list_entry_attr_t attr; 440 panel_t *panel; 441 442 panel = navigator_get_active_panel(navigator); 443 entry = ui_file_list_get_cursor(panel->flist); 444 ui_file_list_entry_get_attr(entry, &attr); 445 446 (void)navigator_edit_file(navigator, attr.name); 447 } 448 320 449 /** File / Exit menu entry selected */ 321 450 static void navigator_file_exit(void *arg) … … 339 468 } 340 469 470 /** Panel callback requesting file open. 471 * 472 * @param arg Argument (navigator_t *) 473 * @param panel Panel 474 * @param fname File name 475 */ 476 void navigator_panel_file_open(void *arg, panel_t *panel, const char *fname) 477 { 478 navigator_t *navigator = (navigator_t *)arg; 479 480 (void)panel; 481 navigator_open_file(navigator, fname); 482 } 483 341 484 /** @} 342 485 */ -
uspace/app/nav/panel.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 377 377 } 378 378 379 /** Open panel file entry.380 *381 * Perform Open action on a file entry (i.e. try running it).382 *383 * @param panel Panel384 * @param fname File name385 *386 * @return EOK on success or an error code387 */388 static errno_t panel_open_file(panel_t *panel, const char *fname)389 {390 task_id_t id;391 task_wait_t wait;392 task_exit_t texit;393 int retval;394 errno_t rc;395 ui_t *ui;396 397 ui = ui_window_get_ui(panel->window);398 399 /* Free up and clean console for the child task. */400 rc = ui_suspend(ui);401 if (rc != EOK)402 return rc;403 404 rc = task_spawnl(&id, &wait, fname, fname, NULL);405 if (rc != EOK)406 goto error;407 408 rc = task_wait(&wait, &texit, &retval);409 if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))410 goto error;411 412 /* Resume UI operation */413 rc = ui_resume(ui);414 if (rc != EOK)415 return rc;416 417 (void) ui_paint(ui_window_get_ui(panel->window));418 return EOK;419 error:420 (void) ui_resume(ui);421 (void) ui_paint(ui_window_get_ui(panel->window));422 return rc;423 }424 425 379 /** File list in panel requests activation. 426 380 * … … 446 400 panel_t *panel = (panel_t *)arg; 447 401 448 (void) panel_open_file(panel, fname); 402 if (panel->cb != NULL && panel->cb->file_open != NULL) 403 panel->cb->file_open(panel->cb_arg, panel, fname); 449 404 } 450 405 -
uspace/app/nav/test/menu.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 37 37 38 38 static void test_menu_file_open(void *); 39 static void test_menu_file_edit(void *); 39 40 static void test_menu_file_exit(void *); 40 41 … … 42 43 static nav_menu_cb_t test_cb = { 43 44 .file_open = test_menu_file_open, 45 .file_edit = test_menu_file_edit, 44 46 .file_exit = test_menu_file_exit 45 47 }; … … 48 50 typedef struct { 49 51 bool file_open; 52 bool file_edit; 50 53 bool file_exit; 51 54 } test_resp_t; … … 148 151 } 149 152 153 /** File / Edit callback */ 154 PCUT_TEST(file_edit) 155 { 156 ui_t *ui; 157 ui_window_t *window; 158 ui_wnd_params_t params; 159 nav_menu_t *menu; 160 test_resp_t resp; 161 errno_t rc; 162 163 rc = ui_create_disp(NULL, &ui); 164 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 165 166 ui_wnd_params_init(¶ms); 167 params.caption = "Test"; 168 169 rc = ui_window_create(ui, ¶ms, &window); 170 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 171 172 rc = nav_menu_create(window, &menu); 173 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 174 175 /* Call back with no callbacks set */ 176 nav_menu_file_edit(NULL, menu); 177 178 /* Call back with dummy callbacks set */ 179 nav_menu_set_cb(menu, &dummy_cb, &resp); 180 nav_menu_file_edit(NULL, menu); 181 182 /* Call back with test callbacks set */ 183 resp.file_edit = false; 184 nav_menu_set_cb(menu, &test_cb, &resp); 185 nav_menu_file_edit(NULL, menu); 186 PCUT_ASSERT_TRUE(resp.file_edit); 187 188 nav_menu_destroy(menu); 189 ui_window_destroy(window); 190 ui_destroy(ui); 191 } 192 193 /** File / Exit callback */ 194 PCUT_TEST(file_exit) 195 { 196 ui_t *ui; 197 ui_window_t *window; 198 ui_wnd_params_t params; 199 nav_menu_t *menu; 200 test_resp_t resp; 201 errno_t rc; 202 203 rc = ui_create_disp(NULL, &ui); 204 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 205 206 ui_wnd_params_init(¶ms); 207 params.caption = "Test"; 208 209 rc = ui_window_create(ui, ¶ms, &window); 210 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 211 212 rc = nav_menu_create(window, &menu); 213 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 214 215 /* Call back with no callbacks set */ 216 nav_menu_file_exit(NULL, menu); 217 218 /* Call back with dummy callbacks set */ 219 nav_menu_set_cb(menu, &dummy_cb, &resp); 220 nav_menu_file_exit(NULL, menu); 221 222 /* Call back with test callbacks set */ 223 resp.file_exit = false; 224 nav_menu_set_cb(menu, &test_cb, &resp); 225 nav_menu_file_exit(NULL, menu); 226 PCUT_ASSERT_TRUE(resp.file_exit); 227 228 nav_menu_destroy(menu); 229 ui_window_destroy(window); 230 ui_destroy(ui); 231 } 232 150 233 /** Testing File / Open callback */ 151 234 static void test_menu_file_open(void *arg) … … 156 239 } 157 240 241 /** Testing File / Edit callback */ 242 static void test_menu_file_edit(void *arg) 243 { 244 test_resp_t *resp = (test_resp_t *)arg; 245 246 resp->file_edit = true; 247 } 248 158 249 /** Testing File / Exit callback */ 159 250 static void test_menu_file_exit(void *arg) -
uspace/app/nav/types/menu.h
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 45 45 /** File / Open */ 46 46 void (*file_open)(void *); 47 /** File / Edit */ 48 void (*file_edit)(void *); 47 49 /** File / Exit */ 48 50 void (*file_exit)(void *); -
uspace/app/nav/types/panel.h
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 80 80 /** Request panel activation */ 81 81 void (*activate_req)(void *, panel_t *); 82 /** Open file */ 83 void (*file_open)(void *, panel_t *, const char *); 82 84 } panel_cb_t; 83 85 -
uspace/app/shutdown-dlg/shutdown-dlg.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <ui/fixed.h> 42 42 #include <ui/label.h> 43 #include <ui/msgdialog.h> 43 44 #include <ui/resource.h> 44 45 #include <ui/ui.h> … … 48 49 static void wnd_close(ui_window_t *, void *); 49 50 static errno_t bg_wnd_paint(ui_window_t *, void *); 51 static void shutdown_progress_destroy(shutdown_progress_t *); 52 static errno_t shutdown_confirm_msg_create(shutdown_dlg_t *); 53 static errno_t shutdown_failed_msg_create(shutdown_dlg_t *); 54 static errno_t shutdown_start(shutdown_dlg_t *); 50 55 51 56 static ui_window_cb_t bg_window_cb = { … … 64 69 .shutdown_complete = sd_shutdown_complete, 65 70 .shutdown_failed = sd_shutdown_failed 71 }; 72 73 static void shutdown_confirm_msg_button(ui_msg_dialog_t *, void *, unsigned); 74 static void shutdown_confirm_msg_close(ui_msg_dialog_t *, void *); 75 76 static ui_msg_dialog_cb_t shutdown_confirm_msg_cb = { 77 .button = shutdown_confirm_msg_button, 78 .close = shutdown_confirm_msg_close 79 }; 80 81 static void shutdown_failed_msg_button(ui_msg_dialog_t *, void *, unsigned); 82 static void shutdown_failed_msg_close(ui_msg_dialog_t *, void *); 83 84 static ui_msg_dialog_cb_t shutdown_failed_msg_cb = { 85 .button = shutdown_failed_msg_button, 86 .close = shutdown_failed_msg_close 66 87 }; 67 88 … … 90 111 91 112 ui_lock(sddlg->ui); 92 (void)ui_label_set_text(sddlg->progress->label, "Shutdown failed."); 93 (void)ui_window_paint(sddlg->progress->window); 113 shutdown_progress_destroy(sddlg->progress); 114 sddlg->progress = NULL; 115 ui_window_destroy(sddlg->bgwindow); 116 sddlg->bgwindow = NULL; 117 (void)shutdown_failed_msg_create(sddlg); 94 118 ui_unlock(sddlg->ui); 95 119 } … … 135 159 136 160 return EOK; 161 } 162 163 /** Create shutdown confirmation dialog. 164 * 165 * @param sddlg Shutdown dialog 166 * @return EOK on success or an error code 167 */ 168 static errno_t shutdown_confirm_msg_create(shutdown_dlg_t *sddlg) 169 { 170 ui_msg_dialog_params_t params; 171 ui_msg_dialog_t *dialog; 172 errno_t rc; 173 174 ui_msg_dialog_params_init(¶ms); 175 params.caption = "Shutdown"; 176 params.text = "Do you want to shut the system down?"; 177 params.choice = umdc_ok_cancel; 178 params.flags |= umdf_topmost | umdf_center; 179 180 rc = ui_msg_dialog_create(sddlg->ui, ¶ms, &dialog); 181 if (rc != EOK) 182 return rc; 183 184 ui_msg_dialog_set_cb(dialog, &shutdown_confirm_msg_cb, sddlg); 185 186 return EOK; 187 } 188 189 /** Create 'shutdown failed' message dialog. 190 * 191 * @param sddlg Shutdown dialog 192 * @return EOK on success or an error code 193 */ 194 static errno_t shutdown_failed_msg_create(shutdown_dlg_t *sddlg) 195 { 196 ui_msg_dialog_params_t params; 197 ui_msg_dialog_t *dialog; 198 errno_t rc; 199 200 ui_msg_dialog_params_init(¶ms); 201 params.caption = "Shutdown failed"; 202 params.text = "The system failed to shut down properly."; 203 204 rc = ui_msg_dialog_create(sddlg->ui, ¶ms, &dialog); 205 if (rc != EOK) 206 return rc; 207 208 ui_msg_dialog_set_cb(dialog, &shutdown_failed_msg_cb, sddlg); 209 210 return EOK; 211 } 212 213 /** Shutdown confirm message dialog button press. 214 * 215 * @param dialog Message dialog 216 * @param arg Argument (ui_demo_t *) 217 * @param bnum Button number 218 */ 219 static void shutdown_confirm_msg_button(ui_msg_dialog_t *dialog, 220 void *arg, unsigned bnum) 221 { 222 shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg; 223 224 ui_msg_dialog_destroy(dialog); 225 226 if (bnum == 0) 227 shutdown_start(sddlg); 228 else 229 ui_quit(sddlg->ui); 230 } 231 232 /** Shutdown confirm message dialog close request. 233 * 234 * @param dialog Message dialog 235 * @param arg Argument (ui_demo_t *) 236 */ 237 static void shutdown_confirm_msg_close(ui_msg_dialog_t *dialog, void *arg) 238 { 239 shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg; 240 241 ui_msg_dialog_destroy(dialog); 242 ui_quit(sddlg->ui); 243 } 244 245 /** Shutdown faield message dialog button press. 246 * 247 * @param dialog Message dialog 248 * @param arg Argument (ui_demo_t *) 249 * @param bnum Button number 250 */ 251 static void shutdown_failed_msg_button(ui_msg_dialog_t *dialog, 252 void *arg, unsigned bnum) 253 { 254 shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg; 255 256 ui_msg_dialog_destroy(dialog); 257 ui_quit(sddlg->ui); 258 } 259 260 /** Shutdown failed message dialog close request. 261 * 262 * @param dialog Message dialog 263 * @param arg Argument (ui_demo_t *) 264 */ 265 static void shutdown_failed_msg_close(ui_msg_dialog_t *dialog, void *arg) 266 { 267 shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg; 268 269 ui_msg_dialog_destroy(dialog); 270 ui_quit(sddlg->ui); 137 271 } 138 272 … … 162 296 params.rect.p0.x = 0; 163 297 params.rect.p0.y = 0; 164 params.rect.p1.x = 24;298 params.rect.p1.x = 64; 165 299 params.rect.p1.y = 5; 166 300 } else { … … 245 379 static void shutdown_progress_destroy(shutdown_progress_t *progress) 246 380 { 381 if (progress == NULL) 382 return; 383 247 384 ui_window_destroy(progress->window); 248 385 free(progress); 249 386 } 250 387 388 static errno_t shutdown_start(shutdown_dlg_t *sddlg) 389 { 390 errno_t rc; 391 392 rc = shutdown_progress_create(sddlg, &sddlg->progress); 393 if (rc != EOK) 394 return rc; 395 396 rc = system_open(SYSTEM_DEFAULT, &sd_system_cb, sddlg, &sddlg->system); 397 if (rc != EOK) { 398 printf("Failed opening system control service.\n"); 399 goto error; 400 } 401 402 rc = system_shutdown(sddlg->system); 403 if (rc != EOK) { 404 printf("Failed requesting system shutdown.\n"); 405 goto error; 406 } 407 408 return EOK; 409 error: 410 return rc; 411 } 412 251 413 /** Run shutdown dialog on display. */ 252 414 static errno_t shutdown_dlg(const char *display_spec) 253 415 { 254 416 ui_t *ui = NULL; 417 shutdown_dlg_t sddlg; 255 418 ui_wnd_params_t params; 256 ui_window_t *window = NULL;257 shutdown_dlg_t sddlg;258 419 errno_t rc; 259 420 … … 265 426 goto error; 266 427 } 428 429 sddlg.ui = ui; 267 430 268 431 ui_wnd_params_init(¶ms); … … 271 434 params.placement = ui_wnd_place_full_screen; 272 435 params.flags |= ui_wndf_topmost | ui_wndf_nofocus; 273 if (ui_is_textmode(ui)) { 274 params.rect.p0.x = 0; 275 params.rect.p0.y = 0; 276 params.rect.p1.x = 24; 277 params.rect.p1.y = 5; 436 /* 437 * params.rect.p0.x = 0; 438 * params.rect.p0.y = 0; 439 * params.rect.p1.x = 1; 440 * params.rect.p1.y = 1; 441 */ 442 443 rc = ui_window_create(sddlg.ui, ¶ms, &sddlg.bgwindow); 444 if (rc != EOK) { 445 printf("Error creating window.\n"); 446 goto error; 447 } 448 449 ui_window_set_cb(sddlg.bgwindow, &bg_window_cb, (void *)&sddlg); 450 451 if (ui_is_textmode(sddlg.ui)) { 452 rc = gfx_color_new_ega(0x17, &sddlg.bg_color); 453 if (rc != EOK) { 454 printf("Error allocating color.\n"); 455 goto error; 456 } 278 457 } else { 279 params.rect.p0.x = 0; 280 params.rect.p0.y = 0; 281 params.rect.p1.x = 300; 282 params.rect.p1.y = 60; 283 } 284 285 sddlg.ui = ui; 286 287 rc = ui_window_create(ui, ¶ms, &window); 288 if (rc != EOK) { 289 printf("Error creating window.\n"); 290 goto error; 291 } 292 293 ui_window_set_cb(window, &bg_window_cb, (void *) &sddlg); 294 sddlg.bgwindow = window; 295 296 rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &sddlg.bg_color); 297 if (rc != EOK) { 298 printf("Error allocating color.\n"); 299 goto error; 300 } 301 302 rc = ui_window_paint(window); 458 rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &sddlg.bg_color); 459 if (rc != EOK) { 460 printf("Error allocating color.\n"); 461 goto error; 462 } 463 } 464 465 rc = ui_window_paint(sddlg.bgwindow); 303 466 if (rc != EOK) { 304 467 printf("Error painting window.\n"); … … 306 469 } 307 470 308 rc = shutdown_progress_create(&sddlg, &sddlg.progress); 309 if (rc != EOK) 310 return rc; 311 312 rc = system_open(SYSTEM_DEFAULT, &sd_system_cb, &sddlg, &sddlg.system); 313 if (rc != EOK) { 314 printf("Failed opening system control service.\n"); 315 goto error; 316 } 317 318 rc = system_shutdown(sddlg.system); 319 if (rc != EOK) { 320 printf("Failed requesting system shutdown.\n"); 321 goto error; 322 } 471 (void)shutdown_confirm_msg_create(&sddlg); 323 472 324 473 ui_run(ui); 325 474 326 475 shutdown_progress_destroy(sddlg.progress); 327 ui_window_destroy(window); 328 system_close(sddlg.system); 476 if (sddlg.bgwindow != NULL) 477 ui_window_destroy(sddlg.bgwindow); 478 if (sddlg.system != NULL) 479 system_close(sddlg.system); 329 480 gfx_color_delete(sddlg.bg_color); 330 481 ui_destroy(ui); … … 336 487 if (sddlg.bg_color != NULL) 337 488 gfx_color_delete(sddlg.bg_color); 338 if ( window != NULL)339 ui_window_destroy( window);489 if (sddlg.bgwindow != NULL) 490 ui_window_destroy(sddlg.bgwindow); 340 491 if (ui != NULL) 341 492 ui_destroy(ui); -
uspace/app/sysinst/rdimg.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 20 18Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 191 191 192 192 printf("rd_img_close: eject RAM disk volume\n"); 193 rc = vol_part_eject(vol, rd_svcid );193 rc = vol_part_eject(vol, rd_svcid, vef_none); 194 194 if (rc != EOK) { 195 195 printf("Error ejecting RAM disk volume.\n"); -
uspace/app/sysinst/sysinst.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 475 475 } 476 476 477 rc = vol_part_eject(vol, part_id );477 rc = vol_part_eject(vol, part_id, vef_physical); 478 478 if (rc != EOK) { 479 479 printf("Error ejecting volume.\n"); -
uspace/app/taskbar/taskbar.sif
r7debda3 rd30e067 25 25 <entry caption="~D~isplay Configuration" cmd="/app/display-cfg -d %d" terminal="n"> 26 26 </entry> 27 <entry caption="Ta ~s~kbarConfiguration" cmd="/app/taskbar-cfg -d %d" terminal="n">27 <entry caption="Taskba~r~ Configuration" cmd="/app/taskbar-cfg -d %d" terminal="n"> 28 28 </entry> 29 29 <entry separator="y"> … … 37 37 <entry caption="~A~bout HelenOS" cmd="/app/aboutos -d %d" terminal="n"> 38 38 </entry> 39 <entry caption="~S~hut Down..." cmd="/app/shutdown-dlg -d %d" terminal="n"> 40 </entry> 39 41 </entries> 40 42 </sif> -
uspace/app/tester/meson.build
r7debda3 rd30e067 1 1 # 2 # Copyright (c) 202 3Jiri Svoboda2 # Copyright (c) 2025 Jiri Svoboda 3 3 # Copyright (c) 2005 Martin Decky 4 4 # Copyright (c) 2007 Jakub Jermar … … 33 33 'tester.c', 34 34 'util.c', 35 'thread/deadlock.c', 35 36 'thread/thread1.c', 36 37 'thread/setjmp1.c', -
uspace/app/tester/mm/mapping1.c
r7debda3 rd30e067 73 73 for (i = 0; i < page_count; i++) { 74 74 void *page_start = ((char *) area) + PAGE_SIZE * i; 75 errno_t rc = as_get_physical_mapping(page_start, NULL); 75 uintptr_t phys_dummy; 76 errno_t rc = as_get_physical_mapping(page_start, &phys_dummy); 76 77 if (rc != expected_rc) { 77 78 TPRINTF("as_get_physical_mapping() = %s != %s\n", -
uspace/app/tester/tester.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2006 Ondrej Palkovsky 3 4 * Copyright (c) 2007 Martin Decky … … 49 50 50 51 test_t tests[] = { 52 #include "thread/deadlock.def" 51 53 #include "thread/thread1.def" 52 54 #include "thread/setjmp1.def" -
uspace/app/tester/tester.h
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2007 Martin Decky 3 4 * All rights reserved. … … 79 80 } test_t; 80 81 82 extern const char *test_deadlock(void); 81 83 extern const char *test_thread1(void); 82 84 extern const char *test_setjmp1(void); -
uspace/app/vol/vol.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 20 17Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include <io/table.h> 37 37 #include <loc.h> 38 #include <stdbool.h> 38 39 #include <stdio.h> 39 40 #include <stdlib.h> … … 107 108 } 108 109 109 static errno_t vol_cmd_eject(const char *volspec )110 static errno_t vol_cmd_eject(const char *volspec, bool physical) 110 111 { 111 112 vol_t *vol = NULL; … … 125 126 } 126 127 127 rc = vol_part_eject(vol, part_id); 128 rc = vol_part_eject(vol, part_id, physical ? vef_physical : 129 vef_none); 128 130 if (rc != EOK) { 129 131 printf("Error ejecting volume.\n"); … … 323 325 { 324 326 printf("Syntax:\n"); 325 printf(" %s List present volumes\n", NAME); 326 printf(" %s -c List volume configuration entries\n", NAME); 327 printf(" %s -h Print help\n", NAME); 328 printf(" %s eject <mp> Eject volume mounted in a directory\n", NAME); 329 printf(" %s insert <svc> Insert volume based on service identifier\n", NAME); 330 printf(" %s insert -p <mp> Insert volume based on filesystem path\n", NAME); 327 printf(" %s List present volumes\n", NAME); 328 printf(" %s -c List volume configuration entries\n", NAME); 329 printf(" %s -h Print help\n", NAME); 330 printf(" %s eject [-s] <mp> Eject volume mounted in a directory\n", NAME); 331 printf(" -s to eject physically\n"); 332 printf(" %s insert <svc> Insert volume based on service identifier\n", NAME); 333 printf(" %s insert -p <mp> Insert volume based on filesystem path\n", NAME); 331 334 } 332 335 … … 336 339 char *volspec; 337 340 vol_cmd_t vcmd; 341 bool physical = false; 338 342 int i; 339 343 errno_t rc = EINVAL; … … 351 355 } else if (str_cmp(cmd, "eject") == 0) { 352 356 vcmd = vcmd_eject; 357 if (str_cmp(argv[i], "-s") == 0) { 358 physical = true; 359 ++i; 360 } 361 353 362 if (argc <= i) { 354 363 printf("Parameter missing.\n"); … … 382 391 switch (vcmd) { 383 392 case vcmd_eject: 384 rc = vol_cmd_eject(volspec );393 rc = vol_cmd_eject(volspec, physical); 385 394 break; 386 395 case vcmd_insert:
Note:
See TracChangeset
for help on using the changeset viewer.