--- rxvt-unicode/src/command.C 2011/04/29 10:10:20 1.484 +++ rxvt-unicode/src/command.C 2012/08/14 20:32:48 1.524 @@ -56,10 +56,10 @@ # include "keyboard.h" #endif -#include +#include #if LINUX_YIELD_HACK -# include +# include #endif /*----------------------------------------------------------------------*/ @@ -133,7 +133,7 @@ 0, }; -void +void ecb_cold rxvt_term::iso14755_54 (int x, int y) { x = Pixel2Col (x); @@ -151,7 +151,7 @@ if (t != NOCHAR || !x) { - iso14755_51 (l.t[x], l.r[x], x, y); + iso14755_51 (l.t[x], l.r[x], x, y, view_start); iso14755buf = ISO_14755_54; break; } @@ -160,8 +160,8 @@ } } -void -rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) +void ecb_cold +rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y, int y2) { rxvt_fontset *fs = FONTSET (r); wchar_t *chr, *alloc, ch2, **fname; @@ -184,6 +184,9 @@ len = 1; } + char rowcol[40]; + snprintf (rowcol, sizeof rowcol, "col %d row %d @%d", x, y, y2); + char attr[80]; // plenty sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", @@ -205,7 +208,6 @@ max_it (width, wcswidth (fname[i], wcslen (fname[i]))); } - max_it (width, 8+5); // for char + hex max_it (width, strlen (attr)); if (y >= 0) @@ -214,7 +216,9 @@ x = 0; } - scr_overlay_new (x, y, width, len * 2 + 1); + scr_overlay_new (x, y, width, len * 2 + 2); + + scr_overlay_set (0, 0, rowcol); r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); @@ -225,16 +229,16 @@ ch = *chr++; sprintf (buf, "%8x", ch); - scr_overlay_set (0, y, buf); - scr_overlay_set (9, y, '='); + scr_overlay_set (0, y + 1, buf); + scr_overlay_set (9, y + 1, '='); # if !UNICODE_3 if (ch >= 0x10000) ch = 0xfffd; # endif - scr_overlay_set (11, y, ch, r); + scr_overlay_set (11, y + 1, ch, r); if (WCWIDTH (ch) >= 2) - scr_overlay_set (12, y, NOCHAR, r); + scr_overlay_set (12, y + 1, NOCHAR, r); } // { @@ -242,10 +246,10 @@ // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); // scr_overlay_set (0, 0, buf); // } - scr_overlay_set (0, len , attr); + scr_overlay_set (0, len + 1, attr); for (int i = 0; i < len; i++) { - scr_overlay_set (0, len + 1 + i, fname[i]); + scr_overlay_set (0, len + 2 + i, fname[i]); free (fname[i]); } @@ -256,25 +260,22 @@ } #endif -void +void ecb_cold rxvt_term::commit_iso14755 () { - wchar_t ch[2]; - - ch[0] = iso14755buf & ISO_14755_MASK; - ch[1] = 0; + wchar_t ch = iso14755buf & ISO_14755_MASK; if (iso14755buf & ISO_14755_51) { - char mb[16]; + char mb[MB_LEN_MAX]; int len; // allow verbatim 0-bytes and control-bytes to be entered - if (ch[0] >= 0x20) - len = wcstombs (mb, ch, 16); + if (ch >= 0x20) + len = wctomb (mb, ch); else { - mb[0] = ch[0]; + mb[0] = ch; len = 1; } @@ -287,7 +288,7 @@ iso14755buf = 0; } -static int +static int ecb_cold hex_keyval (XKeyEvent &ev) { // check whether this event corresponds to a hex digit @@ -306,7 +307,7 @@ } #endif -static inline KeySym +static inline KeySym ecb_cold translate_keypad (KeySym keysym, bool kp) { #ifdef XK_KP_Home @@ -342,7 +343,7 @@ return keysym; } -static inline int +static inline int ecb_cold map_function_key (KeySym keysym) { int param = 0; @@ -401,7 +402,7 @@ return param; } -void +void ecb_cold rxvt_term::key_press (XKeyEvent &ev) { int ctrl, meta, shft, len; @@ -426,7 +427,7 @@ kbuf[0] = 0; -#ifdef USE_XIM +#if USE_XIM if (Input_Context) { Status status_return; @@ -781,13 +782,28 @@ if (newlen) len = strlen (kbuf); - /* - * Pass meta for all function keys, if 'meta' option set - */ + if (len > 0) + { + /* + * pass Shift/Control indicators for function keys ending with `~' + * + * eg, + * Prior = "ESC[5~" + * Shift+Prior = "ESC[5$" + * Ctrl+Prior = "ESC[5^" + * Ctrl+Shift+Prior = "ESC[5@" + */ + if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') + kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); + + /* + * Pass meta for all function keys, if 'meta' option set + */ #ifdef META8_OPTION - if (meta && (meta_char == 0x80) && len > 0) - kbuf[len - 1] |= 0x80; + if (meta && (meta_char == 0x80)) + kbuf[len - 1] |= 0x80; #endif + } } else if (ctrl && keysym == XK_minus) @@ -831,20 +847,6 @@ want_refresh = 1; } - /* - * these modifications only affect the static keybuffer - * pass Shift/Control indicators for function keys ending with `~' - * - * eg, - * Prior = "ESC[5~" - * Shift+Prior = "ESC[5$" - * Ctrl+Prior = "ESC[5^" - * Ctrl+Shift+Prior = "ESC[5@" - * Meta adds an Escape prefix (with META8_OPTION, if meta == ). - */ - if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') - kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); - /* escape prefix */ if (meta #ifdef META8_OPTION @@ -859,7 +861,7 @@ tt_write (kbuf, (unsigned int)len); } -void +void ecb_cold rxvt_term::key_release (XKeyEvent &ev) { #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL @@ -991,8 +993,8 @@ scr_refresh (); scrollBar.show (1); -#ifdef USE_XIM - IMSendSpot (); +#if USE_XIM + im_send_spot (); #endif } @@ -1020,6 +1022,21 @@ #ifdef CURSOR_BLINK void +rxvt_term::cursor_blink_reset () +{ + if (hidden_cursor) + { + hidden_cursor = 0; + want_refresh = 1; + } + + if (option (Opt_cursorBlink)) + cursor_blink_ev.again (); + else + cursor_blink_ev.stop (); +} + +void rxvt_term::cursor_blink_cb (ev::timer &w, int revents) { hidden_cursor = !hidden_cursor; @@ -1047,8 +1064,8 @@ void rxvt_term::cont_scroll_cb (ev::timer &w, int revents) { - if ((scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) - && scr_page (scrollBar.state == STATE_UP ? UP : DN, 1)) + if ((scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN) + && scr_page (scrollBar.state == SB_STATE_UP ? UP : DN, 1)) { want_refresh = 1; refresh_check (); @@ -1208,7 +1225,7 @@ refresh_check (); } -void +void ecb_cold rxvt_term::pointer_unblank () { XDefineCursor (dpy, vt, TermWin_cursor); @@ -1223,7 +1240,7 @@ } #ifdef POINTER_BLANK -void +void ecb_cold rxvt_term::pointer_blank () { if (!option (Opt_pointerBlank)) @@ -1235,7 +1252,7 @@ hidden_pointer = 1; } -void +void ecb_cold rxvt_term::pointer_cb (ev::timer &w, int revents) { make_current (); @@ -1337,7 +1354,7 @@ } /*{{{ process an X event */ -void +void ecb_hot rxvt_term::x_cb (XEvent &ev) { make_current (); @@ -1450,11 +1467,22 @@ while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) ; -#ifdef HAVE_BG_PIXMAP + bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE); + bool moved = false; +#ifdef HAVE_BG_PIXMAP if (bg_window_position_sensitive ()) { + want_position_change = true; + if (!(bg_flags & BG_IS_VALID)) + moved = true; + } +#endif + + if (want_position_change) + { int x, y; + if (ev.xconfigure.send_event) { x = ev.xconfigure.x; @@ -1463,11 +1491,14 @@ else get_window_origin (x, y); - if (bg_set_position (x, y) - || !(bg_flags & BG_IS_VALID)) - moved = true; + if (x != parent_x || y != parent_y) + { + parent_x = x; + parent_y = y; + HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); + moved = true; + } } -#endif if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) { @@ -1478,12 +1509,7 @@ { #ifdef HAVE_BG_PIXMAP if (moved) - { - if (mapped) - update_background (); - else - bg_invalidate (); - } + update_background (); #endif } @@ -1567,7 +1593,7 @@ if (scrollBar.state && ev.xany.window == scrollBar.win) { - scrollBar.state = STATE_IDLE; + scrollBar.state = SB_STATE_IDLE; scrollBar.show (0); } } @@ -1643,7 +1669,7 @@ else { scroll_selection_dir = DN; - dist = ev.xbutton.y - (int_bwidth + height); + dist = ev.xbutton.y - (int_bwidth + vt_height); } scroll_selection_lines = Pixel2Height (dist) @@ -1665,7 +1691,7 @@ #endif } } - else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win) + else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win) { while (XCheckTypedWindowEvent (dpy, scrollBar.win, MotionNotify, &ev)) @@ -1676,7 +1702,7 @@ &unused_root_x, &unused_root_y, &ev.xbutton.x, &ev.xbutton.y, &unused_mask); - scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, + scr_move_to (scrollBar.position (ev.xbutton.y) - csrO, scrollBar.size ()); want_refresh = 1; scrollBar.show (1); @@ -1685,16 +1711,8 @@ } #if defined(CURSOR_BLINK) - if (option (Opt_cursorBlink) && ev.type == KeyPress) - { - if (hidden_cursor) - { - hidden_cursor = 0; - want_refresh = 1; - } - - cursor_blink_ev.again (); - } + if (ev.type == KeyPress) + cursor_blink_reset (); #endif #if defined(POINTER_BLANK) @@ -1715,7 +1733,7 @@ } #if ENABLE_FRILLS -void +void ecb_cold rxvt_term::set_urgency (bool enable) { if (enable == urgency_hint) @@ -1726,11 +1744,12 @@ h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); XSetWMHints (dpy, parent, h); urgency_hint = enable; + XFree (h); } } #endif -void +void ecb_cold rxvt_term::focus_in () { if (!focus) @@ -1741,7 +1760,7 @@ #if USE_XIM if (Input_Context != NULL) { - IMSetPosition (); + im_set_position (); XSetICFocus (Input_Context); } #endif @@ -1765,7 +1784,7 @@ } } -void +void ecb_cold rxvt_term::focus_out () { if (focus) @@ -1808,7 +1827,7 @@ } } -void +void ecb_cold rxvt_term::update_fade_color (unsigned int idx) { #if OFF_FOCUS_FADING @@ -1822,7 +1841,7 @@ } #if ENABLE_TRANSPARENCY || ENABLE_PERL -void +void ecb_hot rxvt_term::rootwin_cb (XEvent &ev) { make_current (); @@ -1831,7 +1850,6 @@ && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) return; -# if ENABLE_TRANSPARENCY switch (ev.type) { case PropertyNotify: @@ -1842,13 +1860,17 @@ if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) { +# if ENABLE_TRANSPARENCY bg_set_root_pixmap (); update_background (); +#endif +#if ENABLE_PERL + HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); +#endif } break; } -# endif refresh_check (); } @@ -1982,7 +2004,7 @@ else if (scrollBar.dnButton (ev.y)) direction = DN; /* down */ - scrollBar.state = STATE_IDLE; + scrollBar.state = SB_STATE_IDLE; /* * Rxvt-style scrollbar: * move up if mouse is above slider @@ -2031,9 +2053,9 @@ if (scr_page (direction, 1)) { if (direction == UP) - scrollBar.state = STATE_UP; + scrollBar.state = SB_STATE_UP; else - scrollBar.state = STATE_DOWN; + scrollBar.state = SB_STATE_DOWN; } } else @@ -2042,53 +2064,53 @@ case Button2: switch (scrollBar.align) { - case R_SB_ALIGN_TOP: + case SB_ALIGN_TOP: csrO = 0; break; - case R_SB_ALIGN_CENTRE: + case SB_ALIGN_CENTRE: csrO = (scrollBar.bot - scrollBar.top) / 2; break; - case R_SB_ALIGN_BOTTOM: + case SB_ALIGN_BOTTOM: csrO = scrollBar.bot - scrollBar.top; break; } - if (scrollBar.style == R_SB_XTERM - || scrollbar_above_slider (ev.y) - || scrollbar_below_slider (ev.y)) - scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); + if (scrollBar.style == SB_STYLE_XTERM + || scrollBar.above_slider (ev.y) + || scrollBar.below_slider (ev.y)) + scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ()); - scrollBar.state = STATE_MOTION; + scrollBar.state = SB_STATE_MOTION; break; case Button1: - if (scrollBar.align == R_SB_ALIGN_CENTRE) + if (scrollBar.align == SB_ALIGN_CENTRE) csrO = ev.y - scrollBar.top; /* FALLTHROUGH */ case Button3: - if (scrollBar.style != R_SB_XTERM) + if (scrollBar.style != SB_STYLE_XTERM) { - if (scrollbar_above_slider (ev.y)) + if (scrollBar.above_slider (ev.y)) # ifdef RXVT_SCROLL_FULL scr_page (UP, nrow - 1); # else scr_page (UP, nrow / 4); # endif - else if (scrollbar_below_slider (ev.y)) + else if (scrollBar.below_slider (ev.y)) # ifdef RXVT_SCROLL_FULL scr_page (DN, nrow - 1); # else scr_page (DN, nrow / 4); # endif else - scrollBar.state = STATE_MOTION; + scrollBar.state = SB_STATE_MOTION; } else { scr_page ((ev.button == Button1 ? DN : UP), (nrow - * scrollbar_position (ev.y) + * scrollBar.position (ev.y) / scrollBar.size ())); } @@ -2109,9 +2131,9 @@ if (!bypass_keystate) reportmode = !! (priv_modes & PrivMode_mouse_report); - if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) + if (scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN) { - scrollBar.state = STATE_IDLE; + scrollBar.state = SB_STATE_IDLE; scrollBar.show (0); } @@ -2171,7 +2193,7 @@ break; case Button2: - if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? + if (IN_RANGE_EXC (ev.x, 0, vt_width) && IN_RANGE_EXC (ev.y, 0, vt_height)) // inside window? selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); break; @@ -2216,7 +2238,7 @@ /*}}} */ -void +void ecb_hot rxvt_term::cmd_parse () { wchar_t ch = NOCHAR; @@ -2224,7 +2246,7 @@ for (;;) { - if (expect_false (ch == NOCHAR)) + if (ecb_unlikely (ch == NOCHAR)) { seq_begin = cmdbuf_ptr; ch = next_char (); @@ -2233,9 +2255,9 @@ break; } - if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) + if (ecb_likely (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) { - if (expect_false (!seen_input)) + if (ecb_unlikely (!seen_input)) { seen_input = 1; // many badly-written programs (e.g. jed) contain a race condition: @@ -2258,12 +2280,12 @@ for (;;) { - if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) + if (ecb_unlikely (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) break; *str++ = ch; - if (expect_false (ch == C0_LF || str >= eol)) + if (ecb_unlikely (ch == C0_LF || str >= eol)) { if (ch == C0_LF) nlines++; @@ -2345,13 +2367,13 @@ } // read the next character -wchar_t +wchar_t ecb_hot rxvt_term::next_char () NOTHROW { while (cmdbuf_ptr < cmdbuf_endp) { // assume 7-bit to be ascii ALWAYS - if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) + if (ecb_likely ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) return *cmdbuf_ptr++; wchar_t wc; @@ -2367,6 +2389,8 @@ if (len == (size_t)-1) { mbstate.reset (); // reset now undefined conversion state + // a -1 might indicate that a previous incomplet char is invalid (previous return -2) + // in which case we "errornously" return the next byte which might be valid. return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through } @@ -2379,7 +2403,7 @@ } // read the next octet -uint32_t +uint32_t ecb_hot rxvt_term::next_octet () NOTHROW { return cmdbuf_ptr < cmdbuf_endp @@ -2389,7 +2413,7 @@ static class out_of_input out_of_input; -wchar_t +wchar_t ecb_hot rxvt_term::cmd_getc () THROW ((class out_of_input)) { wchar_t c = next_char (); @@ -2400,7 +2424,7 @@ return c; } -uint32_t +uint32_t ecb_hot rxvt_term::cmd_get8 () THROW ((class out_of_input)) { uint32_t c = next_octet (); @@ -2414,7 +2438,7 @@ /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE -FILE * +FILE * ecb_cold rxvt_term::popen_printer () { FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); @@ -2425,7 +2449,7 @@ return stream; } -int +int ecb_cold rxvt_term::pclose_printer (FILE *stream) { fflush (stream); @@ -2435,7 +2459,7 @@ /* * simulate attached vt100 printer */ -void +void ecb_cold rxvt_term::process_print_pipe () { FILE *fd = popen_printer (); @@ -2491,7 +2515,6 @@ #endif /* PRINTPIPE */ /*}}} */ -/* *INDENT-OFF* */ enum { C1_40 = 0x40, C1_41 , C1_BPH, C1_NBH, C1_44 , C1_NEL, C1_SSA, C1_ESA, @@ -2499,10 +2522,9 @@ C1_DCS, C1_PU1, C1_PU2, C1_STS, C1_CCH, C1_MW , C1_SPA, C1_EPA, C1_SOS, C1_59 , C1_SCI, C1_CSI, CS_ST , C1_OSC, C1_PM , C1_APC, }; -/* *INDENT-ON* */ /*{{{ process non-printing single characters */ -void +void ecb_hot rxvt_term::process_nonprinting (unicode_t ch) { switch (ch) @@ -2558,7 +2580,7 @@ /*{{{ process VT52 escape sequences */ -void +void ecb_cold rxvt_term::process_escape_vt52 (unicode_t ch) { int row, col; @@ -2602,7 +2624,7 @@ tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ break; case '<': /* turn off VT52 mode */ - set_privmode (PrivMode_vt52, 0); + priv_modes &= ~PrivMode_vt52; break; case 'F': /* use special graphics character set */ case 'G': /* use regular character set */ @@ -2618,7 +2640,7 @@ /*{{{ process escape sequences */ -void +void ecb_hot rxvt_term::process_escape_seq () { unicode_t ch = cmd_getc (); @@ -2631,7 +2653,6 @@ switch (ch) { - /* case 1: do_tek_mode (); break; */ case '#': if (cmd_getc () == '8') scr_E (); @@ -2664,9 +2685,12 @@ scr_forwardindex (); break; #endif + // DECPAM/DECPNM case '=': + priv_modes |= PrivMode_aplKP; + break; case '>': - set_privmode (PrivMode_aplKP, ch == '='); + priv_modes &= ~PrivMode_aplKP; break; case C1_40: @@ -2680,7 +2704,7 @@ case C1_NEL: /* ESC E */ { wchar_t nlcr[] = { C0_LF, C0_CR }; - scr_add_lines (nlcr, ARRAY_LENGTH(nlcr), 1); + scr_add_lines (nlcr, ecb_array_length (nlcr), 1); } break; @@ -2702,10 +2726,10 @@ break; /* 8.3.142: SINGLE-SHIFT TWO */ - /*case C1_SS2: scr_single_shift (2); break; */ + /* case C1_SS2: break; */ /* 8.3.143: SINGLE-SHIFT THREE */ - /*case C1_SS3: scr_single_shift (3); break; */ + /* case C1_SS3: break; */ /* 8.3.27: DEVICE CONTROL STRING */ case C1_DCS: /* ESC P */ @@ -2748,7 +2772,6 @@ /*}}} */ /*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */ -/* *INDENT-OFF* */ enum { CSI_ICH = 0x40, CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, @@ -2778,9 +2801,8 @@ make_byte (0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */ make_byte (0,0,0,0,0,0,0,0), /* x, y, z, {, |, }, ~, */ }; -/* *INDENT-ON* */ -void +void ecb_hot rxvt_term::process_csi_seq () { unicode_t ch, priv, i; @@ -2868,8 +2890,8 @@ static const int pm_h[] = { 7, 25 }; static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 }; - process_terminal_mode ('h', 0, ARRAY_LENGTH(pm_h), pm_h); - process_terminal_mode ('l', 0, ARRAY_LENGTH(pm_l), pm_l); + process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h); + process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l); } break; } @@ -2897,11 +2919,11 @@ #endif case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ - case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ + case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ - case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ + case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ scr_gotorc (arg[0], 0, RELATIVE); break; @@ -3098,7 +3120,6 @@ /*}}} */ #if !ENABLE_MINIMAL -/* ARGSUSED */ void rxvt_term::process_window_ops (const int *args, unsigned int nargs) { @@ -3145,7 +3166,7 @@ //case 9: NYI, TODO, restore maximized window or maximize window default: if (args[0] >= 24) /* set height (chars) */ - set_widthheight ((unsigned int)width, + set_widthheight ((unsigned int)vt_width, (unsigned int) (args[1] * fheight)); break; @@ -3441,7 +3462,7 @@ bool changed = false; if (ISSET_PIXCOLOR (Color_tint)) - changed = bg_set_tint (pix_colors_focused [Color_tint]); + changed = root_effects.set_tint (pix_colors_focused [Color_tint]); if (changed) update_background (); @@ -3455,33 +3476,36 @@ if (!strcmp (str, "?")) { char str[256]; + int h_scale = fimage.h_scale; + int v_scale = fimage.v_scale; + int h_align = fimage.h_align; + int v_align = fimage.v_align; sprintf (str, "[%dx%d+%d+%d]", - min (h_scale, 32767), min (v_scale, 32767), - min (h_align, 32767), min (v_align, 32767)); + h_scale, v_scale, + h_align, v_align); process_xterm_seq (XTerm_title, str, CHAR_ST); } else { - int changed = 0; + bool changed = false; if (*str != ';') { - if (bg_set_file (str)) /* change pixmap */ + try + { + fimage.set_file_geometry (this, str); + changed = true; + } + catch (const class rxvt_failure_exception &e) { - changed++; - str = strchr (str, ';'); - if (str == NULL) - bg_set_default_geometry (); - else - bg_set_geometry (str+1); } } else { str++; - if (bg_set_geometry (str, true)) - changed++; + if (fimage.set_geometry (str, true)) + changed = true; } if (changed) @@ -3490,7 +3514,8 @@ { int x, y; get_window_origin (x, y); - bg_set_position (x, y); + parent_x = x; + parent_y = y; } update_background (); } @@ -3590,14 +3615,17 @@ * 't' = toggle * so no need for fancy checking */ -int +int ecb_cold rxvt_term::privcases (int mode, unsigned long bit) { int state; if (mode == 's') { - SavedModes |= (priv_modes & bit); + if (priv_modes & bit) + SavedModes |= bit; + else + SavedModes &= ~bit; return -1; } else @@ -3607,7 +3635,10 @@ else state = (mode == 't') ? ! (priv_modes & bit) : mode; - set_privmode (bit, state); + if (state) + priv_modes |= bit; + else + priv_modes &= ~bit; } return state; @@ -3615,7 +3646,7 @@ /* we're not using priv _yet_ */ void -rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) +rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int nargs, const int *arg) { unsigned int i, j; int state; @@ -3626,7 +3657,7 @@ const unsigned long bit; } argtopriv[] = { { 1, PrivMode_aplCUR }, // DECCKM - { 2, PrivMode_vt52 }, + { 2, PrivMode_vt52 }, // DECANM { 3, PrivMode_132 }, // DECCOLM { 4, PrivMode_smoothScroll }, // DECSCLM { 5, PrivMode_rVideo }, // DECSCNM @@ -3636,7 +3667,7 @@ { 9, PrivMode_MouseX10 }, // 18 end FF to printer after print screen // 19 Print screen prints full screen/scroll region - { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis + { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis #ifdef scrollBar_esc { scrollBar_esc, PrivMode_scrollBar }, #endif @@ -3647,7 +3678,7 @@ // 45 margin bell NYI // 46 start logging { 47, PrivMode_Screen }, - { 66, PrivMode_aplKP }, // DECPAM/DECPNM + { 66, PrivMode_aplKP }, // DECNKM #ifndef NO_BACKSPACE_KEY { 67, PrivMode_BackSpace }, // DECBKM #endif @@ -3686,7 +3717,7 @@ state = -1; /* basic handling */ - for (j = 0; j < ARRAY_LENGTH(argtopriv); j++) + for (j = 0; j < ecb_array_length (argtopriv); j++) if (argtopriv[j].argval == arg[i]) { state = privcases (mode, argtopriv[j].bit); @@ -3722,7 +3753,7 @@ * parameter. Return from VT52 mode with an ESC < from * within VT52 mode */ - set_privmode (PrivMode_vt52, 1); + priv_modes |= PrivMode_vt52; break; case 3: /* 80/132 */ if (priv_modes & PrivMode_132OK) @@ -3747,11 +3778,9 @@ break; #ifdef scrollBar_esc case scrollBar_esc: - if (scrollBar.map (state)) - { - resize_all_windows (0, 0, 0); - scr_touch (true); - } + scrollBar.map (state); + resize_all_windows (0, 0, 0); + scr_touch (true); break; #endif case 25: /* visible/invisible cursor */ @@ -3816,7 +3845,7 @@ /*}}} */ /*{{{ process sgr sequences */ -void +void ecb_hot rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) { unsigned int i;