Changeset 3be5366 in mainline
- Timestamp:
- 2023-01-19T12:09:34Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6828a56
- Parents:
- aaa3b855
- git-author:
- Jiri Svoboda <jiri@…> (2023-01-19 18:09:23)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-01-19 12:09:34)
- Location:
- uspace
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/include/disp_srv.h
raaa3b855 r3be5366 57 57 errno_t (*window_create)(void *, display_wnd_params_t *, sysarg_t *); 58 58 errno_t (*window_destroy)(void *, sysarg_t); 59 errno_t (*window_move_req)(void *, sysarg_t, gfx_coord2_t *); 59 errno_t (*window_move_req)(void *, sysarg_t, gfx_coord2_t *, 60 sysarg_t); 60 61 errno_t (*window_resize_req)(void *, sysarg_t, display_wnd_rsztype_t, 61 62 gfx_coord2_t *, sysarg_t); -
uspace/lib/display/include/display.h
raaa3b855 r3be5366 54 54 extern errno_t display_window_destroy(display_window_t *); 55 55 extern errno_t display_window_get_gc(display_window_t *, gfx_context_t **); 56 extern errno_t display_window_move_req(display_window_t *, gfx_coord2_t *); 56 extern errno_t display_window_move_req(display_window_t *, gfx_coord2_t *, 57 sysarg_t); 57 58 extern errno_t display_window_resize_req(display_window_t *, 58 59 display_wnd_rsztype_t, gfx_coord2_t *, sysarg_t); -
uspace/lib/display/src/disp_srv.c
raaa3b855 r3be5366 152 152 { 153 153 sysarg_t wnd_id; 154 sysarg_t pos_id; 154 155 ipc_call_t call; 155 156 gfx_coord2_t pos; … … 158 159 159 160 wnd_id = ipc_get_arg1(icall); 161 pos_id = ipc_get_arg2(icall); 160 162 161 163 if (!async_data_write_receive(&call, &size)) { … … 183 185 } 184 186 185 rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos );187 rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos, pos_id); 186 188 async_answer_0(icall, rc); 187 189 } -
uspace/lib/display/src/display.c
raaa3b855 r3be5366 284 284 * @param window Window 285 285 * @param pos Position in the window where the button was pressed 286 * @return EOK on success or an error code 287 */ 288 errno_t display_window_move_req(display_window_t *window, gfx_coord2_t *pos) 289 { 290 async_exch_t *exch; 291 aid_t req; 292 ipc_call_t answer; 293 errno_t rc; 294 295 exch = async_exchange_begin(window->display->sess); 296 req = async_send_1(exch, DISPLAY_WINDOW_MOVE_REQ, window->id, &answer); 286 * @param pos_id Positioning device ID 287 * @return EOK on success or an error code 288 */ 289 errno_t display_window_move_req(display_window_t *window, gfx_coord2_t *pos, 290 sysarg_t pos_id) 291 { 292 async_exch_t *exch; 293 aid_t req; 294 ipc_call_t answer; 295 errno_t rc; 296 297 exch = async_exchange_begin(window->display->sess); 298 req = async_send_2(exch, DISPLAY_WINDOW_MOVE_REQ, window->id, 299 pos_id, &answer); 297 300 rc = async_data_write_start(exch, (void *)pos, sizeof (gfx_coord2_t)); 298 301 async_exchange_end(exch); -
uspace/lib/display/test/display.c
raaa3b855 r3be5366 58 58 static errno_t test_window_create(void *, display_wnd_params_t *, sysarg_t *); 59 59 static errno_t test_window_destroy(void *, sysarg_t); 60 static errno_t test_window_move_req(void *, sysarg_t, gfx_coord2_t * );60 static errno_t test_window_move_req(void *, sysarg_t, gfx_coord2_t *, sysarg_t); 61 61 static errno_t test_window_move(void *, sysarg_t, gfx_coord2_t *); 62 62 static errno_t test_window_get_pos(void *, sysarg_t, gfx_coord2_t *); … … 124 124 sysarg_t move_req_wnd_id; 125 125 gfx_coord2_t move_req_pos; 126 sysarg_t move_req_pos_id; 126 127 127 128 bool window_move_called; … … 379 380 test_response_t resp; 380 381 gfx_coord2_t pos; 382 sysarg_t pos_id; 381 383 382 384 async_set_fallback_port_handler(test_display_conn, &resp); … … 410 412 pos.x = 42; 411 413 pos.y = 43; 412 413 rc = display_window_move_req(wnd, &pos); 414 pos_id = 44; 415 416 rc = display_window_move_req(wnd, &pos, pos_id); 414 417 PCUT_ASSERT_TRUE(resp.window_move_req_called); 415 418 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); … … 417 420 PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x); 418 421 PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y); 422 PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id); 419 423 420 424 display_window_destroy(wnd); … … 434 438 test_response_t resp; 435 439 gfx_coord2_t pos; 440 sysarg_t pos_id; 436 441 437 442 async_set_fallback_port_handler(test_display_conn, &resp); … … 465 470 pos.x = 42; 466 471 pos.y = 43; 467 468 rc = display_window_move_req(wnd, &pos); 472 pos_id = 44; 473 474 rc = display_window_move_req(wnd, &pos, pos_id); 469 475 PCUT_ASSERT_TRUE(resp.window_move_req_called); 470 476 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); … … 472 478 PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x); 473 479 PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y); 480 PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id); 474 481 475 482 display_window_destroy(wnd); … … 2147 2154 2148 2155 static errno_t test_window_move_req(void *arg, sysarg_t wnd_id, 2149 gfx_coord2_t *pos )2156 gfx_coord2_t *pos, sysarg_t pos_id) 2150 2157 { 2151 2158 test_response_t *resp = (test_response_t *) arg; … … 2154 2161 resp->move_req_wnd_id = wnd_id; 2155 2162 resp->move_req_pos = *pos; 2163 resp->move_req_pos_id = pos_id; 2156 2164 return resp->rc; 2157 2165 } -
uspace/lib/ui/include/types/ui/wdecor.h
raaa3b855 r3be5366 85 85 void (*unmaximize)(ui_wdecor_t *, void *); 86 86 void (*close)(ui_wdecor_t *, void *); 87 void (*move)(ui_wdecor_t *, void *, gfx_coord2_t * );87 void (*move)(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t); 88 88 void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t, 89 89 gfx_coord2_t *, sysarg_t); -
uspace/lib/ui/private/wdecor.h
raaa3b855 r3be5366 98 98 extern void ui_wdecor_unmaximize(ui_wdecor_t *); 99 99 extern void ui_wdecor_close(ui_wdecor_t *); 100 extern void ui_wdecor_move(ui_wdecor_t *, gfx_coord2_t * );100 extern void ui_wdecor_move(ui_wdecor_t *, gfx_coord2_t *, sysarg_t); 101 101 extern void ui_wdecor_resize(ui_wdecor_t *, ui_wdecor_rsztype_t, 102 102 gfx_coord2_t *, sysarg_t); -
uspace/lib/ui/src/wdecor.c
raaa3b855 r3be5366 465 465 * @param wdecor Window decoration 466 466 * @param pos Position where the title bar was pressed 467 */ 468 void ui_wdecor_move(ui_wdecor_t *wdecor, gfx_coord2_t *pos) 467 * @param pos_id Positioning device ID 468 */ 469 void ui_wdecor_move(ui_wdecor_t *wdecor, gfx_coord2_t *pos, sysarg_t pos_id) 469 470 { 470 471 if (wdecor->cb != NULL && wdecor->cb->move != NULL) 471 wdecor->cb->move(wdecor, wdecor->arg, pos );472 wdecor->cb->move(wdecor, wdecor->arg, pos, pos_id); 472 473 } 473 474 … … 812 813 { 813 814 gfx_coord2_t pos; 815 sysarg_t pos_id; 814 816 ui_wdecor_rsztype_t rsztype; 815 817 ui_stock_cursor_t cursor; … … 817 819 pos.x = event->hpos; 818 820 pos.y = event->vpos; 821 pos_id = event->pos_id; 819 822 820 823 /* Set appropriate resizing cursor, or set arrow cursor */ … … 827 830 /* Press on window border? */ 828 831 if (rsztype != ui_wr_none && event->type == POS_PRESS) 829 ui_wdecor_resize(wdecor, rsztype, &pos, event->pos_id);832 ui_wdecor_resize(wdecor, rsztype, &pos, pos_id); 830 833 } 831 834 … … 839 842 { 840 843 gfx_coord2_t pos; 844 sysarg_t pos_id; 841 845 ui_wdecor_geom_t geom; 842 846 ui_evclaim_t claim; … … 844 848 pos.x = event->hpos; 845 849 pos.y = event->vpos; 850 pos_id = event->pos_id; 846 851 847 852 ui_wdecor_get_geom(wdecor, &geom); … … 870 875 if (event->type == POS_PRESS && 871 876 gfx_pix_inside_rect(&pos, &geom.title_bar_rect)) { 872 ui_wdecor_move(wdecor, &pos );877 ui_wdecor_move(wdecor, &pos, pos_id); 873 878 return ui_claimed; 874 879 } -
uspace/lib/ui/src/window.c
raaa3b855 r3be5366 78 78 static void wd_unmaximize(ui_wdecor_t *, void *); 79 79 static void wd_close(ui_wdecor_t *, void *); 80 static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t * );80 static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t); 81 81 static void wd_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t, 82 82 gfx_coord2_t *, sysarg_t); … … 973 973 * @param arg Argument (window) 974 974 * @param pos Position where the title bar was pressed 975 */ 976 static void wd_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos) 975 * @param pos_id Positioning device ID 976 */ 977 static void wd_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos, 978 sysarg_t pos_id) 977 979 { 978 980 ui_window_t *window = (ui_window_t *) arg; 979 981 980 982 if (window->dwindow != NULL) 981 (void) display_window_move_req(window->dwindow, pos );983 (void) display_window_move_req(window->dwindow, pos, pos_id); 982 984 } 983 985 -
uspace/lib/ui/test/wdecor.c
raaa3b855 r3be5366 66 66 static void test_wdecor_unmaximize(ui_wdecor_t *, void *); 67 67 static void test_wdecor_close(ui_wdecor_t *, void *); 68 static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t * );68 static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t); 69 69 static void test_wdecor_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t, 70 70 gfx_coord2_t *, sysarg_t); … … 339 339 test_cb_resp_t resp; 340 340 gfx_coord2_t pos; 341 sysarg_t pos_id; 341 342 342 343 rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor); … … 345 346 pos.x = 3; 346 347 pos.y = 4; 348 pos_id = 5; 347 349 348 350 /* Move callback with no callbacks set */ 349 ui_wdecor_move(wdecor, &pos );351 ui_wdecor_move(wdecor, &pos, pos_id); 350 352 351 353 /* Move callback with move callback not implemented */ 352 354 ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL); 353 ui_wdecor_move(wdecor, &pos );355 ui_wdecor_move(wdecor, &pos, pos_id); 354 356 355 357 /* Move callback with real callback set */ … … 357 359 resp.pos.x = 0; 358 360 resp.pos.y = 0; 361 resp.pos_id = 0; 359 362 ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp); 360 ui_wdecor_move(wdecor, &pos );363 ui_wdecor_move(wdecor, &pos, pos_id); 361 364 PCUT_ASSERT_TRUE(resp.move); 362 365 PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x); 363 366 PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y); 367 PCUT_ASSERT_INT_EQUALS(pos_id, resp.pos_id); 364 368 365 369 ui_wdecor_destroy(wdecor); … … 1075 1079 } 1076 1080 1077 static void test_wdecor_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos) 1081 static void test_wdecor_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos, 1082 sysarg_t pos_id) 1078 1083 { 1079 1084 test_cb_resp_t *resp = (test_cb_resp_t *) arg; … … 1081 1086 resp->move = true; 1082 1087 resp->pos = *pos; 1088 resp->pos_id = pos_id; 1083 1089 } 1084 1090 -
uspace/srv/hid/display/dsops.c
raaa3b855 r3be5366 46 46 static errno_t disp_window_create(void *, display_wnd_params_t *, sysarg_t *); 47 47 static errno_t disp_window_destroy(void *, sysarg_t); 48 static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *); 48 static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *, 49 sysarg_t); 49 50 static errno_t disp_window_move(void *, sysarg_t, gfx_coord2_t *); 50 51 static errno_t disp_window_get_pos(void *, sysarg_t, gfx_coord2_t *); … … 127 128 128 129 static errno_t disp_window_move_req(void *arg, sysarg_t wnd_id, 129 gfx_coord2_t *pos )130 gfx_coord2_t *pos, sysarg_t pos_id) 130 131 { 131 132 ds_client_t *client = (ds_client_t *) arg; … … 141 142 142 143 log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_move_req()"); 143 ds_window_move_req(wnd, pos );144 ds_window_move_req(wnd, pos, pos_id); 144 145 ds_display_unlock(client->display); 145 146 return EOK; -
uspace/srv/hid/display/test/window.c
raaa3b855 r3be5366 711 711 display_wnd_params_t params; 712 712 gfx_coord2_t pos; 713 sysarg_t pos_id; 713 714 errno_t rc; 714 715 … … 736 737 pos.x = 42; 737 738 pos.y = 43; 738 ds_window_move_req(wnd, &pos); 739 pos_id = 44; 740 ds_window_move_req(wnd, &pos, pos_id); 739 741 740 742 PCUT_ASSERT_INT_EQUALS(dsw_moving, wnd->state); 741 743 PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x); 742 744 PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y); 745 PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id); 743 746 744 747 ds_window_destroy(wnd); … … 791 794 PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x); 792 795 PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y); 796 PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id); 793 797 794 798 ds_window_destroy(wnd); -
uspace/srv/hid/display/types/display/window.h
raaa3b855 r3be5366 103 103 /** Original position before started to move or resize the window */ 104 104 gfx_coord2_t orig_pos; 105 /** Positioning device that started the resize */105 /** Positioning device that started the move or resize */ 106 106 sysarg_t orig_pos_id; 107 107 /** Window resize type (if state is dsw_resizing) */ -
uspace/srv/hid/display/window.c
raaa3b855 r3be5366 437 437 * @param wnd Window 438 438 * @param pos Position where mouse button was pressed 439 */ 440 static void ds_window_start_move(ds_window_t *wnd, gfx_coord2_t *pos) 439 * @param pos_id Positioning device ID 440 */ 441 static void ds_window_start_move(ds_window_t *wnd, gfx_coord2_t *pos, 442 sysarg_t pos_id) 441 443 { 442 444 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_move (%d, %d)", … … 447 449 448 450 wnd->orig_pos = *pos; 451 wnd->orig_pos_id = pos_id; 449 452 wnd->state = dsw_moving; 450 453 wnd->preview_pos = wnd->dpos; … … 476 479 wnd->dpos = nwpos; 477 480 wnd->state = dsw_idle; 481 wnd->orig_pos_id = 0; 478 482 479 483 (void) ds_display_paint(wnd->display, NULL); … … 569 573 ds_seat_set_wm_cursor(seat, NULL); 570 574 575 wnd->orig_pos_id = 0; 576 571 577 (void) ds_display_paint(wnd->display, NULL); 572 578 } … … 629 635 pos_event_t tevent; 630 636 gfx_coord2_t pos; 637 sysarg_t pos_id; 631 638 gfx_rect_t drect; 632 639 bool inside; … … 638 645 pos.x = event->hpos; 639 646 pos.y = event->vpos; 647 pos_id = event->pos_id; 640 648 gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect); 641 649 inside = gfx_pix_inside_rect(&pos, &drect); … … 643 651 if (event->type == POS_PRESS && event->btn_num == 2 && inside && 644 652 (wnd->flags & wndf_maximized) == 0) { 645 ds_window_start_move(wnd, &pos );653 ds_window_start_move(wnd, &pos, pos_id); 646 654 return EOK; 647 655 } … … 746 754 * @param pos Position where the pointer was when the move started 747 755 * relative to the window 756 * @param pos_id Positioning device ID 748 757 * @param event Button press event 749 758 */ 750 void ds_window_move_req(ds_window_t *wnd, gfx_coord2_t *pos )759 void ds_window_move_req(ds_window_t *wnd, gfx_coord2_t *pos, sysarg_t pos_id) 751 760 { 752 761 gfx_coord2_t orig_pos; … … 756 765 757 766 gfx_coord2_add(&wnd->dpos, pos, &orig_pos); 758 ds_window_start_move(wnd, &orig_pos );767 ds_window_start_move(wnd, &orig_pos, pos_id); 759 768 } 760 769 -
uspace/srv/hid/display/window.h
raaa3b855 r3be5366 63 63 extern errno_t ds_window_post_focus_event(ds_window_t *); 64 64 extern errno_t ds_window_post_unfocus_event(ds_window_t *); 65 extern void ds_window_move_req(ds_window_t *, gfx_coord2_t * );65 extern void ds_window_move_req(ds_window_t *, gfx_coord2_t *, sysarg_t); 66 66 extern void ds_window_move(ds_window_t *, gfx_coord2_t *); 67 67 extern void ds_window_get_pos(ds_window_t *, gfx_coord2_t *);
Note:
See TracChangeset
for help on using the changeset viewer.