Changes in uspace/srv/hid/display/input.c [78445be8:6fbd1f9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/input.c
r78445be8 r6fbd1f9 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 35 35 #include <errno.h> 36 #include <inttypes.h> 36 37 #include <io/input.h> 37 38 #include <io/log.h> … … 39 40 #include <str_error.h> 40 41 #include "display.h" 42 #include "ievent.h" 41 43 #include "input.h" 42 44 #include "main.h" … … 44 46 static errno_t ds_input_ev_active(input_t *); 45 47 static 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); 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); 50 55 51 56 static input_ev_ops_t ds_input_ev_ops = { … … 55 60 .move = ds_input_ev_move, 56 61 .abs_move = ds_input_ev_abs_move, 57 .button = ds_input_ev_button 62 .button = ds_input_ev_button, 63 .dclick = ds_input_ev_dclick 58 64 }; 59 65 … … 68 74 } 69 75 70 static errno_t ds_input_ev_key(input_t *input, kbd_event_type_t type,71 k eycode_t key, keymod_t mods, wchar_t c)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) 72 78 { 73 79 ds_display_t *disp = (ds_display_t *) input->user; … … 75 81 errno_t rc; 76 82 83 event.kbd_id = kbd_id; 77 84 event.type = type; 78 85 event.key = key; … … 81 88 82 89 ds_display_lock(disp); 83 rc = ds_display_post_kbd_event(disp, &event); 84 ds_display_unlock(disp); 85 return rc; 86 } 87 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 90 rc = ds_ievent_post_kbd(disp, &event); 91 ds_display_unlock(disp); 92 return rc; 93 } 94 95 static errno_t ds_input_ev_move(input_t *input, unsigned pos_id, int dx, int dy) 96 { 97 ds_display_t *disp = (ds_display_t *) input->user; 98 ptd_event_t event; 99 errno_t rc; 100 101 event.pos_id = pos_id; 94 102 event.type = PTD_MOVE; 95 103 event.dmove.x = dx; … … 97 105 98 106 ds_display_lock(disp); 99 rc = ds_display_post_ptd_event(disp, &event); 100 ds_display_unlock(disp); 101 return rc; 102 } 103 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 107 rc = ds_ievent_post_ptd(disp, &event); 108 ds_display_unlock(disp); 109 return rc; 110 } 111 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) 114 { 115 ds_display_t *disp = (ds_display_t *) input->user; 116 ptd_event_t event; 117 errno_t rc; 118 119 event.pos_id = pos_id; 111 120 event.type = PTD_ABS_MOVE; 112 121 event.apos.x = x; … … 118 127 119 128 ds_display_lock(disp); 120 rc = ds_display_post_ptd_event(disp, &event); 121 ds_display_unlock(disp); 122 return rc; 123 } 124 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 129 rc = ds_ievent_post_ptd(disp, &event); 130 ds_display_unlock(disp); 131 return rc; 132 } 133 134 static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum, 135 int bpress) 136 { 137 ds_display_t *disp = (ds_display_t *) input->user; 138 ptd_event_t event; 139 errno_t rc; 140 141 event.pos_id = pos_id; 131 142 event.type = bpress ? PTD_PRESS : PTD_RELEASE; 132 143 event.btn_num = bnum; … … 135 146 136 147 ds_display_lock(disp); 137 rc = ds_display_post_ptd_event(disp, &event); 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); 138 167 ds_display_unlock(disp); 139 168 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.