Changeset 46a47c0 in mainline for uspace/srv
- Timestamp:
- 2023-01-16T20:34:01Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0ae23f
- Parents:
- b3eeae5
- Location:
- uspace/srv/hid/display
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/client.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 257 257 * @param client Client 258 258 * @param ewindow Window that the message is targetted to 259 * 260 * @return EOK on success or an error code 261 */ 262 errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow) 259 * @param event Focus event data 260 * 261 * @return EOK on success or an error code 262 */ 263 errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow, 264 display_wnd_focus_ev_t *event) 263 265 { 264 266 ds_window_ev_t *wevent; … … 270 272 wevent->window = ewindow; 271 273 wevent->event.etype = wev_focus; 274 wevent->event.ev.focus = *event; 272 275 list_append(&wevent->levents, &client->events); 273 276 … … 373 376 * @param client Client 374 377 * @param ewindow Window that the message is targetted to 375 * 376 * @return EOK on success or an error code 377 */ 378 errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow) 378 * @param event Unfocus event data 379 * 380 * @return EOK on success or an error code 381 */ 382 errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow, 383 display_wnd_unfocus_ev_t *event) 379 384 { 380 385 ds_window_ev_t *wevent; … … 386 391 wevent->window = ewindow; 387 392 wevent->event.etype = wev_unfocus; 393 wevent->event.ev.unfocus = *event; 388 394 list_append(&wevent->levents, &client->events); 389 395 -
uspace/srv/hid/display/client.h
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 55 55 extern void ds_client_purge_window_events(ds_client_t *, ds_window_t *); 56 56 extern errno_t ds_client_post_close_event(ds_client_t *, ds_window_t *); 57 extern errno_t ds_client_post_focus_event(ds_client_t *, ds_window_t *); 57 extern errno_t ds_client_post_focus_event(ds_client_t *, ds_window_t *, 58 display_wnd_focus_ev_t *); 58 59 extern errno_t ds_client_post_kbd_event(ds_client_t *, ds_window_t *, 59 60 kbd_event_t *); … … 62 63 extern errno_t ds_client_post_resize_event(ds_client_t *, ds_window_t *, 63 64 gfx_rect_t *); 64 extern errno_t ds_client_post_unfocus_event(ds_client_t *, ds_window_t *); 65 extern errno_t ds_client_post_unfocus_event(ds_client_t *, ds_window_t *, 66 display_wnd_unfocus_ev_t *); 65 67 66 68 #endif -
uspace/srv/hid/display/test/client.c
rb3eeae5 r46a47c0 240 240 display_wnd_params_t params; 241 241 ds_window_t *rwindow; 242 display_wnd_focus_ev_t efocus; 242 243 display_wnd_ev_t revent; 243 244 bool called_cb = NULL; … … 271 272 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 272 273 273 rc = ds_client_post_focus_event(client, wnd); 274 efocus.nfocus = 42; 275 276 rc = ds_client_post_focus_event(client, wnd, &efocus); 274 277 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 275 278 PCUT_ASSERT_TRUE(called_cb); … … 279 282 PCUT_ASSERT_EQUALS(wnd, rwindow); 280 283 PCUT_ASSERT_EQUALS(wev_focus, revent.etype); 284 PCUT_ASSERT_INT_EQUALS(efocus.nfocus, revent.ev.focus.nfocus); 281 285 282 286 rc = ds_client_get_event(client, &rwindow, &revent); … … 504 508 display_wnd_params_t params; 505 509 ds_window_t *rwindow; 510 display_wnd_unfocus_ev_t eunfocus; 506 511 display_wnd_ev_t revent; 507 512 bool called_cb = NULL; … … 535 540 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 536 541 537 rc = ds_client_post_unfocus_event(client, wnd); 542 eunfocus.nfocus = 42; 543 544 rc = ds_client_post_unfocus_event(client, wnd, &eunfocus); 538 545 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 539 546 PCUT_ASSERT_TRUE(called_cb); … … 543 550 PCUT_ASSERT_EQUALS(wnd, rwindow); 544 551 PCUT_ASSERT_EQUALS(wev_unfocus, revent.etype); 552 PCUT_ASSERT_INT_EQUALS(eunfocus.nfocus, revent.ev.unfocus.nfocus); 545 553 546 554 rc = ds_client_get_event(client, &rwindow, &revent); -
uspace/srv/hid/display/window.c
rb3eeae5 r46a47c0 680 680 errno_t ds_window_post_focus_event(ds_window_t *wnd) 681 681 { 682 display_wnd_focus_ev_t efocus; 682 683 errno_t rc; 683 684 ds_wmclient_t *wmclient; … … 685 686 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_focus_event"); 686 687 687 rc = ds_client_post_focus_event(wnd->client, wnd); 688 /* Increase focus counter */ 689 ++wnd->nfocus; 690 efocus.nfocus = wnd->nfocus; 691 692 rc = ds_client_post_focus_event(wnd->client, wnd, &efocus); 688 693 if (rc != EOK) 689 694 return rc; 690 691 /* Increase focus counter */692 ++wnd->nfocus;693 695 694 696 /* Notify window managers about window information change */ … … 709 711 errno_t ds_window_post_unfocus_event(ds_window_t *wnd) 710 712 { 713 display_wnd_unfocus_ev_t eunfocus; 711 714 errno_t rc; 712 715 ds_wmclient_t *wmclient; … … 714 717 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_unfocus_event"); 715 718 716 rc = ds_client_post_unfocus_event(wnd->client, wnd); 719 /* Decrease focus counter */ 720 --wnd->nfocus; 721 eunfocus.nfocus = wnd->nfocus; 722 723 rc = ds_client_post_unfocus_event(wnd->client, wnd, &eunfocus); 717 724 if (rc != EOK) 718 725 return rc; 719 720 /* Decrease focus counter */721 --wnd->nfocus;722 726 723 727 /* Notify window managers about window information change */
Note:
See TracChangeset
for help on using the changeset viewer.