Changeset 88d828e in mainline


Ignore:
Timestamp:
2022-11-09T16:44:28Z (18 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68704ab
Parents:
a6492460
git-author:
Jiri Svoboda <jiri@…> (2022-11-09 16:41:51)
git-committer:
Jiri Svoboda <jiri@…> (2022-11-09 16:44:28)
Message:

Keyboard events need device ID too + some DS multiseat work

Location:
uspace
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/kbd_event.h

    ra6492460 r88d828e  
    11/*
    2  * Copyright (c) 2012 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3939#include <inttypes.h>
    4040#include <io/keycode.h>
     41#include <types/common.h>
    4142
    4243typedef enum {
     
    4950        /** List handle */
    5051        link_t link;
     52
     53        /** Keyboard device ID */
     54        sysarg_t kbd_id;
    5155
    5256        /** Press or release event. */
  • uspace/srv/hid/display/display.c

    ra6492460 r88d828e  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    445445        ds_seat_t *seat;
    446446
    447         // TODO Determine which seat the event belongs to
    448         seat = ds_display_first_seat(display);
     447        /* Determine which seat the event belongs to */
     448        seat = ds_display_seat_by_idev(display, event->kbd_id);
    449449        if (seat == NULL)
    450450                return EOK;
     
    462462        ds_seat_t *seat;
    463463
    464         // TODO Determine which seat the event belongs to
    465         seat = ds_display_first_seat(display);
     464        /* Determine which seat the event belongs to */
     465        seat = ds_display_seat_by_idev(display, event->pos_id);
    466466        if (seat == NULL)
    467467                return EOK;
     
    522522
    523523        return list_get_instance(link, ds_seat_t, lseats);
     524}
     525
     526/** Get seat which owns the specified input device.
     527 *
     528 * @param disp Display
     529 * @param idev_id Input device ID
     530 * @return Seat which owns device with ID @a idev_id or @c NULL if not found
     531 */
     532ds_seat_t *ds_display_seat_by_idev(ds_display_t *disp, ds_idev_id_t idev_id)
     533{
     534        // TODO Multi-seat
     535        (void) idev_id;
     536
     537        return ds_display_first_seat(disp);
    524538}
    525539
  • uspace/srv/hid/display/display.h

    ra6492460 r88d828e  
    4646#include "types/display/ddev.h"
    4747#include "types/display/display.h"
     48#include "types/display/idev.h"
    4849#include "types/display/ptd_event.h"
    4950#include "types/display/seat.h"
     
    7980extern ds_seat_t *ds_display_first_seat(ds_display_t *);
    8081extern ds_seat_t *ds_display_next_seat(ds_seat_t *);
     82extern ds_seat_t *ds_display_seat_by_idev(ds_display_t *, ds_idev_id_t);
    8183extern errno_t ds_display_add_ddev(ds_display_t *, ds_ddev_t *);
    8284extern void ds_display_remove_ddev(ds_ddev_t *);
  • uspace/srv/hid/display/input.c

    ra6492460 r88d828e  
    8080        errno_t rc;
    8181
    82         (void)kbd_id;
    83 
     82        event.kbd_id = kbd_id;
    8483        event.type = type;
    8584        event.key = key;
  • uspace/srv/hid/display/test/display.c

    ra6492460 r88d828e  
    317317}
    318318
     319/** ds_display_seat_by_idev() returns the correct seat. */
     320PCUT_TEST(display_seat_by_idev)
     321{
     322        // XXX TODO
     323}
     324
    319325/** Test ds_display_post_kbd_event() delivers event to client callback.
    320326 */
  • uspace/srv/hid/display/window.c

    ra6492460 r88d828e  
    142142        }
    143143
     144        // TODO Multi-seat: which seat should own the new window?
    144145        seat = ds_display_first_seat(client->display);
    145146
     
    505506        wnd->preview_rect = wnd->rect;
    506507
    507         // XXX Need client to tell us which seat started the resize!
     508        // TODO Multi-seat: need client to tell us which seat started the resize!
    508509        seat = ds_display_first_seat(wnd->display);
    509510        ctype = display_cursor_from_wrsz(rsztype);
     
    536537        ds_client_post_resize_event(wnd->client, wnd, &nrect);
    537538
    538         // XXX Need to know which seat started the resize!
     539        // TODO Multi-seat: Need to know which seat started the resize!
    539540        seat = ds_display_first_seat(wnd->display);
    540541        ds_seat_set_wm_cursor(seat, NULL);
  • uspace/srv/hid/display/wmops.c

    ra6492460 r88d828e  
    171171        }
    172172
    173         // TODO Multi-seat
    174         (void) dev_id;
    175         seat = ds_display_first_seat(wnd->display);
     173        /* Determine which seat's focus should be changed */
     174        seat = ds_display_seat_by_idev(wnd->display, dev_id);
     175        if (seat == NULL) {
     176                ds_display_unlock(wmclient->display);
     177                return ENOENT;
     178        }
    176179
    177180        /* Switch focus */
Note: See TracChangeset for help on using the changeset viewer.