ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.487 by sf-exg, Sat Apr 30 13:11:34 2011 UTC vs.
Revision 1.496 by sf-exg, Wed Aug 31 22:39:49 2011 UTC

987 } 987 }
988 988
989 scr_refresh (); 989 scr_refresh ();
990 scrollBar.show (1); 990 scrollBar.show (1);
991#ifdef USE_XIM 991#ifdef USE_XIM
992 IMSendSpot (); 992 im_send_spot ();
993#endif 993#endif
994 } 994 }
995 995
996 display->flush (); 996 display->flush ();
997} 997}
1473 } 1473 }
1474 else 1474 else
1475 { 1475 {
1476#ifdef HAVE_BG_PIXMAP 1476#ifdef HAVE_BG_PIXMAP
1477 if (moved) 1477 if (moved)
1478 {
1479 if (mapped)
1480 update_background (); 1478 update_background ();
1481 else
1482 bg_invalidate ();
1483 }
1484#endif 1479#endif
1485 } 1480 }
1486 1481
1487 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1482 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1488 } 1483 }
1671 XQueryPointer (dpy, scrollBar.win, 1666 XQueryPointer (dpy, scrollBar.win,
1672 &unused_root, &unused_child, 1667 &unused_root, &unused_child,
1673 &unused_root_x, &unused_root_y, 1668 &unused_root_x, &unused_root_y,
1674 &ev.xbutton.x, &ev.xbutton.y, 1669 &ev.xbutton.x, &ev.xbutton.y,
1675 &unused_mask); 1670 &unused_mask);
1676 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1671 scr_move_to (scrollBar.position (ev.xbutton.y) - csrO,
1677 scrollBar.size ()); 1672 scrollBar.size ());
1678 want_refresh = 1; 1673 want_refresh = 1;
1679 scrollBar.show (1); 1674 scrollBar.show (1);
1680 } 1675 }
1681 break; 1676 break;
1736 want_refresh = 1; 1731 want_refresh = 1;
1737 1732
1738#if USE_XIM 1733#if USE_XIM
1739 if (Input_Context != NULL) 1734 if (Input_Context != NULL)
1740 { 1735 {
1741 IMSetPosition (); 1736 im_set_position ();
1742 XSetICFocus (Input_Context); 1737 XSetICFocus (Input_Context);
1743 } 1738 }
1744#endif 1739#endif
1745#if CURSOR_BLINK 1740#if CURSOR_BLINK
1746 if (option (Opt_cursorBlink)) 1741 if (option (Opt_cursorBlink))
2049 csrO = scrollBar.bot - scrollBar.top; 2044 csrO = scrollBar.bot - scrollBar.top;
2050 break; 2045 break;
2051 } 2046 }
2052 2047
2053 if (scrollBar.style == R_SB_XTERM 2048 if (scrollBar.style == R_SB_XTERM
2054 || scrollbar_above_slider (ev.y) 2049 || scrollBar.above_slider (ev.y)
2055 || scrollbar_below_slider (ev.y)) 2050 || scrollBar.below_slider (ev.y))
2056 scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); 2051 scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ());
2057 2052
2058 scrollBar.state = STATE_MOTION; 2053 scrollBar.state = STATE_MOTION;
2059 break; 2054 break;
2060 2055
2061 case Button1: 2056 case Button1:
2064 /* FALLTHROUGH */ 2059 /* FALLTHROUGH */
2065 2060
2066 case Button3: 2061 case Button3:
2067 if (scrollBar.style != R_SB_XTERM) 2062 if (scrollBar.style != R_SB_XTERM)
2068 { 2063 {
2069 if (scrollbar_above_slider (ev.y)) 2064 if (scrollBar.above_slider (ev.y))
2070# ifdef RXVT_SCROLL_FULL 2065# ifdef RXVT_SCROLL_FULL
2071 scr_page (UP, nrow - 1); 2066 scr_page (UP, nrow - 1);
2072# else 2067# else
2073 scr_page (UP, nrow / 4); 2068 scr_page (UP, nrow / 4);
2074# endif 2069# endif
2075 else if (scrollbar_below_slider (ev.y)) 2070 else if (scrollBar.below_slider (ev.y))
2076# ifdef RXVT_SCROLL_FULL 2071# ifdef RXVT_SCROLL_FULL
2077 scr_page (DN, nrow - 1); 2072 scr_page (DN, nrow - 1);
2078# else 2073# else
2079 scr_page (DN, nrow / 4); 2074 scr_page (DN, nrow / 4);
2080# endif 2075# endif
2083 } 2078 }
2084 else 2079 else
2085 { 2080 {
2086 scr_page ((ev.button == Button1 ? DN : UP), 2081 scr_page ((ev.button == Button1 ? DN : UP),
2087 (nrow 2082 (nrow
2088 * scrollbar_position (ev.y) 2083 * scrollBar.position (ev.y)
2089 / scrollBar.size ())); 2084 / scrollBar.size ()));
2090 } 2085 }
2091 2086
2092 break; 2087 break;
2093 } 2088 }
2219 wchar_t ch = NOCHAR; 2214 wchar_t ch = NOCHAR;
2220 char *seq_begin; // remember start of esc-sequence here 2215 char *seq_begin; // remember start of esc-sequence here
2221 2216
2222 for (;;) 2217 for (;;)
2223 { 2218 {
2224 if (expect_false (ch == NOCHAR)) 2219 if (ecb_unlikely (ch == NOCHAR))
2225 { 2220 {
2226 seq_begin = cmdbuf_ptr; 2221 seq_begin = cmdbuf_ptr;
2227 ch = next_char (); 2222 ch = next_char ();
2228 2223
2229 if (ch == NOCHAR) 2224 if (ch == NOCHAR)
2230 break; 2225 break;
2231 } 2226 }
2232 2227
2233 if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) 2228 if (ecb_likely (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
2234 { 2229 {
2235 if (expect_false (!seen_input)) 2230 if (ecb_unlikely (!seen_input))
2236 { 2231 {
2237 seen_input = 1; 2232 seen_input = 1;
2238 // many badly-written programs (e.g. jed) contain a race condition: 2233 // many badly-written programs (e.g. jed) contain a race condition:
2239 // they first read the screensize and then install a SIGWINCH handler. 2234 // they first read the screensize and then install a SIGWINCH handler.
2240 // some window managers resize the window early, and these programs 2235 // some window managers resize the window early, and these programs
2253 wchar_t *str = buf; 2248 wchar_t *str = buf;
2254 wchar_t *eol = str + min (ncol, UBUFSIZ); 2249 wchar_t *eol = str + min (ncol, UBUFSIZ);
2255 2250
2256 for (;;) 2251 for (;;)
2257 { 2252 {
2258 if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) 2253 if (ecb_unlikely (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)))
2259 break; 2254 break;
2260 2255
2261 *str++ = ch; 2256 *str++ = ch;
2262 2257
2263 if (expect_false (ch == C0_LF || str >= eol)) 2258 if (ecb_unlikely (ch == C0_LF || str >= eol))
2264 { 2259 {
2265 if (ch == C0_LF) 2260 if (ch == C0_LF)
2266 nlines++; 2261 nlines++;
2267 2262
2268 refresh_count++; 2263 refresh_count++;
2346rxvt_term::next_char () NOTHROW 2341rxvt_term::next_char () NOTHROW
2347{ 2342{
2348 while (cmdbuf_ptr < cmdbuf_endp) 2343 while (cmdbuf_ptr < cmdbuf_endp)
2349 { 2344 {
2350 // assume 7-bit to be ascii ALWAYS 2345 // assume 7-bit to be ascii ALWAYS
2351 if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) 2346 if (ecb_likely ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b))
2352 return *cmdbuf_ptr++; 2347 return *cmdbuf_ptr++;
2353 2348
2354 wchar_t wc; 2349 wchar_t wc;
2355 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2350 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2356 2351
2595 break; 2590 break;
2596 case 'Z': /* identify the terminal type */ 2591 case 'Z': /* identify the terminal type */
2597 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ 2592 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */
2598 break; 2593 break;
2599 case '<': /* turn off VT52 mode */ 2594 case '<': /* turn off VT52 mode */
2600 set_privmode (PrivMode_vt52, 0); 2595 priv_modes &= ~PrivMode_vt52;
2601 break; 2596 break;
2602 case 'F': /* use special graphics character set */ 2597 case 'F': /* use special graphics character set */
2603 case 'G': /* use regular character set */ 2598 case 'G': /* use regular character set */
2604 /* unimplemented */ 2599 /* unimplemented */
2605 break; 2600 break;
2656#if !ENABLE_MINIMAL 2651#if !ENABLE_MINIMAL
2657 case '9': 2652 case '9':
2658 scr_forwardindex (); 2653 scr_forwardindex ();
2659 break; 2654 break;
2660#endif 2655#endif
2656 // DECPAM/DECPNM
2661 case '=': 2657 case '=':
2658 priv_modes |= PrivMode_aplKP;
2659 break;
2662 case '>': 2660 case '>':
2663 set_privmode (PrivMode_aplKP, ch == '='); 2661 priv_modes &= ~PrivMode_aplKP;
2664 break; 2662 break;
2665 2663
2666 case C1_40: 2664 case C1_40:
2667 cmd_getc (); 2665 cmd_getc ();
2668 break; 2666 break;
2672 2670
2673 /* 8.3.87: NEXT LINE */ 2671 /* 8.3.87: NEXT LINE */
2674 case C1_NEL: /* ESC E */ 2672 case C1_NEL: /* ESC E */
2675 { 2673 {
2676 wchar_t nlcr[] = { C0_LF, C0_CR }; 2674 wchar_t nlcr[] = { C0_LF, C0_CR };
2677 scr_add_lines (nlcr, ARRAY_LENGTH(nlcr), 1); 2675 scr_add_lines (nlcr, ecb_array_length (nlcr), 1);
2678 } 2676 }
2679 break; 2677 break;
2680 2678
2681 /* kidnapped escape sequence: Should be 8.3.48 */ 2679 /* kidnapped escape sequence: Should be 8.3.48 */
2682 case C1_ESA: /* ESC G */ 2680 case C1_ESA: /* ESC G */
2858 scr_soft_reset (); 2856 scr_soft_reset ();
2859 2857
2860 static const int pm_h[] = { 7, 25 }; 2858 static const int pm_h[] = { 7, 25 };
2861 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 }; 2859 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 };
2862 2860
2863 process_terminal_mode ('h', 0, ARRAY_LENGTH(pm_h), pm_h); 2861 process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h);
2864 process_terminal_mode ('l', 0, ARRAY_LENGTH(pm_l), pm_l); 2862 process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l);
2865 } 2863 }
2866 break; 2864 break;
2867 } 2865 }
2868 2866
2869 return; 2867 return;
3452 min (h_align, 32767), min (v_align, 32767)); 3450 min (h_align, 32767), min (v_align, 32767));
3453 process_xterm_seq (XTerm_title, str, CHAR_ST); 3451 process_xterm_seq (XTerm_title, str, CHAR_ST);
3454 } 3452 }
3455 else 3453 else
3456 { 3454 {
3457 int changed = 0; 3455 bool changed = false;
3458 3456
3459 if (*str != ';') 3457 if (*str != ';')
3460 { 3458 {
3461 if (bg_set_file (str)) /* change pixmap */ 3459 if (bg_set_file (str)) /* change pixmap */
3462 {
3463 changed++; 3460 changed = true;
3464 str = strchr (str, ';');
3465 if (str == NULL)
3466 bg_set_default_geometry ();
3467 else
3468 bg_set_geometry (str+1);
3469 }
3470 } 3461 }
3471 else 3462 else
3472 { 3463 {
3473 str++; 3464 str++;
3474 if (bg_set_geometry (str, true)) 3465 if (bg_set_geometry (str, true))
3475 changed++; 3466 changed = true;
3476 } 3467 }
3477 3468
3478 if (changed) 3469 if (changed)
3479 { 3470 {
3480 if (bg_window_position_sensitive ()) 3471 if (bg_window_position_sensitive ())
3596 if (mode == 'r') 3587 if (mode == 'r')
3597 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ 3588 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */
3598 else 3589 else
3599 state = (mode == 't') ? ! (priv_modes & bit) : mode; 3590 state = (mode == 't') ? ! (priv_modes & bit) : mode;
3600 3591
3601 set_privmode (bit, state); 3592 if (state)
3593 priv_modes |= bit;
3594 else
3595 priv_modes &= ~bit;
3602 } 3596 }
3603 3597
3604 return state; 3598 return state;
3605} 3599}
3606 3600
3607/* we're not using priv _yet_ */ 3601/* we're not using priv _yet_ */
3608void 3602void
3609rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) 3603rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int nargs, const int *arg)
3610{ 3604{
3611 unsigned int i, j; 3605 unsigned int i, j;
3612 int state; 3606 int state;
3613 3607
3614 static const struct 3608 static const struct
3615 { 3609 {
3616 const int argval; 3610 const int argval;
3617 const unsigned long bit; 3611 const unsigned long bit;
3618 } argtopriv[] = { 3612 } argtopriv[] = {
3619 { 1, PrivMode_aplCUR }, // DECCKM 3613 { 1, PrivMode_aplCUR }, // DECCKM
3620 { 2, PrivMode_vt52 }, 3614 { 2, PrivMode_vt52 }, // DECANM
3621 { 3, PrivMode_132 }, // DECCOLM 3615 { 3, PrivMode_132 }, // DECCOLM
3622 { 4, PrivMode_smoothScroll }, // DECSCLM 3616 { 4, PrivMode_smoothScroll }, // DECSCLM
3623 { 5, PrivMode_rVideo }, // DECSCNM 3617 { 5, PrivMode_rVideo }, // DECSCNM
3624 { 6, PrivMode_relOrigin }, // DECOM 3618 { 6, PrivMode_relOrigin }, // DECOM
3625 { 7, PrivMode_Autowrap }, // DECAWM 3619 { 7, PrivMode_Autowrap }, // DECAWM
3626 // 8, auto-repeat keys // DECARM 3620 // 8, auto-repeat keys // DECARM
3627 { 9, PrivMode_MouseX10 }, 3621 { 9, PrivMode_MouseX10 },
3628 // 18 end FF to printer after print screen 3622 // 18 end FF to printer after print screen
3629 // 19 Print screen prints full screen/scroll region 3623 // 19 Print screen prints full screen/scroll region
3630 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis 3624 { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis
3631#ifdef scrollBar_esc 3625#ifdef scrollBar_esc
3632 { scrollBar_esc, PrivMode_scrollBar }, 3626 { scrollBar_esc, PrivMode_scrollBar },
3633#endif 3627#endif
3634 { 35, PrivMode_ShiftKeys }, // rxvt extension 3628 { 35, PrivMode_ShiftKeys }, // rxvt extension
3635 // 38, tektronix mode // DECTEK 3629 // 38, tektronix mode // DECTEK
3636 { 40, PrivMode_132OK }, 3630 { 40, PrivMode_132OK },
3637 // 41 xterm more fixes NYI 3631 // 41 xterm more fixes NYI
3638 // 45 margin bell NYI 3632 // 45 margin bell NYI
3639 // 46 start logging 3633 // 46 start logging
3640 { 47, PrivMode_Screen }, 3634 { 47, PrivMode_Screen },
3641 { 66, PrivMode_aplKP }, // DECPAM/DECPNM 3635 { 66, PrivMode_aplKP }, // DECNKM
3642#ifndef NO_BACKSPACE_KEY 3636#ifndef NO_BACKSPACE_KEY
3643 { 67, PrivMode_BackSpace }, // DECBKM 3637 { 67, PrivMode_BackSpace }, // DECBKM
3644#endif 3638#endif
3645 { 1000, PrivMode_MouseX11 }, 3639 { 1000, PrivMode_MouseX11 },
3646 { 1002, PrivMode_MouseBtnEvent }, 3640 { 1002, PrivMode_MouseBtnEvent },
3675 for (i = 0; i < nargs; i++) 3669 for (i = 0; i < nargs; i++)
3676 { 3670 {
3677 state = -1; 3671 state = -1;
3678 3672
3679 /* basic handling */ 3673 /* basic handling */
3680 for (j = 0; j < ARRAY_LENGTH(argtopriv); j++) 3674 for (j = 0; j < ecb_array_length (argtopriv); j++)
3681 if (argtopriv[j].argval == arg[i]) 3675 if (argtopriv[j].argval == arg[i])
3682 { 3676 {
3683 state = privcases (mode, argtopriv[j].bit); 3677 state = privcases (mode, argtopriv[j].bit);
3684 break; 3678 break;
3685 } 3679 }
3711 case 2: /* VT52 mode */ 3705 case 2: /* VT52 mode */
3712 /* oddball mode. should be set regardless of set/reset 3706 /* oddball mode. should be set regardless of set/reset
3713 * parameter. Return from VT52 mode with an ESC < from 3707 * parameter. Return from VT52 mode with an ESC < from
3714 * within VT52 mode 3708 * within VT52 mode
3715 */ 3709 */
3716 set_privmode (PrivMode_vt52, 1); 3710 priv_modes |= PrivMode_vt52;
3717 break; 3711 break;
3718 case 3: /* 80/132 */ 3712 case 3: /* 80/132 */
3719 if (priv_modes & PrivMode_132OK) 3713 if (priv_modes & PrivMode_132OK)
3720 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); 3714 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3721 break; 3715 break;
3736 if (state) /* orthogonal */ 3730 if (state) /* orthogonal */
3737 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3731 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3738 break; 3732 break;
3739#ifdef scrollBar_esc 3733#ifdef scrollBar_esc
3740 case scrollBar_esc: 3734 case scrollBar_esc:
3741 if (scrollBar.map (state)) 3735 scrollBar.map (state);
3742 {
3743 resize_all_windows (0, 0, 0); 3736 resize_all_windows (0, 0, 0);
3744 scr_touch (true); 3737 scr_touch (true);
3745 }
3746 break; 3738 break;
3747#endif 3739#endif
3748 case 25: /* visible/invisible cursor */ 3740 case 25: /* visible/invisible cursor */
3749 scr_cursor_visible (state); 3741 scr_cursor_visible (state);
3750 break; 3742 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines