Changeset b0ae23f in mainline for uspace/srv/hid/display/window.c


Ignore:
Timestamp:
2023-01-17T15:21:13Z (15 months 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/srv/hid/display/window.c

    r46a47c0 rb0ae23f  
    510510 * @param rsztype Resize type (which part of window is being dragged)
    511511 * @param pos Position where mouse button was pressed
     512 * @param pos_id Positioning device ID
    512513 */
    513514static void ds_window_start_resize(ds_window_t *wnd,
    514     display_wnd_rsztype_t rsztype, gfx_coord2_t *pos)
     515    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
    515516{
    516517        ds_seat_t *seat;
     
    523524                return;
    524525
     526        /* Determine which seat started the resize */
     527        seat = ds_display_seat_by_idev(wnd->display, pos_id);
     528        if (seat == NULL)
     529                return;
     530
    525531        wnd->orig_pos = *pos;
     532        wnd->orig_pos_id = pos_id;
    526533        wnd->state = dsw_resizing;
    527534        wnd->rsztype = rsztype;
    528535        wnd->preview_rect = wnd->rect;
    529536
    530         // TODO Multi-seat: need client to tell us which seat started the resize!
    531         seat = ds_display_first_seat(wnd->display);
    532537        ctype = display_cursor_from_wrsz(rsztype);
    533538        ds_seat_set_wm_cursor(seat, wnd->display->cursor[ctype]);
     
    559564        ds_client_post_resize_event(wnd->client, wnd, &nrect);
    560565
    561         // TODO Multi-seat: Need to know which seat started the resize!
    562         seat = ds_display_first_seat(wnd->display);
    563         ds_seat_set_wm_cursor(seat, NULL);
     566        /* Determine which seat started the resize */
     567        seat = ds_display_seat_by_idev(wnd->display, wnd->orig_pos_id);
     568        if (seat != NULL)
     569                ds_seat_set_wm_cursor(seat, NULL);
    564570
    565571        (void) ds_display_paint(wnd->display, NULL);
     
    787793 * @param pos Position where the pointer was when the resize started
    788794 *            relative to the window
     795 * @param pos_id Positioning device ID
    789796 * @param event Button press event
    790797 */
    791798void ds_window_resize_req(ds_window_t *wnd, display_wnd_rsztype_t rsztype,
    792     gfx_coord2_t *pos)
     799    gfx_coord2_t *pos, sysarg_t pos_id)
    793800{
    794801        gfx_coord2_t orig_pos;
    795802
    796         log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_resize_req (%d, %d, %d)",
    797             (int) rsztype, (int) pos->x, (int) pos->y);
     803        log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_resize_req (%d, %d, %d, %d)",
     804            (int)rsztype, (int)pos->x, (int)pos->y, (int)pos_id);
    798805
    799806        gfx_coord2_add(&wnd->dpos, pos, &orig_pos);
    800         ds_window_start_resize(wnd, rsztype, &orig_pos);
     807        ds_window_start_resize(wnd, rsztype, &orig_pos, pos_id);
    801808}
    802809
Note: See TracChangeset for help on using the changeset viewer.