Changeset b0ae23f in mainline for uspace/lib/ui/test/wdecor.c


Ignore:
Timestamp:
2023-01-17T15:21:13Z (2 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/wdecor.c

    r46a47c0 rb0ae23f  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6868static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *);
    6969static void test_wdecor_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
    70     gfx_coord2_t *);
     70    gfx_coord2_t *, sysarg_t);
    7171static void test_wdecor_set_cursor(ui_wdecor_t *, void *, ui_stock_cursor_t);
    7272
     
    108108        bool move;
    109109        gfx_coord2_t pos;
     110        sysarg_t pos_id;
    110111        bool resize;
    111112        ui_wdecor_rsztype_t rsztype;
     
    373374        ui_wdecor_rsztype_t rsztype;
    374375        gfx_coord2_t pos;
     376        sysarg_t pos_id;
    375377
    376378        rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
     
    380382        pos.x = 3;
    381383        pos.y = 4;
     384        pos_id = 5;
    382385
    383386        /* Resize callback with no callbacks set */
    384         ui_wdecor_resize(wdecor, rsztype, &pos);
     387        ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
    385388
    386389        /* Resize callback with move callback not implemented */
    387390        ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
    388         ui_wdecor_resize(wdecor, rsztype, &pos);
     391        ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
    389392
    390393        /* Resize callback with real callback set */
     
    394397        resp.pos.y = 0;
    395398        ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
    396         ui_wdecor_resize(wdecor, rsztype, &pos);
     399        ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
    397400        PCUT_ASSERT_TRUE(resp.resize);
    398401        PCUT_ASSERT_INT_EQUALS(rsztype, resp.rsztype);
    399402        PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x);
    400403        PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y);
     404        PCUT_ASSERT_INT_EQUALS(pos_id, resp.pos_id);
    401405
    402406        ui_wdecor_destroy(wdecor);
     
    10801084
    10811085static void test_wdecor_resize(ui_wdecor_t *wdecor, void *arg,
    1082     ui_wdecor_rsztype_t rsztype, gfx_coord2_t *pos)
     1086    ui_wdecor_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
    10831087{
    10841088        test_cb_resp_t *resp = (test_cb_resp_t *) arg;
     
    10871091        resp->rsztype = rsztype;
    10881092        resp->pos = *pos;
     1093        resp->pos_id = pos_id;
    10891094}
    10901095
Note: See TracChangeset for help on using the changeset viewer.