if (rvideo && !state &&     ticks < rvbell_timeout) {
if (ticks - vbell_startpoint >= VBELL_TIMEOUT) in_vbell = FALSE; if (rvideo && !state &&     (ticks - rvbell_startpoint) < VBELL_TIMEOUT) {	  if (!in_vbell || (rvbell_startpoint - vbell_startpoint < VBELL_TIMEOUT)) vbell_startpoint = rvbell_startpoint;
static void toggle_mode(int mode, int query, int state){    long ticks;    if (query)	switch (mode) {	  case 1:		       /* application cursor keys */	    app_cursor_keys = state;	    break;	  case 2:		       /* VT52 mode */	    vt52_mode = !state;	    if (vt52_mode) {		blink_is_real = FALSE;		vt52_bold = FALSE;	    } else {		blink_is_real = cfg.blinktext;	    }	    break;	  case 3:		       /* 80/132 columns */	    deselect();	    request_resize(state ? 132 : 80, rows);	    reset_132 = state;	    break;	  case 5:		       /* reverse video */	    /*	     * Toggle reverse video. If we receive an OFF within the	     * visual bell timeout period after an ON, we trigger an	     * effective visual bell, so that ESC[?5hESC[?5l will	     * always be an actually _visible_ visual bell.	     */	    ticks = GetTickCount();	    if (rvideo && !state &&    /* we're turning it off */		ticks < rvbell_timeout) {	/* and it's not long since it was turned on */		in_vbell = TRUE;       /* we may clear rvideo but we set in_vbell */		if (vbell_timeout < rvbell_timeout)	/* don't move vbell end forward */		    vbell_timeout = rvbell_timeout;	/* vbell end is at least then */	    } else if (!rvideo && state) {		/* This is an ON, so we notice the time and save it. */		rvbell_timeout = ticks + VBELL_TIMEOUT;	    }	    rvideo = state;	    seen_disp_event = TRUE;	    if (state)		term_update();	    break;	  case 6:		       /* DEC origin mode */	    dec_om = state;	    break;	  case 7:		       /* auto wrap */	    wrap = state;	    break;	  case 8:		       /* auto key repeat */	    repeat_off = !state;	    break;	  case 10:		       /* set local edit mode */	    term_editing = state;	    ldisc_send(NULL, 0, 0);    /* cause ldisc to notice changes */	    break;	  case 25:		       /* enable/disable cursor */	    compatibility2(OTHER, VT220);	    cursor_on = state;	    seen_disp_event = TRUE;	    break;	  case 47:		       /* alternate screen */	    compatibility(OTHER);	    deselect();	    swap_screen(state);	    disptop = 0;	    break;	  case 1000:		       /* xterm mouse 1 */	    xterm_mouse = state ? 1 : 0;	    set_raw_mouse_mode(state);	    break;	  case 1002:		       /* xterm mouse 2 */	    xterm_mouse = state ? 2 : 0;	    set_raw_mouse_mode(state);	    break;    } else	switch (mode) {	  case 4:		       /* set insert mode */	    compatibility(VT102);	    insert = state;	    break;	  case 12:		       /* set echo mode */	    term_echoing = !state;	    ldisc_send(NULL, 0, 0);    /* cause ldisc to notice changes */	    break;	  case 20:		       /* Return sends ... */	    cr_lf_return = state;	    break;	  case 34:		       /* Make cursor BIG */	    compatibility2(OTHER, VT220);	    big_cursor = !state;	}}