Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3be5366 in mainline


Ignore:
Timestamp:
2023-01-19T12:09:34Z (2 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
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)
Message:

Add pos_id information to move request, too

This will become useful momentarily.

Location:
uspace
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/display/include/disp_srv.h

    raaa3b855 r3be5366  
    5757        errno_t (*window_create)(void *, display_wnd_params_t *, sysarg_t *);
    5858        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);
    6061        errno_t (*window_resize_req)(void *, sysarg_t, display_wnd_rsztype_t,
    6162            gfx_coord2_t *, sysarg_t);
  • uspace/lib/display/include/display.h

    raaa3b855 r3be5366  
    5454extern errno_t display_window_destroy(display_window_t *);
    5555extern 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 *);
     56extern errno_t display_window_move_req(display_window_t *, gfx_coord2_t *,
     57    sysarg_t);
    5758extern errno_t display_window_resize_req(display_window_t *,
    5859    display_wnd_rsztype_t, gfx_coord2_t *, sysarg_t);
  • uspace/lib/display/src/disp_srv.c

    raaa3b855 r3be5366  
    152152{
    153153        sysarg_t wnd_id;
     154        sysarg_t pos_id;
    154155        ipc_call_t call;
    155156        gfx_coord2_t pos;
     
    158159
    159160        wnd_id = ipc_get_arg1(icall);
     161        pos_id = ipc_get_arg2(icall);
    160162
    161163        if (!async_data_write_receive(&call, &size)) {
     
    183185        }
    184186
    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);
    186188        async_answer_0(icall, rc);
    187189}
  • uspace/lib/display/src/display.c

    raaa3b855 r3be5366  
    284284 * @param window Window
    285285 * @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 */
     289errno_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);
    297300        rc = async_data_write_start(exch, (void *)pos, sizeof (gfx_coord2_t));
    298301        async_exchange_end(exch);
  • uspace/lib/display/test/display.c

    raaa3b855 r3be5366  
    5858static errno_t test_window_create(void *, display_wnd_params_t *, sysarg_t *);
    5959static errno_t test_window_destroy(void *, sysarg_t);
    60 static errno_t test_window_move_req(void *, sysarg_t, gfx_coord2_t *);
     60static errno_t test_window_move_req(void *, sysarg_t, gfx_coord2_t *, sysarg_t);
    6161static errno_t test_window_move(void *, sysarg_t, gfx_coord2_t *);
    6262static errno_t test_window_get_pos(void *, sysarg_t, gfx_coord2_t *);
     
    124124        sysarg_t move_req_wnd_id;
    125125        gfx_coord2_t move_req_pos;
     126        sysarg_t move_req_pos_id;
    126127
    127128        bool window_move_called;
     
    379380        test_response_t resp;
    380381        gfx_coord2_t pos;
     382        sysarg_t pos_id;
    381383
    382384        async_set_fallback_port_handler(test_display_conn, &resp);
     
    410412        pos.x = 42;
    411413        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);
    414417        PCUT_ASSERT_TRUE(resp.window_move_req_called);
    415418        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     
    417420        PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x);
    418421        PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y);
     422        PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id);
    419423
    420424        display_window_destroy(wnd);
     
    434438        test_response_t resp;
    435439        gfx_coord2_t pos;
     440        sysarg_t pos_id;
    436441
    437442        async_set_fallback_port_handler(test_display_conn, &resp);
     
    465470        pos.x = 42;
    466471        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);
    469475        PCUT_ASSERT_TRUE(resp.window_move_req_called);
    470476        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     
    472478        PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x);
    473479        PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y);
     480        PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id);
    474481
    475482        display_window_destroy(wnd);
     
    21472154
    21482155static 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)
    21502157{
    21512158        test_response_t *resp = (test_response_t *) arg;
     
    21542161        resp->move_req_wnd_id = wnd_id;
    21552162        resp->move_req_pos = *pos;
     2163        resp->move_req_pos_id = pos_id;
    21562164        return resp->rc;
    21572165}
  • uspace/lib/ui/include/types/ui/wdecor.h

    raaa3b855 r3be5366  
    8585        void (*unmaximize)(ui_wdecor_t *, void *);
    8686        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);
    8888        void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
    8989            gfx_coord2_t *, sysarg_t);
  • uspace/lib/ui/private/wdecor.h

    raaa3b855 r3be5366  
    9898extern void ui_wdecor_unmaximize(ui_wdecor_t *);
    9999extern void ui_wdecor_close(ui_wdecor_t *);
    100 extern void ui_wdecor_move(ui_wdecor_t *, gfx_coord2_t *);
     100extern void ui_wdecor_move(ui_wdecor_t *, gfx_coord2_t *, sysarg_t);
    101101extern void ui_wdecor_resize(ui_wdecor_t *, ui_wdecor_rsztype_t,
    102102    gfx_coord2_t *, sysarg_t);
  • uspace/lib/ui/src/wdecor.c

    raaa3b855 r3be5366  
    465465 * @param wdecor Window decoration
    466466 * @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 */
     469void ui_wdecor_move(ui_wdecor_t *wdecor, gfx_coord2_t *pos, sysarg_t pos_id)
    469470{
    470471        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);
    472473}
    473474
     
    812813{
    813814        gfx_coord2_t pos;
     815        sysarg_t pos_id;
    814816        ui_wdecor_rsztype_t rsztype;
    815817        ui_stock_cursor_t cursor;
     
    817819        pos.x = event->hpos;
    818820        pos.y = event->vpos;
     821        pos_id = event->pos_id;
    819822
    820823        /* Set appropriate resizing cursor, or set arrow cursor */
     
    827830        /* Press on window border? */
    828831        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);
    830833}
    831834
     
    839842{
    840843        gfx_coord2_t pos;
     844        sysarg_t pos_id;
    841845        ui_wdecor_geom_t geom;
    842846        ui_evclaim_t claim;
     
    844848        pos.x = event->hpos;
    845849        pos.y = event->vpos;
     850        pos_id = event->pos_id;
    846851
    847852        ui_wdecor_get_geom(wdecor, &geom);
     
    870875                if (event->type == POS_PRESS &&
    871876                    gfx_pix_inside_rect(&pos, &geom.title_bar_rect)) {
    872                         ui_wdecor_move(wdecor, &pos);
     877                        ui_wdecor_move(wdecor, &pos, pos_id);
    873878                        return ui_claimed;
    874879                }
  • uspace/lib/ui/src/window.c

    raaa3b855 r3be5366  
    7878static void wd_unmaximize(ui_wdecor_t *, void *);
    7979static void wd_close(ui_wdecor_t *, void *);
    80 static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t *);
     80static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
    8181static void wd_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
    8282    gfx_coord2_t *, sysarg_t);
     
    973973 * @param arg Argument (window)
    974974 * @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 */
     977static void wd_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos,
     978    sysarg_t pos_id)
    977979{
    978980        ui_window_t *window = (ui_window_t *) arg;
    979981
    980982        if (window->dwindow != NULL)
    981                 (void) display_window_move_req(window->dwindow, pos);
     983                (void) display_window_move_req(window->dwindow, pos, pos_id);
    982984}
    983985
  • uspace/lib/ui/test/wdecor.c

    raaa3b855 r3be5366  
    6666static void test_wdecor_unmaximize(ui_wdecor_t *, void *);
    6767static void test_wdecor_close(ui_wdecor_t *, void *);
    68 static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *);
     68static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
    6969static void test_wdecor_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
    7070    gfx_coord2_t *, sysarg_t);
     
    339339        test_cb_resp_t resp;
    340340        gfx_coord2_t pos;
     341        sysarg_t pos_id;
    341342
    342343        rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
     
    345346        pos.x = 3;
    346347        pos.y = 4;
     348        pos_id = 5;
    347349
    348350        /* Move callback with no callbacks set */
    349         ui_wdecor_move(wdecor, &pos);
     351        ui_wdecor_move(wdecor, &pos, pos_id);
    350352
    351353        /* Move callback with move callback not implemented */
    352354        ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
    353         ui_wdecor_move(wdecor, &pos);
     355        ui_wdecor_move(wdecor, &pos, pos_id);
    354356
    355357        /* Move callback with real callback set */
     
    357359        resp.pos.x = 0;
    358360        resp.pos.y = 0;
     361        resp.pos_id = 0;
    359362        ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
    360         ui_wdecor_move(wdecor, &pos);
     363        ui_wdecor_move(wdecor, &pos, pos_id);
    361364        PCUT_ASSERT_TRUE(resp.move);
    362365        PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x);
    363366        PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y);
     367        PCUT_ASSERT_INT_EQUALS(pos_id, resp.pos_id);
    364368
    365369        ui_wdecor_destroy(wdecor);
     
    10751079}
    10761080
    1077 static void test_wdecor_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos)
     1081static void test_wdecor_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos,
     1082    sysarg_t pos_id)
    10781083{
    10791084        test_cb_resp_t *resp = (test_cb_resp_t *) arg;
     
    10811086        resp->move = true;
    10821087        resp->pos = *pos;
     1088        resp->pos_id = pos_id;
    10831089}
    10841090
  • uspace/srv/hid/display/dsops.c

    raaa3b855 r3be5366  
    4646static errno_t disp_window_create(void *, display_wnd_params_t *, sysarg_t *);
    4747static errno_t disp_window_destroy(void *, sysarg_t);
    48 static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *);
     48static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *,
     49    sysarg_t);
    4950static errno_t disp_window_move(void *, sysarg_t, gfx_coord2_t *);
    5051static errno_t disp_window_get_pos(void *, sysarg_t, gfx_coord2_t *);
     
    127128
    128129static 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)
    130131{
    131132        ds_client_t *client = (ds_client_t *) arg;
     
    141142
    142143        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);
    144145        ds_display_unlock(client->display);
    145146        return EOK;
  • uspace/srv/hid/display/test/window.c

    raaa3b855 r3be5366  
    711711        display_wnd_params_t params;
    712712        gfx_coord2_t pos;
     713        sysarg_t pos_id;
    713714        errno_t rc;
    714715
     
    736737        pos.x = 42;
    737738        pos.y = 43;
    738         ds_window_move_req(wnd, &pos);
     739        pos_id = 44;
     740        ds_window_move_req(wnd, &pos, pos_id);
    739741
    740742        PCUT_ASSERT_INT_EQUALS(dsw_moving, wnd->state);
    741743        PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x);
    742744        PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y);
     745        PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id);
    743746
    744747        ds_window_destroy(wnd);
     
    791794        PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x);
    792795        PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y);
     796        PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id);
    793797
    794798        ds_window_destroy(wnd);
  • uspace/srv/hid/display/types/display/window.h

    raaa3b855 r3be5366  
    103103        /** Original position before started to move or resize the window */
    104104        gfx_coord2_t orig_pos;
    105         /** Positioning device that started the resize */
     105        /** Positioning device that started the move or resize */
    106106        sysarg_t orig_pos_id;
    107107        /** Window resize type (if state is dsw_resizing) */
  • uspace/srv/hid/display/window.c

    raaa3b855 r3be5366  
    437437 * @param wnd Window
    438438 * @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 */
     441static void ds_window_start_move(ds_window_t *wnd, gfx_coord2_t *pos,
     442    sysarg_t pos_id)
    441443{
    442444        log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_move (%d, %d)",
     
    447449
    448450        wnd->orig_pos = *pos;
     451        wnd->orig_pos_id = pos_id;
    449452        wnd->state = dsw_moving;
    450453        wnd->preview_pos = wnd->dpos;
     
    476479        wnd->dpos = nwpos;
    477480        wnd->state = dsw_idle;
     481        wnd->orig_pos_id = 0;
    478482
    479483        (void) ds_display_paint(wnd->display, NULL);
     
    569573                ds_seat_set_wm_cursor(seat, NULL);
    570574
     575        wnd->orig_pos_id = 0;
     576
    571577        (void) ds_display_paint(wnd->display, NULL);
    572578}
     
    629635        pos_event_t tevent;
    630636        gfx_coord2_t pos;
     637        sysarg_t pos_id;
    631638        gfx_rect_t drect;
    632639        bool inside;
     
    638645        pos.x = event->hpos;
    639646        pos.y = event->vpos;
     647        pos_id = event->pos_id;
    640648        gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
    641649        inside = gfx_pix_inside_rect(&pos, &drect);
     
    643651        if (event->type == POS_PRESS && event->btn_num == 2 && inside &&
    644652            (wnd->flags & wndf_maximized) == 0) {
    645                 ds_window_start_move(wnd, &pos);
     653                ds_window_start_move(wnd, &pos, pos_id);
    646654                return EOK;
    647655        }
     
    746754 * @param pos Position where the pointer was when the move started
    747755 *            relative to the window
     756 * @param pos_id Positioning device ID
    748757 * @param event Button press event
    749758 */
    750 void ds_window_move_req(ds_window_t *wnd, gfx_coord2_t *pos)
     759void ds_window_move_req(ds_window_t *wnd, gfx_coord2_t *pos, sysarg_t pos_id)
    751760{
    752761        gfx_coord2_t orig_pos;
     
    756765
    757766        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);
    759768}
    760769
  • uspace/srv/hid/display/window.h

    raaa3b855 r3be5366  
    6363extern errno_t ds_window_post_focus_event(ds_window_t *);
    6464extern errno_t ds_window_post_unfocus_event(ds_window_t *);
    65 extern void ds_window_move_req(ds_window_t *, gfx_coord2_t *);
     65extern void ds_window_move_req(ds_window_t *, gfx_coord2_t *, sysarg_t);
    6666extern void ds_window_move(ds_window_t *, gfx_coord2_t *);
    6767extern void ds_window_get_pos(ds_window_t *, gfx_coord2_t *);
Note: See TracChangeset for help on using the changeset viewer.