Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/vt/vt_core.c
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
static tc_fill_t vtterm_fill; | static tc_fill_t vtterm_fill; | ||||
static tc_copy_t vtterm_copy; | static tc_copy_t vtterm_copy; | ||||
static tc_param_t vtterm_param; | static tc_param_t vtterm_param; | ||||
static tc_done_t vtterm_done; | static tc_done_t vtterm_done; | ||||
static tc_cnprobe_t vtterm_cnprobe; | static tc_cnprobe_t vtterm_cnprobe; | ||||
static tc_cngetc_t vtterm_cngetc; | static tc_cngetc_t vtterm_cngetc; | ||||
static tc_cngrab_t vtterm_cngrab; | |||||
static tc_cnungrab_t vtterm_cnungrab; | |||||
static tc_opened_t vtterm_opened; | static tc_opened_t vtterm_opened; | ||||
static tc_ioctl_t vtterm_ioctl; | static tc_ioctl_t vtterm_ioctl; | ||||
static tc_mmap_t vtterm_mmap; | static tc_mmap_t vtterm_mmap; | ||||
const struct terminal_class vt_termclass = { | const struct terminal_class vt_termclass = { | ||||
.tc_bell = vtterm_bell, | .tc_bell = vtterm_bell, | ||||
.tc_cursor = vtterm_cursor, | .tc_cursor = vtterm_cursor, | ||||
.tc_putchar = vtterm_putchar, | .tc_putchar = vtterm_putchar, | ||||
.tc_fill = vtterm_fill, | .tc_fill = vtterm_fill, | ||||
.tc_copy = vtterm_copy, | .tc_copy = vtterm_copy, | ||||
.tc_param = vtterm_param, | .tc_param = vtterm_param, | ||||
.tc_done = vtterm_done, | .tc_done = vtterm_done, | ||||
.tc_cnprobe = vtterm_cnprobe, | .tc_cnprobe = vtterm_cnprobe, | ||||
.tc_cngetc = vtterm_cngetc, | .tc_cngetc = vtterm_cngetc, | ||||
.tc_cngrab = vtterm_cngrab, | |||||
.tc_cnungrab = vtterm_cnungrab, | |||||
.tc_opened = vtterm_opened, | .tc_opened = vtterm_opened, | ||||
.tc_ioctl = vtterm_ioctl, | .tc_ioctl = vtterm_ioctl, | ||||
.tc_mmap = vtterm_mmap, | .tc_mmap = vtterm_mmap, | ||||
}; | }; | ||||
/* | /* | ||||
* Use a constant timer of 25 Hz to redraw the screen. | * Use a constant timer of 25 Hz to redraw the screen. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | .vw_buf = { | ||||
.vb_scr_size = { | .vb_scr_size = { | ||||
.tp_row = _VTDEFH, | .tp_row = _VTDEFH, | ||||
.tp_col = _VTDEFW, | .tp_col = _VTDEFW, | ||||
}, | }, | ||||
}, | }, | ||||
.vw_device = &vt_consdev, | .vw_device = &vt_consdev, | ||||
.vw_terminal = &vt_consterm, | .vw_terminal = &vt_consterm, | ||||
.vw_kbdmode = K_XLATE, | .vw_kbdmode = K_XLATE, | ||||
.vw_grabbed = 0, | |||||
}; | }; | ||||
static struct terminal vt_consterm = { | static struct terminal vt_consterm = { | ||||
.tm_class = &vt_termclass, | .tm_class = &vt_termclass, | ||||
.tm_softc = &vt_conswindow, | .tm_softc = &vt_conswindow, | ||||
.tm_flags = TF_CONS, | .tm_flags = TF_CONS, | ||||
}; | }; | ||||
static struct consdev vt_consterm_consdev = { | static struct consdev vt_consterm_consdev = { | ||||
.cn_ops = &termcn_cnops, | .cn_ops = &termcn_cnops, | ||||
▲ Show 20 Lines • Show All 969 Lines • ▼ Show 20 Lines | vtterm_cngetc(struct terminal *tm) | ||||
} else if (KEYFLAGS(c) == 0) { | } else if (KEYFLAGS(c) == 0) { | ||||
return (KEYCHAR(c)); | return (KEYCHAR(c)); | ||||
} | } | ||||
if (vw->vw_kbdsq && *vw->vw_kbdsq) | if (vw->vw_kbdsq && *vw->vw_kbdsq) | ||||
return (*vw->vw_kbdsq++); | return (*vw->vw_kbdsq++); | ||||
return (-1); | return (-1); | ||||
} | |||||
static void | |||||
vtterm_cngrab(struct terminal *tm) | |||||
{ | |||||
struct vt_device *vd; | |||||
struct vt_window *vw; | |||||
keyboard_t *kbd; | |||||
vw = tm->tm_softc; | |||||
vd = vw->vw_device; | |||||
if (!cold) | |||||
vt_window_switch(vw); | |||||
kbd = kbd_get_keyboard(vd->vd_keyboard); | |||||
if (kbd == NULL) | |||||
return; | |||||
if (vw->vw_grabbed++ > 0) | |||||
return; | |||||
/* | |||||
* Make sure the keyboard is accessible even when the kbd device | |||||
* driver is disabled. | |||||
*/ | |||||
kbdd_enable(kbd); | |||||
/* We shall always use the keyboard in the XLATE mode here. */ | |||||
vw->vw_prev_kbdmode = vw->vw_kbdmode; | |||||
vw->vw_kbdmode = K_XLATE; | |||||
(void)kbdd_ioctl(kbd, KDSKBMODE, (caddr_t)&vw->vw_kbdmode); | |||||
kbdd_poll(kbd, TRUE); | |||||
} | |||||
static void | |||||
vtterm_cnungrab(struct terminal *tm) | |||||
{ | |||||
struct vt_device *vd; | |||||
struct vt_window *vw; | |||||
keyboard_t *kbd; | |||||
vw = tm->tm_softc; | |||||
vd = vw->vw_device; | |||||
kbd = kbd_get_keyboard(vd->vd_keyboard); | |||||
if (kbd == NULL) | |||||
return; | |||||
if (--vw->vw_grabbed > 0) | |||||
return; | |||||
kbdd_poll(kbd, FALSE); | |||||
vw->vw_kbdmode = vw->vw_prev_kbdmode; | |||||
(void)kbdd_ioctl(kbd, KDSKBMODE, (caddr_t)&vw->vw_kbdmode); | |||||
kbdd_disable(kbd); | |||||
} | } | ||||
static void | static void | ||||
vtterm_opened(struct terminal *tm, int opened) | vtterm_opened(struct terminal *tm, int opened) | ||||
{ | { | ||||
struct vt_window *vw = tm->tm_softc; | struct vt_window *vw = tm->tm_softc; | ||||
struct vt_device *vd = vw->vw_device; | struct vt_device *vd = vw->vw_device; | ||||
▲ Show 20 Lines • Show All 1,063 Lines • Show Last 20 Lines |