Changeset 3be5366 in mainline for uspace/srv


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

Add pos_id information to move request, too

This will become useful momentarily.

Location:
uspace/srv/hid/display
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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.