Changeset 3c54869 in mainline for uspace/srv
- Timestamp:
- 2023-01-04T20:24:44Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d86797
- Parents:
- cdd6fc9
- Location:
- uspace/srv/hid/display
- Files:
-
- 4 edited
-
test/window.c (modified) (2 diffs)
-
types/display/window.h (modified) (2 diffs)
-
window.c (modified) (3 diffs)
-
wmops.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/test/window.c
rcdd6fc9 r3c54869 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 623 623 } 624 624 625 /** Test ds_window_post_focus_event() */ 626 PCUT_TEST(window_post_focus_event) 627 { 628 gfx_context_t *gc; 629 ds_display_t *disp; 630 ds_client_t *client; 631 ds_seat_t *seat; 632 ds_window_t *wnd; 633 display_wnd_params_t params; 634 errno_t rc; 635 636 rc = gfx_context_new(&dummy_ops, NULL, &gc); 637 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 638 639 rc = ds_display_create(gc, df_none, &disp); 640 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 641 642 rc = ds_client_create(disp, NULL, NULL, &client); 643 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 644 645 rc = ds_seat_create(disp, &seat); 646 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 647 648 display_wnd_params_init(¶ms); 649 params.rect.p0.x = params.rect.p0.y = 0; 650 params.rect.p1.x = params.rect.p1.y = 1; 651 652 rc = ds_window_create(client, ¶ms, &wnd); 653 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 654 655 rc = ds_window_post_focus_event(wnd); 656 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 657 658 ds_window_destroy(wnd); 659 ds_seat_destroy(seat); 660 ds_client_destroy(client); 661 ds_display_destroy(disp); 662 } 663 664 /** Test ds_window_post_unfocus_event() */ 665 PCUT_TEST(window_post_unfocus_event) 666 { 667 gfx_context_t *gc; 668 ds_display_t *disp; 669 ds_client_t *client; 670 ds_seat_t *seat; 671 ds_window_t *wnd; 672 display_wnd_params_t params; 673 errno_t rc; 674 675 rc = gfx_context_new(&dummy_ops, NULL, &gc); 676 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 677 678 rc = ds_display_create(gc, df_none, &disp); 679 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 680 681 rc = ds_client_create(disp, NULL, NULL, &client); 682 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 683 684 rc = ds_seat_create(disp, &seat); 685 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 686 687 display_wnd_params_init(¶ms); 688 params.rect.p0.x = params.rect.p0.y = 0; 689 params.rect.p1.x = params.rect.p1.y = 1; 690 691 rc = ds_window_create(client, ¶ms, &wnd); 692 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 693 694 rc = ds_window_post_focus_event(wnd); 695 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 696 697 ds_window_destroy(wnd); 698 ds_seat_destroy(seat); 699 ds_client_destroy(client); 700 ds_display_destroy(disp); 701 } 702 625 703 /** Test ds_window_move_req() */ 626 704 PCUT_TEST(window_move_req) -
uspace/srv/hid/display/types/display/window.h
rcdd6fc9 r3c54869 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 107 107 /** Window caption */ 108 108 char *caption; 109 /** Number of foci */ 110 unsigned nfocus; 109 111 } ds_window_t; 110 112 -
uspace/srv/hid/display/window.c
rcdd6fc9 r3c54869 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 678 678 errno_t ds_window_post_focus_event(ds_window_t *wnd) 679 679 { 680 errno_t rc; 681 ds_wmclient_t *wmclient; 682 680 683 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_focus_event"); 681 684 682 return ds_client_post_focus_event(wnd->client, wnd); 685 rc = ds_client_post_focus_event(wnd->client, wnd); 686 if (rc != EOK) 687 return rc; 688 689 /* Increase focus counter */ 690 ++wnd->nfocus; 691 692 /* Notify window managers about window information change */ 693 wmclient = ds_display_first_wmclient(wnd->display); 694 while (wmclient != NULL) { 695 ds_wmclient_post_wnd_changed_event(wmclient, wnd->id); 696 wmclient = ds_display_next_wmclient(wmclient); 697 } 698 699 return EOK; 683 700 } 684 701 … … 690 707 errno_t ds_window_post_unfocus_event(ds_window_t *wnd) 691 708 { 709 errno_t rc; 710 ds_wmclient_t *wmclient; 711 692 712 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_unfocus_event"); 693 713 694 return ds_client_post_unfocus_event(wnd->client, wnd); 714 rc = ds_client_post_unfocus_event(wnd->client, wnd); 715 if (rc != EOK) 716 return rc; 717 718 /* Decrease focus counter */ 719 --wnd->nfocus; 720 721 /* Notify window managers about window information change */ 722 wmclient = ds_display_first_wmclient(wnd->display); 723 while (wmclient != NULL) { 724 ds_wmclient_post_wnd_changed_event(wmclient, wnd->id); 725 wmclient = ds_display_next_wmclient(wmclient); 726 } 727 728 return EOK; 695 729 } 696 730 -
uspace/srv/hid/display/wmops.c
rcdd6fc9 r3c54869 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 145 145 146 146 info->flags = wnd->flags; 147 info->nfocus = wnd->nfocus; 147 148 148 149 ds_display_unlock(wmclient->display);
Note:
See TracChangeset
for help on using the changeset viewer.
