Changes in uspace/lib/gui/terminal.c [feeac0d:ba733e83] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/terminal.c
rfeeac0d rba733e83 77 77 static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t); 78 78 static void term_set_cursor_visibility(con_srv_t *, bool); 79 static int term_get_event(con_srv_t *, cons_event_t *);79 static int term_get_event(con_srv_t *, kbd_event_t *); 80 80 81 81 static con_ops_t con_ops = { … … 420 420 if (pos < size) { 421 421 link_t *link = prodcons_consume(&term->input_pc); 422 cons_event_t *event = list_get_instance(link, cons_event_t, link);422 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 423 423 424 424 /* Accept key presses of printable chars only. */ 425 if (event->type == CEV_KEY && event->ev.key.type == KEY_PRESS && 426 event->ev.key.c != 0) { 425 if ((event->type == KEY_PRESS) && (event->c != 0)) { 427 426 wchar_t tmp[2] = { 428 event-> ev.key.c,427 event->c, 429 428 0 430 429 }; … … 580 579 } 581 580 582 static int term_get_event(con_srv_t *srv, cons_event_t *event)581 static int term_get_event(con_srv_t *srv, kbd_event_t *event) 583 582 { 584 583 terminal_t *term = srv_to_terminal(srv); 585 584 link_t *link = prodcons_consume(&term->input_pc); 586 cons_event_t *ev = list_get_instance(link, cons_event_t, link);587 588 *event = * ev;589 free( ev);585 kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link); 586 587 *event = *kevent; 588 free(kevent); 590 589 return EOK; 591 590 } … … 635 634 } 636 635 637 static void terminal_queue_cons_event(terminal_t *term, cons_event_t *ev) 638 { 636 static void terminal_handle_keyboard_event(widget_t *widget, 637 kbd_event_t kbd_event) 638 { 639 terminal_t *term = (terminal_t *) widget; 640 639 641 /* Got key press/release event */ 640 cons_event_t *event =641 ( cons_event_t *) malloc(sizeof(cons_event_t));642 kbd_event_t *event = 643 (kbd_event_t *) malloc(sizeof(kbd_event_t)); 642 644 if (event == NULL) 643 645 return; 644 646 645 *event = *ev;646 647 link_initialize(&event->link); 648 event->type = kbd_event.type; 649 event->key = kbd_event.key; 650 event->mods = kbd_event.mods; 651 event->c = kbd_event.c; 647 652 648 653 prodcons_produce(&term->input_pc, &event->link); 649 654 } 650 655 651 /* Got key press/release event */ 652 static void terminal_handle_keyboard_event(widget_t *widget, 653 kbd_event_t kbd_event) 654 { 655 terminal_t *term = (terminal_t *) widget; 656 cons_event_t event; 657 658 event.type = CEV_KEY; 659 event.ev.key = kbd_event; 660 661 terminal_queue_cons_event(term, &event); 662 } 663 664 static void terminal_handle_position_event(widget_t *widget, pos_event_t pos_event) 665 { 666 cons_event_t event; 667 terminal_t *term = (terminal_t *) widget; 668 sysarg_t sx = term->widget.hpos; 669 sysarg_t sy = term->widget.vpos; 670 671 if (pos_event.type == POS_PRESS) { 672 event.type = CEV_POS; 673 event.ev.pos.type = pos_event.type; 674 event.ev.pos.pos_id = pos_event.pos_id; 675 event.ev.pos.btn_num = pos_event.btn_num; 676 677 event.ev.pos.hpos = (pos_event.hpos - sx) / FONT_WIDTH; 678 event.ev.pos.vpos = (pos_event.vpos - sy) / FONT_SCANLINES; 679 terminal_queue_cons_event(term, &event); 680 } 656 static void terminal_handle_position_event(widget_t *widget, pos_event_t event) 657 { 658 /* 659 * Mouse events are ignored so far. 660 * There is no consumer for it. 661 */ 681 662 } 682 663 … … 685 666 terminal_t *term = NULL; 686 667 687 list_foreach(terms, link, terminal_t, cur) { 668 list_foreach(terms, link) { 669 terminal_t *cur = list_get_instance(link, terminal_t, link); 670 688 671 if (cur->dsid == (service_id_t) IPC_GET_ARG1(*icall)) { 689 672 term = cur;
Note:
See TracChangeset
for help on using the changeset viewer.