Changes in uspace/srv/hid/console/console.c [8a99c7e:2f90b46] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r8a99c7e r2f90b46 76 76 } console_state_t; 77 77 78 #define UTF8_CHAR_BUFFER_SIZE (STR_BOUNDS(1) + 1)79 80 78 typedef struct { 81 79 atomic_t refcnt; /**< Connection reference count */ 82 80 prodcons_t input_pc; /**< Incoming keyboard events */ 83 char char_remains[UTF8_CHAR_BUFFER_SIZE]; /**< Not yet sent bytes of last char event. */84 size_t char_remains_len; /**< Number of not yet sent bytes. */85 81 86 82 fibril_mutex_t mtx; /**< Lock protecting mutable fields */ … … 383 379 384 380 fb_pointer_update(fb_sess, mouse.x, mouse.y, true); 385 }386 387 static void cons_mouse_abs_move(sysarg_t x, sysarg_t y,388 sysarg_t max_x, sysarg_t max_y)389 {390 if (max_x && max_y) {391 mouse.x = limit(x * xres / max_x, 0, xres);392 mouse.y = limit(y * yres / max_y, 0, yres);393 394 fb_pointer_update(fb_sess, mouse.x, mouse.y, true);395 }396 381 } 397 382 … … 514 499 async_answer_0(callid, EOK); 515 500 break; 516 case INPUT_EVENT_ABS_MOVE:517 cons_mouse_abs_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call),518 IPC_GET_ARG3(call), IPC_GET_ARG4(call));519 async_answer_0(callid, EOK);520 break;521 501 case INPUT_EVENT_BUTTON: 522 502 /* Got pointer button press/release event */ … … 633 613 634 614 size_t pos = 0; 635 636 /*637 * Read input from keyboard and copy it to the buffer.638 * We need to handle situation when wchar is split by 2 following639 * reads.640 */641 615 while (pos < size) { 642 /* Copy to the buffer remaining characters. */ 643 while ((pos < size) && (cons->char_remains_len > 0)) { 644 buf[pos] = cons->char_remains[0]; 616 link_t *link = prodcons_consume(&cons->input_pc); 617 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 618 619 if (event->type == KEY_PRESS) { 620 buf[pos] = event->c; 645 621 pos++; 646 647 /* Unshift the array. */ 648 for (size_t i = 1; i < cons->char_remains_len; i++) 649 cons->char_remains[i - 1] = cons->char_remains[i]; 650 651 cons->char_remains_len--; 652 } 653 654 /* Still not enough? Then get another key from the queue. */ 655 if (pos < size) { 656 link_t *link = prodcons_consume(&cons->input_pc); 657 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 658 659 /* Accept key presses of printable chars only. */ 660 if ((event->type == KEY_PRESS) && (event->c != 0)) { 661 wchar_t tmp[2] = { event->c, 0 }; 662 wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp); 663 cons->char_remains_len = str_size(cons->char_remains); 664 } 665 666 free(event); 667 } 622 } 623 624 free(event); 668 625 } 669 626 … … 973 930 fibril_mutex_initialize(&consoles[i].mtx); 974 931 prodcons_initialize(&consoles[i].input_pc); 975 consoles[i].char_remains_len = 0;976 932 977 933 if (graphics_state == GRAPHICS_FULL) {
Note:
See TracChangeset
for help on using the changeset viewer.