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.95 by pcg, Sun May 9 18:19:49 2004 UTC vs.
Revision 1.116 by root, Wed Aug 4 03:29:28 2004 UTC

675 IMSendSpot (); 675 IMSendSpot ();
676#endif 676#endif
677 } 677 }
678 678
679 display->flush (); 679 display->flush ();
680
681 flush_ev.stop ();
680} 682}
681 683
682void 684void
683rxvt_term::check_cb (check_watcher &w) 685rxvt_term::check_cb (check_watcher &w)
684{ 686{
685 SET_R (this); 687 SET_R (this);
686 SET_LOCALE (locale); 688 SET_LOCALE (locale);
687 689
690 display->flush ();
691
692 if (!flush_ev.active)
693 flush_ev.start (NOW + 0.01);
694}
695
696void
697rxvt_term::flush_cb (time_watcher &w)
698{
699 SET_R (this);
700 SET_LOCALE (locale);
701
702 refresh_limit = 1;
703 refresh_count = 0;
688 flush (); 704 flush ();
689} 705}
690 706
691#ifdef CURSOR_BLINK 707#ifdef CURSOR_BLINK
692void 708void
706 if (scr_refresh_rend (RS_Blink, RS_Blink)) 722 if (scr_refresh_rend (RS_Blink, RS_Blink))
707 { 723 {
708 hidden_text = !hidden_text; 724 hidden_text = !hidden_text;
709 want_refresh = 1; 725 want_refresh = 1;
710 w.start (w.at + TEXT_BLINK_INTERVAL); 726 w.start (w.at + TEXT_BLINK_INTERVAL);
727 }
728}
729#endif
730
731#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
732void
733rxvt_term::cont_scroll_cb (time_watcher &w)
734{
735 if ((scrollbar_isUp() || scrollbar_isDn()) &&
736 scr_page (scrollbar_isUp() ? UP : DN, 1))
737 {
738 refresh_type |= SMOOTH_REFRESH;
739 want_refresh = 1;
740 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
741 }
742}
743#endif
744
745#ifdef SELECTION_SCROLLING
746void
747rxvt_term::sel_scroll_cb (time_watcher &w)
748{
749 if (scr_page (scroll_selection_dir, scroll_selection_lines))
750 {
751 selection_extend (selection_save_x, selection_save_y, selection_save_state);
752 refresh_type |= SMOOTH_REFRESH;
753 want_refresh = 1;
754 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
755 }
756}
757#endif
758
759#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
760void
761rxvt_term::slip_wheel_cb (time_watcher &w)
762{
763 if (mouse_slip_wheel_speed == 0
764 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
765 : scr_page (UP, mouse_slip_wheel_speed))
766 {
767 refresh_type |= SMOOTH_REFRESH;
768 want_refresh = 1;
769 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
711 } 770 }
712} 771}
713#endif 772#endif
714 773
715bool 774bool
753 while (pty_fill ()) 812 while (pty_fill ())
754 if (cmd_parse ()) 813 if (cmd_parse ())
755 break; 814 break;
756} 815}
757 816
758#ifdef POINTER_BLANK
759void 817void
760rxvt_term::pointer_unblank () 818rxvt_term::pointer_unblank ()
761{ 819{
762 XDefineCursor (display->display, TermWin.vt, TermWin_cursor); 820 XDefineCursor (display->display, TermWin.vt, TermWin_cursor);
763 recolour_cursor (); 821 recolour_cursor ();
764 822
823#ifdef POINTER_BLANK
765 hidden_pointer = 0; 824 hidden_pointer = 0;
766 825
767 if (Options & Opt_pointerBlank) 826 if (Options & Opt_pointerBlank)
768 pointer_ev.start (NOW + pointerBlankDelay); 827 pointer_ev.start (NOW + pointerBlankDelay);
828#endif
769} 829}
770 830
831#ifdef POINTER_BLANK
771void 832void
772rxvt_term::pointer_blank () 833rxvt_term::pointer_blank ()
773{ 834{
774 if (! (Options & Opt_pointerBlank)) 835 if (! (Options & Opt_pointerBlank))
775 return; 836 return;
971 break; 1032 break;
972 1033
973#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1034#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
974 case KeyRelease: 1035 case KeyRelease:
975 { 1036 {
976 if (! (ev.xkey.state & ControlMask)) 1037 if (!(ev.xkey.state & ControlMask))
977 mouse_slip_wheel_speed = 0; 1038 slip_wheel_ev.stop ();
978 else 1039 else
979 { 1040 {
980 KeySym ks; 1041 KeySym ks;
981 1042
982 ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); 1043 ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0);
983 if (ks == XK_Control_L || ks == XK_Control_R) 1044 if (ks == XK_Control_L || ks == XK_Control_R)
984 mouse_slip_wheel_speed = 0; 1045 mouse_slip_wheel_speed = 0;
985 } 1046 }
1029 } 1090 }
1030#endif /* OFFIX_DND */ 1091#endif /* OFFIX_DND */
1031 break; 1092 break;
1032 1093
1033 case MappingNotify: 1094 case MappingNotify:
1034 XRefreshKeyboardMapping (& (ev.xmapping)); 1095 XRefreshKeyboardMapping (&ev.xmapping);
1035 break; 1096 break;
1036 1097
1037 /* 1098 /*
1038 * XXX: this is not the _current_ arrangement 1099 * XXX: this is not the _current_ arrangement
1039 * Here's my conclusion: 1100 * Here's my conclusion:
1070#endif 1131#endif
1071#ifdef CURSOR_BLINK 1132#ifdef CURSOR_BLINK
1072 if (Options & Opt_cursorBlink) 1133 if (Options & Opt_cursorBlink)
1073 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1134 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1074#endif 1135#endif
1136#ifdef OFF_FOCUS_FADING
1137 if (rs[Rs_fade])
1138 {
1139 PixColors = PixColorsFocused;
1140 set_colorfgbg ();
1141 scr_clear ();
1142 scr_touch (true);
1143 }
1144#endif
1075 1145
1076 } 1146 }
1077 break; 1147 break;
1078 1148
1079 case FocusOut: 1149 case FocusOut:
1088#ifdef CURSOR_BLINK 1158#ifdef CURSOR_BLINK
1089 if (Options & Opt_cursorBlink) 1159 if (Options & Opt_cursorBlink)
1090 cursor_blink_ev.stop (); 1160 cursor_blink_ev.stop ();
1091 hidden_cursor = 0; 1161 hidden_cursor = 0;
1092#endif 1162#endif
1163#ifdef OFF_FOCUS_FADING
1164 if (rs[Rs_fade])
1165 {
1166 PixColors = PixColorsUnFocused;
1167 set_colorfgbg ();
1168 scr_clear ();
1169 scr_touch (true);
1170 }
1171#endif
1093 1172
1094 } 1173 }
1095 break; 1174 break;
1096 1175
1097 case ConfigureNotify: 1176 case ConfigureNotify:
1106 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); 1185 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
1107 } 1186 }
1108 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); 1187 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));
1109 1188
1110 if (szHint.width != width || szHint.height != height) 1189 if (szHint.width != width || szHint.height != height)
1111 {
1112 D_SIZE ((stderr, "Size: Resizing from: %4d x %4d", szHint.width, szHint.height));
1113 resize_all_windows (width, height, 1); 1190 resize_all_windows (width, height, 1);
1114 } 1191
1115#ifdef DEBUG_SIZE
1116 else
1117 {
1118 D_SIZE ((stderr, "Size: Not resizing"));
1119 }
1120#endif
1121#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1192#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1122 if (Options & Opt_transparent) 1193 if (Options & Opt_transparent)
1123 { 1194 {
1124 check_our_parents (); 1195 check_our_parents ();
1125 if (am_transparent) 1196 if (am_transparent)
1165 1236
1166 case GraphicsExpose: 1237 case GraphicsExpose:
1167 case Expose: 1238 case Expose:
1168 if (ev.xany.window == TermWin.vt) 1239 if (ev.xany.window == TermWin.vt)
1169 { 1240 {
1170#ifdef NO_SLOW_LINK_SUPPORT 1241 do
1171 scr_expose (ev.xexpose.x, ev.xexpose.y, 1242 scr_expose (ev.xexpose.x, ev.xexpose.y,
1172 ev.xexpose.width, ev.xexpose.height, False); 1243 ev.xexpose.width, ev.xexpose.height, False);
1173#else 1244 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev));
1174 // I don't understand this, so I changed it :) 1245
1246 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1247
1248 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev))
1175 scr_expose (ev.xexpose.x, ev.xexpose.y, 1249 scr_expose (ev.xexpose.x, ev.xexpose.y,
1176 ev.xexpose.width, ev.xexpose.height, False); 1250 ev.xexpose.width, ev.xexpose.height, False);
1177 //scr_expose (ev.xexpose.x, 0, 1251
1178 // ev.xexpose.width, TermWin.height, False); 1252 scr_refresh (refresh_type);
1179#endif
1180 want_refresh = 1;
1181 } 1253 }
1182 else 1254 else
1183 { 1255 {
1184 XEvent unused_event; 1256 XEvent unused_event;
1185 1257
1194 scrollbar_show (0); 1266 scrollbar_show (0);
1195 } 1267 }
1196#ifdef MENUBAR 1268#ifdef MENUBAR
1197 if (menubar_visible () && isMenuBarWindow (ev.xany.window)) 1269 if (menubar_visible () && isMenuBarWindow (ev.xany.window))
1198 menubar_expose (); 1270 menubar_expose ();
1271#endif
1272
1273#ifdef TRANSPARENT
1274 if (am_transparent && ev.xany.window == TermWin.parent[0])
1275 XClearWindow (display->display, ev.xany.window);
1199#endif 1276#endif
1200 } 1277 }
1201 break; 1278 break;
1202 1279
1203 case MotionNotify: 1280 case MotionNotify:
1238 if (ev.xbutton.y < TermWin.int_bwidth 1315 if (ev.xbutton.y < TermWin.int_bwidth
1239 || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) 1316 || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1))
1240 { 1317 {
1241 int dist; 1318 int dist;
1242 1319
1243 pending_scroll_selection=1;
1244
1245 /* don't clobber the current delay if we are 1320 /* don't clobber the current delay if we are
1246 * already in the middle of scrolling. 1321 * already in the middle of scrolling.
1247 */ 1322 */
1248 if (scroll_selection_delay<=0) 1323 if (!sel_scroll_ev.active)
1249 scroll_selection_delay=SCROLLBAR_CONTINUOUS_DELAY; 1324 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY);
1250 1325
1251 /* save the event params so we can highlight 1326 /* save the event params so we can highlight
1252 * the selection in the pending-scroll loop 1327 * the selection in the pending-scroll loop
1253 */ 1328 */
1254 selection_save_x=ev.xbutton.x; 1329 selection_save_x=ev.xbutton.x;
1276 else 1351 else
1277 { 1352 {
1278 /* we are within the text window, so we 1353 /* we are within the text window, so we
1279 * shouldn't be scrolling 1354 * shouldn't be scrolling
1280 */ 1355 */
1281 pending_scroll_selection = 0; 1356 if (sel_scroll_ev.active)
1357 sel_scroll_ev.stop();
1282 } 1358 }
1283#endif 1359#endif
1284#ifdef MOUSE_THRESHOLD 1360#ifdef MOUSE_THRESHOLD
1285 1361
1286 } 1362 }
1503 upordown = 1; /* down */ 1579 upordown = 1; /* down */
1504 } 1580 }
1505 if (upordown) 1581 if (upordown)
1506 { 1582 {
1507#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1583#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1508 scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY; 1584 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY);
1509#endif 1585#endif
1510 if (scr_page (upordown < 0 ? UP : DN, 1)) 1586 if (scr_page (upordown < 0 ? UP : DN, 1))
1511 { 1587 {
1512 if (upordown < 0) 1588 if (upordown < 0)
1513 scrollBar.setUp (); 1589 scrollBar.setUp ();
1600 refresh_type &= ~SMOOTH_REFRESH; 1676 refresh_type &= ~SMOOTH_REFRESH;
1601#endif 1677#endif
1602 1678
1603 } 1679 }
1604#ifdef SELECTION_SCROLLING 1680#ifdef SELECTION_SCROLLING
1605 pending_scroll_selection=0; 1681 if (sel_scroll_ev.active)
1682 sel_scroll_ev.stop();
1606#endif 1683#endif
1607 if (ev.window == TermWin.vt) 1684 if (ev.window == TermWin.vt)
1608 { 1685 {
1609 if (reportmode) 1686 if (reportmode)
1610 { 1687 {
1652 case Button5: 1729 case Button5:
1653 { 1730 {
1654 int i; 1731 int i;
1655 page_dirn v; 1732 page_dirn v;
1656 1733
1657 v = (ev.button == Button4) ? UP : DN; 1734 v = ev.button == Button4 ? UP : DN;
1735
1658 if (ev.state & ShiftMask) 1736 if (ev.state & ShiftMask)
1659 i = 1; 1737 i = 1;
1660 else if ((Options & Opt_mouseWheelScrollPage)) 1738 else if (Options & Opt_mouseWheelScrollPage)
1661 i = TermWin.nrow - 1; 1739 i = TermWin.nrow - 1;
1662 else 1740 else
1663 i = 5; 1741 i = 5;
1742
1664# ifdef MOUSE_SLIP_WHEELING 1743# ifdef MOUSE_SLIP_WHEELING
1665 if (ev.state & ControlMask) 1744 if (ev.state & ControlMask)
1666 { 1745 {
1667 mouse_slip_wheel_speed += (v ? -1 : 1); 1746 mouse_slip_wheel_speed += v ? -1 : 1;
1747 if (mouse_slip_wheel_speed < -TermWin.nrow) mouse_slip_wheel_speed = -TermWin.nrow;
1748 if (mouse_slip_wheel_speed > +TermWin.nrow) mouse_slip_wheel_speed = +TermWin.nrow;
1749
1750 if (slip_wheel_ev.at < NOW)
1668 mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; 1751 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
1752
1753 slip_wheel_ev.start ();
1669 } 1754 }
1755 else
1756 {
1670# endif 1757# endif
1671# ifdef JUMP_MOUSE_WHEEL 1758# ifdef JUMP_MOUSE_WHEEL
1672 scr_page (v, i);
1673 scr_refresh (SMOOTH_REFRESH);
1674 scrollbar_show (1);
1675# else
1676 while (i--)
1677 {
1678 scr_page (v, 1); 1759 scr_page (v, i);
1679 scr_refresh (SMOOTH_REFRESH); 1760 scr_refresh (SMOOTH_REFRESH);
1680 scrollbar_show (1); 1761 scrollbar_show (1);
1762# else
1763 while (i--)
1764 {
1765 scr_page (v, 1);
1766 scr_refresh (SMOOTH_REFRESH);
1767 scrollbar_show (1);
1768 }
1769# endif
1770# ifdef MOUSE_SLIP_WHEELING
1681 } 1771 }
1682# endif 1772#endif
1683
1684 } 1773 }
1685 break; 1774 break;
1686#endif 1775#endif
1687
1688 } 1776 }
1689 } 1777 }
1690#ifdef MENUBAR 1778#ifdef MENUBAR
1691 else if (isMenuBarWindow (ev.window)) 1779 else if (isMenuBarWindow (ev.window))
1692 menubar_control (ev); 1780 menubar_control (ev);
1693#endif 1781#endif
1694} 1782}
1695 1783
1696#ifdef TRANSPARENT 1784#ifdef TRANSPARENT
1697#if TINTING 1785#if TINTING
1698/* shading taken from eterm-0.9.2 */ 1786/* taken from aterm-0.4.2 */
1699/* RGB 15 */
1700 1787
1701static void 1788typedef uint32_t RUINT32T;
1702shade_ximage_15(void *data, int bpl, int w, int h, int rm, int gm, int bm)
1703{
1704 unsigned char *ptr;
1705 int x, y;
1706 1789
1707 ptr = (unsigned char *)data + (w * sizeof(uint16_t)); 1790void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm)
1708 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { 1791{
1709 /* No saturation */ 1792 int sh_r, sh_g, sh_b;
1710 for (y = h; --y >= 0;) { 1793 RUINT32T mask_r, mask_g, mask_b;
1711 for (x = -w; x < 0; x++) { 1794 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
1712 int r, g, b; 1795 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
1796 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
1797 int i;
1713 1798
1714 b = ((uint16_t *) ptr)[x]; 1799 Visual* visual = display->visual;
1715 r = (b & 0x7c00) * rm; 1800
1716 g = (b & 0x3e0) * gm; 1801 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
1717 b = (b & 0x1f) * bm; 1802
1718 ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00) 1803 /* for convenience */
1719 | ((g >> 8) & 0x3e0) 1804 mask_r = visual->red_mask;
1720 | ((b >> 8) & 0x1f); 1805 mask_g = visual->green_mask;
1721 } 1806 mask_b = visual->blue_mask;
1722 ptr += bpl; 1807
1723 } 1808 /* boring lookup table pre-initialization */
1809 switch (srcImage->bits_per_pixel) {
1810 case 15:
1811 if ((mask_r != 0x7c00) ||
1812 (mask_g != 0x03e0) ||
1813 (mask_b != 0x001f))
1814 return;
1815 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32));
1816 lookup_r = lookup;
1817 lookup_g = lookup+32;
1818 lookup_b = lookup+32+32;
1819 sh_r = 10;
1820 sh_g = 5;
1821 sh_b = 0;
1822 break;
1823 case 16:
1824 if ((mask_r != 0xf800) ||
1825 (mask_g != 0x07e0) ||
1826 (mask_b != 0x001f))
1827 return;
1828 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32));
1829 lookup_r = lookup;
1830 lookup_g = lookup+32;
1831 lookup_b = lookup+32+64;
1832 sh_r = 11;
1833 sh_g = 5;
1834 sh_b = 0;
1835 break;
1836 case 24:
1837 if ((mask_r != 0xff0000) ||
1838 (mask_g != 0x00ff00) ||
1839 (mask_b != 0x0000ff))
1840 return;
1841 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
1842 lookup_r = lookup;
1843 lookup_g = lookup+256;
1844 lookup_b = lookup+256+256;
1845 sh_r = 16;
1846 sh_g = 8;
1847 sh_b = 0;
1848 break;
1849 case 32:
1850 if ((mask_r != 0xff0000) ||
1851 (mask_g != 0x00ff00) ||
1852 (mask_b != 0x0000ff))
1853 return;
1854 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
1855 lookup_r = lookup;
1856 lookup_g = lookup+256;
1857 lookup_b = lookup+256+256;
1858 sh_r = 16;
1859 sh_g = 8;
1860 sh_b = 0;
1861 break;
1862 default:
1863 return; /* we do not support this color depth */
1864 }
1865
1866 /* prepare limits for color transformation (each channel is handled separately) */
1867 if (shade < 0) {
1868 shade = -shade;
1869 if (shade < 0) shade = 0;
1870 if (shade > 100) shade = 100;
1871
1872 lower_lim_r = 65535-rm;
1873 lower_lim_g = 65535-gm;
1874 lower_lim_b = 65535-bm;
1875
1876 lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100);
1877 lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100);
1878 lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100);
1879
1880 upper_lim_r = upper_lim_g = upper_lim_b = 65535;
1724 } else { 1881 } else {
1725 for (y = h; --y >= 0;) { 1882 if (shade < 0) shade = 0;
1726 for (x = -w; x < 0; x++) { 1883 if (shade > 100) shade = 100;
1727 int r, g, b;
1728 1884
1729 b = ((uint16_t *) ptr)[x]; 1885 lower_lim_r = lower_lim_g = lower_lim_b = 0;
1730 r = (b & 0x7c00) * rm; 1886
1731 g = (b & 0x3e0) * gm; 1887 upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100);
1732 b = (b & 0x1f) * bm; 1888 upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100);
1733 r |= (!(r >> 15) - 1); 1889 upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100);
1734 g |= (!(g >> 10) - 1); 1890 }
1735 b |= (!(b >> 5) - 1); 1891
1736 ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00) 1892 /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */
1737 | ((g >> 8) & 0x3e0) 1893 if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 ))
1738 | ((b >> 8) & 0x1f); 1894 {
1739 } 1895 unsigned int tmp;
1740 ptr += bpl; 1896
1897 tmp = lower_lim_r;
1898 lower_lim_r = lower_lim_b;
1899 lower_lim_b = tmp;
1900
1901 tmp = upper_lim_r;
1902 upper_lim_r = upper_lim_b;
1903 upper_lim_b = tmp;
1904 }
1905
1906 /* fill our lookup tables */
1907 for (i = 0; i <= mask_r>>sh_r; i++)
1908 {
1909 RUINT32T tmp;
1910 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r));
1911 tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r);
1912 lookup_r[i] = (tmp/65535)<<sh_r;
1913 }
1914 for (i = 0; i <= mask_g>>sh_g; i++)
1915 {
1916 RUINT32T tmp;
1917 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g));
1918 tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g);
1919 lookup_g[i] = (tmp/65535)<<sh_g;
1920 }
1921 for (i = 0; i <= mask_b>>sh_b; i++)
1922 {
1923 RUINT32T tmp;
1924 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b));
1925 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
1926 lookup_b[i] = (tmp/65535)<<sh_b;
1927 }
1928
1929 /* apply table to input image (replacing colors by newly calculated ones) */
1930 switch (srcImage->bits_per_pixel)
1931 {
1932 case 15:
1933 {
1934 unsigned short *p1, *pf, *p, *pl;
1935 p1 = (unsigned short *) srcImage->data;
1936 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1937 while (p1 < pf)
1938 {
1939 p = p1;
1940 pl = p1 + srcImage->width;
1941 for (; p < pl; p++)
1741 } 1942 {
1943 *p = lookup_r[(*p & 0x7c00)>>10] |
1944 lookup_g[(*p & 0x03e0)>> 5] |
1945 lookup_b[(*p & 0x001f)];
1946 }
1947 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
1742 } 1948 }
1743} 1949 break;
1744 1950 }
1745/* RGB 16 */ 1951 case 16:
1746static void 1952 {
1747shade_ximage_16(void *data, int bpl, int w, int h, int rm, int gm, int bm) 1953 unsigned short *p1, *pf, *p, *pl;
1748{ 1954 p1 = (unsigned short *) srcImage->data;
1749 unsigned char *ptr; 1955 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1750 int x, y; 1956 while (p1 < pf)
1751 1957 {
1752 ptr = (unsigned char *)data + (w * sizeof(uint16_t)); 1958 p = p1;
1753 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { 1959 pl = p1 + srcImage->width;
1754 /* No saturation */ 1960 for (; p < pl; p++)
1755 for (y = h; --y >= 0;) {
1756 for (x = -w; x < 0; x++) {
1757 int r, g, b;
1758
1759 b = ((uint16_t *) ptr)[x];
1760 r = (b & 0xf800) * rm;
1761 g = (b & 0x7e0) * gm;
1762 b = (b & 0x1f) * bm;
1763 ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
1764 | ((g >> 8) & 0x7e0)
1765 | ((b >> 8) & 0x1f);
1766 }
1767 ptr += bpl;
1768 } 1961 {
1769 } else { 1962 *p = lookup_r[(*p & 0xf800)>>11] |
1770 for (y = h; --y >= 0;) { 1963 lookup_g[(*p & 0x07e0)>> 5] |
1771 for (x = -w; x < 0; x++) { 1964 lookup_b[(*p & 0x001f)];
1772 int r, g, b;
1773
1774 b = ((uint16_t *) ptr)[x];
1775 r = (b & 0xf800) * rm;
1776 g = (b & 0x7e0) * gm;
1777 b = (b & 0x1f) * bm;
1778 r |= (!(r >> 16) - 1);
1779 g |= (!(g >> 11) - 1);
1780 b |= (!(b >> 5) - 1);
1781 ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
1782 | ((g >> 8) & 0x7e0)
1783 | ((b >> 8) & 0x1f);
1784 } 1965 }
1785 ptr += bpl; 1966 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
1967 }
1968 break;
1969 }
1970 case 24:
1971 {
1972 unsigned char *p1, *pf, *p, *pl;
1973 p1 = (unsigned char *) srcImage->data;
1974 pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1975 while (p1 < pf)
1976 {
1977 p = p1;
1978 pl = p1 + srcImage->width * 3;
1979 for (; p < pl; p += 3)
1786 } 1980 {
1981 p[0] = lookup_r[(p[0] & 0xff0000)>>16];
1982 p[1] = lookup_r[(p[1] & 0x00ff00)>> 8];
1983 p[2] = lookup_r[(p[2] & 0x0000ff)];
1984 }
1985 p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line);
1787 } 1986 }
1788} 1987 break;
1988 }
1989 case 32:
1990 {
1991 RUINT32T *p1, *pf, *p, *pl;
1992 p1 = (RUINT32T *) srcImage->data;
1993 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1789 1994
1790/* RGB 24 */ 1995 while (p1 < pf)
1791static void 1996 {
1792shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm) 1997 p = p1;
1793{ 1998 pl = p1 + srcImage->width;
1794 unsigned char *ptr; 1999 for (; p < pl; p++)
1795 int x, y;
1796
1797 ptr = (unsigned char *)data + (w * 3);
1798 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
1799 /* No saturation */
1800 for (y = h; --y >= 0;) {
1801 for (x = -(w * 3); x < 0; x += 3) {
1802 int r, g, b;
1803
1804 if (byteorder.big_endian()) {
1805 r = (ptr[x + 0] * rm) >> 8;
1806 g = (ptr[x + 1] * gm) >> 8;
1807 b = (ptr[x + 2] * bm) >> 8;
1808 ptr[x + 0] = r;
1809 ptr[x + 1] = g;
1810 ptr[x + 2] = b;
1811 } else {
1812 r = (ptr[x + 2] * rm) >> 8;
1813 g = (ptr[x + 1] * gm) >> 8;
1814 b = (ptr[x + 0] * bm) >> 8;
1815 ptr[x + 2] = r;
1816 ptr[x + 1] = g;
1817 ptr[x + 0] = b;
1818 }
1819 }
1820 ptr += bpl;
1821 } 2000 {
1822 } else { 2001 *p = lookup_r[(*p & 0xff0000)>>16] |
1823 for (y = h; --y >= 0;) { 2002 lookup_g[(*p & 0x00ff00)>> 8] |
1824 for (x = -(w * 3); x < 0; x += 3) { 2003 lookup_b[(*p & 0x0000ff)] |
1825 int r, g, b; 2004 (*p & ~0xffffff);
1826
1827 if (byteorder.big_endian()) {
1828 r = (ptr[x + 0] * rm) >> 8;
1829 g = (ptr[x + 1] * gm) >> 8;
1830 b = (ptr[x + 2] * bm) >> 8;
1831
1832 r |= (!(r >> 8) - 1);
1833 g |= (!(g >> 8) - 1);
1834 b |= (!(b >> 8) - 1);
1835
1836 ptr[x + 0] = r;
1837 ptr[x + 1] = g;
1838 ptr[x + 2] = b;
1839 } else {
1840 r = (ptr[x + 2] * rm) >> 8;
1841 g = (ptr[x + 1] * gm) >> 8;
1842 b = (ptr[x + 0] * bm) >> 8;
1843
1844 r |= (!(r >> 8) - 1);
1845 g |= (!(g >> 8) - 1);
1846 b |= (!(b >> 8) - 1);
1847
1848 ptr[x + 2] = r;
1849 ptr[x + 1] = g;
1850 ptr[x + 0] = b;
1851 }
1852 } 2005 }
1853 ptr += bpl; 2006 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
1854 } 2007 }
2008 break;
2009 }
1855 } 2010 }
1856}
1857 2011
1858/* RGB 32 */ 2012 free (lookup);
1859static void
1860shade_ximage_32(void *data, int bpl, int w, int h, int rm, int gm, int bm)
1861{
1862 unsigned char *ptr;
1863 int x, y;
1864
1865 ptr = (unsigned char *)data + (w * 4);
1866 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
1867 /* No saturation */
1868 for (y = h; --y >= 0;) {
1869 if (byteorder.big_endian()) {
1870 for (x = -(w * 4); x < 0; x += 4) {
1871 int r, g, b;
1872
1873 r = (ptr[x + 1] * rm) >> 8;
1874 g = (ptr[x + 2] * gm) >> 8;
1875 b = (ptr[x + 3] * bm) >> 8;
1876 ptr[x + 1] = r;
1877 ptr[x + 2] = g;
1878 ptr[x + 3] = b;
1879 }
1880 } else {
1881 for (x = -(w * 4); x < 0; x += 4) {
1882 int r, g, b;
1883
1884 r = (ptr[x + 2] * rm) >> 8;
1885 g = (ptr[x + 1] * gm) >> 8;
1886 b = (ptr[x + 0] * bm) >> 8;
1887 ptr[x + 2] = r;
1888 ptr[x + 1] = g;
1889 ptr[x + 0] = b;
1890 }
1891 }
1892 ptr += bpl;
1893 }
1894 } else {
1895 for (y = h; --y >= 0;) {
1896 for (x = -(w * 4); x < 0; x += 4) {
1897 int r, g, b;
1898
1899 if (byteorder.big_endian()) {
1900 r = (ptr[x + 1] * rm) >> 8;
1901 g = (ptr[x + 2] * gm) >> 8;
1902 b = (ptr[x + 3] * bm) >> 8;
1903
1904 r |= (!(r >> 8) - 1);
1905 g |= (!(g >> 8) - 1);
1906 b |= (!(b >> 8) - 1);
1907
1908 ptr[x + 1] = r;
1909 ptr[x + 2] = g;
1910 ptr[x + 3] = b;
1911 } else {
1912 r = (ptr[x + 2] * rm) >> 8;
1913 g = (ptr[x + 1] * gm) >> 8;
1914 b = (ptr[x + 0] * bm) >> 8;
1915
1916 r |= (!(r >> 8) - 1);
1917 g |= (!(g >> 8) - 1);
1918 b |= (!(b >> 8) - 1);
1919
1920 ptr[x + 2] = r;
1921 ptr[x + 1] = g;
1922 ptr[x + 0] = b;
1923 }
1924 }
1925 ptr += bpl;
1926 }
1927 }
1928} 2013}
1929
1930#endif 2014#endif
1931 2015
1932/* 2016/*
1933 * Check our parents are still who we think they are. 2017 * Check our parents are still who we think they are.
1934 * Do transparency updates if required 2018 * Do transparency updates if required
1957 if (rootdepth != wattr.depth) 2041 if (rootdepth != wattr.depth)
1958 { 2042 {
1959 if (am_transparent) 2043 if (am_transparent)
1960 { 2044 {
1961 pchanged = 1; 2045 pchanged = 1;
1962 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); 2046 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
1963 am_transparent = am_pixmap_trans = 0; 2047 am_transparent = am_pixmap_trans = 0;
1964 } 2048 }
1965 2049
1966 return pchanged; /* Don't try any more */ 2050 return pchanged; /* Don't try any more */
1967 } 2051 }
1983 i = (xa[XA_XSETROOTID] 2067 i = (xa[XA_XSETROOTID]
1984 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], 2068 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID],
1985 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2069 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
1986 &nitems, &bytes_after, &prop) == Success); 2070 &nitems, &bytes_after, &prop) == Success);
1987 2071
1988 if (!i || prop == NULL) 2072 if (!i || prop == NULL
2073#if TINTING
2074 || !rs[Rs_color + Color_tint]
2075#endif
2076 )
1989 have_pixmap = 0; 2077 have_pixmap = 0;
1990 else 2078 else
1991 { 2079 {
1992 have_pixmap = 1; 2080 have_pixmap = 1;
1993 rootpixmap = *(Pixmap *)prop; 2081 rootpixmap = *(Pixmap *)prop;
2055 XFreePixmap (display->display, TermWin.pixmap); 2143 XFreePixmap (display->display, TermWin.pixmap);
2056 2144
2057#if TINTING 2145#if TINTING
2058 if (ISSET_PIXCOLOR (Color_tint)) 2146 if (ISSET_PIXCOLOR (Color_tint))
2059 { 2147 {
2060 unsigned short shade, rm, gm, bm; 2148 unsigned short rm, gm, bm;
2149 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2061 2150
2062 PixColors[Color_tint].get (display, rm, gm, bm); 2151 PixColorsFocused[Color_tint].get (display, rm, gm, bm);
2063 2152
2064 rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but... 2153 ShadeXImage (display, image, shade, rm, gm, bm);
2065
2066 /* Determine bitshift and bitmask values */
2067 switch (image->bits_per_pixel)
2068 {
2069 case 15: shade_ximage_15 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2070 case 16: shade_ximage_16 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2071 case 24: shade_ximage_24 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2072 case 32: shade_ximage_32 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2073 }
2074 } 2154 }
2075#endif 2155#endif
2076 2156
2077 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 2157 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt,
2078 szHint.width, szHint.height, image->depth); 2158 szHint.width, szHint.height, image->depth);
2079 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); 2159 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue);
2080 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, 2160 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0,
2081 nx, ny, image->width, image->height); 2161 nx, ny, image->width, image->height);
2082 XFreeGC (display->display, gc); 2162 XFreeGC (display->display, gc);
2083 XDestroyImage (image); 2163 XDestroyImage (image);
2084 XSetWindowBackgroundPixmap (display->display, TermWin.vt, 2164 XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap);
2085 TermWin.pixmap); 2165 XClearWindow (display->display, TermWin.parent[0]);
2086 2166
2087 if (!am_transparent || !am_pixmap_trans) 2167 if (!am_transparent || !am_pixmap_trans)
2088 pchanged = 1; 2168 pchanged = 1;
2089 2169
2090 am_transparent = am_pixmap_trans = 1; 2170 am_transparent = am_pixmap_trans = 1;
2135 } 2215 }
2136 2216
2137 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2217 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
2138 { 2218 {
2139 D_X ((stderr, "InheritPixmap Turning off")); 2219 D_X ((stderr, "InheritPixmap Turning off"));
2140 XSetWindowBackground (display->display, TermWin.parent[0], PixColors[Color_fg]); 2220 XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]);
2141 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); 2221 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
2142 am_transparent = 0; 2222 am_transparent = 0;
2143 /* XXX: also turn off Opt_transparent? */ 2223 /* XXX: also turn off Opt_transparent? */
2144 } 2224 }
2145 else 2225 else
2146 { 2226 {
2149 * needed for fvwm2.2.2 (and before?) */ 2229 * needed for fvwm2.2.2 (and before?) */
2150 sleep (1); 2230 sleep (1);
2151#endif 2231#endif
2152 D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); 2232 D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1));
2153 for (n = 0; n < (unsigned int)i; n++) 2233 for (n = 0; n < (unsigned int)i; n++)
2234 {
2154 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); 2235 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative);
2236 XClearWindow (display->display, TermWin.parent[n]);
2237 }
2155 2238
2156 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2239 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative);
2157 am_transparent = 1; 2240 am_transparent = 1;
2158 } 2241 }
2159 2242
2160 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2243 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2161 TermWin.parent[i] = None; 2244 TermWin.parent[i] = None;
2245 }
2246
2247 // this is experimental
2248 if (scrollBar.win)
2249 {
2250 XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative);
2251 XClearWindow (display->display, scrollBar.win);
2252 scrollBar.setIdle ();
2253 scrollbar_show (0);
2162 } 2254 }
2163 2255
2164 return pchanged; 2256 return pchanged;
2165} 2257}
2166#endif 2258#endif
2209 { 2301 {
2210 nlines++; 2302 nlines++;
2211 refresh_count++; 2303 refresh_count++;
2212 2304
2213 if (! (Options & Opt_jumpScroll) 2305 if (! (Options & Opt_jumpScroll)
2214 || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) 2306 || (refresh_count >= refresh_limit * (TermWin.nrow - 1)))
2215 { 2307 {
2216 refreshnow = true; 2308 refreshnow = true;
2217 flag = true;
2218 ch = NOCHAR; 2309 ch = NOCHAR;
2219 break; 2310 break;
2220 } 2311 }
2221 2312
2222 // scr_add_lines only works for nlines < TermWin.nrow - 1. 2313 // scr_add_lines only works for nlines < TermWin.nrow - 1.
2240 /* 2331 /*
2241 * If there have been a lot of new lines, then update the screen 2332 * If there have been a lot of new lines, then update the screen
2242 * What the heck I'll cheat and only refresh less than every page-full. 2333 * What the heck I'll cheat and only refresh less than every page-full.
2243 * the number of pages between refreshes is refresh_limit, which 2334 * the number of pages between refreshes is refresh_limit, which
2244 * is incremented here because we must be doing flat-out scrolling. 2335 * is incremented here because we must be doing flat-out scrolling.
2245 *
2246 * refreshing should be correct for small scrolls, because of the
2247 * time-out
2248 */ 2336 */
2249 if (refreshnow) 2337 if (refreshnow)
2250 { 2338 {
2251 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2339 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2252 refresh_limit++; 2340 refresh_limit++;
2253 else 2341 else
2342 {
2343 flag = true;
2254 scr_refresh (refresh_type); 2344 scr_refresh (refresh_type);
2345 }
2255 } 2346 }
2256 2347
2257 } 2348 }
2258 else 2349 else
2259 { 2350 {
2273 } 2364 }
2274 2365
2275 return flag; 2366 return flag;
2276} 2367}
2277 2368
2369// read the next octet
2370unicode_t
2371rxvt_term::next_octet ()
2372{
2373 return cmdbuf_ptr < cmdbuf_endp
2374 ? *cmdbuf_ptr++
2375 : NOCHAR;
2376}
2377
2278// read the next character 2378// read the next character
2279unicode_t 2379unicode_t
2280rxvt_term::next_char () 2380rxvt_term::next_char ()
2281{ 2381{
2282 while (cmdbuf_ptr < cmdbuf_endp) 2382 while (cmdbuf_ptr < cmdbuf_endp)
2313 */ 2413 */
2314unicode_t 2414unicode_t
2315rxvt_term::cmd_getc () 2415rxvt_term::cmd_getc ()
2316{ 2416{
2317 unicode_t c = next_char (); 2417 unicode_t c = next_char ();
2418
2419 if (c == NOCHAR)
2420 throw out_of_input;
2421
2422 return c;
2423}
2424
2425unicode_t
2426rxvt_term::cmd_get8 ()
2427{
2428 unicode_t c = next_octet ();
2318 2429
2319 if (c == NOCHAR) 2430 if (c == NOCHAR)
2320 throw out_of_input; 2431 throw out_of_input;
2321 2432
2322 return c; 2433 return c;
2452 break; 2563 break;
2453 case C0_SI: /* shift in - acs */ 2564 case C0_SI: /* shift in - acs */
2454 scr_charset_choose (0); 2565 scr_charset_choose (0);
2455 break; 2566 break;
2456 2567
2568#ifdef EIGHT_BIT_CONTROLS
2457 // 8-bit controls 2569 // 8-bit controls
2458 case 0x90: /* DCS */ 2570 case 0x90: /* DCS */
2459 process_dcs_seq (); 2571 process_dcs_seq ();
2460 break; 2572 break;
2461 case 0x9b: /* CSI */ 2573 case 0x9b: /* CSI */
2462 process_csi_seq (); 2574 process_csi_seq ();
2463 break; 2575 break;
2464 case 0x9d: /* CSI */ 2576 case 0x9d: /* CSI */
2465 process_osc_seq (); 2577 process_osc_seq ();
2466 break; 2578 break;
2579#endif
2467 } 2580 }
2468} 2581}
2469/*}}} */ 2582/*}}} */
2470 2583
2471 2584
3089 * ends_how is terminator used. returned input must be free()'d 3202 * ends_how is terminator used. returned input must be free()'d
3090 */ 3203 */
3091unsigned char * 3204unsigned char *
3092rxvt_term::get_to_st (unicode_t &ends_how) 3205rxvt_term::get_to_st (unicode_t &ends_how)
3093{ 3206{
3094 int seen_esc = 0; /* seen escape? */ 3207 unicode_t prev = 0, ch;
3095 unsigned int n = 0; 3208 unsigned int n = 0;
3096 unsigned char *s; 3209 unsigned char *s;
3097 unicode_t ch;
3098 unsigned char string[STRING_MAX]; 3210 unsigned char string[STRING_MAX];
3099 3211
3100 while ((ch = cmd_getc ())) 3212 while ((ch = cmd_getc ()) != NOCHAR)
3101 { 3213 {
3102 if (ch == C0_BEL || ch == CHAR_ST) 3214 if (prev == C0_ESC)
3103 break; 3215 {
3104
3105 if (seen_esc)
3106 if (ch == 0x5c) /* 7bit ST */ 3216 if (ch == 0x5c) /* 7bit ST */
3107 break; 3217 break;
3108 else 3218 else
3109 return NULL; 3219 return NULL;
3110
3111 if (ch == C0_ESC)
3112 { 3220 }
3113 seen_esc = 1; 3221 else if (ch == C0_BEL || ch == CHAR_ST)
3114 continue; 3222 break;
3115 }
3116 else if (ch == C0_HT) 3223 else if (ch < 0x20)
3117 ch = ' '; /* translate '\t' to space */
3118 else if (ch < 0x20 && (ch != C0_LF && ch != C0_CR))
3119 return NULL; /* other control character - exit */ 3224 return NULL; /* other control character - exit */
3120 3225
3121 if (n >= sizeof (string) - 1) 3226 if (n >= sizeof (string) - 1)
3122 // stop at some sane length 3227 // stop at some sane length
3123 return NULL; 3228 return NULL;
3124 3229
3230 if (ch == C0_SYN)
3231 {
3232 string[n++] = cmd_get8 ();
3233 prev = 0;
3234 }
3235 else
3125 string[n++] = ch; 3236 string[n++] = prev = ch;
3126 seen_esc = 0;
3127 } 3237 }
3128 3238
3129 string[n++] = '\0'; 3239 string[n++] = '\0';
3130 3240
3131 if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) 3241 if ((s = (unsigned char *)rxvt_malloc (n)) == NULL)
3188 if (str[0] == '?' && !str[1]) 3298 if (str[0] == '?' && !str[1])
3189 { 3299 {
3190 if (Options & Opt_insecure) 3300 if (Options & Opt_insecure)
3191 { 3301 {
3192 unsigned short r, g, b; 3302 unsigned short r, g, b;
3193 PixColors[color].get (display, r, g, b); 3303 PixColorsFocused[color].get (display, r, g, b);
3194 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); 3304 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp);
3195 } 3305 }
3196 } 3306 }
3197 else 3307 else
3198 set_window_color (color, str); 3308 set_window_color (color, str);
3303 if (name[0] == '?' && !name[1]) 3413 if (name[0] == '?' && !name[1])
3304 { 3414 {
3305 if (Options & Opt_insecure) 3415 if (Options & Opt_insecure)
3306 { 3416 {
3307 unsigned short r, g, b; 3417 unsigned short r, g, b;
3308 PixColors[color + minCOLOR].get (display, r, g, b); 3418 PixColorsFocused[color + minCOLOR].get (display, r, g, b);
3309 tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); 3419 tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp);
3310 } 3420 }
3311 } 3421 }
3312 else 3422 else
3313 set_window_color (color + minCOLOR, name); 3423 set_window_color (color + minCOLOR, name);
3686 rendset = 0, rendstyle = ~RS_None; 3796 rendset = 0, rendstyle = ~RS_None;
3687 break; 3797 break;
3688 case 1: 3798 case 1:
3689 rendset = 1, rendstyle = RS_Bold; 3799 rendset = 1, rendstyle = RS_Bold;
3690 break; 3800 break;
3801 //case 2: // faint or second colour
3691 case 4: 3802 case 4:
3692 rendset = 1, rendstyle = RS_Uline; 3803 rendset = 1, rendstyle = RS_Uline;
3693 break; 3804 break;
3694 case 5: 3805 case 5: // slowly blinking
3806 case 6: // rapidly blinking
3695 rendset = 1, rendstyle = RS_Blink; 3807 rendset = 1, rendstyle = RS_Blink;
3696 break; 3808 break;
3697 //case 6: // scoansi light background 3809 //case 6: // scoansi light background
3698 case 7: 3810 case 7:
3699 rendset = 1, rendstyle = RS_RVid; 3811 rendset = 1, rendstyle = RS_RVid;
3700 break; 3812 break;
3701 case 8: 3813 case 8:
3702 // invisible. NYI 3814 // invisible. NYI
3703 break; 3815 break;
3816 //case 9: // crossed out
3704 //case 10: // scoansi acs off 3817 //case 10: // scoansi acs off, primary font
3705 //case 11: // scoansi acs on 3818 //case 11: // scoansi acs on, first alt font
3706 //case 12: // scoansi acs on, |0x80 3819 //case 12: // scoansi acs on, |0x80, second alt font
3707 case 21: // disable bold, blink and invis (some terminals use this) 3820 //...
3821 //case 19: // ninth alt font
3822 //case 20: // gothic
3823 case 21: // disable bold, faint
3708 rendset = 0, rendstyle = RS_Bold | RS_Blink; 3824 rendset = 0, rendstyle = RS_Bold;
3709 break; 3825 break;
3710 case 22: 3826 case 22:
3711 rendset = 0, rendstyle = RS_Bold; 3827 rendset = 0, rendstyle = RS_Bold;
3712 break; 3828 break;
3829 //case 23: disable italic
3713 case 24: 3830 case 24:
3714 rendset = 0, rendstyle = RS_Uline; 3831 rendset = 0, rendstyle = RS_Uline;
3715 break; 3832 break;
3716 case 25: 3833 case 25:
3717 rendset = 0, rendstyle = RS_Blink; 3834 rendset = 0, rendstyle = RS_Blink;
3718 break; 3835 break;
3719 case 27: 3836 case 27:
3720 rendset = 0, rendstyle = RS_RVid; 3837 rendset = 0, rendstyle = RS_RVid;
3721 break; 3838 break;
3722 case 28:
3723 // visible. NYI 3839 //case 28: // visible. NYI
3724 break; 3840 //case 29: // not crossed-out
3725 } 3841 }
3726 3842
3727 if (rendset != -1) 3843 if (rendset != -1)
3728 { 3844 {
3729 scr_rendition (rendset, rendstyle); 3845 scr_rendition (rendset, rendstyle);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines