Input method in FreeBSD virtual terminal (Week6)

Date: 07/12-07/18

vt

This week I started to read the vt source code (sys/dev/vt/)

Here are two useful functions I found:

  1. vt_processkey(): process key sequences

  2. vt_mouse_paste(): paste text

vt_processkey()

vt_processkey is reponsible for processing keys sequence.

vt_mouse_paste()

vt_mouse_paste() is called by vt_machine_kbdevent() when a user presses the PASTE key to paste text with mouse:

        case SPCLKEY | PASTE:       /* kbdmap(5) keyword `paste`. */
#ifndef SC_NO_CUTPASTE
                /* Insert text from cut-paste buffer. */
                vt_mouse_paste();
#endif

And the function body:

static void
vt_mouse_paste()
{
        term_char_t *buf;
        int i, len;

        len = VD_PASTEBUFLEN(main_vd);
        buf = VD_PASTEBUF(main_vd);
        len /= sizeof(term_char_t);
        for (i = 0; i < len; i++) {
                if (buf[i] == '\0')
                        continue;
                terminal_input_char(main_vd->vd_curwindow->vw_terminal,
                    buf[i]);
        }
}

It would call terminal_input_char to send characters into the current virtual terminal window.

Final Phase Plan

This week's plans

SummerOfCode2021Projects/InputMethodInFreeBSDVirtualTerminal/Week6 (last edited 2021-07-29T03:31:40+0000 by FanChung)