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.453 by sf-exg, Wed Aug 18 17:45:42 2010 UTC vs.
Revision 1.479 by root, Fri Feb 25 07:07:41 2011 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de>
31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> 31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it>
32 * 32 *
33 * This program is free software; you can redistribute it and/or modify 33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by 34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or 35 * the Free Software Foundation; either version 2 of the License, or
771 771
772 default: 772 default:
773 { 773 {
774 int param = map_function_key (keysym); 774 int param = map_function_key (keysym);
775 if (param > 0) 775 if (param > 0)
776 {
777 int n = sprintf (kbuf,"\033[%d~", param); 776 sprintf (kbuf,"\033[%d~", param);
778 /*
779 * pass Shift/Control indicators for function keys ending with `~'
780 *
781 * eg,
782 * Prior = "ESC[5~"
783 * Shift+Prior = "ESC[5$"
784 * Ctrl+Prior = "ESC[5^"
785 * Ctrl+Shift+Prior = "ESC[5@"
786 */
787 kbuf[n-1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~'));
788 }
789 else 777 else
790 newlen = 0; 778 newlen = 0;
791 } 779 }
792 break; 780 break;
793 } 781 }
844 view_start = 0; 832 view_start = 0;
845 want_refresh = 1; 833 want_refresh = 1;
846 } 834 }
847 835
848 /* 836 /*
837 * these modifications only affect the static keybuffer
838 * pass Shift/Control indicators for function keys ending with `~'
839 *
840 * eg,
841 * Prior = "ESC[5~"
842 * Shift+Prior = "ESC[5$"
843 * Ctrl+Prior = "ESC[5^"
844 * Ctrl+Shift+Prior = "ESC[5@"
849 * Meta adds an Escape prefix (with META8_OPTION, if meta == <escape>). 845 * Meta adds an Escape prefix (with META8_OPTION, if meta == <escape>).
850 */ 846 */
847 if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~')
848 kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~'));
851 849
852 /* escape prefix */ 850 /* escape prefix */
853 if (meta 851 if (meta
854#ifdef META8_OPTION 852#ifdef META8_OPTION
855 && meta_char == C0_ESC 853 && meta_char == C0_ESC
891 commit_iso14755 (); 889 commit_iso14755 ();
892 890
893 return; 891 return;
894 } 892 }
895 893
896 for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) 894 for (unsigned short *i = iso14755_symtab; i[0]; i += 2)
897 if (i[0] == keysym) 895 if (i[0] == keysym)
898 { 896 {
899 iso14755buf = ISO_14755_51 | i[1]; 897 iso14755buf = ISO_14755_51 | i[1];
900 commit_iso14755 (); 898 commit_iso14755 ();
901 899
977rxvt_term::flush () 975rxvt_term::flush ()
978{ 976{
979 flush_ev.stop (); 977 flush_ev.stop ();
980 978
981#ifdef HAVE_BG_PIXMAP 979#ifdef HAVE_BG_PIXMAP
982 if (bgPixmap.check_clearChanged ()) 980 if (bg_flags & BG_NEEDS_REFRESH)
983 { 981 {
984// scr_clear (true); This needs to be researched further! 982 bg_flags &= ~BG_NEEDS_REFRESH;
985 scr_touch (false); 983 scr_touch (false);
986 } 984 }
987#endif 985#endif
988 986
989 if (want_refresh) 987 if (want_refresh)
1160rxvt_term::pty_fill () 1158rxvt_term::pty_fill ()
1161{ 1159{
1162 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1160 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1163 1161
1164 if (CBUFSIZ == n) 1162 if (CBUFSIZ == n)
1165 { 1163 n = 0; // normally this indicates a "too long" command sequence - just drop the data we have
1166 rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n");
1167 n = 0;
1168 }
1169 1164
1170 memmove (cmdbuf_base, cmdbuf_ptr, n); 1165 memmove (cmdbuf_base, cmdbuf_ptr, n);
1171 cmdbuf_ptr = cmdbuf_base; 1166 cmdbuf_ptr = cmdbuf_base;
1172 cmdbuf_endp = cmdbuf_ptr + n; 1167 cmdbuf_endp = cmdbuf_ptr + n;
1173 1168
1253{ 1248{
1254 int button_number, key_state = 0; 1249 int button_number, key_state = 0;
1255 int x, y; 1250 int x, y;
1256 int code = 32; 1251 int code = 32;
1257 1252
1258 x = Pixel2Col (ev.x); 1253 x = Pixel2Col (ev.x) + 1;
1259 y = Pixel2Row (ev.y); 1254 y = Pixel2Row (ev.y) + 1;
1255
1260 if (ev.type == MotionNotify) 1256 if (ev.type == MotionNotify)
1261 { 1257 {
1262 if (x == mouse_row && y == mouse_col) 1258 if (x == mouse_row && y == mouse_col)
1263 return; 1259 return;
1260
1264 mouse_row = x; 1261 mouse_row = x;
1265 mouse_col = y; 1262 mouse_col = y;
1266 code += 32; 1263 code += 32;
1267 } 1264 }
1268 1265
1271 else 1268 else
1272 { 1269 {
1273 button_number = MEvent.button - Button1; 1270 button_number = MEvent.button - Button1;
1274 /* add 0x3D for wheel events, like xterm does */ 1271 /* add 0x3D for wheel events, like xterm does */
1275 if (button_number >= 3) 1272 if (button_number >= 3)
1276 button_number += (64 - 3); 1273 button_number += 64 - 3;
1277 } 1274 }
1278 1275
1279 if (priv_modes & PrivMode_MouseX10) 1276 if (priv_modes & PrivMode_MouseX10)
1280 { 1277 {
1281 /* 1278 /*
1313 fputc ('A', stderr); 1310 fputc ('A', stderr);
1314 if (key_state & 32) 1311 if (key_state & 32)
1315 fputc ('2', stderr); 1312 fputc ('2', stderr);
1316 fprintf (stderr, "]: <%d>, %d/%d\n", 1313 fprintf (stderr, "]: <%d>, %d/%d\n",
1317 button_number, 1314 button_number,
1318 x + 1, 1315 x,
1319 y + 1); 1316 y);
1320#endif 1317#endif
1321 1318
1319#if ENABLE_FRILLS
1320 if (priv_modes & PrivMode_ExtMouseRight)
1321 tt_printf ("\033[%d;%d;%dM",
1322 code + button_number + key_state,
1323 x,
1324 y);
1325 else if (priv_modes & PrivMode_ExtModeMouse)
1326 tt_printf ("\033[M%c%lc%lc",
1327 code + button_number + key_state,
1328 wint_t (32 + x),
1329 wint_t (32 + y));
1330 else
1331#endif
1322 tt_printf ("\033[M%c%c%c", 1332 tt_printf ("\033[M%c%c%c",
1323 (code + button_number + key_state), 1333 code + button_number + key_state,
1324 (32 + x + 1), 1334 32 + x,
1325 (32 + y + 1)); 1335 32 + y);
1326} 1336}
1327 1337
1328/*{{{ process an X event */ 1338/*{{{ process an X event */
1329void 1339void
1330rxvt_term::x_cb (XEvent &ev) 1340rxvt_term::x_cb (XEvent &ev)
1432 && ev.xfocus.mode != NotifyGrab) 1442 && ev.xfocus.mode != NotifyGrab)
1433 focus_out (); 1443 focus_out ();
1434 break; 1444 break;
1435 1445
1436 case ConfigureNotify: 1446 case ConfigureNotify:
1437 /*fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1438 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1439 szHint.width, szHint.height);*/
1440 if (ev.xconfigure.window == parent[0]) 1447 if (ev.xconfigure.window == parent[0])
1441 { 1448 {
1442 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1449 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1443 ; 1450 ;
1451
1452#ifdef HAVE_BG_PIXMAP
1453 bool moved = false;
1454 if (bg_window_position_sensitive ())
1455 {
1456 int x, y;
1457 if (ev.xconfigure.send_event)
1458 {
1459 x = ev.xconfigure.x;
1460 y = ev.xconfigure.y;
1461 }
1462 else
1463 get_window_origin (x, y);
1464
1465 if (bg_set_position (x, y)
1466 || !(bg_flags & BG_IS_VALID))
1467 moved = true;
1468 }
1469#endif
1444 1470
1445 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1471 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1446 { 1472 {
1447 seen_resize = 1; 1473 seen_resize = 1;
1448 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1474 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1449 } 1475 }
1450 else 1476 else
1451 { 1477 {
1452#ifdef HAVE_BG_PIXMAP 1478#ifdef HAVE_BG_PIXMAP
1453 if (bgPixmap.window_position_sensitive ()) 1479 if (moved)
1454 { 1480 {
1455 if (mapped) 1481 if (mapped)
1456 update_background (); 1482 update_background ();
1457 else 1483 else
1458 bgPixmap.invalidate (); 1484 bg_invalidate ();
1459 } 1485 }
1460#endif 1486#endif
1461 } 1487 }
1462 1488
1463 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1489 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1464 } 1490 }
1465 break; 1491 break;
1466 1492
1467 case PropertyNotify: 1493 case PropertyNotify:
1468 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) 1494 HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END));
1469 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1470 && ev.xproperty.state == PropertyNewValue)
1471 selection_property (ev.xproperty.window, ev.xproperty.atom);
1472
1473 break; 1495 break;
1474 1496
1475 case SelectionClear: 1497 case SelectionClear:
1476 selection_clear (ev.xselectionclear.selection == xa[XA_CLIPBOARD]); 1498 selection_clear (ev.xselectionclear.selection == xa[XA_CLIPBOARD]);
1477 break;
1478
1479 case SelectionNotify:
1480 if (selection_wait == Sel_normal)
1481 selection_paste (ev.xselection.requestor, ev.xselection.property, true);
1482 break; 1499 break;
1483 1500
1484 case SelectionRequest: 1501 case SelectionRequest:
1485 selection_send (ev.xselectionrequest); 1502 selection_send (ev.xselectionrequest);
1486 break; 1503 break;
1497 * by scheduling background redraw as soon as we can, but giving a short 1514 * by scheduling background redraw as soon as we can, but giving a short
1498 * bit of time for ConfigureNotifies to arrive. 1515 * bit of time for ConfigureNotifies to arrive.
1499 * We should render background PRIOR to drawing any text, but AFTER all 1516 * We should render background PRIOR to drawing any text, but AFTER all
1500 * of ConfigureNotifys for the best results. 1517 * of ConfigureNotifys for the best results.
1501 */ 1518 */
1502 if (bgPixmap.flags & bgPixmap_t::isInvalid) 1519 if (!(bg_flags & BG_IS_VALID))
1503 update_background_ev.start (0.025); 1520 update_background_ev.start (0.025);
1504#endif 1521#endif
1505 mapped = 1; 1522 mapped = 1;
1506#ifdef TEXT_BLINK 1523#ifdef TEXT_BLINK
1507 text_blink_ev.start (); 1524 text_blink_ev.start ();
1522 if (ev.xany.window == vt) 1539 if (ev.xany.window == vt)
1523 { 1540 {
1524 do 1541 do
1525 { 1542 {
1526 scr_expose (ev.xexpose.x, ev.xexpose.y, 1543 scr_expose (ev.xexpose.x, ev.xexpose.y,
1527 ev.xexpose.width, ev.xexpose.height, False); 1544 ev.xexpose.width, ev.xexpose.height, false);
1528 } 1545 }
1529 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1546 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1530 1547
1531 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1548 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1532 1549
1533 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1550 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1534 { 1551 {
1535 scr_expose (ev.xexpose.x, ev.xexpose.y, 1552 scr_expose (ev.xexpose.x, ev.xexpose.y,
1536 ev.xexpose.width, ev.xexpose.height, False); 1553 ev.xexpose.width, ev.xexpose.height, false);
1537 } 1554 }
1538 1555
1539 want_refresh = 1; 1556 want_refresh = 1;
1540 } 1557 }
1541 else 1558 else
1822 * use the property to determine the pixmap. We use it later on. 1839 * use the property to determine the pixmap. We use it later on.
1823 */ 1840 */
1824 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] 1841 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1825 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1842 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1826 { 1843 {
1827 bgPixmap.set_root_pixmap (); 1844 bg_set_root_pixmap ();
1828 update_background (); 1845 update_background ();
1829 } 1846 }
1830 1847
1831 break; 1848 break;
1832 } 1849 }
2665 2682
2666 /* 8.3.87: NEXT LINE */ 2683 /* 8.3.87: NEXT LINE */
2667 case C1_NEL: /* ESC E */ 2684 case C1_NEL: /* ESC E */
2668 { 2685 {
2669 wchar_t nlcr[] = { C0_LF, C0_CR }; 2686 wchar_t nlcr[] = { C0_LF, C0_CR };
2670 scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); 2687 scr_add_lines (nlcr, ARRAY_LENGTH(nlcr), 1);
2671 } 2688 }
2672 break; 2689 break;
2673 2690
2674 /* kidnapped escape sequence: Should be 8.3.48 */ 2691 /* kidnapped escape sequence: Should be 8.3.48 */
2675 case C1_ESA: /* ESC G */ 2692 case C1_ESA: /* ESC G */
2676 process_graphics (); 2693 // used by original rxvt for rob nations own graphics mode
2694 if (cmd_getc () == 'Q')
2695 tt_printf ("\033G0\012"); /* query graphics - no graphics */
2677 break; 2696 break;
2678 2697
2679 /* 8.3.63: CHARACTER TABULATION SET */ 2698 /* 8.3.63: CHARACTER TABULATION SET */
2680 case C1_HTS: /* ESC H */ 2699 case C1_HTS: /* ESC H */
2681 scr_set_tab (1); 2700 scr_set_tab (1);
2744 CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ, 2763 CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ,
2745 CSI_70 , CSI_71 , CSI_72 , CSI_73 , CSI_74 , CSI_75 , CSI_76 , CSI_77 , 2764 CSI_70 , CSI_71 , CSI_72 , CSI_73 , CSI_74 , CSI_75 , CSI_76 , CSI_77 ,
2746 CSI_78 , CSI_79 , CSI_7A , CSI_7B , CSI_7C , CSI_7D , CSI_7E , CSI_7F 2765 CSI_78 , CSI_79 , CSI_7A , CSI_7B , CSI_7C , CSI_7D , CSI_7E , CSI_7F
2747}; 2766};
2748 2767
2749#define make_byte(b7,b6,b5,b4,b3,b2,b1,b0) \ 2768#define make_byte(b0,b1,b2,b3,b4,b5,b6,b7) \
2750 (((b7) << 7) | ((b6) << 6) | ((b5) << 5) | ((b4) << 4) \ 2769 (((b7) << 7) | ((b6) << 6) | ((b5) << 5) | ((b4) << 4) \
2751 | ((b3) << 3) | ((b2) << 2) | ((b1) << 1) | (b0)) 2770 | ((b3) << 3) | ((b2) << 2) | ((b1) << 1) | (b0))
2752#define get_byte_array_bit(array, bit) \ 2771#define get_byte_array_bit(array, bit) \
2753 (!! ((array)[ (bit) / 8] & (128 >> ((bit) & 7)))) 2772 (!! ((array)[(bit) >> 3] & (1 << ((bit) & 7))))
2754 2773
2755const unsigned char csi_defaults[] = 2774static const unsigned char csi_defaults[] =
2756 { 2775 {
2757 make_byte (1,1,1,1,1,1,1,1), /* @, A, B, C, D, E, F, G, */ 2776 make_byte (1,1,1,1,1,1,1,1), /* @, A, B, C, D, E, F, G, */
2758 make_byte (1,1,0,0,1,1,0,0), /* H, I, J, K, L, M, N, O, */ 2777 make_byte (1,1,0,0,1,1,0,0), /* H, I, J, K, L, M, N, O, */
2759 make_byte (1,0,1,1,1,1,1,0), /* P, Q, R, S, T, U, V, W, */ 2778 make_byte (1,0,1,1,1,1,1,0), /* P, Q, R, S, T, U, V, W, */
2760 make_byte (1,1,1,0,0,0,1,0), /* X, Y, Z, [, \, ], ^, _, */ 2779 make_byte (1,1,1,0,0,0,1,0), /* X, Y, Z, [, \, ], ^, _, */
2849 { 2868 {
2850 /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */ 2869 /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */
2851 scr_soft_reset (); 2870 scr_soft_reset ();
2852 2871
2853 static const int pm_h[] = { 7, 25 }; 2872 static const int pm_h[] = { 7, 25 };
2854 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 }; 2873 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 };
2855 2874
2856 process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h); 2875 process_terminal_mode ('h', 0, ARRAY_LENGTH(pm_h), pm_h);
2857 process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l); 2876 process_terminal_mode ('l', 0, ARRAY_LENGTH(pm_l), pm_l);
2858 } 2877 }
2859 break; 2878 break;
2860 } 2879 }
2861 2880
2862 return; 2881 return;
3424 process_color_seq (op, Color_tint, str, resp); 3443 process_color_seq (op, Color_tint, str, resp);
3425 { 3444 {
3426 bool changed = false; 3445 bool changed = false;
3427 3446
3428 if (ISSET_PIXCOLOR (Color_tint)) 3447 if (ISSET_PIXCOLOR (Color_tint))
3429 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3448 changed = bg_set_tint (pix_colors_focused [Color_tint]);
3430 else
3431 changed = bgPixmap.unset_tint ();
3432 3449
3433 if (changed) 3450 if (changed)
3434 update_background (); 3451 update_background ();
3435 } 3452 }
3436 3453
3442 if (!strcmp (str, "?")) 3459 if (!strcmp (str, "?"))
3443 { 3460 {
3444 char str[256]; 3461 char str[256];
3445 3462
3446 sprintf (str, "[%dx%d+%d+%d]", 3463 sprintf (str, "[%dx%d+%d+%d]",
3447 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), 3464 min (h_scale, 32767), min (v_scale, 32767),
3448 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); 3465 min (h_align, 32767), min (v_align, 32767));
3449 process_xterm_seq (XTerm_title, str, CHAR_ST); 3466 process_xterm_seq (XTerm_title, str, CHAR_ST);
3450 } 3467 }
3451 else 3468 else
3452 { 3469 {
3453 int changed = 0; 3470 int changed = 0;
3454 3471
3455 if (*str != ';') 3472 if (*str != ';')
3456 { 3473 {
3457 /* reset to default scaling :*/
3458 bgPixmap.unset_geometry ();
3459 if (bgPixmap.set_file (str)) /* change pixmap */ 3474 if (bg_set_file (str)) /* change pixmap */
3475 {
3460 changed++; 3476 changed++;
3461 str = strchr (str, ';'); 3477 str = strchr (str, ';');
3462 if (str == NULL) 3478 if (str == NULL)
3463 bgPixmap.set_defaultGeometry (); 3479 bg_set_default_geometry ();
3480 else
3481 bg_set_geometry (str+1);
3482 }
3464 } 3483 }
3465 3484 else
3466 while (str)
3467 { 3485 {
3468 str++; 3486 str++;
3469 if (bgPixmap.set_geometry (str)) 3487 if (bg_set_geometry (str, true))
3470 changed++; 3488 changed++;
3471 str = strchr (str, ';');
3472 } 3489 }
3473 3490
3474 if (changed) 3491 if (changed)
3492 {
3493 if (bg_window_position_sensitive ())
3494 {
3495 int x, y;
3496 get_window_origin (x, y);
3497 bg_set_position (x, y);
3498 }
3475 update_background (); 3499 update_background ();
3500 }
3476 } 3501 }
3477 break; 3502 break;
3478#endif 3503#endif
3479 3504
3480 case XTerm_logfile: 3505 case XTerm_logfile:
3612 { 6, PrivMode_relOrigin }, // DECOM 3637 { 6, PrivMode_relOrigin }, // DECOM
3613 { 7, PrivMode_Autowrap }, // DECAWM 3638 { 7, PrivMode_Autowrap }, // DECAWM
3614 // 8, auto-repeat keys // DECARM 3639 // 8, auto-repeat keys // DECARM
3615 { 9, PrivMode_MouseX10 }, 3640 { 9, PrivMode_MouseX10 },
3616 // 18 end FF to printer after print screen 3641 // 18 end FF to printer after print screen
3617 // 19 Print screen prints full screen/scorll region 3642 // 19 Print screen prints full screen/scroll region
3618 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis 3643 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis
3619#ifdef scrollBar_esc 3644#ifdef scrollBar_esc
3620 { scrollBar_esc, PrivMode_scrollBar }, 3645 { scrollBar_esc, PrivMode_scrollBar },
3621#endif 3646#endif
3622 { 35, PrivMode_ShiftKeys }, // rxvt extension 3647 { 35, PrivMode_ShiftKeys }, // rxvt extension
3631 { 67, PrivMode_BackSpace }, // DECBKM 3656 { 67, PrivMode_BackSpace }, // DECBKM
3632#endif 3657#endif
3633 { 1000, PrivMode_MouseX11 }, 3658 { 1000, PrivMode_MouseX11 },
3634 { 1002, PrivMode_MouseBtnEvent }, 3659 { 1002, PrivMode_MouseBtnEvent },
3635 { 1003, PrivMode_MouseAnyEvent }, 3660 { 1003, PrivMode_MouseAnyEvent },
3661#if ENABLE_FRILLS
3662 { 1005, PrivMode_ExtModeMouse },
3663#endif
3636 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3664 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3637 { 1011, PrivMode_Keypress }, // rxvt extension 3665 { 1011, PrivMode_Keypress }, // rxvt extension
3666#if ENABLE_FRILLS
3667 { 1015, PrivMode_ExtMouseRight }, // urxvt extension of 1005
3668#endif
3638 // 1035 enable modifiers for alt, numlock NYI 3669 // 1035 enable modifiers for alt, numlock NYI
3639 // 1036 send ESC for meta keys NYI 3670 // 1036 send ESC for meta keys NYI
3640 // 1037 send DEL for keypad delete NYI 3671 // 1037 send DEL for keypad delete NYI
3641 { 1047, PrivMode_Screen }, 3672 { 1047, PrivMode_Screen },
3642 // 1048 save and restore cursor 3673 // 1048 save and restore cursor, implemented in code
3643 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ 3674 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */
3644 // 1051, 1052, 1060, 1061 keyboard emulation NYI 3675 // 1051, 1052, 1060, 1061 keyboard emulation NYI
3645 { 2004, PrivMode_BracketPaste }, 3676 { 2004, PrivMode_BracketPaste },
3646 }; 3677 };
3647 3678
3657 for (i = 0; i < nargs; i++) 3688 for (i = 0; i < nargs; i++)
3658 { 3689 {
3659 state = -1; 3690 state = -1;
3660 3691
3661 /* basic handling */ 3692 /* basic handling */
3662 for (j = 0; j < (sizeof (argtopriv)/sizeof (argtopriv[0])); j++) 3693 for (j = 0; j < ARRAY_LENGTH(argtopriv); j++)
3663 if (argtopriv[j].argval == arg[i]) 3694 if (argtopriv[j].argval == arg[i])
3664 { 3695 {
3665 state = privcases (mode, argtopriv[j].bit); 3696 state = privcases (mode, argtopriv[j].bit);
3666 break; 3697 break;
3667 } 3698 }
3745 case 1003: 3776 case 1003:
3746 if (state) 3777 if (state)
3747 { 3778 {
3748 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3779 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3749 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3780 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3781 mouse_row = mouse_col = 0;
3750 vt_emask_mouse = PointerMotionMask; 3782 vt_emask_mouse = PointerMotionMask;
3751 } 3783 }
3752 else 3784 else
3753 vt_emask_mouse = NoEventMask; 3785 vt_emask_mouse = NoEventMask;
3754 3786
3939 } 3971 }
3940 } 3972 }
3941} 3973}
3942/*}}} */ 3974/*}}} */
3943 3975
3944/*{{{ (do not) process Rob Nation's own graphics mode sequences */
3945void
3946rxvt_term::process_graphics ()
3947{
3948 unicode_t ch, cmd = cmd_getc ();
3949
3950 if (cmd == 'Q')
3951 {
3952 /* query graphics */
3953 tt_printf ("\033G0\012"); /* no graphics */
3954 return;
3955 }
3956 /* swallow other graphics sequences until terminating ':' */
3957 do
3958 ch = cmd_getc ();
3959 while (ch != ':');
3960}
3961/*}}} */
3962
3963/* ------------------------------------------------------------------------- */ 3976/* ------------------------------------------------------------------------- */
3964 3977
3965/* 3978/*
3966 * Send printf () formatted output to the command. 3979 * Send printf () formatted output to the command.
3967 * Only use for small amounts of data. 3980 * Only use for small amounts of data.
3980 3993
3981/* ---------------------------------------------------------------------- */ 3994/* ---------------------------------------------------------------------- */
3982/* Write data to the pty as typed by the user, pasted with the mouse, 3995/* Write data to the pty as typed by the user, pasted with the mouse,
3983 * or generated by us in response to a query ESC sequence. 3996 * or generated by us in response to a query ESC sequence.
3984 */ 3997 */
3985const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT 3998static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
3986 3999
3987void 4000void
3988rxvt_term::tt_write (const char *data, unsigned int len) 4001rxvt_term::tt_write (const char *data, unsigned int len)
3989{ 4002{
3990 if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) 4003 if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END)))
4002 4015
4003 data += written; 4016 data += written;
4004 len -= written; 4017 len -= written;
4005 } 4018 }
4006 4019
4007 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 4020 v_buffer = (char *)rxvt_realloc (v_buffer, v_buflen + len);
4008 4021
4009 memcpy (v_buffer + v_buflen, data, len); 4022 memcpy (v_buffer + v_buflen, data, len);
4010 v_buflen += len; 4023 v_buflen += len;
4011 4024
4012 pty_ev.set (ev::READ | ev::WRITE); 4025 pty_ev.set (ev::READ | ev::WRITE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines