… | |
… | |
147 | || !IN_RANGE_EXC (y, 0, nrow)) |
147 | || !IN_RANGE_EXC (y, 0, nrow)) |
148 | return; |
148 | return; |
149 | |
149 | |
150 | for (;;) |
150 | for (;;) |
151 | { |
151 | { |
152 | const line_t &l = ROW(y - view_start); |
152 | const line_t &l = ROW(y + view_start); |
153 | |
153 | |
154 | text_t t = l.t[x]; |
154 | text_t t = l.t[x]; |
155 | |
155 | |
156 | if (t != NOCHAR || !x) |
156 | if (t != NOCHAR || !x) |
157 | { |
157 | { |
… | |
… | |
443 | scr_move_to (0, 1); |
443 | scr_move_to (0, 1); |
444 | return; |
444 | return; |
445 | } |
445 | } |
446 | else if (keysym == XK_End) |
446 | else if (keysym == XK_End) |
447 | { |
447 | { |
448 | scr_move_to (1, 0); |
448 | scr_move_to (1, 1); |
449 | return; |
449 | return; |
450 | } |
450 | } |
451 | } |
451 | } |
452 | #endif |
452 | #endif |
453 | } |
453 | } |
… | |
… | |
972 | |
972 | |
973 | if (want_refresh) |
973 | if (want_refresh) |
974 | { |
974 | { |
975 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
975 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
976 | { |
976 | { |
977 | int row = -view_start; |
977 | int row = view_start; |
978 | int end_row = row + nrow; |
978 | int end_row = row + nrow; |
979 | |
979 | |
980 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
980 | while (row > top_row && ROW (row - 1).is_longer ()) |
981 | --row; |
981 | --row; |
982 | |
982 | |
983 | do |
983 | do |
984 | { |
984 | { |
985 | int start_row = row; |
985 | int start_row = row; |
… | |
… | |
1021 | } |
1021 | } |
1022 | |
1022 | |
1023 | void |
1023 | void |
1024 | rxvt_term::check_cb (check_watcher &w) |
1024 | rxvt_term::check_cb (check_watcher &w) |
1025 | { |
1025 | { |
1026 | SET_R (this); |
1026 | make_current (); |
1027 | SET_LOCALE (locale); |
|
|
1028 | |
1027 | |
1029 | display->flush (); |
1028 | display->flush (); |
1030 | |
1029 | |
1031 | if (want_refresh && !flush_ev.active) |
1030 | if (want_refresh && !flush_ev.active) |
1032 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1031 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1033 | } |
1032 | } |
1034 | |
1033 | |
1035 | void |
1034 | void |
1036 | rxvt_term::flush_cb (time_watcher &w) |
1035 | rxvt_term::flush_cb (time_watcher &w) |
1037 | { |
1036 | { |
1038 | SET_R (this); |
1037 | make_current (); |
1039 | SET_LOCALE (locale); |
|
|
1040 | |
1038 | |
1041 | refresh_limit = 1; |
1039 | refresh_limit = 1; |
1042 | refresh_count = 0; |
1040 | refresh_count = 0; |
1043 | flush (); |
1041 | flush (); |
1044 | } |
1042 | } |
… | |
… | |
1101 | { |
1099 | { |
1102 | if (mouse_slip_wheel_speed == 0 |
1100 | if (mouse_slip_wheel_speed == 0 |
1103 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1101 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1104 | : scr_page (UP, mouse_slip_wheel_speed)) |
1102 | : scr_page (UP, mouse_slip_wheel_speed)) |
1105 | { |
1103 | { |
1106 | if (view_start == nsaved || |
1104 | if (view_start == top_row || view_start == 0) |
1107 | view_start == 0) |
|
|
1108 | mouse_slip_wheel_speed = 0; |
1105 | mouse_slip_wheel_speed = 0; |
1109 | |
1106 | |
1110 | refresh_type |= SMOOTH_REFRESH; |
1107 | refresh_type |= SMOOTH_REFRESH; |
1111 | want_refresh = 1; |
1108 | want_refresh = 1; |
1112 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1109 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
… | |
… | |
1173 | } |
1170 | } |
1174 | |
1171 | |
1175 | void |
1172 | void |
1176 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1173 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1177 | { |
1174 | { |
1178 | SET_R (this); |
1175 | make_current (); |
1179 | SET_LOCALE (locale); |
|
|
1180 | |
1176 | |
1181 | if (revents & EVENT_READ) |
1177 | if (revents & EVENT_READ) |
1182 | // loop, but don't allow a single term to monopolize us |
1178 | // loop, but don't allow a single term to monopolize us |
1183 | while (pty_fill ()) |
1179 | while (pty_fill ()) |
1184 | if (cmd_parse ()) |
1180 | if (cmd_parse ()) |
… | |
… | |
1216 | } |
1212 | } |
1217 | |
1213 | |
1218 | void |
1214 | void |
1219 | rxvt_term::pointer_cb (time_watcher &w) |
1215 | rxvt_term::pointer_cb (time_watcher &w) |
1220 | { |
1216 | { |
1221 | SET_R (this); |
1217 | make_current (); |
1222 | SET_LOCALE (locale); |
|
|
1223 | |
1218 | |
1224 | pointer_blank (); |
1219 | pointer_blank (); |
1225 | } |
1220 | } |
1226 | #endif |
1221 | #endif |
1227 | |
1222 | |
… | |
… | |
1306 | |
1301 | |
1307 | /*{{{ process an X event */ |
1302 | /*{{{ process an X event */ |
1308 | void |
1303 | void |
1309 | rxvt_term::x_cb (XEvent &ev) |
1304 | rxvt_term::x_cb (XEvent &ev) |
1310 | { |
1305 | { |
|
|
1306 | make_current (); |
|
|
1307 | |
1311 | dDisp; |
1308 | dDisp; |
1312 | |
1309 | |
1313 | SET_R (this); |
1310 | if (ev.xany.window == vt |
1314 | SET_LOCALE (locale); |
1311 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1312 | return; |
1315 | |
1313 | |
|
|
1314 | // for XQueryPointer |
1316 | Window unused_root, unused_child; |
1315 | Window unused_root, unused_child; |
1317 | int unused_root_x, unused_root_y; |
1316 | int unused_root_x, unused_root_y; |
1318 | unsigned int unused_mask; |
1317 | unsigned int unused_mask; |
1319 | |
1318 | |
1320 | switch (ev.type) |
1319 | switch (ev.type) |
… | |
… | |
1818 | |
1817 | |
1819 | #if TRANSPARENT |
1818 | #if TRANSPARENT |
1820 | void |
1819 | void |
1821 | rxvt_term::rootwin_cb (XEvent &ev) |
1820 | rxvt_term::rootwin_cb (XEvent &ev) |
1822 | { |
1821 | { |
1823 | SET_R (this); |
1822 | make_current (); |
1824 | SET_LOCALE (locale); |
|
|
1825 | |
1823 | |
1826 | switch (ev.type) |
1824 | switch (ev.type) |
1827 | { |
1825 | { |
1828 | case PropertyNotify: |
1826 | case PropertyNotify: |
1829 | /* |
1827 | /* |
… | |
… | |
1920 | #else |
1918 | #else |
1921 | selection.rect = false; |
1919 | selection.rect = false; |
1922 | #endif |
1920 | #endif |
1923 | |
1921 | |
1924 | /* allow shift+left click to extend selection */ |
1922 | /* allow shift+left click to extend selection */ |
1925 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1923 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1926 | { |
1924 | { |
1927 | if (MEvent.button == Button1 && clickintime) |
1925 | if (MEvent.button == Button1 && clickintime) |
1928 | selection_rotate (ev.x, ev.y); |
1926 | selection_rotate (ev.x, ev.y); |
1929 | else |
1927 | else |
1930 | selection_extend (ev.x, ev.y, 1); |
1928 | selection_extend (ev.x, ev.y, 1); |
… | |
… | |
3858 | { |
3856 | { |
3859 | if ((name = strchr (buf, ';')) == NULL) |
3857 | if ((name = strchr (buf, ';')) == NULL) |
3860 | break; |
3858 | break; |
3861 | |
3859 | |
3862 | *name++ = '\0'; |
3860 | *name++ = '\0'; |
3863 | color = atoi (buf); |
3861 | color = atoi (buf) + minCOLOR; |
3864 | |
3862 | |
3865 | if (color < 0 || color >= TOTAL_COLORS) |
3863 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3866 | break; |
3864 | break; |
3867 | |
3865 | |
3868 | if ((buf = strchr (name, ';')) != NULL) |
3866 | if ((buf = strchr (name, ';')) != NULL) |
3869 | *buf++ = '\0'; |
3867 | *buf++ = '\0'; |
3870 | |
3868 | |
3871 | if (name[0] == '?' && !name[1]) |
3869 | if (name[0] == '?' && !name[1]) |
3872 | { |
3870 | { |
3873 | unsigned short r, g, b; |
3871 | unsigned short r, g, b; |
3874 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3872 | pix_colors_focused[color].get (display, r, g, b); |
3875 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3873 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3876 | } |
3874 | } |
3877 | else |
3875 | else |
3878 | set_window_color (color + minCOLOR, name); |
3876 | set_window_color (color, name); |
3879 | } |
3877 | } |
3880 | break; |
3878 | break; |
3881 | case XTerm_Color00: |
3879 | case XTerm_Color00: |
3882 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3880 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3883 | break; |
3881 | break; |
3884 | case XTerm_Color01: |
3882 | case XTerm_Color01: |
3885 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3883 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3886 | break; |
3884 | break; |
3887 | #ifndef NO_CURSORCOLOR |
3885 | #ifndef NO_CURSORCOLOR |
3888 | case XTerm_Color_cursor: |
3886 | case XTerm_Color_cursor: |
3889 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3887 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3890 | break; |
3888 | break; |
… | |
… | |
3894 | break; |
3892 | break; |
3895 | case XTerm_Color_pointer_bg: |
3893 | case XTerm_Color_pointer_bg: |
3896 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3894 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3897 | break; |
3895 | break; |
3898 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3896 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3899 | case XTerm_Color_BD: |
|
|
3900 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3901 | break; |
|
|
3902 | case XTerm_Color_UL: |
|
|
3903 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3904 | break; |
|
|
3905 | case XTerm_Color_RV: |
3897 | case XTerm_Color_RV: |
3906 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3898 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3899 | break; |
|
|
3900 | case Rxvt_Color_BD: |
|
|
3901 | case URxvt_Color_BD: |
|
|
3902 | process_color_seq (op, Color_BD, str, resp); |
|
|
3903 | break; |
|
|
3904 | case Rxvt_Color_UL: |
|
|
3905 | case URxvt_Color_UL: |
|
|
3906 | process_color_seq (op, Color_UL, str, resp); |
3907 | break; |
3907 | break; |
3908 | case URxvt_Color_IT: |
3908 | case URxvt_Color_IT: |
3909 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3909 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3910 | break; |
3910 | break; |
3911 | #endif |
3911 | #endif |
… | |
… | |
3916 | if (am_transparent) |
3916 | if (am_transparent) |
3917 | want_full_refresh = want_refresh = 1; |
3917 | want_full_refresh = want_refresh = 1; |
3918 | break; |
3918 | break; |
3919 | #endif |
3919 | #endif |
3920 | |
3920 | |
3921 | case XTerm_Pixmap: |
3921 | case Rxvt_Pixmap: |
3922 | if (*str != ';') |
3922 | if (*str != ';') |
3923 | { |
3923 | { |
3924 | #if XPM_BACKGROUND |
3924 | #if XPM_BACKGROUND |
3925 | scale_pixmap (""); /* reset to default scaling */ |
3925 | scale_pixmap (""); /* reset to default scaling */ |
3926 | set_bgPixmap (str); /* change pixmap */ |
3926 | set_bgPixmap (str); /* change pixmap */ |
3927 | #endif |
|
|
3928 | scr_touch (true); |
3927 | scr_touch (true); |
|
|
3928 | #endif |
3929 | } |
3929 | } |
|
|
3930 | |
3930 | while ((str = strchr (str, ';')) != NULL) |
3931 | while ((str = strchr (str, ';')) != NULL) |
3931 | { |
3932 | { |
3932 | str++; |
3933 | str++; |
3933 | #if XPM_BACKGROUND |
3934 | #if XPM_BACKGROUND |
3934 | changed += scale_pixmap (str); |
3935 | changed += scale_pixmap (str); |
… | |
… | |
3937 | |
3938 | |
3938 | if (changed) |
3939 | if (changed) |
3939 | { |
3940 | { |
3940 | #ifdef XPM_BACKGROUND |
3941 | #ifdef XPM_BACKGROUND |
3941 | resize_pixmap (); |
3942 | resize_pixmap (); |
3942 | #endif |
|
|
3943 | scr_touch (true); |
3943 | scr_touch (true); |
|
|
3944 | #endif |
3944 | } |
3945 | } |
3945 | break; |
3946 | break; |
3946 | |
3947 | |
3947 | case XTerm_restoreFG: |
3948 | case Rxvt_restoreFG: |
3948 | set_window_color (Color_fg, str); |
3949 | set_window_color (Color_fg, str); |
3949 | break; |
3950 | break; |
3950 | case XTerm_restoreBG: |
3951 | case Rxvt_restoreBG: |
3951 | set_window_color (Color_bg, str); |
3952 | set_window_color (Color_bg, str); |
3952 | break; |
3953 | break; |
3953 | |
3954 | |
3954 | case XTerm_logfile: |
3955 | case XTerm_logfile: |
3955 | // TODO, when secure mode? |
3956 | // TODO, when secure mode? |
… | |
… | |
3960 | if (OPTION (Opt_insecure)) |
3961 | if (OPTION (Opt_insecure)) |
3961 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3962 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3962 | break; |
3963 | break; |
3963 | #endif |
3964 | #endif |
3964 | #if 0 |
3965 | #if 0 |
3965 | case XTerm_dumpscreen: /* no error notices */ |
3966 | case Rxvt_dumpscreen: /* no error notices */ |
3966 | { |
3967 | { |
3967 | int fd; |
3968 | int fd; |
3968 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3969 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3969 | { |
3970 | { |
3970 | scr_dump (fd); |
3971 | scr_dump (fd); |