--- rxvt-unicode/src/command.C 2004/05/09 18:19:49 1.95 +++ rxvt-unicode/src/command.C 2004/07/31 00:01:12 1.107 @@ -712,6 +712,49 @@ } #endif +#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING +void +rxvt_term::cont_scroll_cb (time_watcher &w) +{ + if ((scrollbar_isUp() || scrollbar_isDn()) && + scr_page (scrollbar_isUp() ? UP : DN, 1)) + { + refresh_type |= SMOOTH_REFRESH; + want_refresh = 1; + w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); + } +} +#endif + +#ifdef SELECTION_SCROLLING +void +rxvt_term::sel_scroll_cb (time_watcher &w) +{ + if (scr_page (scroll_selection_dir, scroll_selection_lines)) + { + selection_extend (selection_save_x, selection_save_y, selection_save_state); + refresh_type |= SMOOTH_REFRESH; + want_refresh = 1; + w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); + } +} +#endif + +#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) +void +rxvt_term::slip_wheel_cb (time_watcher &w) +{ + if (mouse_slip_wheel_speed == 0 + || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) + : scr_page (UP, mouse_slip_wheel_speed)) + { + refresh_type |= SMOOTH_REFRESH; + want_refresh = 1; + w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); + } +} +#endif + bool rxvt_term::pty_fill () { @@ -755,19 +798,21 @@ break; } -#ifdef POINTER_BLANK void rxvt_term::pointer_unblank () { XDefineCursor (display->display, TermWin.vt, TermWin_cursor); recolour_cursor (); +#ifdef POINTER_BLANK hidden_pointer = 0; if (Options & Opt_pointerBlank) pointer_ev.start (NOW + pointerBlankDelay); +#endif } +#ifdef POINTER_BLANK void rxvt_term::pointer_blank () { @@ -973,11 +1018,11 @@ #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) case KeyRelease: { - if (! (ev.xkey.state & ControlMask)) - mouse_slip_wheel_speed = 0; + if (!(ev.xkey.state & ControlMask)) + slip_wheel_ev.stop (); else { - KeySym ks; + KeySym ks; ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); if (ks == XK_Control_L || ks == XK_Control_R) @@ -1072,6 +1117,15 @@ if (Options & Opt_cursorBlink) cursor_blink_ev.start (NOW + BLINK_INTERVAL); #endif +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + { + PixColors = PixColorsFocused; + set_colorfgbg (); + scr_clear (); + scr_touch (true); + } +#endif } break; @@ -1090,6 +1144,15 @@ cursor_blink_ev.stop (); hidden_cursor = 0; #endif +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + { + PixColors = PixColorsUnFocused; + set_colorfgbg (); + scr_clear (); + scr_touch (true); + } +#endif } break; @@ -1240,13 +1303,11 @@ { int dist; - pending_scroll_selection=1; - /* don't clobber the current delay if we are * already in the middle of scrolling. */ - if (scroll_selection_delay<=0) - scroll_selection_delay=SCROLLBAR_CONTINUOUS_DELAY; + if (!sel_scroll_ev.active) + sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); /* save the event params so we can highlight * the selection in the pending-scroll loop @@ -1278,7 +1339,8 @@ /* we are within the text window, so we * shouldn't be scrolling */ - pending_scroll_selection = 0; + if (sel_scroll_ev.active) + sel_scroll_ev.stop(); } #endif #ifdef MOUSE_THRESHOLD @@ -1505,7 +1567,7 @@ if (upordown) { #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY; + cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); #endif if (scr_page (upordown < 0 ? UP : DN, 1)) { @@ -1602,7 +1664,8 @@ } #ifdef SELECTION_SCROLLING - pending_scroll_selection=0; + if (sel_scroll_ev.active) + sel_scroll_ev.stop(); #endif if (ev.window == TermWin.vt) { @@ -1654,37 +1717,48 @@ int i; page_dirn v; - v = (ev.button == Button4) ? UP : DN; + v = ev.button == Button4 ? UP : DN; + if (ev.state & ShiftMask) i = 1; - else if ((Options & Opt_mouseWheelScrollPage)) + else if (Options & Opt_mouseWheelScrollPage) i = TermWin.nrow - 1; else i = 5; + # ifdef MOUSE_SLIP_WHEELING if (ev.state & ControlMask) { - mouse_slip_wheel_speed += (v ? -1 : 1); - mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; + mouse_slip_wheel_speed += v ? -1 : 1; + if (mouse_slip_wheel_speed < -TermWin.nrow) mouse_slip_wheel_speed = -TermWin.nrow; + if (mouse_slip_wheel_speed > +TermWin.nrow) mouse_slip_wheel_speed = +TermWin.nrow; + + if (slip_wheel_ev.at < NOW) + slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; + + slip_wheel_ev.start (); } + else + { # endif # ifdef JUMP_MOUSE_WHEEL - scr_page (v, i); - scr_refresh (SMOOTH_REFRESH); - scrollbar_show (1); -# else - while (i--) - { - scr_page (v, 1); + scr_page (v, i); scr_refresh (SMOOTH_REFRESH); scrollbar_show (1); - } +# else + while (i--) + { + scr_page (v, 1); + scr_refresh (SMOOTH_REFRESH); + scrollbar_show (1); + } # endif - +# ifdef MOUSE_SLIP_WHEELING + } +#endif } break; #endif - } } #ifdef MENUBAR @@ -1959,7 +2033,7 @@ if (am_transparent) { pchanged = 1; - XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); + XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]); am_transparent = am_pixmap_trans = 0; } @@ -1985,7 +2059,7 @@ 0L, 1L, False, XA_PIXMAP, &atype, &aformat, &nitems, &bytes_after, &prop) == Success); - if (!i || prop == NULL) + if (!i || prop == NULL || !rs[Rs_color + Color_tint]) have_pixmap = 0; else { @@ -2006,7 +2080,7 @@ GC gc; XGCValues gcvalue; - XTranslateCoordinates (display->display, TermWin.parent[0], display->root, + XTranslateCoordinates (display->display, TermWin.vt, display->root, 0, 0, &sx, &sy, &cr); nw = (unsigned int)szHint.width; nh = (unsigned int)szHint.height; @@ -2057,9 +2131,11 @@ #if TINTING if (ISSET_PIXCOLOR (Color_tint)) { - unsigned short shade, rm, gm, bm; - - PixColors[Color_tint].get (display, rm, gm, bm); + unsigned short rm, gm, bm; + if (rs[Rs_shade]) + PixColorsFocused[Color_tint].fade (display, atoi (rs[Rs_shade])).get (display, rm, gm, bm); + else + PixColorsFocused[Color_tint].get (display, rm, gm, bm); rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but... @@ -2081,8 +2157,7 @@ nx, ny, image->width, image->height); XFreeGC (display->display, gc); XDestroyImage (image); - XSetWindowBackgroundPixmap (display->display, TermWin.vt, - TermWin.pixmap); + XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); if (!am_transparent || !am_pixmap_trans) pchanged = 1; @@ -2136,9 +2211,9 @@ if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) { - D_X ((stderr, "InheritPixmap Turning off")); - XSetWindowBackground (display->display, TermWin.parent[0], PixColors[Color_fg]); - XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); + D_X ((stderr, "InheritPixmap Turning off")); /* Mikachu? */ + XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]); + XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]); am_transparent = 0; /* XXX: also turn off Opt_transparent? */ } @@ -2275,6 +2350,15 @@ return flag; } +// read the next octet +unicode_t +rxvt_term::next_octet () +{ + return cmdbuf_ptr < cmdbuf_endp + ? *cmdbuf_ptr++ + : NOCHAR; +} + // read the next character unicode_t rxvt_term::next_char () @@ -2322,6 +2406,17 @@ return c; } +unicode_t +rxvt_term::cmd_get8 () +{ + unicode_t c = next_octet (); + + if (c == NOCHAR) + throw out_of_input; + + return c; +} + /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE @@ -2454,6 +2549,7 @@ scr_charset_choose (0); break; +#ifdef EIGHT_BIT_CONTROLS // 8-bit controls case 0x90: /* DCS */ process_dcs_seq (); @@ -2464,6 +2560,7 @@ case 0x9d: /* CSI */ process_osc_seq (); break; +#endif } } /*}}} */ @@ -3091,39 +3188,36 @@ unsigned char * rxvt_term::get_to_st (unicode_t &ends_how) { - int seen_esc = 0; /* seen escape? */ + unicode_t prev = 0, ch; unsigned int n = 0; unsigned char *s; - unicode_t ch; unsigned char string[STRING_MAX]; - while ((ch = cmd_getc ())) + while ((ch = cmd_getc ()) != NOCHAR) { - if (ch == C0_BEL || ch == CHAR_ST) - break; - - if (seen_esc) - if (ch == 0x5c) /* 7bit ST */ - break; - else - return NULL; - - if (ch == C0_ESC) + if (prev == C0_ESC) { - seen_esc = 1; - continue; + if (ch == 0x5c) /* 7bit ST */ + break; + else + return NULL; } - else if (ch == C0_HT) - ch = ' '; /* translate '\t' to space */ - else if (ch < 0x20 && (ch != C0_LF && ch != C0_CR)) + else if (ch == C0_BEL || ch == CHAR_ST) + break; + else if (ch < 0x20) return NULL; /* other control character - exit */ if (n >= sizeof (string) - 1) // stop at some sane length return NULL; - string[n++] = ch; - seen_esc = 0; + if (ch == C0_SYN) + { + string[n++] = cmd_get8 (); + prev = 0; + } + else + string[n++] = prev = ch; } string[n++] = '\0'; @@ -3190,7 +3284,7 @@ if (Options & Opt_insecure) { unsigned short r, g, b; - PixColors[color].get (display, r, g, b); + PixColorsFocused[color].get (display, r, g, b); tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); } } @@ -3305,7 +3399,7 @@ if (Options & Opt_insecure) { unsigned short r, g, b; - PixColors[color + minCOLOR].get (display, r, g, b); + PixColorsFocused[color + minCOLOR].get (display, r, g, b); tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); } } @@ -3688,10 +3782,12 @@ case 1: rendset = 1, rendstyle = RS_Bold; break; + //case 2: // faint or second colour case 4: rendset = 1, rendstyle = RS_Uline; break; - case 5: + case 5: // slowly blinking + case 6: // rapidly blinking rendset = 1, rendstyle = RS_Blink; break; //case 6: // scoansi light background @@ -3701,15 +3797,20 @@ case 8: // invisible. NYI break; - //case 10: // scoansi acs off - //case 11: // scoansi acs on - //case 12: // scoansi acs on, |0x80 - case 21: // disable bold, blink and invis (some terminals use this) - rendset = 0, rendstyle = RS_Bold | RS_Blink; + //case 9: // crossed out + //case 10: // scoansi acs off, primary font + //case 11: // scoansi acs on, first alt font + //case 12: // scoansi acs on, |0x80, second alt font + //... + //case 19: // ninth alt font + //case 20: // gothic + case 21: // disable bold, faint + rendset = 0, rendstyle = RS_Bold; break; case 22: rendset = 0, rendstyle = RS_Bold; break; + //case 23: disable italic case 24: rendset = 0, rendstyle = RS_Uline; break; @@ -3719,9 +3820,8 @@ case 27: rendset = 0, rendstyle = RS_RVid; break; - case 28: - // visible. NYI - break; + //case 28: // visible. NYI + //case 29: // not crossed-out } if (rendset != -1)