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.413 by ayin, Sun Feb 17 12:11:56 2008 UTC vs.
Revision 1.419 by root, Fri Oct 10 13:23:56 2008 UTC

1015 } 1015 }
1016 while (row < end_row); 1016 while (row < end_row);
1017 } 1017 }
1018 1018
1019 scr_refresh (); 1019 scr_refresh ();
1020 scrollbar_show (1); 1020 scrollBar.show (1);
1021#ifdef USE_XIM 1021#ifdef USE_XIM
1022 IMSendSpot (); 1022 IMSendSpot ();
1023#endif 1023#endif
1024 } 1024 }
1025 1025
1536 ; 1536 ;
1537 1537
1538 if (scrollBar.state && ev.xany.window == scrollBar.win) 1538 if (scrollBar.state && ev.xany.window == scrollBar.win)
1539 { 1539 {
1540 scrollBar.state = STATE_IDLE; 1540 scrollBar.state = STATE_IDLE;
1541 scrollbar_show (0); 1541 scrollBar.show (0);
1542 } 1542 }
1543 } 1543 }
1544 break; 1544 break;
1545 1545
1546 case MotionNotify: 1546 case MotionNotify:
1647 &ev.xbutton.x, &ev.xbutton.y, 1647 &ev.xbutton.x, &ev.xbutton.y,
1648 &unused_mask); 1648 &unused_mask);
1649 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1649 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1650 scrollBar.size ()); 1650 scrollBar.size ());
1651 want_refresh = 1; 1651 want_refresh = 1;
1652 scrollbar_show (1); 1652 scrollBar.show (1);
1653 } 1653 }
1654 break; 1654 break;
1655 } 1655 }
1656 1656
1657#if defined(CURSOR_BLINK) 1657#if defined(CURSOR_BLINK)
2066 reportmode = !! (priv_modes & PrivMode_mouse_report); 2066 reportmode = !! (priv_modes & PrivMode_mouse_report);
2067 2067
2068 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 2068 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN)
2069 { 2069 {
2070 scrollBar.state = STATE_IDLE; 2070 scrollBar.state = STATE_IDLE;
2071 scrollbar_show (0); 2071 scrollBar.show (0);
2072 } 2072 }
2073 2073
2074#ifdef SELECTION_SCROLLING 2074#ifdef SELECTION_SCROLLING
2075 sel_scroll_ev.stop(); 2075 sel_scroll_ev.stop();
2076#endif 2076#endif
2159 } 2159 }
2160 else 2160 else
2161# endif 2161# endif
2162 { 2162 {
2163 scr_page (v, i); 2163 scr_page (v, i);
2164 scrollbar_show (1); 2164 scrollBar.show (1);
2165 } 2165 }
2166 } 2166 }
2167 break; 2167 break;
2168#endif 2168#endif
2169 } 2169 }
2179 wchar_t ch = NOCHAR; 2179 wchar_t ch = NOCHAR;
2180 char *seq_begin; // remember start of esc-sequence here 2180 char *seq_begin; // remember start of esc-sequence here
2181 2181
2182 for (;;) 2182 for (;;)
2183 { 2183 {
2184 if (ch == NOCHAR) 2184 if (expect_false (ch == NOCHAR))
2185 { 2185 {
2186 seq_begin = cmdbuf_ptr; 2186 seq_begin = cmdbuf_ptr;
2187 ch = next_char (); 2187 ch = next_char ();
2188 2188
2189 if (ch == NOCHAR) 2189 if (ch == NOCHAR)
2190 break; 2190 break;
2191 } 2191 }
2192 2192
2193 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) 2193 if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
2194 { 2194 {
2195 if (!seen_input) 2195 if (expect_false (!seen_input))
2196 { 2196 {
2197 seen_input = 1; 2197 seen_input = 1;
2198 // many badly-written programs (e.g. jed) contain a race condition: 2198 // many badly-written programs (e.g. jed) contain a race condition:
2199 // they first read the screensize and then install a SIGWINCH handler. 2199 // they first read the screensize and then install a SIGWINCH handler.
2200 // some window managers resize the window early, and these programs 2200 // some window managers resize the window early, and these programs
2213 wchar_t *str = buf; 2213 wchar_t *str = buf;
2214 wchar_t *eol = str + min (ncol, UBUFSIZ); 2214 wchar_t *eol = str + min (ncol, UBUFSIZ);
2215 2215
2216 for (;;) 2216 for (;;)
2217 { 2217 {
2218 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2218 if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)))
2219 break; 2219 break;
2220 2220
2221 *str++ = ch; 2221 *str++ = ch;
2222 2222
2223 if (ch == C0_LF || str >= eol) 2223 if (expect_false (ch == C0_LF || str >= eol))
2224 { 2224 {
2225 if (ch == C0_LF) 2225 if (ch == C0_LF)
2226 nlines++; 2226 nlines++;
2227 2227
2228 refresh_count++; 2228 refresh_count++;
2310rxvt_term::next_char () NOTHROW 2310rxvt_term::next_char () NOTHROW
2311{ 2311{
2312 while (cmdbuf_ptr < cmdbuf_endp) 2312 while (cmdbuf_ptr < cmdbuf_endp)
2313 { 2313 {
2314 // assume 7-bit to be ascii ALWAYS 2314 // assume 7-bit to be ascii ALWAYS
2315 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2315 if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b))
2316 return *cmdbuf_ptr++; 2316 return *cmdbuf_ptr++;
2317 2317
2318 wchar_t wc; 2318 wchar_t wc;
2319 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2319 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2320 2320
2324 cmdbuf_ptr = cmdbuf_endp; 2324 cmdbuf_ptr = cmdbuf_endp;
2325 break; 2325 break;
2326 } 2326 }
2327 2327
2328 if (len == (size_t)-1) 2328 if (len == (size_t)-1)
2329 {
2330 mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state
2329 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through 2331 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through
2332 }
2330 2333
2331 // assume wchar == unicode 2334 // assume wchar == unicode
2332 cmdbuf_ptr += len; 2335 cmdbuf_ptr += len;
2333 return wc & UNICODE_MASK; 2336 return wc & UNICODE_MASK;
2334 } 2337 }
2378/*----------------------------------------------------------------------*/ 2381/*----------------------------------------------------------------------*/
2379#ifdef PRINTPIPE 2382#ifdef PRINTPIPE
2380FILE * 2383FILE *
2381rxvt_term::popen_printer () 2384rxvt_term::popen_printer ()
2382{ 2385{
2383 FILE *stream = popen (rs[Rs_print_pipe], "w"); 2386 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w");
2384 2387
2385 if (stream == NULL) 2388 if (stream == NULL)
2386 rxvt_warn ("can't open printer pipe, not printing.\n"); 2389 rxvt_warn ("can't open printer pipe, not printing.\n");
2387 2390
2388 return stream; 2391 return stream;
2399 * simulate attached vt100 printer 2402 * simulate attached vt100 printer
2400 */ 2403 */
2401void 2404void
2402rxvt_term::process_print_pipe () 2405rxvt_term::process_print_pipe ()
2403{ 2406{
2404 int done; 2407 FILE *fd = popen_printer ();
2405 FILE *fd;
2406 2408
2407 if ((fd = popen_printer ()) == NULL) 2409 if (!fd)
2408 return; 2410 return;
2409 2411
2410 /* 2412 /*
2411 * Send all input to the printer until either ESC[4i or ESC[?4i 2413 * Send all input to the printer until either ESC[4i or ESC[?4i
2412 * is received. 2414 * is received.
2413 */ 2415 */
2414 for (done = 0; !done;) 2416 for (int done = 0; !done; )
2415 { 2417 {
2416 unsigned char buf[8]; 2418 unsigned char buf[8];
2417 unicode_t ch; 2419 unicode_t ch;
2418 unsigned int i, len; 2420 unsigned int i, len;
2419 2421
2691 2693
2692 /* 8.3.106: RESET TO INITIAL STATE */ 2694 /* 8.3.106: RESET TO INITIAL STATE */
2693 case 'c': 2695 case 'c':
2694 mbstate.reset (); 2696 mbstate.reset ();
2695 scr_poweron (); 2697 scr_poweron ();
2696 scrollbar_show (1); 2698 scrollBar.show (1);
2697 break; 2699 break;
2698 2700
2699 /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ 2701 /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */
2700 case 'n': 2702 case 'n':
2701 scr_charset_choose (2); 2703 scr_charset_choose (2);
3507 break; 3509 break;
3508#endif 3510#endif
3509 3511
3510#if ENABLE_PERL 3512#if ENABLE_PERL
3511 case URxvt_perl: 3513 case URxvt_perl:
3512 if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) 3514 HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_STR_LEN, &resp, 1, DT_END));
3513 ; // no responses yet
3514 break; 3515 break;
3515#endif 3516#endif
3516 } 3517 }
3517} 3518}
3518/*----------------------------------------------------------------------*/ 3519/*----------------------------------------------------------------------*/
3677 if (state) /* orthogonal */ 3678 if (state) /* orthogonal */
3678 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3679 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3679 break; 3680 break;
3680#ifdef scrollBar_esc 3681#ifdef scrollBar_esc
3681 case scrollBar_esc: 3682 case scrollBar_esc:
3682 if (scrollbar_mapping (state)) 3683 if (scrollBar.map (state))
3683 { 3684 {
3684 resize_all_windows (0, 0, 0); 3685 resize_all_windows (0, 0, 0);
3685 scr_touch (true); 3686 scr_touch (true);
3686 } 3687 }
3687 break; 3688 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines