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.329 by ayin, Mon Jun 11 19:57:28 2007 UTC vs.
Revision 1.346 by root, Wed Aug 15 06:48:16 2007 UTC

95 XK_Shift_L, 0x21e7, 95 XK_Shift_L, 0x21e7,
96 XK_Shift_R, 0x21e7, 96 XK_Shift_R, 0x21e7,
97 97
98 XK_Shift_Lock, 0x21eb, 98 XK_Shift_Lock, 0x21eb,
99 XK_ISO_Lock, 0x21eb, 99 XK_ISO_Lock, 0x21eb,
100 XK_ISO_Lock, 0x21eb,
101 XK_Caps_Lock, 0x21ec, 100 XK_Caps_Lock, 0x21ec,
102 XK_Num_Lock, 0x21ed, 101 XK_Num_Lock, 0x21ed,
103 XK_ISO_Level3_Shift, 0x21ee, 102 XK_ISO_Level3_Shift, 0x21ee,
104 XK_ISO_Level3_Lock, 0x21ef, 103 XK_ISO_Level3_Lock, 0x21ef,
105 XK_ISO_Group_Lock, 0x21f0, 104 XK_ISO_Group_Lock, 0x21f0,
519# endif 518# endif
520 return; 519 return;
521 } 520 }
522 else 521 else
523 { 522 {
524# if ENABLE_OVERLAY 523# if ISO_14755
525 scr_overlay_off (); 524 scr_overlay_off ();
526# endif 525# endif
527 iso14755buf = 0; 526 iso14755buf = 0;
528 } 527 }
529 } 528 }
530 else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) 529 else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R))
531 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) 530 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R)))
532 if (!(iso14755buf & ISO_14755_STARTED)) 531 if (!(iso14755buf & ISO_14755_STARTED))
533 { 532 {
534 iso14755buf |= ISO_14755_STARTED; 533 iso14755buf |= ISO_14755_STARTED;
535# if ENABLE_OVERLAY 534# if ISO_14755
536 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); 535 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1);
537 scr_overlay_set (0, 0, "ISO 14755 mode"); 536 scr_overlay_set (0, 0, "ISO 14755 mode");
538# endif 537# endif
539 } 538 }
540#endif 539#endif
728 727
729 case XK_Find: 728 case XK_Find:
730 strcpy (kbuf, "\033[1~"); 729 strcpy (kbuf, "\033[1~");
731 break; 730 break;
732 731
733#ifdef XK_KP_End 732#ifdef XK_KP_Insert
734 case XK_KP_Insert: 733 case XK_KP_Insert:
735 /* allow shift to override */ 734 /* allow shift to override */
736 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 735 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
737 { 736 {
738 strcpy (kbuf, "\033Op"); 737 strcpy (kbuf, "\033Op");
934#if ENABLE_FRILLS || ISO_14755 933#if ENABLE_FRILLS || ISO_14755
935 // ISO 14755 support 934 // ISO 14755 support
936 if (iso14755buf) 935 if (iso14755buf)
937 if (iso14755buf & ISO_14755_52) 936 if (iso14755buf & ISO_14755_52)
938 { 937 {
939# if ENABLE_OVERLAY 938# if ISO_14755
940 scr_overlay_off (); 939 scr_overlay_off ();
941# endif 940# endif
942# if ISO_14755 941# if ISO_14755
943 // iso14755 part 5.2 handling: release time 942 // iso14755 part 5.2 handling: release time
944 // first: controls 943 // first: controls
967 966
968 return; 967 return;
969 } 968 }
970 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) 969 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask))
971 { 970 {
972# if ENABLE_OVERLAY 971# if ISO_14755
973 scr_overlay_off (); 972 scr_overlay_off ();
974# endif 973# endif
975 if (iso14755buf & ISO_14755_51) 974 if (iso14755buf & ISO_14755_51)
976 commit_iso14755 (); 975 commit_iso14755 ();
977#if ISO_14755 976#if ISO_14755
1035void 1034void
1036rxvt_term::flush () 1035rxvt_term::flush ()
1037{ 1036{
1038 flush_ev.stop (); 1037 flush_ev.stop ();
1039 1038
1040#ifdef TRANSPARENT 1039#ifdef ENABLE_TRANSPARENCY
1041 if (want_full_refresh) 1040 if (want_full_refresh)
1042 { 1041 {
1043 want_full_refresh = 0; 1042 want_full_refresh = 0;
1044 scr_clear (); 1043 scr_clear ();
1045 scr_touch (false); 1044 scr_touch (false);
1110void 1109void
1111rxvt_term::flush_cb (time_watcher &w) 1110rxvt_term::flush_cb (time_watcher &w)
1112{ 1111{
1113 make_current (); 1112 make_current ();
1114 1113
1115 refresh_limit = 1;
1116 refresh_count = 0; 1114 refresh_count = 0;
1117 flush (); 1115 flush ();
1118} 1116}
1119 1117
1120#ifdef CURSOR_BLINK 1118#ifdef CURSOR_BLINK
1434 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) 1432 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1435 focus_out (); 1433 focus_out ();
1436 } 1434 }
1437#endif 1435#endif
1438 } 1436 }
1439 break;
1440
1441 case MappingNotify:
1442 XRefreshKeyboardMapping (&ev.xmapping);
1443 break; 1437 break;
1444 1438
1445 /* 1439 /*
1446 * XXX: this is not the _current_ arrangement 1440 * XXX: this is not the _current_ arrangement
1447 * Here's my conclusion: 1441 * Here's my conclusion:
1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1484 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1491 { 1485 {
1492 seen_resize = 1; 1486 seen_resize = 1;
1493 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1487 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1494#ifdef XPM_BACKGROUND 1488#ifdef XPM_BACKGROUND
1489 /* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */
1495 if (!option (Opt_transparent) && bgPixmap.auto_resize) 1490 if (!option (Opt_transparent) && bgPixmap.window_size_sensitive ())
1496 { 1491 {
1497 resize_pixmap (); 1492 bgPixmap.render ();
1498 scr_touch (true); 1493 scr_touch (true);
1499 } 1494 }
1500#endif 1495#endif
1501 } 1496 }
1502 1497
1503 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1498 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1504 1499
1505#ifdef TRANSPARENT 1500#ifdef ENABLE_TRANSPARENCY
1506 if (option (Opt_transparent)) 1501 if (option (Opt_transparent))
1507 check_our_parents (); 1502 bgPixmap.render ();
1508#endif 1503#endif
1509 } 1504 }
1510 break; 1505 break;
1511 1506
1512 case PropertyNotify: 1507 case PropertyNotify:
1544 text_blink_ev.stop (); 1539 text_blink_ev.stop ();
1545#endif 1540#endif
1546 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1541 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1547 break; 1542 break;
1548 1543
1549#ifdef TRANSPARENT 1544#ifdef ENABLE_TRANSPARENCY
1550 case ReparentNotify: 1545 case ReparentNotify:
1551 rootwin_cb (ev); 1546 rootwin_cb (ev);
1552 break; 1547 break;
1553#endif /* TRANSPARENT */ 1548#endif /* ENABLE_TRANSPARENCY */
1554 1549
1555 case GraphicsExpose: 1550 case GraphicsExpose:
1556 case Expose: 1551 case Expose:
1557 if (ev.xany.window == vt) 1552 if (ev.xany.window == vt)
1558 { 1553 {
1581 if (isScrollbarWindow (ev.xany.window)) 1576 if (isScrollbarWindow (ev.xany.window))
1582 { 1577 {
1583 scrollBar.setIdle (); 1578 scrollBar.setIdle ();
1584 scrollbar_show (0); 1579 scrollbar_show (0);
1585 } 1580 }
1586
1587#ifdef TRANSPARENT
1588 if (am_transparent && ev.xany.window == parent[0])
1589 XClearWindow (dpy, ev.xany.window);
1590#endif
1591 } 1581 }
1592 break; 1582 break;
1593 1583
1594 case MotionNotify: 1584 case MotionNotify:
1595#ifdef POINTER_BLANK 1585#ifdef POINTER_BLANK
1693 &ev.xbutton.x, &ev.xbutton.y, 1683 &ev.xbutton.x, &ev.xbutton.y,
1694 &unused_mask); 1684 &unused_mask);
1695 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1685 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1696 scrollbar_size ()); 1686 scrollbar_size ());
1697 want_refresh = 1; 1687 want_refresh = 1;
1698 refresh_limit = 0;
1699 scrollbar_show (1); 1688 scrollbar_show (1);
1700 } 1689 }
1701 break; 1690 break;
1702 } 1691 }
1703 1692
1785 1774
1786#if ENABLE_FRILLS || ISO_14755 1775#if ENABLE_FRILLS || ISO_14755
1787 if (iso14755buf) 1776 if (iso14755buf)
1788 { 1777 {
1789 iso14755buf = 0; 1778 iso14755buf = 0;
1790# if ENABLE_OVERLAY 1779# if ISO_14755
1791 scr_overlay_off (); 1780 scr_overlay_off ();
1792# endif 1781# endif
1793 } 1782 }
1794#endif 1783#endif
1795#if USE_XIM 1784#if USE_XIM
1822 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); 1811 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
1823 } 1812 }
1824#endif 1813#endif
1825} 1814}
1826 1815
1827#if TRANSPARENT || ENABLE_PERL 1816#if ENABLE_TRANSPARENCY || ENABLE_PERL
1828void 1817void
1829rxvt_term::rootwin_cb (XEvent &ev) 1818rxvt_term::rootwin_cb (XEvent &ev)
1830{ 1819{
1831 make_current (); 1820 make_current ();
1832 1821
1833 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1822 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1834 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1823 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1835 return; 1824 return;
1836 1825
1837# if TRANSPARENT 1826# if ENABLE_TRANSPARENCY
1838 switch (ev.type) 1827 switch (ev.type)
1839 { 1828 {
1840 case PropertyNotify: 1829 case PropertyNotify:
1841 /* 1830 /*
1842 * if user used some Esetroot compatible prog to set the root bg, 1831 * if user used some Esetroot compatible prog to set the root bg,
1843 * use the property to determine the pixmap. We use it later on. 1832 * use the property to determine the pixmap. We use it later on.
1844 */ 1833 */
1845 if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] 1834 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1846 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1835 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1847 return; 1836 {
1848 1837 bgPixmap.set_root_pixmap ();
1849 /* FALLTHROUGH */ 1838 bgPixmap.render ();
1850 case ReparentNotify: 1839 }
1851 if (option (Opt_transparent))
1852 check_our_parents ();
1853 break; 1840 break;
1854 } 1841 }
1855# endif 1842# endif
1856} 1843}
1857#endif 1844#endif
2291 if (ch == C0_LF) 2278 if (ch == C0_LF)
2292 nlines++; 2279 nlines++;
2293 2280
2294 refresh_count++; 2281 refresh_count++;
2295 2282
2296 if (!option (Opt_jumpScroll) 2283 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2297 || (refresh_count >= refresh_limit * (nrow - 1)))
2298 { 2284 {
2299 refreshnow = true;
2300 refresh_count = 0; 2285 refresh_count = 0;
2286
2287 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.)
2288 {
2289 refreshnow = true;
2301 ch = NOCHAR; 2290 ch = NOCHAR;
2302 break; 2291 break;
2292 }
2303 } 2293 }
2304 2294
2305 // scr_add_lines only works for nlines <= nrow - 1. 2295 // scr_add_lines only works for nlines <= nrow - 1.
2306 if (nlines >= nrow - 1) 2296 if (nlines >= nrow - 1)
2307 { 2297 {
2335 && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) 2325 && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))))
2336 scr_add_lines (buf, str - buf, nlines); 2326 scr_add_lines (buf, str - buf, nlines);
2337 2327
2338 /* 2328 /*
2339 * If there have been a lot of new lines, then update the screen 2329 * If there have been a lot of new lines, then update the screen
2340 * What the heck I'll cheat and only refresh less than every page-full. 2330 * What the heck we'll cheat and only refresh less than every page-full.
2341 * the number of pages between refreshes is refresh_limit, which 2331 * if skipScroll is enabled.
2342 * is incremented here because we must be doing flat-out scrolling.
2343 */ 2332 */
2344 if (refreshnow) 2333 if (refreshnow)
2345 { 2334 {
2346 if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2347 refresh_limit++;
2348 else
2349 {
2350 flag = true; 2335 flag = true;
2351 //TODO: due to popular request, implement "skipscroll" option here
2352 scr_refresh (); 2336 scr_refresh ();
2353 want_refresh = 1; 2337 want_refresh = 1;
2354 }
2355 } 2338 }
2356 2339
2357 } 2340 }
2358 else 2341 else
2359 { 2342 {
2580 process_dcs_seq (); 2563 process_dcs_seq ();
2581 break; 2564 break;
2582 case 0x9b: /* CSI */ 2565 case 0x9b: /* CSI */
2583 process_csi_seq (); 2566 process_csi_seq ();
2584 break; 2567 break;
2585 case 0x9d: /* CSI */ 2568 case 0x9d: /* OSC */
2586 process_osc_seq (); 2569 process_osc_seq ();
2587 break; 2570 break;
2588#endif 2571#endif
2589 } 2572 }
2590} 2573}
2818 unicode_t ch, priv, i; 2801 unicode_t ch, priv, i;
2819 unsigned int nargs, p; 2802 unsigned int nargs, p;
2820 int n, ndef; 2803 int n, ndef;
2821 int arg[ESC_ARGS]; 2804 int arg[ESC_ARGS];
2822 2805
2823 for (nargs = ESC_ARGS; nargs > 0;) 2806 memset (arg, 0, sizeof (arg));
2824 arg[--nargs] = 0; 2807 nargs = 0;
2825 2808
2826 priv = 0; 2809 priv = 0;
2827 ch = cmd_getc (); 2810 ch = cmd_getc ();
2828 if (ch >= '<' && ch <= '?') 2811 if (ch >= '<' && ch <= '?')
2829 { /* '<' '=' '>' '?' */ 2812 { /* '<' '=' '>' '?' */
2873 switch (priv) 2856 switch (priv)
2874 { 2857 {
2875 case '>': 2858 case '>':
2876 if (ch == CSI_DA) /* secondary device attributes */ 2859 if (ch == CSI_DA) /* secondary device attributes */
2877 { 2860 {
2878 // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, 2861 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2879 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2862 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2880 // 2863 //
2881 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2864 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2882 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2865 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify
2883 // that we do not support xterm mouse reporting (should be 95 when we do). 2866 // that we do not support xterm mouse reporting (should be 95 when we do).
3441 break; 3424 break;
3442 case URxvt_Color_IT: 3425 case URxvt_Color_IT:
3443 process_color_seq (op, Color_IT, str, resp); 3426 process_color_seq (op, Color_IT, str, resp);
3444 break; 3427 break;
3445#endif 3428#endif
3446#if TRANSPARENT && TINTING 3429#if ENABLE_TRANSPARENCY
3447 case URxvt_Color_tint: 3430 case URxvt_Color_tint:
3448 process_color_seq (op, Color_tint, str, resp); 3431 process_color_seq (op, Color_tint, str, resp);
3432 {
3433 bool changed = false;
3434 if (ISSET_PIXCOLOR (Color_tint))
3435 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3436 else
3437 changed = bgPixmap.unset_tint ();
3438 if (changed)
3439 bgPixmap.render ();
3440 }
3449 3441
3450 check_our_parents ();
3451
3452 if (am_transparent)
3453 want_full_refresh = want_refresh = 1;
3454
3455 break; 3442 break;
3456#endif 3443#endif
3457 3444
3445#if XPM_BACKGROUND
3458 case Rxvt_Pixmap: 3446 case Rxvt_Pixmap:
3447 if (!strcmp (str, "?"))
3459 { 3448 {
3449 char str[256];
3450
3451 sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */
3452 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
3453 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
3454 process_xterm_seq (XTerm_title, str, CHAR_ST);
3455 }
3456 else
3457 {
3458 int changed = 0;
3459
3460 if (*str != ';') 3460 if (*str != ';')
3461 { 3461 {
3462#if XPM_BACKGROUND
3463 scale_pixmap (""); /* reset to default scaling */ 3462 /* reset to default scaling :*/
3463 bgPixmap.unset_geometry ();
3464 set_bgPixmap (str); /* change pixmap */ 3464 if (bgPixmap.set_file (str)) /* change pixmap */
3465 changed++;
3466 str = strchr (str, ';');
3467 if (str == NULL)
3468 bgPixmap.set_defaultGeometry ();
3469 }
3470 while (str)
3471 {
3472 str++;
3473 if (bgPixmap.set_geometry (str))
3474 changed++;
3475 str = strchr (str, ';');
3476 }
3477 if (changed)
3478 {
3479 bgPixmap.render ();
3465 scr_touch (true); 3480 scr_touch (true);
3466#endif
3467 } 3481 }
3468
3469 int changed = 0;
3470
3471 while ((str = strchr (str, ';')) != NULL)
3472 {
3473 str++;
3474#if XPM_BACKGROUND
3475 changed += scale_pixmap (str);
3476#endif
3477 } 3482 }
3478
3479 if (changed)
3480 {
3481#ifdef XPM_BACKGROUND
3482 resize_pixmap ();
3483 scr_touch (true);
3484#endif
3485 }
3486#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
3487 if (option (Opt_transparent))
3488 check_our_parents ();
3489#endif
3490 }
3491 break; 3483 break;
3484#endif
3492 3485
3493 case Rxvt_restoreFG: 3486 case Rxvt_restoreFG:
3494 set_window_color (Color_fg, str); 3487 set_window_color (Color_fg, str);
3495 break; 3488 break;
3496 case Rxvt_restoreBG: 3489 case Rxvt_restoreBG:
3618{ 3611{
3619 unsigned int i, j; 3612 unsigned int i, j;
3620 int state; 3613 int state;
3621 3614
3622 static const struct 3615 static const struct
3623 { 3616 {
3624 const int argval; 3617 const int argval;
3625 const unsigned long bit; 3618 const unsigned long bit;
3626 }
3627
3628 argtopriv[] = { 3619 } argtopriv[] = {
3629 { 1, PrivMode_aplCUR }, 3620 { 1, PrivMode_aplCUR },
3630 { 2, PrivMode_vt52 }, 3621 { 2, PrivMode_vt52 },
3631 { 3, PrivMode_132 }, 3622 { 3, PrivMode_132 },
3632 { 4, PrivMode_smoothScroll }, 3623 { 4, PrivMode_smoothScroll },
3633 { 5, PrivMode_rVideo }, 3624 { 5, PrivMode_rVideo },

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines