… | |
… | |
919 | #endif /* DEBUG_CMD */ |
919 | #endif /* DEBUG_CMD */ |
920 | tt_write (kbuf, (unsigned int)len); |
920 | tt_write (kbuf, (unsigned int)len); |
921 | } |
921 | } |
922 | /*}}} */ |
922 | /*}}} */ |
923 | |
923 | |
924 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
924 | #if defined (KEYSYM_RESOURCE) |
925 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
926 | /* attempt to `write' count to the input buffer */ |
|
|
927 | unsigned int |
925 | unsigned int |
928 | rxvt_term::cmd_write (const char *str, unsigned int count) |
926 | rxvt_term::cmd_write (const char *str, unsigned int count) |
929 | { |
927 | { |
930 | unsigned int n, s; |
928 | unsigned int n, s; |
931 | |
929 | |
… | |
… | |
1021 | } |
1019 | } |
1022 | |
1020 | |
1023 | void |
1021 | void |
1024 | rxvt_term::check_cb (check_watcher &w) |
1022 | rxvt_term::check_cb (check_watcher &w) |
1025 | { |
1023 | { |
1026 | SET_R (this); |
1024 | make_current (); |
1027 | SET_LOCALE (locale); |
|
|
1028 | |
1025 | |
1029 | display->flush (); |
1026 | display->flush (); |
1030 | |
1027 | |
1031 | if (want_refresh && !flush_ev.active) |
1028 | if (want_refresh && !flush_ev.active) |
1032 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1029 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1033 | } |
1030 | } |
1034 | |
1031 | |
1035 | void |
1032 | void |
1036 | rxvt_term::flush_cb (time_watcher &w) |
1033 | rxvt_term::flush_cb (time_watcher &w) |
1037 | { |
1034 | { |
1038 | SET_R (this); |
1035 | make_current (); |
1039 | SET_LOCALE (locale); |
|
|
1040 | |
1036 | |
1041 | refresh_limit = 1; |
1037 | refresh_limit = 1; |
1042 | refresh_count = 0; |
1038 | refresh_count = 0; |
1043 | flush (); |
1039 | flush (); |
1044 | } |
1040 | } |
… | |
… | |
1172 | } |
1168 | } |
1173 | |
1169 | |
1174 | void |
1170 | void |
1175 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1171 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1176 | { |
1172 | { |
1177 | SET_R (this); |
1173 | make_current (); |
1178 | SET_LOCALE (locale); |
|
|
1179 | |
1174 | |
1180 | if (revents & EVENT_READ) |
1175 | if (revents & EVENT_READ) |
1181 | // loop, but don't allow a single term to monopolize us |
1176 | // loop, but don't allow a single term to monopolize us |
1182 | while (pty_fill ()) |
1177 | while (pty_fill ()) |
1183 | if (cmd_parse ()) |
1178 | if (cmd_parse ()) |
… | |
… | |
1215 | } |
1210 | } |
1216 | |
1211 | |
1217 | void |
1212 | void |
1218 | rxvt_term::pointer_cb (time_watcher &w) |
1213 | rxvt_term::pointer_cb (time_watcher &w) |
1219 | { |
1214 | { |
1220 | SET_R (this); |
1215 | make_current (); |
1221 | SET_LOCALE (locale); |
|
|
1222 | |
1216 | |
1223 | pointer_blank (); |
1217 | pointer_blank (); |
1224 | } |
1218 | } |
1225 | #endif |
1219 | #endif |
1226 | |
1220 | |
… | |
… | |
1305 | |
1299 | |
1306 | /*{{{ process an X event */ |
1300 | /*{{{ process an X event */ |
1307 | void |
1301 | void |
1308 | rxvt_term::x_cb (XEvent &ev) |
1302 | rxvt_term::x_cb (XEvent &ev) |
1309 | { |
1303 | { |
|
|
1304 | make_current (); |
|
|
1305 | |
1310 | dDisp; |
1306 | dDisp; |
1311 | |
1307 | |
1312 | SET_R (this); |
|
|
1313 | SET_LOCALE (locale); |
|
|
1314 | |
|
|
1315 | if (ev.xany.window == vt |
1308 | if (ev.xany.window == vt |
|
|
1309 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1316 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1310 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1317 | return; |
1311 | return; |
1318 | |
1312 | |
1319 | // for XQueryPointer |
1313 | // for XQueryPointer |
1320 | Window unused_root, unused_child; |
1314 | Window unused_root, unused_child; |
… | |
… | |
1591 | if (isScrollbarWindow (ev.xany.window)) |
1585 | if (isScrollbarWindow (ev.xany.window)) |
1592 | { |
1586 | { |
1593 | scrollBar.setIdle (); |
1587 | scrollBar.setIdle (); |
1594 | scrollbar_show (0); |
1588 | scrollbar_show (0); |
1595 | } |
1589 | } |
1596 | #ifdef MENUBAR |
|
|
1597 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1598 | menubar_expose (); |
|
|
1599 | #endif |
|
|
1600 | |
1590 | |
1601 | #ifdef TRANSPARENT |
1591 | #ifdef TRANSPARENT |
1602 | if (am_transparent && ev.xany.window == parent[0]) |
1592 | if (am_transparent && ev.xany.window == parent[0]) |
1603 | XClearWindow (disp, ev.xany.window); |
1593 | XClearWindow (disp, ev.xany.window); |
1604 | #endif |
1594 | #endif |
… | |
… | |
1608 | case MotionNotify: |
1598 | case MotionNotify: |
1609 | #ifdef POINTER_BLANK |
1599 | #ifdef POINTER_BLANK |
1610 | if (hidden_pointer) |
1600 | if (hidden_pointer) |
1611 | pointer_unblank (); |
1601 | pointer_unblank (); |
1612 | #endif |
1602 | #endif |
1613 | #if MENUBAR |
|
|
1614 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1615 | { |
|
|
1616 | menubar_control (ev.xbutton); |
|
|
1617 | break; |
|
|
1618 | } |
|
|
1619 | #endif |
|
|
1620 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1603 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1621 | break; |
1604 | break; |
1622 | |
1605 | |
1623 | if (ev.xany.window == vt) |
1606 | if (ev.xany.window == vt) |
1624 | { |
1607 | { |
|
|
1608 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1625 | if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1609 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1626 | ; // nop |
1610 | ; // nop |
1627 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1611 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1628 | { |
1612 | { |
1629 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1613 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1630 | ; |
1614 | ; |
… | |
… | |
1822 | |
1806 | |
1823 | #if TRANSPARENT |
1807 | #if TRANSPARENT |
1824 | void |
1808 | void |
1825 | rxvt_term::rootwin_cb (XEvent &ev) |
1809 | rxvt_term::rootwin_cb (XEvent &ev) |
1826 | { |
1810 | { |
1827 | SET_R (this); |
1811 | make_current (); |
1828 | SET_LOCALE (locale); |
|
|
1829 | |
1812 | |
1830 | switch (ev.type) |
1813 | switch (ev.type) |
1831 | { |
1814 | { |
1832 | case PropertyNotify: |
1815 | case PropertyNotify: |
1833 | /* |
1816 | /* |
… | |
… | |
2102 | } |
2085 | } |
2103 | } |
2086 | } |
2104 | |
2087 | |
2105 | return; |
2088 | return; |
2106 | } |
2089 | } |
2107 | |
|
|
2108 | #if MENUBAR |
|
|
2109 | /* |
|
|
2110 | * Menubar window processing of button press |
|
|
2111 | */ |
|
|
2112 | if (isMenuBarWindow (ev.window)) |
|
|
2113 | menubar_control (ev); |
|
|
2114 | #endif |
|
|
2115 | } |
2090 | } |
2116 | |
2091 | |
2117 | void |
2092 | void |
2118 | rxvt_term::button_release (XButtonEvent &ev) |
2093 | rxvt_term::button_release (XButtonEvent &ev) |
2119 | { |
2094 | { |
… | |
… | |
2228 | } |
2203 | } |
2229 | break; |
2204 | break; |
2230 | #endif |
2205 | #endif |
2231 | } |
2206 | } |
2232 | } |
2207 | } |
2233 | #ifdef MENUBAR |
|
|
2234 | else if (isMenuBarWindow (ev.window)) |
|
|
2235 | menubar_control (ev); |
|
|
2236 | #endif |
|
|
2237 | } |
2208 | } |
2238 | |
2209 | |
2239 | #ifdef TRANSPARENT |
2210 | #ifdef TRANSPARENT |
2240 | #if TINTING |
2211 | #if TINTING |
2241 | /* taken from aterm-0.4.2 */ |
2212 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2784 | } |
2755 | } |
2785 | |
2756 | |
2786 | // scr_add_lines only works for nlines <= nrow - 1. |
2757 | // scr_add_lines only works for nlines <= nrow - 1. |
2787 | if (nlines >= nrow - 1) |
2758 | if (nlines >= nrow - 1) |
2788 | { |
2759 | { |
|
|
2760 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2789 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2761 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2790 | scr_add_lines (buf, str - buf, nlines); |
2762 | scr_add_lines (buf, str - buf, nlines); |
2791 | |
2763 | |
2792 | nlines = 0; |
2764 | nlines = 0; |
2793 | str = buf; |
2765 | str = buf; |
2794 | eol = str + min (ncol, UBUFSIZ); |
2766 | eol = str + min (ncol, UBUFSIZ); |
… | |
… | |
2809 | |
2781 | |
2810 | seq_begin = cmdbuf_ptr; |
2782 | seq_begin = cmdbuf_ptr; |
2811 | ch = next_char (); |
2783 | ch = next_char (); |
2812 | } |
2784 | } |
2813 | |
2785 | |
|
|
2786 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2814 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2787 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2815 | scr_add_lines (buf, str - buf, nlines); |
2788 | scr_add_lines (buf, str - buf, nlines); |
2816 | |
2789 | |
2817 | /* |
2790 | /* |
2818 | * If there have been a lot of new lines, then update the screen |
2791 | * If there have been a lot of new lines, then update the screen |
2819 | * What the heck I'll cheat and only refresh less than every page-full. |
2792 | * What the heck I'll cheat and only refresh less than every page-full. |
… | |
… | |
3960 | |
3933 | |
3961 | case XTerm_logfile: |
3934 | case XTerm_logfile: |
3962 | // TODO, when secure mode? |
3935 | // TODO, when secure mode? |
3963 | break; |
3936 | break; |
3964 | |
3937 | |
3965 | #ifdef MENUBAR |
|
|
3966 | case URxvt_Menu: |
|
|
3967 | if (OPTION (Opt_insecure)) |
|
|
3968 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3969 | break; |
|
|
3970 | #endif |
|
|
3971 | #if 0 |
3938 | #if 0 |
3972 | case Rxvt_dumpscreen: /* no error notices */ |
3939 | case Rxvt_dumpscreen: /* no error notices */ |
3973 | { |
3940 | { |
3974 | int fd; |
3941 | int fd; |
3975 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3942 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
… | |
… | |
4092 | { 5, PrivMode_rVideo }, |
4059 | { 5, PrivMode_rVideo }, |
4093 | { 6, PrivMode_relOrigin }, |
4060 | { 6, PrivMode_relOrigin }, |
4094 | { 7, PrivMode_Autowrap }, |
4061 | { 7, PrivMode_Autowrap }, |
4095 | // 8, bi-directional support mode |
4062 | // 8, bi-directional support mode |
4096 | { 9, PrivMode_MouseX10 }, |
4063 | { 9, PrivMode_MouseX10 }, |
4097 | #ifdef menuBar_esc |
|
|
4098 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4099 | #endif |
|
|
4100 | // 18, 19 printing-related |
4064 | // 18, 19 printing-related |
4101 | { 25, PrivMode_VisibleCursor }, |
4065 | { 25, PrivMode_VisibleCursor }, |
4102 | #ifdef scrollBar_esc |
4066 | #ifdef scrollBar_esc |
4103 | { scrollBar_esc, PrivMode_scrollBar }, |
4067 | { scrollBar_esc, PrivMode_scrollBar }, |
4104 | #endif |
4068 | #endif |
… | |
… | |
4199 | /* case 8: - auto repeat, can't do on a per window basis */ |
4163 | /* case 8: - auto repeat, can't do on a per window basis */ |
4200 | case 9: /* X10 mouse reporting */ |
4164 | case 9: /* X10 mouse reporting */ |
4201 | if (state) /* orthogonal */ |
4165 | if (state) /* orthogonal */ |
4202 | priv_modes &= ~PrivMode_MouseX11; |
4166 | priv_modes &= ~PrivMode_MouseX11; |
4203 | break; |
4167 | break; |
4204 | #ifdef menuBar_esc |
|
|
4205 | case menuBar_esc: |
|
|
4206 | #ifdef MENUBAR |
|
|
4207 | map_menuBar (state); |
|
|
4208 | #endif |
|
|
4209 | break; |
|
|
4210 | #endif |
|
|
4211 | #ifdef scrollBar_esc |
4168 | #ifdef scrollBar_esc |
4212 | case scrollBar_esc: |
4169 | case scrollBar_esc: |
4213 | if (scrollbar_mapping (state)) |
4170 | if (scrollbar_mapping (state)) |
4214 | { |
4171 | { |
4215 | resize_all_windows (0, 0, 0); |
4172 | resize_all_windows (0, 0, 0); |