Ignore:
File:
1 edited

Legend:

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

    r88d828e r78445be8  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2019 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3434
    3535#include <errno.h>
    36 #include <inttypes.h>
    3736#include <io/input.h>
    3837#include <io/log.h>
     
    4544static errno_t ds_input_ev_active(input_t *);
    4645static errno_t ds_input_ev_deactive(input_t *);
    47 static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
    48     keymod_t, char32_t);
    49 static errno_t ds_input_ev_move(input_t *, unsigned, int, int);
    50 static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
    51     unsigned, unsigned);
    52 static errno_t ds_input_ev_button(input_t *, unsigned, int, int);
    53 static errno_t ds_input_ev_dclick(input_t *, unsigned, int);
     46static errno_t ds_input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
     47static errno_t ds_input_ev_move(input_t *, int, int);
     48static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
     49static errno_t ds_input_ev_button(input_t *, int, int);
    5450
    5551static input_ev_ops_t ds_input_ev_ops = {
     
    5955        .move = ds_input_ev_move,
    6056        .abs_move = ds_input_ev_abs_move,
    61         .button = ds_input_ev_button,
    62         .dclick = ds_input_ev_dclick
     57        .button = ds_input_ev_button
    6358};
    6459
     
    7368}
    7469
    75 static 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)
     70static errno_t ds_input_ev_key(input_t *input, kbd_event_type_t type,
     71    keycode_t key, keymod_t mods, wchar_t c)
    7772{
    7873        ds_display_t *disp = (ds_display_t *) input->user;
     
    8075        errno_t rc;
    8176
    82         event.kbd_id = kbd_id;
    8377        event.type = type;
    8478        event.key = key;
     
    9286}
    9387
    94 static errno_t ds_input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
     88static errno_t ds_input_ev_move(input_t *input, int dx, int dy)
    9589{
    9690        ds_display_t *disp = (ds_display_t *) input->user;
     
    9892        errno_t rc;
    9993
    100         event.pos_id = pos_id;
    10194        event.type = PTD_MOVE;
    10295        event.dmove.x = dx;
     
    109102}
    110103
    111 static errno_t ds_input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
    112     unsigned y, unsigned max_x, unsigned max_y)
     104static errno_t ds_input_ev_abs_move(input_t *input, unsigned x, unsigned y,
     105    unsigned max_x, unsigned max_y)
    113106{
    114107        ds_display_t *disp = (ds_display_t *) input->user;
     
    116109        errno_t rc;
    117110
    118         event.pos_id = pos_id;
    119111        event.type = PTD_ABS_MOVE;
    120112        event.apos.x = x;
     
    131123}
    132124
    133 static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum,
    134     int bpress)
     125static errno_t ds_input_ev_button(input_t *input, int bnum, int bpress)
    135126{
    136127        ds_display_t *disp = (ds_display_t *) input->user;
     
    138129        errno_t rc;
    139130
    140         event.pos_id = pos_id;
    141131        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 
    152 static 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;
    160132        event.btn_num = bnum;
    161133        event.dmove.x = 0;
Note: See TracChangeset for help on using the changeset viewer.