Changeset 6828a56 in mainline for uspace/srv/hid/display/test/window.c


Ignore:
Timestamp:
2023-01-19T13:51:14Z (23 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d380b6
Parents:
3be5366
git-author:
Jiri Svoboda <jiri@…> (2023-01-19 19:50:50)
git-committer:
Jiri Svoboda <jiri@…> (2023-01-19 13:51:14)
Message:

Avoid two seats fighting when moving/resizing a window

When two seats have focus on the same window, both pointer's movements
would be delivered to it. Make sure only the seat which started the
move or resize operation affects the operation, otherwise they fight
over it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/test/window.c

    r3be5366 r6828a56  
    3636#include "../client.h"
    3737#include "../display.h"
     38#include "../idevcfg.h"
    3839#include "../seat.h"
    3940#include "../window.h"
     
    12731274}
    12741275
     1276/** ds_window_orig_seat() correctly compares seats */
     1277PCUT_TEST(window_orig_seat)
     1278{
     1279        gfx_context_t *gc;
     1280        ds_display_t *disp;
     1281        ds_client_t *client;
     1282        ds_seat_t *seat0;
     1283        ds_seat_t *seat1;
     1284        sysarg_t devid0;
     1285        sysarg_t devid1;
     1286        ds_idevcfg_t *cfg0;
     1287        ds_idevcfg_t *cfg1;
     1288        ds_window_t *wnd;
     1289        display_wnd_params_t params;
     1290        errno_t rc;
     1291
     1292        rc = gfx_context_new(&dummy_ops, NULL, &gc);
     1293        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1294
     1295        rc = ds_display_create(gc, df_none, &disp);
     1296        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1297
     1298        rc = ds_client_create(disp, NULL, NULL, &client);
     1299        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1300
     1301        rc = ds_seat_create(disp, "Alice", &seat0);
     1302        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1303
     1304        rc = ds_seat_create(disp, "Bob", &seat1);
     1305        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1306
     1307        display_wnd_params_init(&params);
     1308        params.rect.p0.x = params.rect.p0.y = 0;
     1309        params.rect.p1.x = params.rect.p1.y = 1;
     1310
     1311        rc = ds_window_create(client, &params, &wnd);
     1312        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1313
     1314        devid0 = 42;
     1315        devid1 = 43;
     1316
     1317        rc = ds_idevcfg_create(disp, devid0, seat0, &cfg0);
     1318        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1319
     1320        rc = ds_idevcfg_create(disp, devid1, seat1, &cfg1);
     1321        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1322
     1323        wnd->state = dsw_moving;
     1324        wnd->orig_pos_id = devid0;
     1325
     1326        PCUT_ASSERT_TRUE(ds_window_orig_seat(wnd, devid0));
     1327        PCUT_ASSERT_FALSE(ds_window_orig_seat(wnd, devid1));
     1328
     1329        ds_idevcfg_destroy(cfg0);
     1330        ds_idevcfg_destroy(cfg1);
     1331        ds_window_destroy(wnd);
     1332        ds_seat_destroy(seat0);
     1333        ds_seat_destroy(seat1);
     1334        ds_client_destroy(client);
     1335        ds_display_destroy(disp);
     1336}
     1337
    12751338static errno_t dummy_set_color(void *arg, gfx_color_t *color)
    12761339{
Note: See TracChangeset for help on using the changeset viewer.