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.331 by root, Mon Jun 18 13:38:12 2007 UTC vs.
Revision 1.360 by ayin, Wed Oct 24 10:39:57 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
548#endif 547#endif
549 548
550 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 549 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
551 { 550 {
552 { 551 {
552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553 newlen = 1; 553 newlen = 1;
554 switch (keysym) 554 switch (keysym)
555 { 555 {
556#ifndef NO_BACKSPACE_KEY 556#ifndef NO_BACKSPACE_KEY
557 case XK_BackSpace: 557 case XK_BackSpace:
560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) 560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace)
561 ^ !!ctrl) ? '\b' : '\177'; 561 ^ !!ctrl) ? '\b' : '\177';
562 kbuf[1] = '\0'; 562 kbuf[1] = '\0';
563 } 563 }
564 else 564 else
565 strcpy (kbuf, key_backspace); 565 strcpy (kbuf, rs[Rs_backspace_key]);
566 break; 566 break;
567#endif 567#endif
568#ifndef NO_DELETE_KEY 568#ifndef NO_DELETE_KEY
569# ifdef XK_KP_Prior 569# ifdef XK_KP_Delete
570 case XK_KP_Delete: 570 case XK_KP_Delete:
571 /* allow shift to override */ 571 /* allow shift to override */
572 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 572 if (kp)
573 { 573 {
574 strcpy (kbuf, "\033On"); 574 strcpy (kbuf, "\033On");
575 break; 575 break;
576 } 576 }
577 /* FALLTHROUGH */ 577 /* FALLTHROUGH */
578# endif 578# endif
579 case XK_Delete: 579 case XK_Delete:
580 strcpy (kbuf, key_delete); 580 strcpy (kbuf, rs[Rs_delete_key]);
581 break; 581 break;
582#endif 582#endif
583 case XK_Tab: 583 case XK_Tab:
584 if (shft) 584 if (shft)
585 strcpy (kbuf, "\033[Z"); 585 strcpy (kbuf, "\033[Z");
600#ifdef XK_KP_Left 600#ifdef XK_KP_Left
601 case XK_KP_Up: /* \033Ox or standard */ 601 case XK_KP_Up: /* \033Ox or standard */
602 case XK_KP_Down: /* \033Or or standard */ 602 case XK_KP_Down: /* \033Or or standard */
603 case XK_KP_Right: /* \033Ov or standard */ 603 case XK_KP_Right: /* \033Ov or standard */
604 case XK_KP_Left: /* \033Ot or standard */ 604 case XK_KP_Left: /* \033Ot or standard */
605 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 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;
610 } 610 }
633 633
634#ifndef UNSHIFTED_SCROLLKEYS 634#ifndef UNSHIFTED_SCROLLKEYS
635# ifdef XK_KP_Prior 635# ifdef XK_KP_Prior
636 case XK_KP_Prior: 636 case XK_KP_Prior:
637 /* allow shift to override */ 637 /* allow shift to override */
638 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 638 if (kp)
639 { 639 {
640 strcpy (kbuf, "\033Oy"); 640 strcpy (kbuf, "\033Oy");
641 break; 641 break;
642 } 642 }
643 /* FALLTHROUGH */ 643 /* FALLTHROUGH */
646 strcpy (kbuf, "\033[5~"); 646 strcpy (kbuf, "\033[5~");
647 break; 647 break;
648# ifdef XK_KP_Next 648# ifdef XK_KP_Next
649 case XK_KP_Next: 649 case XK_KP_Next:
650 /* allow shift to override */ 650 /* allow shift to override */
651 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 651 if (kp)
652 { 652 {
653 strcpy (kbuf, "\033Os"); 653 strcpy (kbuf, "\033Os");
654 break; 654 break;
655 } 655 }
656 /* FALLTHROUGH */ 656 /* FALLTHROUGH */
659 strcpy (kbuf, "\033[6~"); 659 strcpy (kbuf, "\033[6~");
660 break; 660 break;
661#endif 661#endif
662 case XK_KP_Enter: 662 case XK_KP_Enter:
663 /* allow shift to override */ 663 /* allow shift to override */
664 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 664 if (kp)
665 { 665 {
666 strcpy (kbuf, "\033OM"); 666 strcpy (kbuf, "\033OM");
667 break; 667 break;
668 } 668 }
669 669
712 case XK_KP_6: /* "\033Ov" : "6" */ 712 case XK_KP_6: /* "\033Ov" : "6" */
713 case XK_KP_7: /* "\033Ow" : "7" */ 713 case XK_KP_7: /* "\033Ow" : "7" */
714 case XK_KP_8: /* "\033Ox" : "8" */ 714 case XK_KP_8: /* "\033Ox" : "8" */
715 case XK_KP_9: /* "\033Oy" : "9" */ 715 case XK_KP_9: /* "\033Oy" : "9" */
716 /* allow shift to override */ 716 /* allow shift to override */
717 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 717 if (kp)
718 { 718 {
719 strcpy (kbuf, "\033Oj"); 719 strcpy (kbuf, "\033Oj");
720 kbuf[2] += (keysym - XK_KP_Multiply); 720 kbuf[2] += (keysym - XK_KP_Multiply);
721 } 721 }
722 else 722 else
728 728
729 case XK_Find: 729 case XK_Find:
730 strcpy (kbuf, "\033[1~"); 730 strcpy (kbuf, "\033[1~");
731 break; 731 break;
732 732
733#ifdef XK_KP_End 733#ifdef XK_KP_Insert
734 case XK_KP_Insert: 734 case XK_KP_Insert:
735 /* allow shift to override */ 735 /* allow shift to override */
736 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 736 if (kp)
737 { 737 {
738 strcpy (kbuf, "\033Op"); 738 strcpy (kbuf, "\033Op");
739 break; 739 break;
740 } 740 }
741 /* FALLTHROUGH */ 741 /* FALLTHROUGH */
754 strcpy (kbuf, "\033[4~"); 754 strcpy (kbuf, "\033[4~");
755 break; 755 break;
756#ifdef XK_KP_End 756#ifdef XK_KP_End
757 case XK_KP_End: 757 case XK_KP_End:
758 /* allow shift to override */ 758 /* allow shift to override */
759 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 759 if (kp)
760 { 760 {
761 strcpy (kbuf, "\033Oq"); 761 strcpy (kbuf, "\033Oq");
762 break; 762 break;
763 } 763 }
764 /* FALLTHROUGH */ 764 /* FALLTHROUGH */
767 strcpy (kbuf, KS_END); 767 strcpy (kbuf, KS_END);
768 break; 768 break;
769#ifdef XK_KP_Home 769#ifdef XK_KP_Home
770 case XK_KP_Home: 770 case XK_KP_Home:
771 /* allow shift to override */ 771 /* allow shift to override */
772 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 772 if (kp)
773 { 773 {
774 strcpy (kbuf, "\033Ow"); 774 strcpy (kbuf, "\033Ow");
775 break; 775 break;
776 } 776 }
777 /* FALLTHROUGH */ 777 /* FALLTHROUGH */
934#if ENABLE_FRILLS || ISO_14755 934#if ENABLE_FRILLS || ISO_14755
935 // ISO 14755 support 935 // ISO 14755 support
936 if (iso14755buf) 936 if (iso14755buf)
937 if (iso14755buf & ISO_14755_52) 937 if (iso14755buf & ISO_14755_52)
938 { 938 {
939# if ENABLE_OVERLAY 939# if ISO_14755
940 scr_overlay_off (); 940 scr_overlay_off ();
941# endif 941# endif
942# if ISO_14755 942# if ISO_14755
943 // iso14755 part 5.2 handling: release time 943 // iso14755 part 5.2 handling: release time
944 // first: controls 944 // first: controls
967 967
968 return; 968 return;
969 } 969 }
970 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) 970 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask))
971 { 971 {
972# if ENABLE_OVERLAY 972# if ISO_14755
973 scr_overlay_off (); 973 scr_overlay_off ();
974# endif 974# endif
975 if (iso14755buf & ISO_14755_51) 975 if (iso14755buf & ISO_14755_51)
976 commit_iso14755 (); 976 commit_iso14755 ();
977#if ISO_14755 977#if ISO_14755
1034 1034
1035void 1035void
1036rxvt_term::flush () 1036rxvt_term::flush ()
1037{ 1037{
1038 flush_ev.stop (); 1038 flush_ev.stop ();
1039 1039
1040#ifdef TRANSPARENT 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)
1302void 1301void
1303rxvt_term::mouse_report (XButtonEvent &ev) 1302rxvt_term::mouse_report (XButtonEvent &ev)
1304{ 1303{
1305 int button_number, key_state = 0; 1304 int button_number, key_state = 0;
1306 int x, y; 1305 int x, y;
1306 int code = 32;
1307 1307
1308 x = ev.x; 1308 x = Pixel2Col (ev.x);
1309 y = ev.y; 1309 y = Pixel2Row (ev.y);
1310 pixel_position (&x, &y); 1310 if (ev.type == MotionNotify) {
1311 if (x == mouse_row && y == mouse_col)
1312 return;
1313 mouse_row = x;
1314 mouse_col = y;
1315 code += 32;
1316 }
1311 1317
1312 if (MEvent.button == AnyButton) 1318 if (MEvent.button == AnyButton)
1313 button_number = 3; 1319 button_number = 3;
1314 else 1320 else
1315 { 1321 {
1361 x + 1, 1367 x + 1,
1362 y + 1); 1368 y + 1);
1363#endif 1369#endif
1364 1370
1365 tt_printf ("\033[M%c%c%c", 1371 tt_printf ("\033[M%c%c%c",
1366 (32 + button_number + key_state), 1372 (code + button_number + key_state),
1367 (32 + x + 1), 1373 (32 + x + 1),
1368 (32 + y + 1)); 1374 (32 + y + 1));
1369} 1375}
1370 1376
1371/*{{{ process an X event */ 1377/*{{{ process an X event */
1433 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) 1439 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1434 focus_out (); 1440 focus_out ();
1435 } 1441 }
1436#endif 1442#endif
1437 } 1443 }
1438 break;
1439
1440 case MappingNotify:
1441 XRefreshKeyboardMapping (&ev.xmapping);
1442 break; 1444 break;
1443 1445
1444 /* 1446 /*
1445 * XXX: this is not the _current_ arrangement 1447 * XXX: this is not the _current_ arrangement
1446 * Here's my conclusion: 1448 * Here's my conclusion:
1479 && ev.xfocus.mode != NotifyGrab) 1481 && ev.xfocus.mode != NotifyGrab)
1480 focus_out (); 1482 focus_out ();
1481 break; 1483 break;
1482 1484
1483 case ConfigureNotify: 1485 case ConfigureNotify:
1486 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1487 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1488 szHint.width, szHint.height); */
1484 if (ev.xconfigure.window == parent[0]) 1489 if (ev.xconfigure.window == parent[0])
1485 { 1490 {
1486 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1491 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1487 ; 1492 ;
1488 1493
1489 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1494 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1490 { 1495 {
1491 seen_resize = 1; 1496 seen_resize = 1;
1492 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1497 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1493#ifdef XPM_BACKGROUND
1494 if (!option (Opt_transparent) && bgPixmap.auto_resize)
1495 {
1496 resize_pixmap ();
1497 scr_touch (true);
1498 }
1499#endif
1500 } 1498 }
1501 1499 else
1500 {
1501#ifdef HAVE_BG_PIXMAP
1502 if (bgPixmap.window_position_sensitive ())
1503 update_background ();
1504#endif
1505 }
1502 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1506 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1503
1504#ifdef TRANSPARENT
1505 if (option (Opt_transparent))
1506 check_our_parents ();
1507#endif
1508 } 1507 }
1509 break; 1508 break;
1510 1509
1511 case PropertyNotify: 1510 case PropertyNotify:
1512 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) 1511 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1543 text_blink_ev.stop (); 1542 text_blink_ev.stop ();
1544#endif 1543#endif
1545 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1544 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1546 break; 1545 break;
1547 1546
1548#ifdef TRANSPARENT
1549 case ReparentNotify:
1550 rootwin_cb (ev);
1551 break;
1552#endif /* TRANSPARENT */
1553
1554 case GraphicsExpose: 1547 case GraphicsExpose:
1555 case Expose: 1548 case Expose:
1556 if (ev.xany.window == vt) 1549 if (ev.xany.window == vt)
1557 { 1550 {
1558 do 1551 do
1552 {
1559 scr_expose (ev.xexpose.x, ev.xexpose.y, 1553 scr_expose (ev.xexpose.x, ev.xexpose.y,
1560 ev.xexpose.width, ev.xexpose.height, False); 1554 ev.xexpose.width, ev.xexpose.height, False);
1555 }
1561 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1556 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1562 1557
1563 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1558 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1564 1559
1565 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1560 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1561 {
1566 scr_expose (ev.xexpose.x, ev.xexpose.y, 1562 scr_expose (ev.xexpose.x, ev.xexpose.y,
1567 ev.xexpose.width, ev.xexpose.height, False); 1563 ev.xexpose.width, ev.xexpose.height, False);
1568 1564 }
1569 want_refresh = 1; 1565 want_refresh = 1;
1570 } 1566 }
1571 else 1567 else
1572 { 1568 {
1573 XEvent unused_event; 1569 XEvent unused_event;
1580 if (isScrollbarWindow (ev.xany.window)) 1576 if (isScrollbarWindow (ev.xany.window))
1581 { 1577 {
1582 scrollBar.setIdle (); 1578 scrollBar.setIdle ();
1583 scrollbar_show (0); 1579 scrollbar_show (0);
1584 } 1580 }
1585
1586#ifdef TRANSPARENT
1587 if (am_transparent && ev.xany.window == parent[0])
1588 XClearWindow (dpy, ev.xany.window);
1589#endif
1590 } 1581 }
1591 break; 1582 break;
1592 1583
1593 case MotionNotify: 1584 case MotionNotify:
1594#ifdef POINTER_BLANK 1585#ifdef POINTER_BLANK
1595 if (hidden_pointer) 1586 if (hidden_pointer)
1596 pointer_unblank (); 1587 pointer_unblank ();
1597#endif 1588#endif
1589 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1590 || priv_modes & PrivMode_MouseAnyEvent)
1591 mouse_report (ev.xbutton);
1598 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1592 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1599 break; 1593 break;
1600 1594
1601 if (ev.xany.window == vt) 1595 if (ev.xany.window == vt)
1602 { 1596 {
1756 } 1750 }
1757#endif 1751#endif
1758#if ENABLE_FRILLS 1752#if ENABLE_FRILLS
1759 if (option (Opt_urgentOnBell)) 1753 if (option (Opt_urgentOnBell))
1760 { 1754 {
1761 XWMHints *h;
1762
1763 h = XGetWMHints(dpy, parent[0]); 1755 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1764 if (h != NULL)
1765 { 1756 {
1766 h->flags &= ~XUrgencyHint; 1757 h->flags &= ~XUrgencyHint;
1767 XSetWMHints(dpy, parent[0], h); 1758 XSetWMHints (dpy, parent[0], h);
1768 } 1759 }
1769 } 1760 }
1770#endif 1761#endif
1771 } 1762 }
1772} 1763}
1783 1774
1784#if ENABLE_FRILLS || ISO_14755 1775#if ENABLE_FRILLS || ISO_14755
1785 if (iso14755buf) 1776 if (iso14755buf)
1786 { 1777 {
1787 iso14755buf = 0; 1778 iso14755buf = 0;
1788# if ENABLE_OVERLAY 1779# if ISO_14755
1789 scr_overlay_off (); 1780 scr_overlay_off ();
1790# endif 1781# endif
1791 } 1782 }
1792#endif 1783#endif
1793#if USE_XIM 1784#if USE_XIM
1820 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);
1821 } 1812 }
1822#endif 1813#endif
1823} 1814}
1824 1815
1825#if TRANSPARENT || ENABLE_PERL 1816#if ENABLE_TRANSPARENCY || ENABLE_PERL
1826void 1817void
1827rxvt_term::rootwin_cb (XEvent &ev) 1818rxvt_term::rootwin_cb (XEvent &ev)
1828{ 1819{
1829 make_current (); 1820 make_current ();
1830 1821
1831 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1822 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1832 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1823 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1833 return; 1824 return;
1834 1825
1835# if TRANSPARENT 1826# if ENABLE_TRANSPARENCY
1836 switch (ev.type) 1827 switch (ev.type)
1837 { 1828 {
1838 case PropertyNotify: 1829 case PropertyNotify:
1839 /* 1830 /*
1840 * 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,
1841 * 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.
1842 */ 1833 */
1843 if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] 1834 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1844 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1835 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1845 return; 1836 {
1846 1837 bgPixmap.set_root_pixmap ();
1847 /* FALLTHROUGH */ 1838 update_background ();
1848 case ReparentNotify: 1839 }
1849 if (option (Opt_transparent))
1850 check_our_parents ();
1851 break; 1840 break;
1852 } 1841 }
1853# endif 1842# endif
1854} 1843}
1855#endif 1844#endif
2574 process_dcs_seq (); 2563 process_dcs_seq ();
2575 break; 2564 break;
2576 case 0x9b: /* CSI */ 2565 case 0x9b: /* CSI */
2577 process_csi_seq (); 2566 process_csi_seq ();
2578 break; 2567 break;
2579 case 0x9d: /* CSI */ 2568 case 0x9d: /* OSC */
2580 process_osc_seq (); 2569 process_osc_seq ();
2581 break; 2570 break;
2582#endif 2571#endif
2583 } 2572 }
2584} 2573}
2810rxvt_term::process_csi_seq () 2799rxvt_term::process_csi_seq ()
2811{ 2800{
2812 unicode_t ch, priv, i; 2801 unicode_t ch, priv, i;
2813 unsigned int nargs, p; 2802 unsigned int nargs, p;
2814 int n, ndef; 2803 int n, ndef;
2815 int arg[ESC_ARGS]; 2804 int arg[ESC_ARGS] = { };
2816 2805
2817 for (nargs = ESC_ARGS; nargs > 0;) 2806 nargs = 0;
2818 arg[--nargs] = 0;
2819 2807
2820 priv = 0; 2808 priv = 0;
2821 ch = cmd_getc (); 2809 ch = cmd_getc ();
2822 if (ch >= '<' && ch <= '?') 2810 if (ch >= '<' && ch <= '?')
2823 { /* '<' '=' '>' '?' */ 2811 { /* '<' '=' '>' '?' */
2867 switch (priv) 2855 switch (priv)
2868 { 2856 {
2869 case '>': 2857 case '>':
2870 if (ch == CSI_DA) /* secondary device attributes */ 2858 if (ch == CSI_DA) /* secondary device attributes */
2871 { 2859 {
2872 // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, 2860 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2873 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2861 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2874 // 2862 //
2875 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2863 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2876 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2864 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2877 // that we do not support xterm mouse reporting (should be 95 when we do). 2865 // versions.
2878 // 2866 //
2879 tt_printf ("\033[>%d;94;0c", 'U'); 2867 tt_printf ("\033[>%d;95;0c", 'U');
2880 } 2868 }
2881 break; 2869 break;
2882 case '?': 2870 case '?':
2883 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2871 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2884 process_terminal_mode (ch, priv, nargs, arg); 2872 process_terminal_mode (ch, priv, nargs, arg);
3435 break; 3423 break;
3436 case URxvt_Color_IT: 3424 case URxvt_Color_IT:
3437 process_color_seq (op, Color_IT, str, resp); 3425 process_color_seq (op, Color_IT, str, resp);
3438 break; 3426 break;
3439#endif 3427#endif
3440#if TRANSPARENT && TINTING 3428#if ENABLE_TRANSPARENCY
3441 case URxvt_Color_tint: 3429 case URxvt_Color_tint:
3442 process_color_seq (op, Color_tint, str, resp); 3430 process_color_seq (op, Color_tint, str, resp);
3431 {
3432 bool changed = false;
3433 if (ISSET_PIXCOLOR (Color_tint))
3434 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3435 else
3436 changed = bgPixmap.unset_tint ();
3437 if (changed)
3438 update_background ();
3439 }
3443 3440
3444 check_our_parents ();
3445
3446 if (am_transparent)
3447 want_full_refresh = want_refresh = 1;
3448
3449 break; 3441 break;
3450#endif 3442#endif
3451 3443
3444#if BG_IMAGE_FROM_FILE
3452 case Rxvt_Pixmap: 3445 case Rxvt_Pixmap:
3453 { 3446 if (!strcmp (str, "?"))
3454 if (*str != ';')
3455 { 3447 {
3456#if XPM_BACKGROUND 3448 char str[256];
3457 scale_pixmap (""); /* reset to default scaling */ 3449
3458 set_bgPixmap (str); /* change pixmap */ 3450 sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */
3459 scr_touch (true); 3451 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
3460#endif 3452 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
3453 process_xterm_seq (XTerm_title, str, CHAR_ST);
3461 } 3454 }
3462 3455 else
3456 {
3463 int changed = 0; 3457 int changed = 0;
3464 3458
3465 while ((str = strchr (str, ';')) != NULL) 3459 if (*str != ';')
3466 { 3460 {
3461 /* reset to default scaling :*/
3462 bgPixmap.unset_geometry ();
3463 if (bgPixmap.set_file (str)) /* change pixmap */
3464 changed++;
3465 str = strchr (str, ';');
3466 if (str == NULL)
3467 bgPixmap.set_defaultGeometry ();
3468 }
3469 while (str)
3470 {
3467 str++; 3471 str++;
3468#if XPM_BACKGROUND 3472 if (bgPixmap.set_geometry (str))
3469 changed += scale_pixmap (str); 3473 changed++;
3470#endif 3474 str = strchr (str, ';');
3471 } 3475 }
3472
3473 if (changed) 3476 if (changed)
3474 { 3477 update_background ();
3475#ifdef XPM_BACKGROUND
3476 resize_pixmap ();
3477 scr_touch (true);
3478#endif
3479 } 3478 }
3480#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
3481 if (option (Opt_transparent))
3482 check_our_parents ();
3483#endif
3484 }
3485 break; 3479 break;
3480#endif
3486 3481
3487 case Rxvt_restoreFG: 3482 case Rxvt_restoreFG:
3488 set_window_color (Color_fg, str); 3483 set_window_color (Color_fg, str);
3489 break; 3484 break;
3490 case Rxvt_restoreBG: 3485 case Rxvt_restoreBG:
3612{ 3607{
3613 unsigned int i, j; 3608 unsigned int i, j;
3614 int state; 3609 int state;
3615 3610
3616 static const struct 3611 static const struct
3617 { 3612 {
3618 const int argval; 3613 const int argval;
3619 const unsigned long bit; 3614 const unsigned long bit;
3620 }
3621
3622 argtopriv[] = { 3615 } argtopriv[] = {
3623 { 1, PrivMode_aplCUR }, 3616 { 1, PrivMode_aplCUR },
3624 { 2, PrivMode_vt52 }, 3617 { 2, PrivMode_vt52 },
3625 { 3, PrivMode_132 }, 3618 { 3, PrivMode_132 },
3626 { 4, PrivMode_smoothScroll }, 3619 { 4, PrivMode_smoothScroll },
3627 { 5, PrivMode_rVideo }, 3620 { 5, PrivMode_rVideo },
3644#ifndef NO_BACKSPACE_KEY 3637#ifndef NO_BACKSPACE_KEY
3645 { 67, PrivMode_BackSpace }, 3638 { 67, PrivMode_BackSpace },
3646#endif 3639#endif
3647 { 1000, PrivMode_MouseX11 }, 3640 { 1000, PrivMode_MouseX11 },
3648 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3641 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3649 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3642 { 1002, PrivMode_MouseBtnEvent },
3650 // 1003 Use All Motion Mouse Tracking. NYI, TODO 3643 { 1003, PrivMode_MouseAnyEvent },
3651 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3644 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3652 { 1011, PrivMode_Keypress }, // rxvt extension 3645 { 1011, PrivMode_Keypress }, // rxvt extension
3653 // 1035 enable modifiers for alt, numlock NYI 3646 // 1035 enable modifiers for alt, numlock NYI
3654 // 1036 send ESC for meta keys NYI 3647 // 1036 send ESC for meta keys NYI
3655 // 1037 send DEL for keypad delete NYI 3648 // 1037 send DEL for keypad delete NYI
3729 scr_autowrap (state); 3722 scr_autowrap (state);
3730 break; 3723 break;
3731 /* case 8: - auto repeat, can't do on a per window basis */ 3724 /* case 8: - auto repeat, can't do on a per window basis */
3732 case 9: /* X10 mouse reporting */ 3725 case 9: /* X10 mouse reporting */
3733 if (state) /* orthogonal */ 3726 if (state) /* orthogonal */
3734 priv_modes &= ~PrivMode_MouseX11; 3727 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3735 break; 3728 break;
3736#ifdef scrollBar_esc 3729#ifdef scrollBar_esc
3737 case scrollBar_esc: 3730 case scrollBar_esc:
3738 if (scrollbar_mapping (state)) 3731 if (scrollbar_mapping (state))
3739 { 3732 {
3752 break; 3745 break;
3753 /* case 66: - application key pad */ 3746 /* case 66: - application key pad */
3754 /* case 67: - backspace key */ 3747 /* case 67: - backspace key */
3755 case 1000: /* X11 mouse reporting */ 3748 case 1000: /* X11 mouse reporting */
3756 if (state) /* orthogonal */ 3749 if (state) /* orthogonal */
3757 priv_modes &= ~PrivMode_MouseX10; 3750 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3758 break; 3751 break;
3759#if 0 3752#if 0
3760 case 1001: 3753 case 1001:
3761 break; /* X11 mouse highlighting */ 3754 break; /* X11 mouse highlighting */
3762#endif 3755#endif
3756 case 1002:
3757 case 1003:
3758 if (state) {
3759 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3760 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3761 vt_emask_mouse = PointerMotionMask;
3762 } else
3763 vt_emask_mouse = NoEventMask;
3764 vt_select_input ();
3765 break;
3763 case 1010: /* scroll to bottom on TTY output inhibit */ 3766 case 1010: /* scroll to bottom on TTY output inhibit */
3764 set_option (Opt_scrollTtyOutput, !state); 3767 set_option (Opt_scrollTtyOutput, !state);
3765 break; 3768 break;
3766 case 1011: /* scroll to bottom on key press */ 3769 case 1011: /* scroll to bottom on key press */
3767 set_option (Opt_scrollTtyKeypress, state); 3770 set_option (Opt_scrollTtyKeypress, state);
4019 4022
4020 if (v_buflen == 0) 4023 if (v_buflen == 0)
4021 { 4024 {
4022 free (v_buffer); 4025 free (v_buffer);
4023 v_buffer = 0; 4026 v_buffer = 0;
4024 v_buflen = 0;
4025 4027
4026 pty_ev.set (EVENT_READ); 4028 pty_ev.set (EVENT_READ);
4027 return; 4029 return;
4028 } 4030 }
4029 4031

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines