--- rxvt-unicode/src/command.C 2007/12/31 13:50:56 1.389 +++ rxvt-unicode/src/command.C 2008/02/15 10:56:29 1.407 @@ -281,8 +281,8 @@ iso14755buf = 0; } -int -rxvt_term::hex_keyval (XKeyEvent &ev) +static int +hex_keyval (XKeyEvent &ev) { // check wether this event corresponds to a hex digit // if the modifiers had not been pressed. @@ -304,7 +304,6 @@ rxvt_term::key_press (XKeyEvent &ev) { int ctrl, meta, shft, len; - unsigned int newlen; KeySym keysym; int valid_keysym; char kbuf[KBUFSZ]; @@ -549,9 +548,8 @@ if (keysym >= 0xFF00 && keysym <= 0xFFFF) { - { bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; - newlen = 1; + unsigned int newlen = 1; #ifdef XK_KP_Home static const KeySym keypadtrans[] = { XK_KP_7, // XK_KP_Home @@ -791,7 +789,6 @@ if (newlen) len = strlen (kbuf); - } /* * Pass meta for all function keys, if 'meta' option set @@ -1081,7 +1078,7 @@ { hidden_text = !hidden_text; want_refresh = 1; - refresh_check (); + refresh_check (); } else w.stop (); @@ -1092,8 +1089,8 @@ void rxvt_term::cont_scroll_cb (ev::timer &w, int revents) { - if ((scrollbar_isUp () || scrollbar_isDn ()) - && scr_page (scrollbar_isUp () ? UP : DN, 1)) + if ((scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) + && scr_page (scrollBar.state == STATE_UP ? UP : DN, 1)) { want_refresh = 1; refresh_check (); @@ -1440,9 +1437,9 @@ break; case ConfigureNotify: - /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", + /*fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, - szHint.width, szHint.height); */ + szHint.width, szHint.height);*/ if (ev.xconfigure.window == parent[0]) { while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) @@ -1457,7 +1454,12 @@ { #ifdef HAVE_BG_PIXMAP if (bgPixmap.window_position_sensitive ()) - update_background (); + { + if (mapped) + update_background (); + else + bgPixmap.invalidate (); + } #endif } @@ -1487,6 +1489,22 @@ break; case MapNotify: +#ifdef HAVE_BG_PIXMAP + /* This is needed spcifically to fix the case of no window manager or a + * non-reparenting window manager. In those cases we never get first + * ConfigureNotify. Also that speeds startup under normal WM, by taking + * care of multiplicity of ConfigureNotify events arriwing while WM does + * reparenting. + * We should not render background immidiately, as there could be several + * ConfigureNotify's to follow. Lets take care of all of them in one scoop + * by scheduling background redraw as soon as we can, but giving a short + * bit of time for ConfigureNotifies to arrive. + * We should render background PRIOR to drawing any text, but AFTER all + * of ConfigureNotifys for the best results. + */ + if (bgPixmap.flags & bgPixmap_t::isInvalid) + update_background_ev.start (0.025); +#endif mapped = 1; #ifdef TEXT_BLINK text_blink_ev.start (); @@ -1534,7 +1552,7 @@ if (scrollBar.state && ev.xany.window == scrollBar.win) { - scrollBar.setIdle (); + scrollBar.state = STATE_IDLE; scrollbar_show (0); } } @@ -1632,7 +1650,7 @@ #endif } } - else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) + else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win) { while (XCheckTypedWindowEvent (dpy, scrollBar.win, MotionNotify, &ev)) @@ -1928,7 +1946,14 @@ */ if (scrollBar.state && ev.window == scrollBar.win) { - scrollBar.setIdle (); + page_dirn direction = NO_DIR; + + if (scrollBar.upButton (ev.y)) + direction = UP; /* up */ + else if (scrollBar.dnButton (ev.y)) + direction = DN; /* down */ + + scrollBar.state = STATE_IDLE; /* * Rxvt-style scrollbar: * move up if mouse is above slider @@ -1947,15 +1972,9 @@ * arrow buttons - send up/down * click on scrollbar - send pageup/down */ - if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_upButton (ev.y)) - || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_upButton (ev.y))) + if (direction == UP) tt_printf ("\033[A"); - else if ((scrollBar.style == R_SB_NEXT - && scrollbarnext_dnButton (ev.y)) - || (scrollBar.style == R_SB_RXVT - && scrollbarrxvt_dnButton (ev.y))) + else if (direction == DN) tt_printf ("\033[B"); else switch (ev.button) @@ -1973,37 +1992,19 @@ } else #endif /* NO_SCROLLBAR_REPORT */ - { - char upordown = 0; - - if (scrollBar.style == R_SB_NEXT) - { - if (scrollbarnext_upButton (ev.y)) - upordown = -1; /* up */ - else if (scrollbarnext_dnButton (ev.y)) - upordown = 1; /* down */ - } - else if (scrollBar.style == R_SB_RXVT) - { - if (scrollbarrxvt_upButton (ev.y)) - upordown = -1; /* up */ - else if (scrollbarrxvt_dnButton (ev.y)) - upordown = 1; /* down */ - } - - if (upordown) + if (direction != NO_DIR) { #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING if (!cont_scroll_ev.is_active ()) cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); #endif - if (scr_page (upordown < 0 ? UP : DN, 1)) + if (scr_page (direction, 1)) { - if (upordown < 0) - scrollBar.setUp (); + if (direction == UP) + scrollBar.state = STATE_UP; else - scrollBar.setDn (); + scrollBar.state = STATE_DOWN; } } else @@ -2028,7 +2029,7 @@ || scrollbar_below_slider (ev.y)) scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); - scrollBar.setMotion (); + scrollBar.state = STATE_MOTION; break; case Button1: @@ -2052,7 +2053,7 @@ scr_page (DN, nrow / 4); # endif else - scrollBar.setMotion (); + scrollBar.state = STATE_MOTION; } else { @@ -2079,9 +2080,9 @@ if (!bypass_keystate) reportmode = !! (priv_modes & PrivMode_mouse_report); - if (scrollbar_isUpDn ()) + if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) { - scrollBar.setIdle (); + scrollBar.state = STATE_IDLE; scrollbar_show (0); } @@ -2172,13 +2173,11 @@ slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); } else - { # endif + { scr_page (v, i); scrollbar_show (1); -# ifdef MOUSE_SLIP_WHEELING } -# endif } break; #endif @@ -2831,6 +2830,7 @@ tt_printf ("\033[>%d;95;0c", 'U'); } break; + case '?': if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') process_terminal_mode (ch, priv, nargs, arg); @@ -3356,9 +3356,11 @@ process_color_seq (op, color, name, resp); } break; + case Rxvt_restoreFG: case XTerm_Color00: process_color_seq (op, Color_fg, str, resp); break; + case Rxvt_restoreBG: case XTerm_Color01: process_color_seq (op, Color_bg, str, resp); break; @@ -3447,13 +3449,6 @@ break; #endif - case Rxvt_restoreFG: - set_window_color (Color_fg, str); - break; - case Rxvt_restoreBG: - set_window_color (Color_bg, str); - break; - case XTerm_logfile: // TODO, when secure mode? break; @@ -3617,6 +3612,7 @@ // 1048 save and restore cursor { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ // 1051, 1052, 1060, 1061 keyboard emulation NYI + { 2004, PrivMode_BracketPaste }, }; if (nargs == 0) @@ -3674,7 +3670,10 @@ break; case 3: /* 80/132 */ if (priv_modes & PrivMode_132OK) - set_widthheight (((state ? 132 : 80) * fwidth), height); + { + scr_poweron (); + set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); + } break; case 4: /* smooth scrolling */ set_option (Opt_jumpScroll, !state);