Ignore:
File:
1 edited

Legend:

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

    r6fbd1f9 r78445be8  
    11/*
    2  * Copyright (c) 2024 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>
     
    4039#include <str_error.h>
    4140#include "display.h"
    42 #include "ievent.h"
    4341#include "input.h"
    4442#include "main.h"
     
    4644static errno_t ds_input_ev_active(input_t *);
    4745static errno_t ds_input_ev_deactive(input_t *);
    48 static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
    49     keymod_t, char32_t);
    50 static errno_t ds_input_ev_move(input_t *, unsigned, int, int);
    51 static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
    52     unsigned, unsigned);
    53 static errno_t ds_input_ev_button(input_t *, unsigned, int, int);
    54 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);
    5550
    5651static input_ev_ops_t ds_input_ev_ops = {
     
    6055        .move = ds_input_ev_move,
    6156        .abs_move = ds_input_ev_abs_move,
    62         .button = ds_input_ev_button,
    63         .dclick = ds_input_ev_dclick
     57        .button = ds_input_ev_button
    6458};
    6559
     
    7468}
    7569
    76 static errno_t ds_input_ev_key(input_t *input, unsigned kbd_id,
    77     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)
    7872{
    7973        ds_display_t *disp = (ds_display_t *) input->user;
     
    8175        errno_t rc;
    8276
    83         event.kbd_id = kbd_id;
    8477        event.type = type;
    8578        event.key = key;
     
    8881
    8982        ds_display_lock(disp);
    90         rc = ds_ievent_post_kbd(disp, &event);
     83        rc = ds_display_post_kbd_event(disp, &event);
    9184        ds_display_unlock(disp);
    9285        return rc;
    9386}
    9487
    95 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)
    9689{
    9790        ds_display_t *disp = (ds_display_t *) input->user;
     
    9992        errno_t rc;
    10093
    101         event.pos_id = pos_id;
    10294        event.type = PTD_MOVE;
    10395        event.dmove.x = dx;
     
    10597
    10698        ds_display_lock(disp);
    107         rc = ds_ievent_post_ptd(disp, &event);
     99        rc = ds_display_post_ptd_event(disp, &event);
    108100        ds_display_unlock(disp);
    109101        return rc;
    110102}
    111103
    112 static errno_t ds_input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
    113     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)
    114106{
    115107        ds_display_t *disp = (ds_display_t *) input->user;
     
    117109        errno_t rc;
    118110
    119         event.pos_id = pos_id;
    120111        event.type = PTD_ABS_MOVE;
    121112        event.apos.x = x;
     
    127118
    128119        ds_display_lock(disp);
    129         rc = ds_ievent_post_ptd(disp, &event);
     120        rc = ds_display_post_ptd_event(disp, &event);
    130121        ds_display_unlock(disp);
    131122        return rc;
    132123}
    133124
    134 static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum,
    135     int bpress)
     125static errno_t ds_input_ev_button(input_t *input, int bnum, int bpress)
    136126{
    137127        ds_display_t *disp = (ds_display_t *) input->user;
     
    139129        errno_t rc;
    140130
    141         event.pos_id = pos_id;
    142131        event.type = bpress ? PTD_PRESS : PTD_RELEASE;
    143132        event.btn_num = bnum;
     
    146135
    147136        ds_display_lock(disp);
    148         rc = ds_ievent_post_ptd(disp, &event);
    149         ds_display_unlock(disp);
    150         return rc;
    151 }
    152 
    153 static errno_t ds_input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
    154 {
    155         ds_display_t *disp = (ds_display_t *) input->user;
    156         ptd_event_t event;
    157         errno_t rc;
    158 
    159         event.pos_id = pos_id;
    160         event.type = PTD_DCLICK;
    161         event.btn_num = bnum;
    162         event.dmove.x = 0;
    163         event.dmove.y = 0;
    164 
    165         ds_display_lock(disp);
    166         rc = ds_ievent_post_ptd(disp, &event);
     137        rc = ds_display_post_ptd_event(disp, &event);
    167138        ds_display_unlock(disp);
    168139        return rc;
Note: See TracChangeset for help on using the changeset viewer.