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.107 by root, Sat Jul 31 00:01:12 2004 UTC vs.
Revision 1.120 by root, Tue Aug 10 22:36:30 2004 UTC

306 newlen = 0; 306 newlen = 0;
307 } 307 }
308 break; 308 break;
309 309
310#ifdef XK_KP_Left 310#ifdef XK_KP_Left
311 case XK_KP_Up: /* \033Ox or standard */ 311 case XK_KP_Up: /* \033Ox or standard */
312 case XK_KP_Down: /* \033Or or standard */ 312 case XK_KP_Down: /* \033Or or standard */
313 case XK_KP_Right: /* \033Ov or standard */ 313 case XK_KP_Right: /* \033Ov or standard */
314 case XK_KP_Left: /* \033Ot or standard */ 314 case XK_KP_Left: /* \033Ot or standard */
315 if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) 315 if ((PrivateModes & PrivMode_aplKP) ? !shft : shft)
316 { 316 {
661 if (want_full_refresh) 661 if (want_full_refresh)
662 { 662 {
663 want_full_refresh = 0; 663 want_full_refresh = 0;
664 scr_clear (); 664 scr_clear ();
665 scr_touch (false); 665 scr_touch (false);
666 want_refresh = 1;
667 } 666 }
668#endif 667#endif
669 668
670 if (want_refresh) 669 if (want_refresh)
671 { 670 {
675 IMSendSpot (); 674 IMSendSpot ();
676#endif 675#endif
677 } 676 }
678 677
679 display->flush (); 678 display->flush ();
679
680 flush_ev.stop ();
680} 681}
681 682
682void 683void
683rxvt_term::check_cb (check_watcher &w) 684rxvt_term::check_cb (check_watcher &w)
684{ 685{
685 SET_R (this); 686 SET_R (this);
686 SET_LOCALE (locale); 687 SET_LOCALE (locale);
687 688
689 display->flush ();
690
691 if (want_refresh && !flush_ev.active)
692 flush_ev.start (NOW + 0.01);
693}
694
695void
696rxvt_term::flush_cb (time_watcher &w)
697{
698 SET_R (this);
699 SET_LOCALE (locale);
700
701 refresh_limit = 1;
702 refresh_count = 0;
688 flush (); 703 flush ();
689} 704}
690 705
691#ifdef CURSOR_BLINK 706#ifdef CURSOR_BLINK
692void 707void
1074 } 1089 }
1075#endif /* OFFIX_DND */ 1090#endif /* OFFIX_DND */
1076 break; 1091 break;
1077 1092
1078 case MappingNotify: 1093 case MappingNotify:
1079 XRefreshKeyboardMapping (& (ev.xmapping)); 1094 XRefreshKeyboardMapping (&ev.xmapping);
1080 break; 1095 break;
1081 1096
1082 /* 1097 /*
1083 * XXX: this is not the _current_ arrangement 1098 * XXX: this is not the _current_ arrangement
1084 * Here's my conclusion: 1099 * Here's my conclusion:
1169 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); 1184 D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height));
1170 } 1185 }
1171 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); 1186 while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));
1172 1187
1173 if (szHint.width != width || szHint.height != height) 1188 if (szHint.width != width || szHint.height != height)
1174 {
1175 D_SIZE ((stderr, "Size: Resizing from: %4d x %4d", szHint.width, szHint.height));
1176 resize_all_windows (width, height, 1); 1189 resize_all_windows (width, height, 1);
1177 } 1190
1178#ifdef DEBUG_SIZE
1179 else
1180 {
1181 D_SIZE ((stderr, "Size: Not resizing"));
1182 }
1183#endif
1184#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1191#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1185 if (Options & Opt_transparent) 1192 if (Options & Opt_transparent)
1186 { 1193 {
1187 check_our_parents (); 1194 check_our_parents ();
1188 if (am_transparent) 1195 if (am_transparent)
1189 want_full_refresh = 1; 1196 want_refresh = want_full_refresh = 1;
1190 } 1197 }
1191#endif 1198#endif
1192 } 1199 }
1193 break; 1200 break;
1194 1201
1228 1235
1229 case GraphicsExpose: 1236 case GraphicsExpose:
1230 case Expose: 1237 case Expose:
1231 if (ev.xany.window == TermWin.vt) 1238 if (ev.xany.window == TermWin.vt)
1232 { 1239 {
1233#ifdef NO_SLOW_LINK_SUPPORT 1240 do
1234 scr_expose (ev.xexpose.x, ev.xexpose.y, 1241 scr_expose (ev.xexpose.x, ev.xexpose.y,
1235 ev.xexpose.width, ev.xexpose.height, False); 1242 ev.xexpose.width, ev.xexpose.height, False);
1236#else 1243 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev));
1237 // I don't understand this, so I changed it :) 1244
1245 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1246
1247 while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev))
1238 scr_expose (ev.xexpose.x, ev.xexpose.y, 1248 scr_expose (ev.xexpose.x, ev.xexpose.y,
1239 ev.xexpose.width, ev.xexpose.height, False); 1249 ev.xexpose.width, ev.xexpose.height, False);
1240 //scr_expose (ev.xexpose.x, 0, 1250
1241 // ev.xexpose.width, TermWin.height, False); 1251 scr_refresh (refresh_type);
1242#endif
1243 want_refresh = 1;
1244 } 1252 }
1245 else 1253 else
1246 { 1254 {
1247 XEvent unused_event; 1255 XEvent unused_event;
1248 1256
1257 scrollbar_show (0); 1265 scrollbar_show (0);
1258 } 1266 }
1259#ifdef MENUBAR 1267#ifdef MENUBAR
1260 if (menubar_visible () && isMenuBarWindow (ev.xany.window)) 1268 if (menubar_visible () && isMenuBarWindow (ev.xany.window))
1261 menubar_expose (); 1269 menubar_expose ();
1270#endif
1271
1272#ifdef TRANSPARENT
1273 if (am_transparent && ev.xany.window == TermWin.parent[0])
1274 XClearWindow (display->display, ev.xany.window);
1262#endif 1275#endif
1263 } 1276 }
1264 break; 1277 break;
1265 1278
1266 case MotionNotify: 1279 case MotionNotify:
1399 } 1412 }
1400 1413
1401 /* FALLTHROUGH */ 1414 /* FALLTHROUGH */
1402 case ReparentNotify: 1415 case ReparentNotify:
1403 if ((Options & Opt_transparent) && check_our_parents () && am_transparent) 1416 if ((Options & Opt_transparent) && check_our_parents () && am_transparent)
1404 want_full_refresh = 1; 1417 want_refresh = want_full_refresh = 1;
1405 break; 1418 break;
1406#endif 1419#endif
1407 } 1420 }
1408} 1421}
1409 1422
1591 break; 1604 break;
1592 case R_SB_ALIGN_BOTTOM: 1605 case R_SB_ALIGN_BOTTOM:
1593 csrO = scrollBar.bot - scrollBar.top; 1606 csrO = scrollBar.bot - scrollBar.top;
1594 break; 1607 break;
1595 } 1608 }
1609
1596 if (scrollBar.style == R_SB_XTERM 1610 if (scrollBar.style == R_SB_XTERM
1597 || scrollbar_above_slider (ev.y) 1611 || scrollbar_above_slider (ev.y)
1598 || scrollbar_below_slider (ev.y)) 1612 || scrollbar_below_slider (ev.y))
1599 scr_move_to ( scrollbar_position (ev.y) - csrO, 1613 scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ());
1600 scrollbar_size ()); 1614
1601 scrollBar.setMotion (); 1615 scrollBar.setMotion ();
1602 break; 1616 break;
1603 1617
1604 case Button1: 1618 case Button1:
1605 if (scrollbar_align == R_SB_ALIGN_CENTRE) 1619 if (scrollbar_align == R_SB_ALIGN_CENTRE)
1629 scr_page ((ev.button == Button1 ? DN : UP), 1643 scr_page ((ev.button == Button1 ? DN : UP),
1630 (TermWin.nrow 1644 (TermWin.nrow
1631 * scrollbar_position (ev.y) 1645 * scrollbar_position (ev.y)
1632 / scrollbar_size ())); 1646 / scrollbar_size ()));
1633 } 1647 }
1648
1634 break; 1649 break;
1635 } 1650 }
1636 } 1651 }
1637 return; 1652 return;
1638 } 1653 }
1767#endif 1782#endif
1768} 1783}
1769 1784
1770#ifdef TRANSPARENT 1785#ifdef TRANSPARENT
1771#if TINTING 1786#if TINTING
1772/* shading taken from eterm-0.9.2 */ 1787/* taken from aterm-0.4.2 */
1773/* RGB 15 */
1774 1788
1775static void 1789typedef uint32_t RUINT32T;
1776shade_ximage_15(void *data, int bpl, int w, int h, int rm, int gm, int bm)
1777{
1778 unsigned char *ptr;
1779 int x, y;
1780 1790
1781 ptr = (unsigned char *)data + (w * sizeof(uint16_t)); 1791void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm)
1782 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { 1792{
1783 /* No saturation */ 1793 int sh_r, sh_g, sh_b;
1784 for (y = h; --y >= 0;) { 1794 RUINT32T mask_r, mask_g, mask_b;
1785 for (x = -w; x < 0; x++) { 1795 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
1786 int r, g, b; 1796 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
1797 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
1798 int i;
1787 1799
1788 b = ((uint16_t *) ptr)[x]; 1800 Visual* visual = display->visual;
1789 r = (b & 0x7c00) * rm; 1801
1790 g = (b & 0x3e0) * gm; 1802 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
1791 b = (b & 0x1f) * bm; 1803
1792 ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00) 1804 /* for convenience */
1793 | ((g >> 8) & 0x3e0) 1805 mask_r = visual->red_mask;
1794 | ((b >> 8) & 0x1f); 1806 mask_g = visual->green_mask;
1795 } 1807 mask_b = visual->blue_mask;
1796 ptr += bpl; 1808
1797 } 1809 /* boring lookup table pre-initialization */
1810 switch (srcImage->bits_per_pixel) {
1811 case 15:
1812 if ((mask_r != 0x7c00) ||
1813 (mask_g != 0x03e0) ||
1814 (mask_b != 0x001f))
1815 return;
1816 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32));
1817 lookup_r = lookup;
1818 lookup_g = lookup+32;
1819 lookup_b = lookup+32+32;
1820 sh_r = 10;
1821 sh_g = 5;
1822 sh_b = 0;
1823 break;
1824 case 16:
1825 if ((mask_r != 0xf800) ||
1826 (mask_g != 0x07e0) ||
1827 (mask_b != 0x001f))
1828 return;
1829 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32));
1830 lookup_r = lookup;
1831 lookup_g = lookup+32;
1832 lookup_b = lookup+32+64;
1833 sh_r = 11;
1834 sh_g = 5;
1835 sh_b = 0;
1836 break;
1837 case 24:
1838 if ((mask_r != 0xff0000) ||
1839 (mask_g != 0x00ff00) ||
1840 (mask_b != 0x0000ff))
1841 return;
1842 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
1843 lookup_r = lookup;
1844 lookup_g = lookup+256;
1845 lookup_b = lookup+256+256;
1846 sh_r = 16;
1847 sh_g = 8;
1848 sh_b = 0;
1849 break;
1850 case 32:
1851 if ((mask_r != 0xff0000) ||
1852 (mask_g != 0x00ff00) ||
1853 (mask_b != 0x0000ff))
1854 return;
1855 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
1856 lookup_r = lookup;
1857 lookup_g = lookup+256;
1858 lookup_b = lookup+256+256;
1859 sh_r = 16;
1860 sh_g = 8;
1861 sh_b = 0;
1862 break;
1863 default:
1864 return; /* we do not support this color depth */
1865 }
1866
1867 /* prepare limits for color transformation (each channel is handled separately) */
1868 if (shade < 0) {
1869 shade = -shade;
1870 if (shade < 0) shade = 0;
1871 if (shade > 100) shade = 100;
1872
1873 lower_lim_r = 65535-rm;
1874 lower_lim_g = 65535-gm;
1875 lower_lim_b = 65535-bm;
1876
1877 lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100);
1878 lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100);
1879 lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100);
1880
1881 upper_lim_r = upper_lim_g = upper_lim_b = 65535;
1798 } else { 1882 } else {
1799 for (y = h; --y >= 0;) { 1883 if (shade < 0) shade = 0;
1800 for (x = -w; x < 0; x++) { 1884 if (shade > 100) shade = 100;
1801 int r, g, b;
1802 1885
1803 b = ((uint16_t *) ptr)[x]; 1886 lower_lim_r = lower_lim_g = lower_lim_b = 0;
1804 r = (b & 0x7c00) * rm; 1887
1805 g = (b & 0x3e0) * gm; 1888 upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100);
1806 b = (b & 0x1f) * bm; 1889 upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100);
1807 r |= (!(r >> 15) - 1); 1890 upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100);
1808 g |= (!(g >> 10) - 1); 1891 }
1809 b |= (!(b >> 5) - 1); 1892
1810 ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00) 1893 /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */
1811 | ((g >> 8) & 0x3e0) 1894 if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 ))
1812 | ((b >> 8) & 0x1f); 1895 {
1813 } 1896 unsigned int tmp;
1814 ptr += bpl; 1897
1898 tmp = lower_lim_r;
1899 lower_lim_r = lower_lim_b;
1900 lower_lim_b = tmp;
1901
1902 tmp = upper_lim_r;
1903 upper_lim_r = upper_lim_b;
1904 upper_lim_b = tmp;
1905 }
1906
1907 /* fill our lookup tables */
1908 for (i = 0; i <= mask_r>>sh_r; i++)
1909 {
1910 RUINT32T tmp;
1911 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r));
1912 tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r);
1913 lookup_r[i] = (tmp/65535)<<sh_r;
1914 }
1915 for (i = 0; i <= mask_g>>sh_g; i++)
1916 {
1917 RUINT32T tmp;
1918 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g));
1919 tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g);
1920 lookup_g[i] = (tmp/65535)<<sh_g;
1921 }
1922 for (i = 0; i <= mask_b>>sh_b; i++)
1923 {
1924 RUINT32T tmp;
1925 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b));
1926 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
1927 lookup_b[i] = (tmp/65535)<<sh_b;
1928 }
1929
1930 /* apply table to input image (replacing colors by newly calculated ones) */
1931 switch (srcImage->bits_per_pixel)
1932 {
1933 case 15:
1934 {
1935 unsigned short *p1, *pf, *p, *pl;
1936 p1 = (unsigned short *) srcImage->data;
1937 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1938 while (p1 < pf)
1939 {
1940 p = p1;
1941 pl = p1 + srcImage->width;
1942 for (; p < pl; p++)
1815 } 1943 {
1944 *p = lookup_r[(*p & 0x7c00)>>10] |
1945 lookup_g[(*p & 0x03e0)>> 5] |
1946 lookup_b[(*p & 0x001f)];
1947 }
1948 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
1816 } 1949 }
1817} 1950 break;
1818 1951 }
1819/* RGB 16 */ 1952 case 16:
1820static void 1953 {
1821shade_ximage_16(void *data, int bpl, int w, int h, int rm, int gm, int bm) 1954 unsigned short *p1, *pf, *p, *pl;
1822{ 1955 p1 = (unsigned short *) srcImage->data;
1823 unsigned char *ptr; 1956 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1824 int x, y; 1957 while (p1 < pf)
1825 1958 {
1826 ptr = (unsigned char *)data + (w * sizeof(uint16_t)); 1959 p = p1;
1827 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { 1960 pl = p1 + srcImage->width;
1828 /* No saturation */ 1961 for (; p < pl; p++)
1829 for (y = h; --y >= 0;) {
1830 for (x = -w; x < 0; x++) {
1831 int r, g, b;
1832
1833 b = ((uint16_t *) ptr)[x];
1834 r = (b & 0xf800) * rm;
1835 g = (b & 0x7e0) * gm;
1836 b = (b & 0x1f) * bm;
1837 ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
1838 | ((g >> 8) & 0x7e0)
1839 | ((b >> 8) & 0x1f);
1840 }
1841 ptr += bpl;
1842 } 1962 {
1843 } else { 1963 *p = lookup_r[(*p & 0xf800)>>11] |
1844 for (y = h; --y >= 0;) { 1964 lookup_g[(*p & 0x07e0)>> 5] |
1845 for (x = -w; x < 0; x++) { 1965 lookup_b[(*p & 0x001f)];
1846 int r, g, b;
1847
1848 b = ((uint16_t *) ptr)[x];
1849 r = (b & 0xf800) * rm;
1850 g = (b & 0x7e0) * gm;
1851 b = (b & 0x1f) * bm;
1852 r |= (!(r >> 16) - 1);
1853 g |= (!(g >> 11) - 1);
1854 b |= (!(b >> 5) - 1);
1855 ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
1856 | ((g >> 8) & 0x7e0)
1857 | ((b >> 8) & 0x1f);
1858 } 1966 }
1859 ptr += bpl; 1967 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
1968 }
1969 break;
1970 }
1971 case 24:
1972 {
1973 unsigned char *p1, *pf, *p, *pl;
1974 p1 = (unsigned char *) srcImage->data;
1975 pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1976 while (p1 < pf)
1977 {
1978 p = p1;
1979 pl = p1 + srcImage->width * 3;
1980 for (; p < pl; p += 3)
1860 } 1981 {
1982 p[0] = lookup_r[(p[0] & 0xff0000)>>16];
1983 p[1] = lookup_r[(p[1] & 0x00ff00)>> 8];
1984 p[2] = lookup_r[(p[2] & 0x0000ff)];
1985 }
1986 p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line);
1861 } 1987 }
1862} 1988 break;
1989 }
1990 case 32:
1991 {
1992 RUINT32T *p1, *pf, *p, *pl;
1993 p1 = (RUINT32T *) srcImage->data;
1994 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
1863 1995
1864/* RGB 24 */ 1996 while (p1 < pf)
1865static void 1997 {
1866shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm) 1998 p = p1;
1867{ 1999 pl = p1 + srcImage->width;
1868 unsigned char *ptr; 2000 for (; p < pl; p++)
1869 int x, y;
1870
1871 ptr = (unsigned char *)data + (w * 3);
1872 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
1873 /* No saturation */
1874 for (y = h; --y >= 0;) {
1875 for (x = -(w * 3); x < 0; x += 3) {
1876 int r, g, b;
1877
1878 if (byteorder.big_endian()) {
1879 r = (ptr[x + 0] * rm) >> 8;
1880 g = (ptr[x + 1] * gm) >> 8;
1881 b = (ptr[x + 2] * bm) >> 8;
1882 ptr[x + 0] = r;
1883 ptr[x + 1] = g;
1884 ptr[x + 2] = b;
1885 } else {
1886 r = (ptr[x + 2] * rm) >> 8;
1887 g = (ptr[x + 1] * gm) >> 8;
1888 b = (ptr[x + 0] * bm) >> 8;
1889 ptr[x + 2] = r;
1890 ptr[x + 1] = g;
1891 ptr[x + 0] = b;
1892 }
1893 }
1894 ptr += bpl;
1895 } 2001 {
1896 } else { 2002 *p = lookup_r[(*p & 0xff0000)>>16] |
1897 for (y = h; --y >= 0;) { 2003 lookup_g[(*p & 0x00ff00)>> 8] |
1898 for (x = -(w * 3); x < 0; x += 3) { 2004 lookup_b[(*p & 0x0000ff)] |
1899 int r, g, b; 2005 (*p & ~0xffffff);
1900
1901 if (byteorder.big_endian()) {
1902 r = (ptr[x + 0] * rm) >> 8;
1903 g = (ptr[x + 1] * gm) >> 8;
1904 b = (ptr[x + 2] * bm) >> 8;
1905
1906 r |= (!(r >> 8) - 1);
1907 g |= (!(g >> 8) - 1);
1908 b |= (!(b >> 8) - 1);
1909
1910 ptr[x + 0] = r;
1911 ptr[x + 1] = g;
1912 ptr[x + 2] = b;
1913 } else {
1914 r = (ptr[x + 2] * rm) >> 8;
1915 g = (ptr[x + 1] * gm) >> 8;
1916 b = (ptr[x + 0] * bm) >> 8;
1917
1918 r |= (!(r >> 8) - 1);
1919 g |= (!(g >> 8) - 1);
1920 b |= (!(b >> 8) - 1);
1921
1922 ptr[x + 2] = r;
1923 ptr[x + 1] = g;
1924 ptr[x + 0] = b;
1925 }
1926 } 2006 }
1927 ptr += bpl; 2007 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
1928 } 2008 }
2009 break;
2010 }
1929 } 2011 }
1930}
1931 2012
1932/* RGB 32 */ 2013 free (lookup);
1933static void
1934shade_ximage_32(void *data, int bpl, int w, int h, int rm, int gm, int bm)
1935{
1936 unsigned char *ptr;
1937 int x, y;
1938
1939 ptr = (unsigned char *)data + (w * 4);
1940 if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
1941 /* No saturation */
1942 for (y = h; --y >= 0;) {
1943 if (byteorder.big_endian()) {
1944 for (x = -(w * 4); x < 0; x += 4) {
1945 int r, g, b;
1946
1947 r = (ptr[x + 1] * rm) >> 8;
1948 g = (ptr[x + 2] * gm) >> 8;
1949 b = (ptr[x + 3] * bm) >> 8;
1950 ptr[x + 1] = r;
1951 ptr[x + 2] = g;
1952 ptr[x + 3] = b;
1953 }
1954 } else {
1955 for (x = -(w * 4); x < 0; x += 4) {
1956 int r, g, b;
1957
1958 r = (ptr[x + 2] * rm) >> 8;
1959 g = (ptr[x + 1] * gm) >> 8;
1960 b = (ptr[x + 0] * bm) >> 8;
1961 ptr[x + 2] = r;
1962 ptr[x + 1] = g;
1963 ptr[x + 0] = b;
1964 }
1965 }
1966 ptr += bpl;
1967 }
1968 } else {
1969 for (y = h; --y >= 0;) {
1970 for (x = -(w * 4); x < 0; x += 4) {
1971 int r, g, b;
1972
1973 if (byteorder.big_endian()) {
1974 r = (ptr[x + 1] * rm) >> 8;
1975 g = (ptr[x + 2] * gm) >> 8;
1976 b = (ptr[x + 3] * bm) >> 8;
1977
1978 r |= (!(r >> 8) - 1);
1979 g |= (!(g >> 8) - 1);
1980 b |= (!(b >> 8) - 1);
1981
1982 ptr[x + 1] = r;
1983 ptr[x + 2] = g;
1984 ptr[x + 3] = b;
1985 } else {
1986 r = (ptr[x + 2] * rm) >> 8;
1987 g = (ptr[x + 1] * gm) >> 8;
1988 b = (ptr[x + 0] * bm) >> 8;
1989
1990 r |= (!(r >> 8) - 1);
1991 g |= (!(g >> 8) - 1);
1992 b |= (!(b >> 8) - 1);
1993
1994 ptr[x + 2] = r;
1995 ptr[x + 1] = g;
1996 ptr[x + 0] = b;
1997 }
1998 }
1999 ptr += bpl;
2000 }
2001 }
2002} 2014}
2003
2004#endif 2015#endif
2005 2016
2006/* 2017/*
2007 * Check our parents are still who we think they are. 2018 * Check our parents are still who we think they are.
2008 * Do transparency updates if required 2019 * Do transparency updates if required
2057 i = (xa[XA_XSETROOTID] 2068 i = (xa[XA_XSETROOTID]
2058 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], 2069 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID],
2059 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2070 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2060 &nitems, &bytes_after, &prop) == Success); 2071 &nitems, &bytes_after, &prop) == Success);
2061 2072
2062 if (!i || prop == NULL || !rs[Rs_color + Color_tint]) 2073 if (!i || prop == NULL
2074#if TINTING
2075 || !rs[Rs_color + Color_tint]
2076#endif
2077 )
2063 have_pixmap = 0; 2078 have_pixmap = 0;
2064 else 2079 else
2065 { 2080 {
2066 have_pixmap = 1; 2081 have_pixmap = 1;
2067 rootpixmap = *(Pixmap *)prop; 2082 rootpixmap = *(Pixmap *)prop;
2078 Window cr; 2093 Window cr;
2079 XImage *image; 2094 XImage *image;
2080 GC gc; 2095 GC gc;
2081 XGCValues gcvalue; 2096 XGCValues gcvalue;
2082 2097
2083 XTranslateCoordinates (display->display, TermWin.vt, display->root, 2098 XTranslateCoordinates (display->display, TermWin.parent[0], display->root,
2084 0, 0, &sx, &sy, &cr); 2099 0, 0, &sx, &sy, &cr);
2085 nw = (unsigned int)szHint.width; 2100 nw = (unsigned int)szHint.width;
2086 nh = (unsigned int)szHint.height; 2101 nh = (unsigned int)szHint.height;
2087 nx = ny = 0; 2102 nx = ny = 0;
2088 2103
2130 2145
2131#if TINTING 2146#if TINTING
2132 if (ISSET_PIXCOLOR (Color_tint)) 2147 if (ISSET_PIXCOLOR (Color_tint))
2133 { 2148 {
2134 unsigned short rm, gm, bm; 2149 unsigned short rm, gm, bm;
2135 if (rs[Rs_shade]) 2150 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2136 PixColorsFocused[Color_tint].fade (display, atoi (rs[Rs_shade])).get (display, rm, gm, bm); 2151
2137 else
2138 PixColorsFocused[Color_tint].get (display, rm, gm, bm); 2152 PixColorsFocused[Color_tint].get (display, rm, gm, bm);
2139 2153
2140 rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but... 2154 ShadeXImage (display, image, shade, rm, gm, bm);
2141
2142 /* Determine bitshift and bitmask values */
2143 switch (image->bits_per_pixel)
2144 {
2145 case 15: shade_ximage_15 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2146 case 16: shade_ximage_16 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2147 case 24: shade_ximage_24 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2148 case 32: shade_ximage_32 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
2149 }
2150 } 2155 }
2151#endif 2156#endif
2152 2157
2153 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, 2158 TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt,
2154 szHint.width, szHint.height, image->depth); 2159 szHint.width, szHint.height, image->depth);
2155 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); 2160 gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue);
2156 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, 2161 XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0,
2157 nx, ny, image->width, image->height); 2162 nx, ny, image->width, image->height);
2158 XFreeGC (display->display, gc); 2163 XFreeGC (display->display, gc);
2159 XDestroyImage (image); 2164 XDestroyImage (image);
2160 XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); 2165 XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap);
2166 XClearWindow (display->display, TermWin.parent[0]);
2161 2167
2162 if (!am_transparent || !am_pixmap_trans) 2168 if (!am_transparent || !am_pixmap_trans)
2163 pchanged = 1; 2169 pchanged = 1;
2164 2170
2165 am_transparent = am_pixmap_trans = 1; 2171 am_transparent = am_pixmap_trans = 1;
2209 } 2215 }
2210 } 2216 }
2211 2217
2212 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) 2218 if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
2213 { 2219 {
2214 D_X ((stderr, "InheritPixmap Turning off")); /* Mikachu? */ 2220 D_X ((stderr, "InheritPixmap Turning off"));
2215 XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]); 2221 XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]);
2216 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]); 2222 XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
2217 am_transparent = 0; 2223 am_transparent = 0;
2218 /* XXX: also turn off Opt_transparent? */ 2224 /* XXX: also turn off Opt_transparent? */
2219 } 2225 }
2224 * needed for fvwm2.2.2 (and before?) */ 2230 * needed for fvwm2.2.2 (and before?) */
2225 sleep (1); 2231 sleep (1);
2226#endif 2232#endif
2227 D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); 2233 D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1));
2228 for (n = 0; n < (unsigned int)i; n++) 2234 for (n = 0; n < (unsigned int)i; n++)
2235 {
2229 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); 2236 XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative);
2237 XClearWindow (display->display, TermWin.parent[n]);
2238 }
2230 2239
2231 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); 2240 XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative);
2232 am_transparent = 1; 2241 am_transparent = 1;
2233 } 2242 }
2234 2243
2235 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) 2244 for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++)
2236 TermWin.parent[i] = None; 2245 TermWin.parent[i] = None;
2246 }
2247
2248 // this is experimental
2249 if (scrollBar.win)
2250 {
2251 XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative);
2252 XClearWindow (display->display, scrollBar.win);
2253 scrollBar.setIdle ();
2254 scrollbar_show (0);
2237 } 2255 }
2238 2256
2239 return pchanged; 2257 return pchanged;
2240} 2258}
2241#endif 2259#endif
2266 unicode_t buf[UBUFSIZ]; 2284 unicode_t buf[UBUFSIZ];
2267 bool refreshnow = false; 2285 bool refreshnow = false;
2268 int nlines = 0; 2286 int nlines = 0;
2269 unicode_t *str = buf; 2287 unicode_t *str = buf;
2270 2288
2271 *str++ = ch;
2272
2273 for (;;) 2289 for (;;)
2274 { 2290 {
2275 seq_begin = cmdbuf_ptr;
2276 ch = next_char ();
2277
2278 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2291 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))
2279 break; 2292 break;
2280 2293
2281 *str++ = ch; 2294 *str++ = ch;
2282 2295
2283 if (ch == C0_LF) 2296 if (ch == C0_LF)
2284 { 2297 {
2285 nlines++; 2298 nlines++;
2286 refresh_count++; 2299 refresh_count++;
2287 2300
2288 if (! (Options & Opt_jumpScroll) 2301 if (!(Options & Opt_jumpScroll)
2289 || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) 2302 || (refresh_count >= refresh_limit * (TermWin.nrow - 1)))
2290 { 2303 {
2291 refreshnow = true; 2304 refreshnow = true;
2292 flag = true;
2293 ch = NOCHAR; 2305 ch = NOCHAR;
2294 break; 2306 break;
2295 } 2307 }
2296 2308
2297 // scr_add_lines only works for nlines < TermWin.nrow - 1. 2309 // scr_add_lines only works for nlines <= TermWin.nrow - 1.
2298 if (nlines >= TermWin.nrow - 1) 2310 if (nlines >= TermWin.nrow - 1)
2299 { 2311 {
2300 scr_add_lines (buf, nlines, str - buf); 2312 scr_add_lines (buf, nlines, str - buf);
2301 nlines = 0; 2313 nlines = 0;
2302 str = buf; 2314 str = buf;
2306 if (str >= buf + UBUFSIZ) 2318 if (str >= buf + UBUFSIZ)
2307 { 2319 {
2308 ch = NOCHAR; 2320 ch = NOCHAR;
2309 break; 2321 break;
2310 } 2322 }
2323
2324 seq_begin = cmdbuf_ptr;
2325 ch = next_char ();
2311 } 2326 }
2312 2327
2313 scr_add_lines (buf, nlines, str - buf); 2328 scr_add_lines (buf, nlines, str - buf);
2314 2329
2315 /* 2330 /*
2316 * If there have been a lot of new lines, then update the screen 2331 * If there have been a lot of new lines, then update the screen
2317 * What the heck I'll cheat and only refresh less than every page-full. 2332 * What the heck I'll cheat and only refresh less than every page-full.
2318 * the number of pages between refreshes is refresh_limit, which 2333 * the number of pages between refreshes is refresh_limit, which
2319 * is incremented here because we must be doing flat-out scrolling. 2334 * is incremented here because we must be doing flat-out scrolling.
2320 *
2321 * refreshing should be correct for small scrolls, because of the
2322 * time-out
2323 */ 2335 */
2324 if (refreshnow) 2336 if (refreshnow)
2325 { 2337 {
2326 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2338 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2327 refresh_limit++; 2339 refresh_limit++;
2328 else 2340 else
2341 {
2342 flag = true;
2329 scr_refresh (refresh_type); 2343 scr_refresh (refresh_type);
2344 }
2330 } 2345 }
2331 2346
2332 } 2347 }
2333 else 2348 else
2334 { 2349 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines