Changeset aefdccd in mainline for uspace/lib/ui/src
- Timestamp:
- 2025-10-20T06:14:54Z (3 months ago)
- Parents:
- adbd7e1 (diff), 3e41cc4 (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. - git-author:
- boba-buba <120932204+boba-buba@…> (2025-10-20 06:14:54)
- git-committer:
- GitHub <noreply@…> (2025-10-20 06:14:54)
- Location:
- uspace/lib/ui/src
- Files:
-
- 5 edited
-
filelist.c (modified) (3 diffs)
-
list.c (modified) (2 diffs)
-
msgdialog.c (modified) (4 diffs)
-
ui.c (modified) (2 diffs)
-
window.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/filelist.c
radbd7e1 raefdccd 349 349 goto error; 350 350 } 351 352 ui_file_list_clear_entries(flist); 351 353 352 354 if (str_cmp(ndir, "/") != 0) { … … 422 424 } 423 425 426 /** Re-read file list from directory. 427 * 428 * @param flist File list 429 * @return EOK on success or an error code 430 */ 431 errno_t ui_file_list_refresh(ui_file_list_t *flist) 432 { 433 errno_t rc; 434 ui_list_pos_t pos; 435 436 ui_list_save_pos(flist->list, &pos); 437 rc = ui_file_list_read_dir(flist, flist->dir); 438 if (rc != EOK) 439 return rc; 440 ui_list_restore_pos(flist->list, &pos); 441 return EOK; 442 } 443 424 444 /** Sort file list entries. 425 445 * … … 593 613 return ENOMEM; 594 614 595 ui_file_list_clear_entries(flist);596 597 615 rc = ui_file_list_read_dir(flist, dirname); 598 616 if (rc != EOK) { -
uspace/lib/ui/src/list.c
radbd7e1 raefdccd 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 1652 1652 } 1653 1653 1654 /** Save list position for later. 1655 * 1656 * The position will be valid even if the list is cleaned and re-populated 1657 * (it just counts position from the top.) 1658 * 1659 * @param list UI list 1660 * @param pos Place to store position 1661 */ 1662 void ui_list_save_pos(ui_list_t *list, ui_list_pos_t *pos) 1663 { 1664 pos->page_idx = list->page_idx; 1665 pos->cursor_idx = list->cursor_idx; 1666 } 1667 1668 /** Restore saved list position. 1669 * 1670 * The position will be valid even if the list is cleaned and re-populated 1671 * (it just counts position from the top.) 1672 * 1673 * @param list UI list 1674 * @param pos Saved list position 1675 */ 1676 void ui_list_restore_pos(ui_list_t *list, ui_list_pos_t *pos) 1677 { 1678 size_t idx, i; 1679 ui_list_entry_t *entry, *next; 1680 1681 idx = 0; 1682 entry = ui_list_first(list); 1683 1684 for (i = 0; i < pos->cursor_idx; i++) { 1685 next = ui_list_next(entry); 1686 if (next != NULL) { 1687 entry = next; 1688 ++idx; 1689 } 1690 } 1691 1692 list->cursor = entry; 1693 list->cursor_idx = idx; 1694 1695 idx = 0; 1696 entry = ui_list_first(list); 1697 1698 for (i = 0; i < pos->page_idx; i++) { 1699 next = ui_list_next(entry); 1700 if (next != NULL) { 1701 entry = next; 1702 ++idx; 1703 } 1704 } 1705 1706 list->page = entry; 1707 list->page_idx = idx; 1708 } 1709 1654 1710 /** @} 1655 1711 */ -
uspace/lib/ui/src/msgdialog.c
radbd7e1 raefdccd 285 285 if (dialog->cb != NULL && dialog->cb->close != NULL) 286 286 dialog->cb->close(dialog, dialog->arg); 287 else 288 ui_msg_dialog_destroy(dialog); 287 289 } 288 290 … … 310 312 dialog->cb->button(dialog, dialog->arg, 0); 311 313 return; 314 } else { 315 ui_msg_dialog_destroy(dialog); 312 316 } 313 317 } else if (event->key == KC_ESCAPE) { … … 316 320 dialog->cb->close(dialog, dialog->arg); 317 321 return; 322 } else { 323 ui_msg_dialog_destroy(dialog); 318 324 } 319 325 } … … 337 343 dialog->cb->button(dialog, dialog->arg, i); 338 344 } 345 } else { 346 ui_msg_dialog_destroy(dialog); 339 347 } 340 348 } -
uspace/lib/ui/src/ui.c
radbd7e1 raefdccd 412 412 errno_t rc; 413 413 gfx_context_t *gc; 414 ui_window_t * awnd;414 ui_window_t *wnd; 415 415 gfx_color_t *color = NULL; 416 416 … … 439 439 gfx_color_delete(color); 440 440 441 /* XXX Should repaint all windows */ 442 awnd = ui_window_get_active(ui); 443 if (awnd == NULL) 444 return EOK; 445 446 rc = ui_wdecor_paint(awnd->wdecor); 447 if (rc != EOK) 448 return rc; 449 450 return ui_window_paint(awnd); 441 /* Repaint all windows */ 442 wnd = ui_window_first(ui); 443 while (wnd != NULL) { 444 rc = ui_wdecor_paint(wnd->wdecor); 445 if (rc != EOK) 446 return rc; 447 448 rc = ui_window_paint(wnd); 449 if (rc != EOK) 450 return rc; 451 452 wnd = ui_window_next(wnd); 453 } 454 455 return EOK; 451 456 } 452 457 -
uspace/lib/ui/src/window.c
radbd7e1 raefdccd 617 617 } 618 618 619 /** Get first (lowermost) window (only valid in fullscreen mode). 620 * 621 * @param ui User interface 622 * @return First window 623 */ 624 ui_window_t *ui_window_first(ui_t *ui) 625 { 626 link_t *link; 627 628 link = list_first(&ui->windows); 629 if (link == NULL) 630 return NULL; 631 632 return list_get_instance(link, ui_window_t, lwindows); 633 } 634 635 /** Get next window (only valid in fullscreen mode). 636 * 637 * @param cur Current window 638 * @return First window 639 */ 640 ui_window_t *ui_window_next(ui_window_t *cur) 641 { 642 link_t *link; 643 644 link = list_next(&cur->lwindows, &cur->ui->windows); 645 if (link == NULL) 646 return NULL; 647 648 return list_get_instance(link, ui_window_t, lwindows); 649 } 650 619 651 /** Get active window (only valid in fullscreen mode). 620 652 *
Note:
See TracChangeset
for help on using the changeset viewer.
