… | |
… | |
510 | #endif |
510 | #endif |
511 | max_it (lnsppg, 1); |
511 | max_it (lnsppg, 1); |
512 | |
512 | |
513 | if (keysym == XK_Prior) |
513 | if (keysym == XK_Prior) |
514 | { |
514 | { |
515 | scr_page (UP, lnsppg); |
515 | scr_page (lnsppg); |
516 | return; |
516 | return; |
517 | } |
517 | } |
518 | else if (keysym == XK_Next) |
518 | else if (keysym == XK_Next) |
519 | { |
519 | { |
520 | scr_page (DN, lnsppg); |
520 | scr_page (-lnsppg); |
521 | return; |
521 | return; |
522 | } |
522 | } |
523 | } |
523 | } |
524 | #ifdef SCROLL_ON_UPDOWN_KEYS |
524 | #ifdef SCROLL_ON_UPDOWN_KEYS |
525 | if (IS_SCROLL_MOD) |
525 | if (IS_SCROLL_MOD) |
526 | { |
526 | { |
527 | if (keysym == XK_Up) |
527 | if (keysym == XK_Up) |
528 | { |
528 | { |
529 | scr_page (UP, 1); |
529 | scr_page (1); |
530 | return; |
530 | return; |
531 | } |
531 | } |
532 | else if (keysym == XK_Down) |
532 | else if (keysym == XK_Down) |
533 | { |
533 | { |
534 | scr_page (DN, 1); |
534 | scr_page (-1); |
535 | return; |
535 | return; |
536 | } |
536 | } |
537 | } |
537 | } |
538 | #endif |
538 | #endif |
539 | #ifdef SCROLL_ON_HOMEEND_KEYS |
539 | #ifdef SCROLL_ON_HOMEEND_KEYS |
540 | if (IS_SCROLL_MOD) |
540 | if (IS_SCROLL_MOD) |
541 | { |
541 | { |
542 | if (keysym == XK_Home) |
542 | if (keysym == XK_Home) |
543 | { |
543 | { |
544 | scr_move_to (0, 1); |
544 | scr_changeview (top_row); |
545 | return; |
545 | return; |
546 | } |
546 | } |
547 | else if (keysym == XK_End) |
547 | else if (keysym == XK_End) |
548 | { |
548 | { |
549 | scr_move_to (1, 1); |
549 | scr_changeview (0); |
550 | return; |
550 | return; |
551 | } |
551 | } |
552 | } |
552 | } |
553 | #endif |
553 | #endif |
554 | } |
554 | } |
… | |
… | |
941 | void |
941 | void |
942 | rxvt_term::flush () |
942 | rxvt_term::flush () |
943 | { |
943 | { |
944 | flush_ev.stop (); |
944 | flush_ev.stop (); |
945 | |
945 | |
946 | #ifdef HAVE_BG_PIXMAP |
946 | #ifdef HAVE_IMG |
947 | if (bg_flags & BG_NEEDS_REFRESH) |
947 | if (bg_flags & BG_NEEDS_REFRESH) |
948 | { |
948 | { |
949 | bg_flags &= ~BG_NEEDS_REFRESH; |
949 | bg_flags &= ~BG_NEEDS_REFRESH; |
950 | scr_touch (false); |
950 | scr_touch (false); |
951 | } |
951 | } |
… | |
… | |
1077 | |
1077 | |
1078 | #ifdef SELECTION_SCROLLING |
1078 | #ifdef SELECTION_SCROLLING |
1079 | void |
1079 | void |
1080 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1080 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1081 | { |
1081 | { |
1082 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1082 | if (scr_page (scroll_selection_lines)) |
1083 | { |
1083 | { |
1084 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1084 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1085 | want_refresh = 1; |
1085 | want_refresh = 1; |
1086 | refresh_check (); |
1086 | refresh_check (); |
1087 | } |
1087 | } |
… | |
… | |
1092 | |
1092 | |
1093 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1093 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1094 | void |
1094 | void |
1095 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1095 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1096 | { |
1096 | { |
1097 | if (scr_changeview (view_start - mouse_slip_wheel_speed)) |
1097 | if (scr_page (mouse_slip_wheel_speed)) |
1098 | { |
1098 | { |
1099 | want_refresh = 1; |
1099 | want_refresh = 1; |
1100 | refresh_check (); |
1100 | refresh_check (); |
1101 | } |
1101 | } |
1102 | |
1102 | |
… | |
… | |
1472 | bool moved = false; |
1472 | bool moved = false; |
1473 | #ifdef HAVE_BG_PIXMAP |
1473 | #ifdef HAVE_BG_PIXMAP |
1474 | if (bg_window_position_sensitive ()) |
1474 | if (bg_window_position_sensitive ()) |
1475 | { |
1475 | { |
1476 | want_position_change = true; |
1476 | want_position_change = true; |
1477 | if (!(bg_flags & BG_IS_VALID)) |
1477 | if (bg_img == 0) |
1478 | moved = true; |
1478 | moved = true; |
1479 | } |
1479 | } |
1480 | #endif |
1480 | #endif |
1481 | |
1481 | |
1482 | if (want_position_change) |
1482 | if (want_position_change) |
… | |
… | |
1529 | selection_send (ev.xselectionrequest); |
1529 | selection_send (ev.xselectionrequest); |
1530 | break; |
1530 | break; |
1531 | |
1531 | |
1532 | case MapNotify: |
1532 | case MapNotify: |
1533 | #ifdef HAVE_BG_PIXMAP |
1533 | #ifdef HAVE_BG_PIXMAP |
1534 | /* This is needed specifically to fix the case of no window manager or a |
1534 | // This is needed at startup for the case of no window manager |
1535 | * non-reparenting window manager. In those cases we never get first |
1535 | // or a non-reparenting window manager and also because we |
1536 | * ConfigureNotify. Also that speeds startup under normal WM, by taking |
1536 | // defer bg image updates if the window is not mapped. The |
1537 | * care of multiplicity of ConfigureNotify events arriving while WM does |
1537 | // short delay is to optimize for multiple ConfigureNotify |
1538 | * reparenting. |
1538 | // events at startup when the window manager reparents the |
1539 | * We should not render background immediately, as there could be several |
1539 | // window, so as to perform the computation after we have |
1540 | * ConfigureNotify's to follow. Lets take care of all of them in one scoop |
1540 | // received all of them. |
1541 | * by scheduling background redraw as soon as we can, but giving a short |
1541 | if (bg_img == 0) |
1542 | * bit of time for ConfigureNotifies to arrive. |
|
|
1543 | * We should render background PRIOR to drawing any text, but AFTER all |
|
|
1544 | * of ConfigureNotifys for the best results. |
|
|
1545 | */ |
|
|
1546 | if (!(bg_flags & BG_IS_VALID)) |
|
|
1547 | update_background_ev.start (0.025); |
1542 | update_background_ev.start (0.025); |
1548 | #endif |
1543 | #endif |
1549 | mapped = 1; |
1544 | mapped = 1; |
1550 | #ifdef TEXT_BLINK |
1545 | #ifdef TEXT_BLINK |
1551 | text_blink_ev.start (); |
1546 | text_blink_ev.start (); |
… | |
… | |
1643 | |
1638 | |
1644 | #ifdef SELECTION_SCROLLING |
1639 | #ifdef SELECTION_SCROLLING |
1645 | if (ev.xbutton.y < int_bwidth |
1640 | if (ev.xbutton.y < int_bwidth |
1646 | || Pixel2Row (ev.xbutton.y) > (nrow-1)) |
1641 | || Pixel2Row (ev.xbutton.y) > (nrow-1)) |
1647 | { |
1642 | { |
|
|
1643 | page_dirn scroll_selection_dir; |
1648 | int dist; |
1644 | int dist; |
1649 | |
1645 | |
1650 | /* don't clobber the current delay if we are |
1646 | /* don't clobber the current delay if we are |
1651 | * already in the middle of scrolling. |
1647 | * already in the middle of scrolling. |
1652 | */ |
1648 | */ |
… | |
… | |
1675 | scroll_selection_lines = Pixel2Height (dist) |
1671 | scroll_selection_lines = Pixel2Height (dist) |
1676 | / SELECTION_SCROLL_LINE_SPEEDUP |
1672 | / SELECTION_SCROLL_LINE_SPEEDUP |
1677 | + 1; |
1673 | + 1; |
1678 | min_it (scroll_selection_lines, |
1674 | min_it (scroll_selection_lines, |
1679 | SELECTION_SCROLL_MAX_LINES); |
1675 | SELECTION_SCROLL_MAX_LINES); |
|
|
1676 | scroll_selection_lines *= scroll_selection_dir; |
1680 | } |
1677 | } |
1681 | else |
1678 | else |
1682 | { |
1679 | { |
1683 | /* we are within the text window, so we |
1680 | /* we are within the text window, so we |
1684 | * shouldn't be scrolling |
1681 | * shouldn't be scrolling |
… | |
… | |
1838 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1835 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1839 | } |
1836 | } |
1840 | #endif |
1837 | #endif |
1841 | } |
1838 | } |
1842 | |
1839 | |
1843 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1840 | #if BG_IMAGE_FROM_ROOT || ENABLE_PERL |
1844 | void ecb_hot |
1841 | void ecb_hot |
1845 | rxvt_term::rootwin_cb (XEvent &ev) |
1842 | rxvt_term::rootwin_cb (XEvent &ev) |
1846 | { |
1843 | { |
1847 | make_current (); |
1844 | make_current (); |
1848 | |
1845 | |
… | |
… | |
1858 | * use the property to determine the pixmap. We use it later on. |
1855 | * use the property to determine the pixmap. We use it later on. |
1859 | */ |
1856 | */ |
1860 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1857 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1861 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1858 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1862 | { |
1859 | { |
1863 | # if ENABLE_TRANSPARENCY |
1860 | #if BG_IMAGE_FROM_ROOT |
1864 | bg_set_root_pixmap (); |
1861 | if (option (Opt_transparent)) |
|
|
1862 | { |
|
|
1863 | rxvt_img::new_from_root (this)->replace (root_img); |
1865 | update_background (); |
1864 | update_background (); |
|
|
1865 | } |
1866 | #endif |
1866 | #endif |
1867 | #if ENABLE_PERL |
|
|
1868 | HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); |
1867 | HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); |
1869 | #endif |
|
|
1870 | } |
1868 | } |
1871 | |
1869 | |
1872 | break; |
1870 | break; |
1873 | } |
1871 | } |
1874 | |
1872 | |
… | |
… | |
2199 | |
2197 | |
2200 | #ifdef MOUSE_WHEEL |
2198 | #ifdef MOUSE_WHEEL |
2201 | case Button4: |
2199 | case Button4: |
2202 | case Button5: |
2200 | case Button5: |
2203 | { |
2201 | { |
2204 | int i; |
2202 | int lines; |
2205 | page_dirn v; |
2203 | page_dirn dirn; |
2206 | |
2204 | |
2207 | v = ev.button == Button4 ? UP : DN; |
2205 | dirn = ev.button == Button4 ? UP : DN; |
2208 | |
2206 | |
2209 | if (ev.state & ShiftMask) |
2207 | if (ev.state & ShiftMask) |
2210 | i = 1; |
2208 | lines = 1; |
2211 | else if (option (Opt_mouseWheelScrollPage)) |
2209 | else if (option (Opt_mouseWheelScrollPage)) |
2212 | i = nrow - 1; |
2210 | lines = nrow - 1; |
2213 | else |
2211 | else |
2214 | i = 5; |
2212 | lines = 5; |
2215 | |
2213 | |
2216 | # ifdef MOUSE_SLIP_WHEELING |
2214 | # ifdef MOUSE_SLIP_WHEELING |
2217 | if (ev.state & ControlMask) |
2215 | if (ev.state & ControlMask) |
2218 | { |
2216 | { |
2219 | mouse_slip_wheel_speed += v ? -1 : 1; |
2217 | mouse_slip_wheel_speed += dirn; |
2220 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2218 | clamp_it (mouse_slip_wheel_speed, -nrow, nrow); |
2221 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
|
|
2222 | |
2219 | |
2223 | if (!slip_wheel_ev.is_active ()) |
2220 | if (!slip_wheel_ev.is_active ()) |
2224 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2221 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2225 | } |
2222 | } |
2226 | else |
2223 | else |
2227 | # endif |
2224 | # endif |
2228 | { |
2225 | { |
2229 | scr_page (v, i); |
2226 | scr_page (dirn, lines); |
2230 | scrollBar.show (1); |
2227 | scrollBar.show (1); |
2231 | } |
2228 | } |
2232 | } |
2229 | } |
2233 | break; |
2230 | break; |
2234 | #endif |
2231 | #endif |
… | |
… | |
2803 | }; |
2800 | }; |
2804 | |
2801 | |
2805 | void ecb_hot |
2802 | void ecb_hot |
2806 | rxvt_term::process_csi_seq () |
2803 | rxvt_term::process_csi_seq () |
2807 | { |
2804 | { |
2808 | unicode_t ch, priv, i; |
2805 | unicode_t ch, priv, prev_ch, i; |
2809 | unsigned int nargs, p; |
2806 | unsigned int nargs, p; |
2810 | int n, ndef; |
2807 | int n, ndef; |
2811 | int arg[ESC_ARGS] = { }; |
2808 | int arg[ESC_ARGS] = { }; |
2812 | |
2809 | |
2813 | nargs = 0; |
2810 | nargs = 0; |
… | |
… | |
2819 | /* '<' '=' '>' '?' '!' */ |
2816 | /* '<' '=' '>' '?' '!' */ |
2820 | priv = ch; |
2817 | priv = ch; |
2821 | ch = cmd_getc (); |
2818 | ch = cmd_getc (); |
2822 | } |
2819 | } |
2823 | |
2820 | |
|
|
2821 | prev_ch = 0; |
2824 | /* read any numerical arguments */ |
2822 | /* read any numerical arguments */ |
2825 | for (n = -1; ch < CSI_ICH; ) |
2823 | for (n = -1; ch < CSI_ICH; ) |
2826 | { |
2824 | { |
2827 | if (isdigit (ch)) |
2825 | if (isdigit (ch)) |
2828 | { |
2826 | { |
… | |
… | |
2838 | n = -1; |
2836 | n = -1; |
2839 | } |
2837 | } |
2840 | else if (IS_CONTROL (ch)) |
2838 | else if (IS_CONTROL (ch)) |
2841 | process_nonprinting (ch); |
2839 | process_nonprinting (ch); |
2842 | |
2840 | |
|
|
2841 | prev_ch = ch; |
2843 | ch = cmd_getc (); |
2842 | ch = cmd_getc (); |
2844 | } |
2843 | } |
2845 | |
2844 | |
2846 | if (ch > CSI_7F) |
2845 | if (ch > CSI_7F) |
2847 | return; |
2846 | return; |
… | |
… | |
3081 | scr_insert_mode (1); |
3080 | scr_insert_mode (1); |
3082 | else if (arg[0] == 20) |
3081 | else if (arg[0] == 20) |
3083 | priv_modes |= PrivMode_LFNL; |
3082 | priv_modes |= PrivMode_LFNL; |
3084 | break; |
3083 | break; |
3085 | |
3084 | |
|
|
3085 | case CSI_71: // DESCUSR: set cursor style |
|
|
3086 | if (prev_ch == ' ') |
|
|
3087 | set_cursor_style (arg[0]); |
|
|
3088 | break; |
|
|
3089 | |
3086 | /* |
3090 | /* |
3087 | * PRIVATE USE beyond this point. All CSI_7? sequences here |
3091 | * PRIVATE USE beyond this point. All CSI_7? sequences here |
3088 | */ |
3092 | */ |
3089 | case CSI_72: /* DECSTBM: set top and bottom margins */ |
3093 | case CSI_72: /* DECSTBM: set top and bottom margins */ |
3090 | if (nargs == 1) |
3094 | if (nargs == 1) |
… | |
… | |
3223 | rxvt_term::get_to_st (unicode_t &ends_how) |
3227 | rxvt_term::get_to_st (unicode_t &ends_how) |
3224 | { |
3228 | { |
3225 | unicode_t ch; |
3229 | unicode_t ch; |
3226 | bool seen_esc = false; |
3230 | bool seen_esc = false; |
3227 | unsigned int n = 0; |
3231 | unsigned int n = 0; |
3228 | wchar_t string[STRING_MAX]; |
3232 | wchar_t string[CBUFSIZ]; |
3229 | |
3233 | |
3230 | while ((ch = cmd_getc ()) != NOCHAR) |
3234 | while ((ch = cmd_getc ()) != NOCHAR) |
3231 | { |
3235 | { |
3232 | if (seen_esc) |
3236 | if (seen_esc) |
3233 | { |
3237 | { |
… | |
… | |
3248 | else if (ch < 0x20) |
3252 | else if (ch < 0x20) |
3249 | return NULL; /* other control character - exit */ |
3253 | return NULL; /* other control character - exit */ |
3250 | |
3254 | |
3251 | seen_esc = false; |
3255 | seen_esc = false; |
3252 | |
3256 | |
3253 | if (n >= STRING_MAX - 1) |
3257 | if (n >= sizeof (string) - 1) |
3254 | // stop at some sane length |
3258 | // stop at some sane length |
3255 | return NULL; |
3259 | return NULL; |
3256 | |
3260 | |
3257 | string[n++] = ch; |
3261 | string[n++] = ch; |
3258 | } |
3262 | } |
… | |
… | |
3453 | break; |
3457 | break; |
3454 | #endif |
3458 | #endif |
3455 | case URxvt_Color_border: |
3459 | case URxvt_Color_border: |
3456 | process_color_seq (op, Color_border, str, resp); |
3460 | process_color_seq (op, Color_border, str, resp); |
3457 | break; |
3461 | break; |
3458 | #if ENABLE_TRANSPARENCY |
3462 | |
|
|
3463 | #if BG_IMAGE_FROM_ROOT |
3459 | case URxvt_Color_tint: |
3464 | case URxvt_Color_tint: |
3460 | process_color_seq (op, Color_tint, str, resp); |
3465 | process_color_seq (op, Color_tint, str, resp); |
3461 | { |
3466 | { |
3462 | bool changed = false; |
3467 | bool changed = false; |
3463 | |
3468 | |
… | |
… | |
3994 | break; |
3999 | break; |
3995 | #endif |
4000 | #endif |
3996 | } |
4001 | } |
3997 | } |
4002 | } |
3998 | } |
4003 | } |
|
|
4004 | |
|
|
4005 | void |
|
|
4006 | rxvt_term::set_cursor_style (int style) |
|
|
4007 | { |
|
|
4008 | if (!IN_RANGE_INC (style, 0, 4)) |
|
|
4009 | return; |
|
|
4010 | |
|
|
4011 | set_option (Opt_cursorUnderline, style >= 3); |
|
|
4012 | |
|
|
4013 | #ifdef CURSOR_BLINK |
|
|
4014 | set_option (Opt_cursorBlink, !style || (style & 1)); |
|
|
4015 | cursor_blink_reset (); |
|
|
4016 | #endif |
|
|
4017 | |
|
|
4018 | want_refresh = 1; |
|
|
4019 | } |
3999 | /*}}} */ |
4020 | /*}}} */ |
4000 | |
4021 | |
4001 | /* ------------------------------------------------------------------------- */ |
4022 | /* ------------------------------------------------------------------------- */ |
4002 | |
4023 | |
4003 | /* |
4024 | /* |