Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/input.c

    r78445be8 r88d828e  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3434
    3535#include <errno.h>
     36#include <inttypes.h>
    3637#include <io/input.h>
    3738#include <io/log.h>
     
    4445static errno_t ds_input_ev_active(input_t *);
    4546static errno_t ds_input_ev_deactive(input_t *);
    46 static errno_t ds_input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
    47 static errno_t ds_input_ev_move(input_t *, int, int);
    48 static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
    49 static errno_t ds_input_ev_button(input_t *, int, int);
     47static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
     48    keymod_t, char32_t);
     49static errno_t ds_input_ev_move(input_t *, unsigned, int, int);
     50static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
     51    unsigned, unsigned);
     52static errno_t ds_input_ev_button(input_t *, unsigned, int, int);
     53static errno_t ds_input_ev_dclick(input_t *, unsigned, int);
    5054
    5155static input_ev_ops_t ds_input_ev_ops = {
     
    5559        .move = ds_input_ev_move,
    5660        .abs_move = ds_input_ev_abs_move,
    57         .button = ds_input_ev_button
     61        .button = ds_input_ev_button,
     62        .dclick = ds_input_ev_dclick
    5863};
    5964
     
    6873}
    6974
    70 static errno_t ds_input_ev_key(input_t *input, kbd_event_type_t type,
    71     keycode_t key, keymod_t mods, wchar_t c)
     75static errno_t ds_input_ev_key(input_t *input, unsigned kbd_id,
     76    kbd_event_type_t type, keycode_t key, keymod_t mods, char32_t c)
    7277{
    7378        ds_display_t *disp = (ds_display_t *) input->user;
     
    7580        errno_t rc;
    7681
     82        event.kbd_id = kbd_id;
    7783        event.type = type;
    7884        event.key = key;
     
    8692}
    8793
    88 static errno_t ds_input_ev_move(input_t *input, int dx, int dy)
    89 {
    90         ds_display_t *disp = (ds_display_t *) input->user;
    91         ptd_event_t event;
    92         errno_t rc;
    93 
     94static errno_t ds_input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
     95{
     96        ds_display_t *disp = (ds_display_t *) input->user;
     97        ptd_event_t event;
     98        errno_t rc;
     99
     100        event.pos_id = pos_id;
    94101        event.type = PTD_MOVE;
    95102        event.dmove.x = dx;
     
    102109}
    103110
    104 static errno_t ds_input_ev_abs_move(input_t *input, unsigned x, unsigned y,
    105     unsigned max_x, unsigned max_y)
    106 {
    107         ds_display_t *disp = (ds_display_t *) input->user;
    108         ptd_event_t event;
    109         errno_t rc;
    110 
     111static errno_t ds_input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
     112    unsigned y, unsigned max_x, unsigned max_y)
     113{
     114        ds_display_t *disp = (ds_display_t *) input->user;
     115        ptd_event_t event;
     116        errno_t rc;
     117
     118        event.pos_id = pos_id;
    111119        event.type = PTD_ABS_MOVE;
    112120        event.apos.x = x;
     
    123131}
    124132
    125 static errno_t ds_input_ev_button(input_t *input, int bnum, int bpress)
    126 {
    127         ds_display_t *disp = (ds_display_t *) input->user;
    128         ptd_event_t event;
    129         errno_t rc;
    130 
     133static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum,
     134    int bpress)
     135{
     136        ds_display_t *disp = (ds_display_t *) input->user;
     137        ptd_event_t event;
     138        errno_t rc;
     139
     140        event.pos_id = pos_id;
    131141        event.type = bpress ? PTD_PRESS : PTD_RELEASE;
     142        event.btn_num = bnum;
     143        event.dmove.x = 0;
     144        event.dmove.y = 0;
     145
     146        ds_display_lock(disp);
     147        rc = ds_display_post_ptd_event(disp, &event);
     148        ds_display_unlock(disp);
     149        return rc;
     150}
     151
     152static errno_t ds_input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
     153{
     154        ds_display_t *disp = (ds_display_t *) input->user;
     155        ptd_event_t event;
     156        errno_t rc;
     157
     158        event.pos_id = pos_id;
     159        event.type = PTD_DCLICK;
    132160        event.btn_num = bnum;
    133161        event.dmove.x = 0;
Note: See TracChangeset for help on using the changeset viewer.