vt: restore tty when console is ungrabbed
When a break-to-debugger is triggered, kdb will grab the console and vt(4) will generally switch back to ttyv0. If one issues a continue from the debugger, then kdb will ungrab the console and the system rolls on. This change adds a perhaps minor feature: when we're down to grab == 0 and if vt actually switched away to ttyv0, switch back to the tty it was previously on before the console was grabbed. The justification behind this is that a typical flow is to work in !ttyv0 to avoid console spam while occasionally dropping to ddb to inspect system state before returning. This could easily enough be tossed behind a sysctl or something if it's not generally appreciated, but I anticipate indifference. Reviewed by: ray Differential Revision: https://reviews.freebsd.org/D27110
This commit is contained in:
parent
be46634337
commit
c4a0333b55
@ -124,6 +124,7 @@ struct vt_device {
|
||||
struct vt_window *vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */
|
||||
struct vt_window *vd_curwindow; /* (d) Current window. */
|
||||
struct vt_window *vd_savedwindow;/* (?) Saved for suspend. */
|
||||
struct vt_window *vd_grabwindow; /* (?) Saved before cngrab. */
|
||||
struct vt_pastebuf vd_pastebuf; /* (?) Copy/paste buf. */
|
||||
const struct vt_driver *vd_driver; /* (c) Graphics driver. */
|
||||
void *vd_softc; /* (u) Driver data. */
|
||||
|
@ -1805,6 +1805,9 @@ vtterm_cngrab(struct terminal *tm)
|
||||
vw = tm->tm_softc;
|
||||
vd = vw->vw_device;
|
||||
|
||||
/* To be restored after we ungrab. */
|
||||
if (vd->vd_grabwindow == NULL)
|
||||
vd->vd_grabwindow = vd->vd_curwindow;
|
||||
|
||||
if (!cold)
|
||||
vt_window_switch(vw);
|
||||
@ -1821,10 +1824,14 @@ vtterm_cnungrab(struct terminal *tm)
|
||||
vw = tm->tm_softc;
|
||||
vd = vw->vw_device;
|
||||
|
||||
MPASS(vd->vd_grabwindow != NULL);
|
||||
if (vtterm_cnungrab_noswitch(vd, vw) != 0)
|
||||
return;
|
||||
|
||||
if (!cold && vd->vd_grabwindow != vw)
|
||||
vt_window_switch(vd->vd_grabwindow);
|
||||
|
||||
vd->vd_grabwindow = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user