--- rxvt-unicode/src/command.C 2004/02/13 12:16:21 1.43 +++ rxvt-unicode/src/command.C 2004/03/11 00:53:19 1.67 @@ -27,6 +27,7 @@ * Copyright (c) 2001 Marius Gedminas * - Ctrl/Mod4+Tab works like Meta+Tab (options) * Copyright (c) 2003 Rob McMullen + * Copyright (c) 2003-2004 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,13 +58,13 @@ void rxvt_term::lookup_key (XKeyEvent &ev) { - int ctrl, meta, shft, len; - unsigned int newlen; - KeySym keysym; + int ctrl, meta, shft, len; + unsigned int newlen; + KeySym keysym; #ifdef DEBUG_CMD - static int debug_key = 1; /* accessible by a debugger only */ + static int debug_key = 1; /* accessible by a debugger only */ #endif - int valid_keysym; + int valid_keysym; unsigned char kbuf[KBUFSZ]; /* @@ -90,12 +91,11 @@ Status status_return; #ifdef X_HAVE_UTF8_STRING - if (enc_utf8 && 0) + if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, KBUFSZ, &keysym, &status_return); else #endif - { wchar_t wkbuf[KBUFSZ + 1]; @@ -110,26 +110,34 @@ SET_LOCALE (locale); if (status_return == XLookupChars - || status_return == XLookupBoth) + || status_return == XLookupBoth) { - wkbuf[len] = 0; - len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); - if (len < 0) - len = 0; + /* make sure the user can type ctrl-@, i.e. NUL */ + if (len == 1 && *wkbuf == 0) + { + kbuf[0] = 0; + len = 1; + } + else + { + wkbuf[len] = 0; + len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); + if (len < 0) + len = 0; + } } else len = 0; } valid_keysym = status_return == XLookupKeySym - || status_return == XLookupBoth; + || status_return == XLookupBoth; } else #endif - { len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); - valid_keysym = !len; + valid_keysym = keysym != NoSymbol; } if (valid_keysym) @@ -144,12 +152,12 @@ { if (keysym == ks_bigfont) { - change_font (0, FONT_UP); + change_font (FONT_UP); return; } else if (keysym == ks_smallfont) { - change_font (0, FONT_DN); + change_font (FONT_DN); return; } } @@ -164,7 +172,7 @@ if (IS_SCROLL_MOD) { #endif - int lnsppg; + int lnsppg; #ifdef PAGING_CONTEXT_LINES lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; @@ -212,7 +220,6 @@ } } #endif - } if (shft) @@ -233,10 +240,10 @@ return; /* rxvt extras */ case XK_KP_Add: /* Shift+KP_Add = bigger font */ - change_font (0, FONT_UP); + change_font (FONT_UP); return; case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ - change_font (0, FONT_DN); + change_font (FONT_DN); return; } } @@ -248,22 +255,6 @@ return; } #endif -#ifdef GREEK_SUPPORT - if (keysym == ks_greekmodeswith) - { - greek_mode = !greek_mode; - if (greek_mode) - { - xterm_seq (XTerm_title, - (greek_getmode () == GREEK_ELOT928 - ? "[Greek: iso]" : "[Greek: ibm]"), CHAR_ST); - greek_reset (); - } - else - xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); - return; - } -#endif if (keysym >= 0xFF00 && keysym <= 0xFFFF) { @@ -288,7 +279,6 @@ } else #endif - { newlen = 1; switch (keysym) @@ -303,35 +293,11 @@ } else STRCPY (kbuf, key_backspace); -# ifdef MULTICHAR_SET - if ((Options & Opt_mc_hack) && screen.cur.col > 0) - { - int col, row; - - newlen = STRLEN (kbuf); - col = screen.cur.col - 1; - row = screen.cur.row + TermWin.saveLines; - if (IS_MULTI2 (screen.rend[row][col])) - MEMMOVE (kbuf + newlen, kbuf, newlen + 1); - } -# endif break; #endif #ifndef NO_DELETE_KEY case XK_Delete: STRCPY (kbuf, key_delete); -# ifdef MULTICHAR_SET - if (Options & Opt_mc_hack) - { - int col, row; - - newlen = STRLEN (kbuf); - col = screen.cur.col; - row = screen.cur.row + TermWin.saveLines; - if (IS_MULTI1 (screen.rend[row][col])) - MEMMOVE (kbuf + newlen, kbuf, newlen + 1); - } -# endif break; #endif case XK_Tab: @@ -351,7 +317,6 @@ } break; - #ifdef XK_KP_Left case XK_KP_Up: /* \033Ox or standard */ case XK_KP_Down: /* \033Or or standard */ @@ -360,7 +325,7 @@ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { STRCPY (kbuf, "\033OZ"); - kbuf[2] = ("txvr"[keysym - XK_KP_Left]); + kbuf[2] = "txvr"[keysym - XK_KP_Left]; break; } else @@ -373,52 +338,17 @@ case XK_Right: /* "\033[C" */ case XK_Left: /* "\033[D" */ STRCPY (kbuf, "\033[Z"); - kbuf[2] = ("DACB"[keysym - XK_Left]); + kbuf[2] = "DACB"[keysym - XK_Left]; /* do Shift first */ if (shft) - kbuf[2] = ("dacb"[keysym - XK_Left]); + kbuf[2] = "dacb"[keysym - XK_Left]; else if (ctrl) { kbuf[1] = 'O'; - kbuf[2] = ("dacb"[keysym - XK_Left]); + kbuf[2] = "dacb"[keysym - XK_Left]; } else if (PrivateModes & PrivMode_aplCUR) kbuf[1] = 'O'; -#ifdef MULTICHAR_SET - //TODO: ?? - if (Options & Opt_mc_hack) - { - int col, row, m; - - col = screen.cur.col; - row = screen.cur.row + TermWin.saveLines; - m = 0; - if (keysym == XK_Right - && IS_MULTI1 (screen.rend[row][col])) - m = 1; - else if (keysym == XK_Left) - { - if (col > 0) - { - if (IS_MULTI2 (screen.rend[row][col - 1])) - m = 1; - } - else if (screen.cur.row > 0) - { - col = screen.tlen[--row]; - if (col == -1) - col = TermWin.ncol - 1; - else - col--; - if (col > 0 - && IS_MULTI2 (screen.rend[row][col])) - m = 1; - } - } - if (m) - MEMMOVE (kbuf + 3, kbuf, 3 + 1); - } -#endif break; #ifndef UNSHIFTED_SCROLLKEYS @@ -484,7 +414,7 @@ break; case XK_KP_Multiply: /* "\033Oj" : "*" */ - case XK_KP_Add: /* "\033Ok" : "+" */ + case XK_KP_Add: /* "\033Ok" : "+" */ case XK_KP_Separator: /* "\033Ol" : "," */ case XK_KP_Subtract: /* "\033Om" : "-" */ case XK_KP_Decimal: /* "\033On" : "." */ @@ -644,10 +574,6 @@ meta = 0; } #endif -#ifdef GREEK_SUPPORT - if (greek_mode) - len = greek_xlat (kbuf, len); -#endif /* nil */ ; } } @@ -679,25 +605,23 @@ /* escape prefix */ if (meta #ifdef META8_OPTION - && (meta_char == C0_ESC) + && meta_char == C0_ESC #endif ) { const unsigned char ch = C0_ESC; - tt_write (&ch, 1); } -#ifdef DEBUG_CMD - if (debug_key) - { /* Display keyboard buffer contents */ - char *p; - int i; - - fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); - for (i = 0, p = kbuf; i < len; i++, p++) - fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); - fprintf (stderr, "'\n"); - } + +#if defined(DEBUG_CMD) + /* Display keyboard buffer contents */ + unsigned char *p; + int i; + + fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); + for (i = 0, p = kbuf; i < len; i++, p++) + fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); + fprintf (stderr, "'\n"); #endif /* DEBUG_CMD */ tt_write (kbuf, (unsigned int)len); } @@ -713,6 +637,7 @@ n = cmdbuf_ptr - cmdbuf_base; s = cmdbuf_base + BUFSIZ - 1 - cmdbuf_endp; + if (n > 0 && s < count) { MEMMOVE (cmdbuf_base, cmdbuf_ptr, @@ -721,13 +646,18 @@ cmdbuf_endp -= n; s += n; } + if (count > s) { rxvt_print_error ("data loss: cmd_write too large"); count = s; } + for (; count--;) *cmdbuf_endp++ = *str++; + + cmd_parse (); + return 0; } #endif /* MENUBAR_MAX */ @@ -809,7 +739,7 @@ } else if (n < 0 && errno != EAGAIN) destroy (); - + return false; } @@ -836,106 +766,116 @@ tt_winch (); } - uint32_t ch = NOCHAR; + if (cmd_parse ()) + break; + } + } +} + +bool +rxvt_term::cmd_parse () +{ + bool flag = false; + uint32_t ch = NOCHAR; + + for (;;) + { + if (ch == NOCHAR) + ch = next_char (); + + if (ch == NOCHAR) // TODO: improve + break; + + if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') + { + /* Read a text string from the input buffer */ + uint32_t buf[BUFSIZ]; + bool refreshnow = false; + int nlines = 0; + uint32_t *str = buf; + + *str++ = ch; for (;;) { - if (ch == NOCHAR) - ch = next_char (); + ch = next_char (); - if (ch == NOCHAR) // TODO: improve + if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')) break; - - if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') + else { - /* Read a text string from the input buffer */ - uint32_t buf[BUFSIZ]; - bool refreshnow = false; - int nlines = 0; - uint32_t *str = buf; - *str++ = ch; - for (;;) + if (ch == '\n') { - ch = next_char (); + nlines++; + refresh_count++; - if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')) - break; - else + if (! (Options & Opt_jumpScroll) + || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) { - *str++ = ch; + refreshnow = true; + flag = false; + ch = NOCHAR; + break; + } - if (ch == '\n') - { - nlines++; - refresh_count++; - - if (! (Options & Opt_jumpScroll) - || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) - { - refreshnow = true; - flag = false; - ch = NOCHAR; - break; - } - - // scr_add_lines only works for nlines < TermWin.nrow - 1. - if (nlines >= TermWin.nrow - 1) - { - scr_add_lines (buf, nlines, str - buf); - nlines = 0; - str = buf; - } - } - - if (str >= buf + BUFSIZ) - { - ch = NOCHAR; - break; - } + // scr_add_lines only works for nlines < TermWin.nrow - 1. + if (nlines >= TermWin.nrow - 1) + { + scr_add_lines (buf, nlines, str - buf); + nlines = 0; + str = buf; } } - scr_add_lines (buf, nlines, str - buf); - - /* - * If there have been a lot of new lines, then update the screen - * What the heck I'll cheat and only refresh less than every page-full. - * the number of pages between refreshes is refresh_limit, which - * is incremented here because we must be doing flat-out scrolling. - * - * refreshing should be correct for small scrolls, because of the - * time-out - */ - if (refreshnow) + if (str >= buf + BUFSIZ) { - if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) - refresh_limit++; - - scr_refresh (refresh_type); + ch = NOCHAR; + break; } - } - else - { - switch (ch) - { - default: - process_nonprinting (ch); - break; - case C0_ESC: /* escape char */ - process_escape_seq (); - break; - /*case 0x9b: */ /* CSI */ - /* process_csi_seq (); */ - } + } - ch = NOCHAR; - } + scr_add_lines (buf, nlines, str - buf); + + /* + * If there have been a lot of new lines, then update the screen + * What the heck I'll cheat and only refresh less than every page-full. + * the number of pages between refreshes is refresh_limit, which + * is incremented here because we must be doing flat-out scrolling. + * + * refreshing should be correct for small scrolls, because of the + * time-out + */ + if (refreshnow) + { + if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) + refresh_limit++; + + scr_refresh (refresh_type); } + + } + else + { + switch (ch) + { + default: + process_nonprinting (ch); + break; + case C0_ESC: /* escape char */ + process_escape_seq (); + break; + /*case 0x9b: */ /* CSI */ + /* process_csi_seq (); */ + } + + ch = NOCHAR; } } + + return flag; } // read the next character, currently handles UTF-8 @@ -945,14 +885,20 @@ { while (cmdbuf_ptr < cmdbuf_endp) { - if (*cmdbuf_ptr < 0x80) // assume < 0x80 to be ascii ALWAYS (all shift-states etc.) uh-oh + // assume 0x20 .. 0x7f to be ascii ALWAYS (all shift-states etc.) uh-oh + if ((*cmdbuf_ptr <= 0x7f && 0x20 <= *cmdbuf_ptr) + || !*cmdbuf_ptr) return *cmdbuf_ptr++; wchar_t wc; - size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, &mbstate.mbs); + size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); if (len == (size_t)-2) - return NOCHAR; + { + // the mbstate stores incomplete sequences. didn't know this :/ + cmdbuf_ptr = cmdbuf_endp; + break; + } if (len == (size_t)-1) return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through @@ -1023,10 +969,10 @@ #endif void -rxvt_term::mouse_report (const XButtonEvent &ev) +rxvt_term::mouse_report (XButtonEvent &ev) { - int button_number, key_state = 0; - int x, y; + int button_number, key_state = 0; + int x, y; x = ev.x; y = ev.y; @@ -1430,10 +1376,6 @@ if (menubar_visible () && isMenuBarWindow (ev.xany.window)) menubar_expose (); #endif -#ifdef RXVT_GRAPHICS - Gr_expose (ev.xany.window); -#endif - } break; @@ -1445,7 +1387,7 @@ #if MENUBAR if (isMenuBarWindow (ev.xany.window)) { - menubar_control (& (ev.xbutton)); + menubar_control (ev.xbutton); break; } #endif @@ -1584,7 +1526,7 @@ } void -rxvt_term::button_press (const XButtonEvent &ev) +rxvt_term::button_press (XButtonEvent &ev) { int reportmode = 0, clickintime; @@ -1596,88 +1538,80 @@ */ if (ev.window == TermWin.vt) { -#if RXVT_GRAPHICS - if (ev.subwindow != None) - rxvt_Gr_ButtonPress (ev.x, ev.y); - else -#endif - + clickintime = ev.time - MEvent.time < MULTICLICK_TIME; + if (reportmode) { - clickintime = ev.time - MEvent.time < MULTICLICK_TIME; - if (reportmode) - { - /* mouse report from vt window */ - /* save the xbutton state (for ButtonRelease) */ - MEvent.state = ev.state; + /* mouse report from vt window */ + /* save the xbutton state (for ButtonRelease) */ + MEvent.state = ev.state; #ifdef MOUSE_REPORT_DOUBLECLICK - if (ev.button == MEvent.button && clickintime) - { - /* same button, within alloted time */ - MEvent.clicks++; - if (MEvent.clicks > 1) - { - /* only report double clicks */ - MEvent.clicks = 2; - mouse_report (ev); - - /* don't report the release */ - MEvent.clicks = 0; - MEvent.button = AnyButton; - } - } - else + if (ev.button == MEvent.button && clickintime) + { + /* same button, within alloted time */ + MEvent.clicks++; + if (MEvent.clicks > 1) { - /* different button, or time expired */ - MEvent.clicks = 1; - MEvent.button = ev.button; + /* only report double clicks */ + MEvent.clicks = 2; mouse_report (ev); + + /* don't report the release */ + MEvent.clicks = 0; + MEvent.button = AnyButton; } -#else + } + else + { + /* different button, or time expired */ + MEvent.clicks = 1; MEvent.button = ev.button; mouse_report (ev); + } +#else + MEvent.button = ev.button; + mouse_report (ev); #endif /* MOUSE_REPORT_DOUBLECLICK */ - } - else + } + else + { + if (ev.button != MEvent.button) + MEvent.clicks = 0; + switch (ev.button) { - if (ev.button != MEvent.button) - MEvent.clicks = 0; - switch (ev.button) - { - case Button1: - /* allow shift+left click to extend selection */ - if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) - { - if (MEvent.button == Button1 && clickintime) - selection_rotate (ev.x, ev.y); - else - selection_extend (ev.x, ev.y, 1); - } + case Button1: + /* allow shift+left click to extend selection */ + if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) + { + if (MEvent.button == Button1 && clickintime) + selection_rotate (ev.x, ev.y); else - { - if (MEvent.button == Button1 && clickintime) - MEvent.clicks++; - else - MEvent.clicks = 1; + selection_extend (ev.x, ev.y, 1); + } + else + { + if (MEvent.button == Button1 && clickintime) + MEvent.clicks++; + else + MEvent.clicks = 1; - selection_click (MEvent.clicks, ev.x, ev.y); - } + selection_click (MEvent.clicks, ev.x, ev.y); + } - MEvent.button = Button1; - break; + MEvent.button = Button1; + break; - case Button3: - if (MEvent.button == Button3 && clickintime) - selection_rotate (ev.x, ev.y); - else - selection_extend (ev.x, ev.y, 1); - MEvent.button = Button3; - break; - } + case Button3: + if (MEvent.button == Button3 && clickintime) + selection_rotate (ev.x, ev.y); + else + selection_extend (ev.x, ev.y, 1); + MEvent.button = Button3; + break; } - MEvent.time = ev.time; - return; } + MEvent.time = ev.time; + return; } /* @@ -1830,7 +1764,7 @@ } void -rxvt_term::button_release (const XButtonEvent &ev) +rxvt_term::button_release (XButtonEvent &ev) { int reportmode = 0; @@ -1852,93 +1786,85 @@ #endif if (ev.window == TermWin.vt) { -#ifdef RXVT_GRAPHICS - if (ev.subwindow != None) - rxvt_Gr_ButtonRelease (ev.x, ev.y); - else -#endif - + if (reportmode) { - if (reportmode) - { - /* mouse report from vt window */ - /* don't report release of wheel "buttons" */ - if (ev.button >= 4) - return; + /* mouse report from vt window */ + /* don't report release of wheel "buttons" */ + if (ev.button >= 4) + return; #ifdef MOUSE_REPORT_DOUBLECLICK - /* only report the release of 'slow' single clicks */ - if (MEvent.button != AnyButton - && (ev.button != MEvent.button - || (ev.time - MEvent.time - > MULTICLICK_TIME / 2))) - { - MEvent.clicks = 0; - MEvent.button = AnyButton; - mouse_report (ev); - } -#else /* MOUSE_REPORT_DOUBLECLICK */ + /* only report the release of 'slow' single clicks */ + if (MEvent.button != AnyButton + && (ev.button != MEvent.button + || (ev.time - MEvent.time + > MULTICLICK_TIME / 2))) + { + MEvent.clicks = 0; MEvent.button = AnyButton; mouse_report (ev); -#endif /* MOUSE_REPORT_DOUBLECLICK */ - return; } - /* - * dumb hack to compensate for the failure of click-and-drag - * when overriding mouse reporting - */ - if (PrivateModes & PrivMode_mouse_report - && bypass_keystate - && ev.button == Button1 && MEvent.clicks <= 1) - selection_extend (ev.x, ev.y, 0); - - switch (ev.button) - { - case Button1: - case Button3: - selection_make (ev.time); - break; - case Button2: - selection_request (ev.time, ev.x, ev.y); - break; +#else /* MOUSE_REPORT_DOUBLECLICK */ + MEvent.button = AnyButton; + mouse_report (ev); +#endif /* MOUSE_REPORT_DOUBLECLICK */ + return; + } + /* + * dumb hack to compensate for the failure of click-and-drag + * when overriding mouse reporting + */ + if (PrivateModes & PrivMode_mouse_report + && bypass_keystate + && ev.button == Button1 && MEvent.clicks <= 1) + selection_extend (ev.x, ev.y, 0); + + switch (ev.button) + { + case Button1: + case Button3: + selection_make (ev.time); + break; + case Button2: + selection_request (ev.time, ev.x, ev.y); + break; #ifdef MOUSE_WHEEL - case Button4: - case Button5: - { - int i; - page_dirn v; + case Button4: + case Button5: + { + int i; + page_dirn v; - v = (ev.button == Button4) ? UP : DN; - if (ev.state & ShiftMask) - i = 1; - else if ((Options & Opt_mouseWheelScrollPage)) - i = TermWin.nrow - 1; - else - i = 5; + v = (ev.button == Button4) ? UP : DN; + if (ev.state & ShiftMask) + i = 1; + 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; - } + if (ev.state & ControlMask) + { + mouse_slip_wheel_speed += (v ? -1 : 1); + mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; + } # endif # ifdef JUMP_MOUSE_WHEEL - scr_page (v, i); + 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); -# else - while (i--) - { - scr_page (v, 1); - scr_refresh (SMOOTH_REFRESH); - scrollbar_show (1); - } + } # endif - } - break; + } + break; #endif - } } } #ifdef MENUBAR @@ -2010,30 +1936,33 @@ /* * Copy display->root pixmap transparency */ - int sx, sy, nx, ny; - unsigned int nw, nh; - Window cr; - XImage *image; - GC gc; - XGCValues gcvalue; + int sx, sy, nx, ny; + unsigned int nw, nh; + Window cr; + XImage *image; + GC gc; + XGCValues gcvalue; XTranslateCoordinates (display->display, TermWin.parent[0], display->root, 0, 0, &sx, &sy, &cr); nw = (unsigned int)szHint.width; nh = (unsigned int)szHint.height; nx = ny = 0; + if (sx < 0) { nw += sx; nx = -sx; sx = 0; } + if (sy < 0) { nh += sy; ny = -sy; sy = 0; } + MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); allowedxerror = -1; @@ -2076,6 +2005,7 @@ am_transparent = am_pixmap_trans = 1; } } + if (!am_pixmap_trans) { unsigned int n; @@ -2100,7 +2030,9 @@ if (oldp != TermWin.parent[i]) pchanged = 1; } + n = 0; + if (pchanged) { for (; n < (unsigned int)i; n++) @@ -2114,6 +2046,7 @@ } } } + if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) { @@ -2146,6 +2079,7 @@ ParentRelative); am_transparent = 1; } + for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) TermWin.parent[i] = None; } @@ -2161,7 +2095,7 @@ FILE * rxvt_term::popen_printer () { - FILE *stream = popen (rs[Rs_print_pipe], "w"); + FILE *stream = popen (rs[Rs_print_pipe], "w"); if (stream == NULL) rxvt_print_error ("can't open printer pipe"); @@ -2371,7 +2305,7 @@ if (cmd_getc () == '8') scr_E (); break; - case ' (': + case '(': scr_charset_set (0, (unsigned int)cmd_getc ()); break; case ')': @@ -2383,11 +2317,6 @@ case '+': scr_charset_set (3, (unsigned int)cmd_getc ()); break; -#ifdef MULTICHAR_SET - case '$': - scr_charset_set (-2, (unsigned int)cmd_getc ()); - break; -#endif #ifndef NO_FRILLS case '6': scr_backindex (); @@ -2738,7 +2667,7 @@ break; #endif case 8: /* unofficial extension */ - xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); + xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); break; } break; @@ -3022,6 +2951,8 @@ * 39 = change default fg color * 49 = change default bg color * 55 = dump scrollback buffer and all of screen + * 701 = change locale + * 702 = find font */ void rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) @@ -3117,8 +3048,27 @@ case XTerm_logfile: break; case XTerm_font: - change_font (0, str); + change_font (str); + break; +#ifndef NO_FRILLS + case XTerm_locale: + if (str[0] == '?' && !str[1]) + tt_printf ("%-.250s\n", locale); + else + { + set_locale (str); +# ifdef USE_XIM + im_cb (); +# endif + } break; + case XTerm_findfont: + { + int fid = TermWin.fontset->find_font (atoi (str)); + tt_printf ("%d %-.250s\n", fid, (*TermWin.fontset)[fid]->name); + } + break; +#endif #if 0 case XTerm_dumpscreen: /* no error notices */ { @@ -3256,8 +3206,7 @@ break; case 3: /* 80/132 */ if (PrivateModes & PrivMode_132OK) - set_widthheight ( (unsigned int) ((state ? 132 : 80) * TermWin.fwidth), - (unsigned int)TermWin.height); + set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height); break; case 4: /* smooth scrolling */ if (state) @@ -3478,7 +3427,6 @@ { unsigned char ch, cmd = cmd_getc (); -#ifndef RXVT_GRAPHICS if (cmd == 'Q') { /* query graphics */ tt_printf ("\033G0\n"); /* no graphics */ @@ -3488,51 +3436,6 @@ do ch = cmd_getc (); while (ch != ':'); -#else - unsigned int nargs; - int args[NGRX_PTS]; - unsigned char *text = NULL; - - if (cmd == 'Q') - { /* query graphics */ - tt_printf ("\033G1\n"); /* yes, graphics (color) */ - return; - } - for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1;) - { - int neg; - - ch = cmd_getc (); - neg = (ch == '-'); - if (neg || ch == '+') - ch = cmd_getc (); - - for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) - args[nargs] = args[nargs] * 10 + (ch - '0'); - if (neg) - args[nargs] = -args[nargs]; - - nargs++; - args[nargs] = 0; - if (ch != ';') - break; - } - - if ((cmd == 'T') && (nargs >= 5)) - { - int i, len = args[4]; - - text = (unsigned char *)rxvt_malloc ((len + 1) * sizeof (char)); - - if (text != NULL) - { - for (i = 0; i < len; i++) - text[i] = cmd_getc (); - text[len] = '\0'; - } - } - Gr_do_graphics (cmd, nargs, args, text); -#endif } /*}}} */