Changeset b0ae23f in mainline for uspace/lib/display


Ignore:
Timestamp:
2023-01-17T15:21:13Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0d4afe
Parents:
46a47c0
git-author:
Jiri Svoboda <jiri@…> (2023-01-17 18:21:02)
git-committer:
Jiri Svoboda <jiri@…> (2023-01-17 15:21:13)
Message:

Change the correct pointer's shape when resizing window

The request to resize a window originates from the client. The display
server forces the cursor to a double-arrow shape regardless of whether
it is over the window or not, until the resize is done. This is to
make sure the cursor keeps that shape even if it moves outside of
the current boundaries of the window. With multiple pointers we need
to know which one to change. This is done by passing the pos_id from
button press event that starts the resize all the way to
ds_window_start_resize(). Then it needs to be stored in the window
structure for use when it is time to restore the cursor.

Location:
uspace/lib/display
Files:
5 edited

Legend:

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

    r46a47c0 rb0ae23f  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5959        errno_t (*window_move_req)(void *, sysarg_t, gfx_coord2_t *);
    6060        errno_t (*window_resize_req)(void *, sysarg_t, display_wnd_rsztype_t,
    61             gfx_coord2_t *);
     61            gfx_coord2_t *, sysarg_t);
    6262        errno_t (*window_move)(void *, sysarg_t, gfx_coord2_t *);
    6363        errno_t (*window_get_pos)(void *, sysarg_t, gfx_coord2_t *);
  • uspace/lib/display/include/display.h

    r46a47c0 rb0ae23f  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5656extern errno_t display_window_move_req(display_window_t *, gfx_coord2_t *);
    5757extern errno_t display_window_resize_req(display_window_t *,
    58     display_wnd_rsztype_t, gfx_coord2_t *);
     58    display_wnd_rsztype_t, gfx_coord2_t *, sysarg_t);
    5959extern errno_t display_window_move(display_window_t *, gfx_coord2_t *);
    6060extern errno_t display_window_get_pos(display_window_t *, gfx_coord2_t *);
  • uspace/lib/display/src/disp_srv.c

    r46a47c0 rb0ae23f  
    320320        display_wnd_rsztype_t rsztype;
    321321        gfx_coord2_t pos;
     322        sysarg_t pos_id;
    322323        size_t size;
    323324        errno_t rc;
     
    325326        wnd_id = ipc_get_arg1(icall);
    326327        rsztype = (display_wnd_rsztype_t) ipc_get_arg2(icall);
     328        pos_id = ipc_get_arg3(icall);
    327329
    328330        if (!async_data_write_receive(&call, &size)) {
     
    350352        }
    351353
    352         rc = srv->ops->window_resize_req(srv->arg, wnd_id, rsztype, &pos);
     354        rc = srv->ops->window_resize_req(srv->arg, wnd_id, rsztype, &pos,
     355            pos_id);
    353356        async_answer_0(icall, rc);
    354357}
  • uspace/lib/display/src/display.c

    r46a47c0 rb0ae23f  
    414414 * @param rsztype Resize type (which part of window frame is being dragged)
    415415 * @param pos Position in the window where the button was pressed
     416 * @param pos_id Positioning device ID
    416417 * @return EOK on success or an error code
    417418 */
    418419errno_t display_window_resize_req(display_window_t *window,
    419     display_wnd_rsztype_t rsztype, gfx_coord2_t *pos)
    420 {
    421         async_exch_t *exch;
    422         aid_t req;
    423         ipc_call_t answer;
    424         errno_t rc;
    425 
    426         exch = async_exchange_begin(window->display->sess);
    427         req = async_send_2(exch, DISPLAY_WINDOW_RESIZE_REQ, window->id,
    428             (sysarg_t) rsztype, &answer);
     420    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
     421{
     422        async_exch_t *exch;
     423        aid_t req;
     424        ipc_call_t answer;
     425        errno_t rc;
     426
     427        exch = async_exchange_begin(window->display->sess);
     428        req = async_send_3(exch, DISPLAY_WINDOW_RESIZE_REQ, window->id,
     429            (sysarg_t) rsztype, pos_id, &answer);
    429430        rc = async_data_write_start(exch, (void *)pos, sizeof (gfx_coord2_t));
    430431        async_exchange_end(exch);
  • uspace/lib/display/test/display.c

    r46a47c0 rb0ae23f  
    6363static errno_t test_window_get_max_rect(void *, sysarg_t, gfx_rect_t *);
    6464static errno_t test_window_resize_req(void *, sysarg_t, display_wnd_rsztype_t,
    65     gfx_coord2_t *);
     65    gfx_coord2_t *, sysarg_t);
    6666static errno_t test_window_resize(void *, sysarg_t, gfx_coord2_t *,
    6767    gfx_rect_t *);
     
    141141        display_wnd_rsztype_t resize_req_rsztype;
    142142        gfx_coord2_t resize_req_pos;
     143        sysarg_t resize_req_pos_id;
    143144
    144145        bool window_resize_called;
     
    831832        display_wnd_rsztype_t rsztype;
    832833        gfx_coord2_t pos;
     834        sysarg_t pos_id;
    833835
    834836        async_set_fallback_port_handler(test_display_conn, &resp);
     
    863865        pos.x = 42;
    864866        pos.y = 43;
    865 
    866         rc = display_window_resize_req(wnd, rsztype, &pos);
     867        pos_id = 44;
     868
     869        rc = display_window_resize_req(wnd, rsztype, &pos, pos_id);
    867870        PCUT_ASSERT_TRUE(resp.window_resize_req_called);
    868871        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     
    871874        PCUT_ASSERT_INT_EQUALS(pos.x, resp.resize_req_pos.x);
    872875        PCUT_ASSERT_INT_EQUALS(pos.y, resp.resize_req_pos.y);
     876        PCUT_ASSERT_INT_EQUALS(pos_id, resp.resize_req_pos_id);
    873877
    874878        display_window_destroy(wnd);
     
    889893        display_wnd_rsztype_t rsztype;
    890894        gfx_coord2_t pos;
     895        sysarg_t pos_id;
    891896
    892897        async_set_fallback_port_handler(test_display_conn, &resp);
     
    921926        pos.x = 42;
    922927        pos.y = 43;
    923 
    924         rc = display_window_resize_req(wnd, rsztype, &pos);
     928        pos_id = 44;
     929
     930        rc = display_window_resize_req(wnd, rsztype, &pos, pos_id);
    925931        PCUT_ASSERT_TRUE(resp.window_resize_req_called);
    926932        PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
     
    929935        PCUT_ASSERT_INT_EQUALS(pos.x, resp.resize_req_pos.x);
    930936        PCUT_ASSERT_INT_EQUALS(pos.y, resp.resize_req_pos.y);
     937        PCUT_ASSERT_INT_EQUALS(pos_id, resp.resize_req_pos_id);
    931938
    932939        display_window_destroy(wnd);
     
    21882195
    21892196static errno_t test_window_resize_req(void *arg, sysarg_t wnd_id,
    2190     display_wnd_rsztype_t rsztype, gfx_coord2_t *pos)
     2197    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
    21912198{
    21922199        test_response_t *resp = (test_response_t *) arg;
     
    21962203        resp->resize_req_wnd_id = wnd_id;
    21972204        resp->resize_req_pos = *pos;
     2205        resp->resize_req_pos_id = pos_id;
    21982206        return resp->rc;
    21992207}
Note: See TracChangeset for help on using the changeset viewer.