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.352 by ayin, Sun Sep 9 10:35:00 2007 UTC vs.
Revision 1.363 by root, Sun Nov 11 04:08:00 2007 UTC

596 newlen = 0; 596 newlen = 0;
597 } 597 }
598 break; 598 break;
599 599
600#ifdef XK_KP_Left 600#ifdef XK_KP_Left
601 case XK_KP_Left: /* \033Ot or standard */
601 case XK_KP_Up: /* \033Ox or standard */ 602 case XK_KP_Up: /* \033Ox or standard */
603 case XK_KP_Right: /* \033Ov or standard */
602 case XK_KP_Down: /* \033Or or standard */ 604 case XK_KP_Down: /* \033Or or standard */
603 case XK_KP_Right: /* \033Ov or standard */
604 case XK_KP_Left: /* \033Ot or standard */
605 if (kp) 605 if (kp)
606 { 606 {
607 strcpy (kbuf, "\033OZ"); 607 strcpy (kbuf, "\033OZ");
608 kbuf[2] = "txvr"[keysym - XK_KP_Left]; 608 kbuf[2] = "txvr"[keysym - XK_KP_Left];
609 break; 609 break;
1035void 1035void
1036rxvt_term::flush () 1036rxvt_term::flush ()
1037{ 1037{
1038 flush_ev.stop (); 1038 flush_ev.stop ();
1039 1039
1040#ifdef ENABLE_TRANSPARENCY 1040#ifdef HAVE_BG_PIXMAP
1041 if (want_full_refresh) 1041 if (bgPixmap.check_clearChanged ())
1042 { 1042 {
1043 want_full_refresh = 0; 1043// scr_clear (true); This needs to be researched further!
1044 scr_clear ();
1045 scr_touch (false); 1044 scr_touch (false);
1046 } 1045 }
1047#endif 1046#endif
1048 1047
1049 if (want_refresh) 1048 if (want_refresh)
1095 1094
1096 display->flush (); 1095 display->flush ();
1097} 1096}
1098 1097
1099void 1098void
1100rxvt_term::check_cb (check_watcher &w) 1099rxvt_term::prepare_cb (ev::prepare &w, int revents)
1101{ 1100{
1102 make_current (); 1101 make_current ();
1103 1102
1104 display->flush (); 1103 display->flush ();
1105 1104
1106 if (want_refresh && !flush_ev.active) 1105 if (want_refresh && !flush_ev.active)
1107 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally 1106 flush_ev.start (1. / 60.); // refresh at max. 60 hz normally
1108} 1107}
1109 1108
1110void 1109void
1111rxvt_term::flush_cb (time_watcher &w) 1110rxvt_term::flush_cb (ev::timer &w, int revents)
1112{ 1111{
1113 make_current (); 1112 make_current ();
1114 1113
1115 refresh_count = 0; 1114 refresh_count = 0;
1116 flush (); 1115 flush ();
1117} 1116}
1118 1117
1119#ifdef CURSOR_BLINK 1118#ifdef CURSOR_BLINK
1120void 1119void
1121rxvt_term::cursor_blink_cb (time_watcher &w) 1120rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1122{ 1121{
1123 hidden_cursor = !hidden_cursor; 1122 hidden_cursor = !hidden_cursor;
1124 want_refresh = 1; 1123 want_refresh = 1;
1125
1126 w.start (w.at + CURSOR_BLINK_INTERVAL);
1127} 1124}
1128#endif 1125#endif
1129 1126
1130#ifdef TEXT_BLINK 1127#ifdef TEXT_BLINK
1131void 1128void
1132rxvt_term::text_blink_cb (time_watcher &w) 1129rxvt_term::text_blink_cb (ev::timer &w, int revents)
1133{ 1130{
1134 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1131 if (scr_refresh_rend (RS_Blink, RS_Blink))
1135 { 1132 {
1136 hidden_text = !hidden_text; 1133 hidden_text = !hidden_text;
1137 want_refresh = 1; 1134 want_refresh = 1;
1138 w.start (w.at + TEXT_BLINK_INTERVAL);
1139 } 1135 }
1140} 1136}
1141#endif 1137#endif
1142 1138
1143#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1139#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1144void 1140void
1145rxvt_term::cont_scroll_cb (time_watcher &w) 1141rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1146{ 1142{
1147 if ((scrollbar_isUp() || scrollbar_isDn()) && 1143 if ((scrollbar_isUp() || scrollbar_isDn()) &&
1148 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1144 scr_page (scrollbar_isUp() ? UP : DN, 1))
1149 {
1150 want_refresh = 1; 1145 want_refresh = 1;
1151 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1146 else
1152 } 1147 w.stop ();
1153} 1148}
1154#endif 1149#endif
1155 1150
1156#ifdef SELECTION_SCROLLING 1151#ifdef SELECTION_SCROLLING
1157void 1152void
1158rxvt_term::sel_scroll_cb (time_watcher &w) 1153rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1159{ 1154{
1160 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1155 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1161 { 1156 {
1162 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1157 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1163 want_refresh = 1; 1158 want_refresh = 1;
1164 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1165 } 1159 }
1160 else
1161 w.stop ();
1166} 1162}
1167#endif 1163#endif
1168 1164
1169#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1165#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1170void 1166void
1171rxvt_term::slip_wheel_cb (time_watcher &w) 1167rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1172{ 1168{
1173 if (mouse_slip_wheel_speed == 0 1169 if (mouse_slip_wheel_speed == 0
1174 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) 1170 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1175 : scr_page (UP, mouse_slip_wheel_speed)) 1171 : scr_page (UP, mouse_slip_wheel_speed))
1176 { 1172 {
1177 if (view_start == top_row || view_start == 0) 1173 if (view_start == top_row || view_start == 0)
1178 mouse_slip_wheel_speed = 0; 1174 mouse_slip_wheel_speed = 0;
1179 1175
1180 want_refresh = 1; 1176 want_refresh = 1;
1181 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1182 } 1177 }
1178 else
1179 w.stop ();
1183} 1180}
1184#endif 1181#endif
1185 1182
1186#if LINUX_YIELD_HACK 1183#if LINUX_YIELD_HACK
1187static struct event_handler 1184static struct event_handler
1188{ 1185{
1189 check_watcher yield_ev; 1186 ev::prepare yield_ev;
1190 1187
1191 void yield_cb (check_watcher &w) 1188 void yield_cb (ev::prepare &w, int revents)
1192 { 1189 {
1193 // this should really be sched_yield(), but the linux guys thought 1190 // this should really be sched_yield(), but the linux guys thought
1194 // that giving a process calling sched_yield () less cpu time than 1191 // that giving a process calling sched_yield () less cpu time than
1195 // ones with high nice levels is a useful thing to do. It surely is is 1192 // ones with high nice levels is a useful thing to do. It surely is is
1196 // allowed by the sus... as is returning ENOSYS. 1193 // allowed by the sus... as is returning ENOSYS.
1247 1244
1248 return false; 1245 return false;
1249} 1246}
1250 1247
1251void 1248void
1252rxvt_term::pty_cb (io_watcher &w, short revents) 1249rxvt_term::pty_cb (ev::io &w, int revents)
1253{ 1250{
1254 make_current (); 1251 make_current ();
1255 1252
1256 if (revents & EVENT_READ) 1253 if (revents & ev::READ)
1257 // loop, but don't allow a single term to monopolize us 1254 // loop, but don't allow a single term to monopolize us
1258 while (pty_fill ()) 1255 while (pty_fill ())
1259 if (cmd_parse ()) 1256 if (cmd_parse ())
1260 break; 1257 break;
1261 1258
1262 if (revents & EVENT_WRITE) 1259 if (revents & ev::WRITE)
1263 pty_write (); 1260 pty_write ();
1264} 1261}
1265 1262
1266void 1263void
1267rxvt_term::pointer_unblank () 1264rxvt_term::pointer_unblank ()
1271 1268
1272#ifdef POINTER_BLANK 1269#ifdef POINTER_BLANK
1273 hidden_pointer = 0; 1270 hidden_pointer = 0;
1274 1271
1275 if (option (Opt_pointerBlank)) 1272 if (option (Opt_pointerBlank))
1276 pointer_ev.start (NOW + pointerBlankDelay); 1273 pointer_ev.start (pointerBlankDelay);
1277#endif 1274#endif
1278} 1275}
1279 1276
1280#ifdef POINTER_BLANK 1277#ifdef POINTER_BLANK
1281void 1278void
1289 1286
1290 hidden_pointer = 1; 1287 hidden_pointer = 1;
1291} 1288}
1292 1289
1293void 1290void
1294rxvt_term::pointer_cb (time_watcher &w) 1291rxvt_term::pointer_cb (ev::timer &w, int revents)
1295{ 1292{
1296 make_current (); 1293 make_current ();
1297 1294
1298 pointer_blank (); 1295 pointer_blank ();
1299} 1296}
1302void 1299void
1303rxvt_term::mouse_report (XButtonEvent &ev) 1300rxvt_term::mouse_report (XButtonEvent &ev)
1304{ 1301{
1305 int button_number, key_state = 0; 1302 int button_number, key_state = 0;
1306 int x, y; 1303 int x, y;
1304 int code = 32;
1307 1305
1308 x = ev.x; 1306 x = Pixel2Col (ev.x);
1309 y = ev.y; 1307 y = Pixel2Row (ev.y);
1310 pixel_position (&x, &y); 1308 if (ev.type == MotionNotify) {
1309 if (x == mouse_row && y == mouse_col)
1310 return;
1311 mouse_row = x;
1312 mouse_col = y;
1313 code += 32;
1314 }
1311 1315
1312 if (MEvent.button == AnyButton) 1316 if (MEvent.button == AnyButton)
1313 button_number = 3; 1317 button_number = 3;
1314 else 1318 else
1315 { 1319 {
1361 x + 1, 1365 x + 1,
1362 y + 1); 1366 y + 1);
1363#endif 1367#endif
1364 1368
1365 tt_printf ("\033[M%c%c%c", 1369 tt_printf ("\033[M%c%c%c",
1366 (32 + button_number + key_state), 1370 (code + button_number + key_state),
1367 (32 + x + 1), 1371 (32 + x + 1),
1368 (32 + y + 1)); 1372 (32 + y + 1));
1369} 1373}
1370 1374
1371/*{{{ process an X event */ 1375/*{{{ process an X event */
1475 && ev.xfocus.mode != NotifyGrab) 1479 && ev.xfocus.mode != NotifyGrab)
1476 focus_out (); 1480 focus_out ();
1477 break; 1481 break;
1478 1482
1479 case ConfigureNotify: 1483 case ConfigureNotify:
1480/* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", 1484 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1481 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, 1485 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1482 szHint.width, szHint.height);*/ 1486 szHint.width, szHint.height); */
1483 if (ev.xconfigure.window == parent[0]) 1487 if (ev.xconfigure.window == parent[0])
1484 { 1488 {
1485 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1489 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1486 ; 1490 ;
1487 1491
1490 seen_resize = 1; 1494 seen_resize = 1;
1491 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1495 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1492 } 1496 }
1493 else 1497 else
1494 { 1498 {
1495#ifdef ENABLE_TRANSPARENCY 1499#ifdef HAVE_BG_PIXMAP
1496 if (option (Opt_transparent)) 1500 if (bgPixmap.window_position_sensitive ())
1497 update_background (); 1501 update_background ();
1498#endif 1502#endif
1499 } 1503 }
1500 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1504 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1501 } 1505 }
1523 break; 1527 break;
1524 1528
1525 case MapNotify: 1529 case MapNotify:
1526 mapped = 1; 1530 mapped = 1;
1527#ifdef TEXT_BLINK 1531#ifdef TEXT_BLINK
1528 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1532 text_blink_ev.start (TEXT_BLINK_INTERVAL);
1529#endif 1533#endif
1530 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1534 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1531 break; 1535 break;
1532 1536
1533 case UnmapNotify: 1537 case UnmapNotify:
1535#ifdef TEXT_BLINK 1539#ifdef TEXT_BLINK
1536 text_blink_ev.stop (); 1540 text_blink_ev.stop ();
1537#endif 1541#endif
1538 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1542 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1539 break; 1543 break;
1540
1541#ifdef ENABLE_TRANSPARENCY
1542 case ReparentNotify:
1543 rootwin_cb (ev);
1544 break;
1545#endif /* ENABLE_TRANSPARENCY */
1546 1544
1547 case GraphicsExpose: 1545 case GraphicsExpose:
1548 case Expose: 1546 case Expose:
1549 if (ev.xany.window == vt) 1547 if (ev.xany.window == vt)
1550 { 1548 {
1551 do 1549 do
1550 {
1552 scr_expose (ev.xexpose.x, ev.xexpose.y, 1551 scr_expose (ev.xexpose.x, ev.xexpose.y,
1553 ev.xexpose.width, ev.xexpose.height, False); 1552 ev.xexpose.width, ev.xexpose.height, False);
1553 }
1554 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1554 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1555 1555
1556 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1556 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1557 1557
1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1559 {
1559 scr_expose (ev.xexpose.x, ev.xexpose.y, 1560 scr_expose (ev.xexpose.x, ev.xexpose.y,
1560 ev.xexpose.width, ev.xexpose.height, False); 1561 ev.xexpose.width, ev.xexpose.height, False);
1561 1562 }
1562 want_refresh = 1; 1563 want_refresh = 1;
1563 } 1564 }
1564 else 1565 else
1565 { 1566 {
1566 XEvent unused_event; 1567 XEvent unused_event;
1581 case MotionNotify: 1582 case MotionNotify:
1582#ifdef POINTER_BLANK 1583#ifdef POINTER_BLANK
1583 if (hidden_pointer) 1584 if (hidden_pointer)
1584 pointer_unblank (); 1585 pointer_unblank ();
1585#endif 1586#endif
1587 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1588 || priv_modes & PrivMode_MouseAnyEvent)
1589 mouse_report (ev.xbutton);
1586 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1590 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1587 break; 1591 break;
1588 1592
1589 if (ev.xany.window == vt) 1593 if (ev.xany.window == vt)
1590 { 1594 {
1625 1629
1626 /* don't clobber the current delay if we are 1630 /* don't clobber the current delay if we are
1627 * already in the middle of scrolling. 1631 * already in the middle of scrolling.
1628 */ 1632 */
1629 if (!sel_scroll_ev.active) 1633 if (!sel_scroll_ev.active)
1630 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1634 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1631 1635
1632 /* save the event params so we can highlight 1636 /* save the event params so we can highlight
1633 * the selection in the pending-scroll loop 1637 * the selection in the pending-scroll loop
1634 */ 1638 */
1635 selection_save_x = ev.xbutton.x; 1639 selection_save_x = ev.xbutton.x;
1694 { 1698 {
1695 hidden_cursor = 0; 1699 hidden_cursor = 0;
1696 want_refresh = 1; 1700 want_refresh = 1;
1697 } 1701 }
1698 1702
1699 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1703 cursor_blink_ev.again ();
1700 } 1704 }
1701#endif 1705#endif
1702 1706
1703#if defined(POINTER_BLANK) 1707#if defined(POINTER_BLANK)
1704 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1708 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1732 XSetICFocus (Input_Context); 1736 XSetICFocus (Input_Context);
1733 } 1737 }
1734#endif 1738#endif
1735#if CURSOR_BLINK 1739#if CURSOR_BLINK
1736 if (option (Opt_cursorBlink)) 1740 if (option (Opt_cursorBlink))
1737 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1741 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL);
1738#endif 1742#endif
1739#if OFF_FOCUS_FADING 1743#if OFF_FOCUS_FADING
1740 if (rs[Rs_fade]) 1744 if (rs[Rs_fade])
1741 { 1745 {
1742 pix_colors = pix_colors_focused; 1746 pix_colors = pix_colors_focused;
1744 } 1748 }
1745#endif 1749#endif
1746#if ENABLE_FRILLS 1750#if ENABLE_FRILLS
1747 if (option (Opt_urgentOnBell)) 1751 if (option (Opt_urgentOnBell))
1748 { 1752 {
1749 XWMHints *h;
1750
1751 h = XGetWMHints(dpy, parent[0]); 1753 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1752 if (h != NULL)
1753 { 1754 {
1754 h->flags &= ~XUrgencyHint; 1755 h->flags &= ~XUrgencyHint;
1755 XSetWMHints(dpy, parent[0], h); 1756 XSetWMHints (dpy, parent[0], h);
1756 } 1757 }
1757 } 1758 }
1758#endif 1759#endif
1759 } 1760 }
1760} 1761}
1783 XUnsetICFocus (Input_Context); 1784 XUnsetICFocus (Input_Context);
1784#endif 1785#endif
1785#if CURSOR_BLINK 1786#if CURSOR_BLINK
1786 if (option (Opt_cursorBlink)) 1787 if (option (Opt_cursorBlink))
1787 cursor_blink_ev.stop (); 1788 cursor_blink_ev.stop ();
1789
1788 hidden_cursor = 0; 1790 hidden_cursor = 0;
1789#endif 1791#endif
1790#if OFF_FOCUS_FADING 1792#if OFF_FOCUS_FADING
1791 if (rs[Rs_fade]) 1793 if (rs[Rs_fade])
1792 { 1794 {
2025 upordown = 1; /* down */ 2027 upordown = 1; /* down */
2026 } 2028 }
2027 if (upordown) 2029 if (upordown)
2028 { 2030 {
2029#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2031#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2030 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2032 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2031#endif 2033#endif
2032 if (scr_page (upordown < 0 ? UP : DN, 1)) 2034 if (scr_page (upordown < 0 ? UP : DN, 1))
2033 { 2035 {
2034 if (upordown < 0) 2036 if (upordown < 0)
2035 scrollBar.setUp (); 2037 scrollBar.setUp ();
2198 { 2200 {
2199 mouse_slip_wheel_speed += v ? -1 : 1; 2201 mouse_slip_wheel_speed += v ? -1 : 1;
2200 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2202 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2201 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2203 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2202 2204
2203 if (slip_wheel_ev.at < NOW) 2205 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2204 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
2205
2206 slip_wheel_ev.start ();
2207 } 2206 }
2208 else 2207 else
2209 { 2208 {
2210# endif 2209# endif
2211 scr_page (v, i); 2210 scr_page (v, i);
2279 2278
2280 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2281 { 2280 {
2282 refresh_count = 0; 2281 refresh_count = 0;
2283 2282
2284 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.)
2285 { 2284 {
2286 refreshnow = true; 2285 refreshnow = true;
2287 ch = NOCHAR; 2286 ch = NOCHAR;
2288 break; 2287 break;
2289 } 2288 }
2856 { 2855 {
2857 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, 2856 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2858 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2857 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2859 // 2858 //
2860 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2859 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2861 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2860 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2862 // that we do not support xterm mouse reporting (should be 95 when we do). 2861 // versions.
2863 // 2862 //
2864 tt_printf ("\033[>%d;94;0c", 'U'); 2863 tt_printf ("\033[>%d;95;0c", 'U');
2865 } 2864 }
2866 break; 2865 break;
2867 case '?': 2866 case '?':
2868 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2867 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2869 process_terminal_mode (ch, priv, nargs, arg); 2868 process_terminal_mode (ch, priv, nargs, arg);
3436 } 3435 }
3437 3436
3438 break; 3437 break;
3439#endif 3438#endif
3440 3439
3441#if XPM_BACKGROUND 3440#if BG_IMAGE_FROM_FILE
3442 case Rxvt_Pixmap: 3441 case Rxvt_Pixmap:
3443 if (!strcmp (str, "?")) 3442 if (!strcmp (str, "?"))
3444 { 3443 {
3445 char str[256]; 3444 char str[256];
3446 3445
3634#ifndef NO_BACKSPACE_KEY 3633#ifndef NO_BACKSPACE_KEY
3635 { 67, PrivMode_BackSpace }, 3634 { 67, PrivMode_BackSpace },
3636#endif 3635#endif
3637 { 1000, PrivMode_MouseX11 }, 3636 { 1000, PrivMode_MouseX11 },
3638 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3639 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3638 { 1002, PrivMode_MouseBtnEvent },
3640 // 1003 Use All Motion Mouse Tracking. NYI, TODO 3639 { 1003, PrivMode_MouseAnyEvent },
3641 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3642 { 1011, PrivMode_Keypress }, // rxvt extension 3641 { 1011, PrivMode_Keypress }, // rxvt extension
3643 // 1035 enable modifiers for alt, numlock NYI 3642 // 1035 enable modifiers for alt, numlock NYI
3644 // 1036 send ESC for meta keys NYI 3643 // 1036 send ESC for meta keys NYI
3645 // 1037 send DEL for keypad delete NYI 3644 // 1037 send DEL for keypad delete NYI
3719 scr_autowrap (state); 3718 scr_autowrap (state);
3720 break; 3719 break;
3721 /* case 8: - auto repeat, can't do on a per window basis */ 3720 /* case 8: - auto repeat, can't do on a per window basis */
3722 case 9: /* X10 mouse reporting */ 3721 case 9: /* X10 mouse reporting */
3723 if (state) /* orthogonal */ 3722 if (state) /* orthogonal */
3724 priv_modes &= ~PrivMode_MouseX11; 3723 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3725 break; 3724 break;
3726#ifdef scrollBar_esc 3725#ifdef scrollBar_esc
3727 case scrollBar_esc: 3726 case scrollBar_esc:
3728 if (scrollbar_mapping (state)) 3727 if (scrollbar_mapping (state))
3729 { 3728 {
3742 break; 3741 break;
3743 /* case 66: - application key pad */ 3742 /* case 66: - application key pad */
3744 /* case 67: - backspace key */ 3743 /* case 67: - backspace key */
3745 case 1000: /* X11 mouse reporting */ 3744 case 1000: /* X11 mouse reporting */
3746 if (state) /* orthogonal */ 3745 if (state) /* orthogonal */
3747 priv_modes &= ~PrivMode_MouseX10; 3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3748 break; 3747 break;
3749#if 0 3748#if 0
3750 case 1001: 3749 case 1001:
3751 break; /* X11 mouse highlighting */ 3750 break; /* X11 mouse highlighting */
3752#endif 3751#endif
3752 case 1002:
3753 case 1003:
3754 if (state) {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask;
3758 } else
3759 vt_emask_mouse = NoEventMask;
3760 vt_select_input ();
3761 break;
3753 case 1010: /* scroll to bottom on TTY output inhibit */ 3762 case 1010: /* scroll to bottom on TTY output inhibit */
3754 set_option (Opt_scrollTtyOutput, !state); 3763 set_option (Opt_scrollTtyOutput, !state);
3755 break; 3764 break;
3756 case 1011: /* scroll to bottom on key press */ 3765 case 1011: /* scroll to bottom on key press */
3757 set_option (Opt_scrollTtyKeypress, state); 3766 set_option (Opt_scrollTtyKeypress, state);
3994 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 4003 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
3995 4004
3996 memcpy (v_buffer + v_buflen, data, len); 4005 memcpy (v_buffer + v_buflen, data, len);
3997 v_buflen += len; 4006 v_buflen += len;
3998 4007
3999 pty_ev.set (EVENT_READ | EVENT_WRITE); 4008 pty_ev.set (ev::READ | ev::WRITE);
4000} 4009}
4001 4010
4002void rxvt_term::pty_write () 4011void rxvt_term::pty_write ()
4003{ 4012{
4004 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 4013 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4009 4018
4010 if (v_buflen == 0) 4019 if (v_buflen == 0)
4011 { 4020 {
4012 free (v_buffer); 4021 free (v_buffer);
4013 v_buffer = 0; 4022 v_buffer = 0;
4014 v_buflen = 0;
4015 4023
4016 pty_ev.set (EVENT_READ); 4024 pty_ev.set (ev::READ);
4017 return; 4025 return;
4018 } 4026 }
4019 4027
4020 memmove (v_buffer, v_buffer + written, v_buflen); 4028 memmove (v_buffer, v_buffer + written, v_buflen);
4021 } 4029 }
4022 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4030 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4023 pty_ev.set (EVENT_READ); 4031 pty_ev.set (ev::READ);
4024} 4032}
4025 4033
4026/*----------------------- end-of-file (C source) -----------------------*/ 4034/*----------------------- end-of-file (C source) -----------------------*/
4027 4035

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines