… | |
… | |
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 | |
682 | void |
684 | void |
683 | rxvt_term::check_cb (check_watcher &w) |
685 | rxvt_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 | |
|
|
696 | void |
|
|
697 | rxvt_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 |
692 | void |
708 | void |
… | |
… | |
1074 | } |
1090 | } |
1075 | #endif /* OFFIX_DND */ |
1091 | #endif /* OFFIX_DND */ |
1076 | break; |
1092 | break; |
1077 | |
1093 | |
1078 | case MappingNotify: |
1094 | case MappingNotify: |
1079 | XRefreshKeyboardMapping (& (ev.xmapping)); |
1095 | XRefreshKeyboardMapping (&ev.xmapping); |
1080 | break; |
1096 | break; |
1081 | |
1097 | |
1082 | /* |
1098 | /* |
1083 | * XXX: this is not the _current_ arrangement |
1099 | * XXX: this is not the _current_ arrangement |
1084 | * Here's my conclusion: |
1100 | * Here's my conclusion: |
… | |
… | |
1169 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1185 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1170 | } |
1186 | } |
1171 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1187 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1172 | |
1188 | |
1173 | if (szHint.width != width || szHint.height != height) |
1189 | 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); |
1190 | resize_all_windows (width, height, 1); |
1177 | } |
1191 | |
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 */ |
1192 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1185 | if (Options & Opt_transparent) |
1193 | if (Options & Opt_transparent) |
1186 | { |
1194 | { |
1187 | check_our_parents (); |
1195 | check_our_parents (); |
1188 | if (am_transparent) |
1196 | if (am_transparent) |
… | |
… | |
1228 | |
1236 | |
1229 | case GraphicsExpose: |
1237 | case GraphicsExpose: |
1230 | case Expose: |
1238 | case Expose: |
1231 | if (ev.xany.window == TermWin.vt) |
1239 | if (ev.xany.window == TermWin.vt) |
1232 | { |
1240 | { |
1233 | #ifdef NO_SLOW_LINK_SUPPORT |
1241 | do |
1234 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1242 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1235 | ev.xexpose.width, ev.xexpose.height, False); |
1243 | ev.xexpose.width, ev.xexpose.height, False); |
1236 | #else |
1244 | while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev)); |
1237 | // 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)) |
1238 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1249 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1239 | ev.xexpose.width, ev.xexpose.height, False); |
1250 | ev.xexpose.width, ev.xexpose.height, False); |
1240 | //scr_expose (ev.xexpose.x, 0, |
1251 | |
1241 | // ev.xexpose.width, TermWin.height, False); |
1252 | scr_refresh (refresh_type); |
1242 | #endif |
|
|
1243 | want_refresh = 1; |
|
|
1244 | } |
1253 | } |
1245 | else |
1254 | else |
1246 | { |
1255 | { |
1247 | XEvent unused_event; |
1256 | XEvent unused_event; |
1248 | |
1257 | |
… | |
… | |
1257 | scrollbar_show (0); |
1266 | scrollbar_show (0); |
1258 | } |
1267 | } |
1259 | #ifdef MENUBAR |
1268 | #ifdef MENUBAR |
1260 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1269 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1261 | 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); |
1262 | #endif |
1276 | #endif |
1263 | } |
1277 | } |
1264 | break; |
1278 | break; |
1265 | |
1279 | |
1266 | case MotionNotify: |
1280 | case MotionNotify: |
… | |
… | |
1767 | #endif |
1781 | #endif |
1768 | } |
1782 | } |
1769 | |
1783 | |
1770 | #ifdef TRANSPARENT |
1784 | #ifdef TRANSPARENT |
1771 | #if TINTING |
1785 | #if TINTING |
1772 | /* shading taken from eterm-0.9.2 */ |
1786 | /* taken from aterm-0.4.2 */ |
1773 | /* RGB 15 */ |
|
|
1774 | |
1787 | |
1775 | static void |
1788 | typedef uint32_t RUINT32T; |
1776 | shade_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 | |
1789 | |
1781 | ptr = (unsigned char *)data + (w * sizeof(uint16_t)); |
1790 | void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) |
1782 | if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { |
1791 | { |
1783 | /* No saturation */ |
1792 | int sh_r, sh_g, sh_b; |
1784 | for (y = h; --y >= 0;) { |
1793 | RUINT32T mask_r, mask_g, mask_b; |
1785 | for (x = -w; x < 0; x++) { |
1794 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
1786 | 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; |
1787 | |
1798 | |
1788 | b = ((uint16_t *) ptr)[x]; |
1799 | Visual* visual = display->visual; |
1789 | r = (b & 0x7c00) * rm; |
1800 | |
1790 | g = (b & 0x3e0) * gm; |
1801 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
1791 | b = (b & 0x1f) * bm; |
1802 | |
1792 | ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00) |
1803 | /* for convenience */ |
1793 | | ((g >> 8) & 0x3e0) |
1804 | mask_r = visual->red_mask; |
1794 | | ((b >> 8) & 0x1f); |
1805 | mask_g = visual->green_mask; |
1795 | } |
1806 | mask_b = visual->blue_mask; |
1796 | ptr += bpl; |
1807 | |
1797 | } |
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; |
1798 | } else { |
1881 | } else { |
1799 | for (y = h; --y >= 0;) { |
1882 | if (shade < 0) shade = 0; |
1800 | for (x = -w; x < 0; x++) { |
1883 | if (shade > 100) shade = 100; |
1801 | int r, g, b; |
|
|
1802 | |
1884 | |
1803 | b = ((uint16_t *) ptr)[x]; |
1885 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1804 | r = (b & 0x7c00) * rm; |
1886 | |
1805 | g = (b & 0x3e0) * gm; |
1887 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
1806 | b = (b & 0x1f) * bm; |
1888 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
1807 | r |= (!(r >> 15) - 1); |
1889 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
1808 | g |= (!(g >> 10) - 1); |
1890 | } |
1809 | b |= (!(b >> 5) - 1); |
1891 | |
1810 | ((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 */ |
1811 | | ((g >> 8) & 0x3e0) |
1893 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
1812 | | ((b >> 8) & 0x1f); |
1894 | { |
1813 | } |
1895 | unsigned int tmp; |
1814 | 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++) |
1815 | } |
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); |
1816 | } |
1948 | } |
1817 | } |
1949 | break; |
1818 | |
1950 | } |
1819 | /* RGB 16 */ |
1951 | case 16: |
1820 | static void |
1952 | { |
1821 | shade_ximage_16(void *data, int bpl, int w, int h, int rm, int gm, int bm) |
1953 | unsigned short *p1, *pf, *p, *pl; |
1822 | { |
1954 | p1 = (unsigned short *) srcImage->data; |
1823 | unsigned char *ptr; |
1955 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
1824 | int x, y; |
1956 | while (p1 < pf) |
1825 | |
1957 | { |
1826 | ptr = (unsigned char *)data + (w * sizeof(uint16_t)); |
1958 | p = p1; |
1827 | if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { |
1959 | pl = p1 + srcImage->width; |
1828 | /* No saturation */ |
1960 | 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 | } |
1961 | { |
1843 | } else { |
1962 | *p = lookup_r[(*p & 0xf800)>>11] | |
1844 | for (y = h; --y >= 0;) { |
1963 | lookup_g[(*p & 0x07e0)>> 5] | |
1845 | for (x = -w; x < 0; x++) { |
1964 | 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 | } |
1965 | } |
1859 | 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) |
1860 | } |
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); |
1861 | } |
1986 | } |
1862 | } |
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); |
1863 | |
1994 | |
1864 | /* RGB 24 */ |
1995 | while (p1 < pf) |
1865 | static void |
1996 | { |
1866 | shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm) |
1997 | p = p1; |
1867 | { |
1998 | pl = p1 + srcImage->width; |
1868 | unsigned char *ptr; |
1999 | 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 | } |
2000 | { |
1896 | } else { |
2001 | *p = lookup_r[(*p & 0xff0000)>>16] | |
1897 | for (y = h; --y >= 0;) { |
2002 | lookup_g[(*p & 0x00ff00)>> 8] | |
1898 | for (x = -(w * 3); x < 0; x += 3) { |
2003 | lookup_b[(*p & 0x0000ff)] | |
1899 | int r, g, b; |
2004 | (*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 | } |
2005 | } |
1927 | ptr += bpl; |
2006 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
1928 | } |
2007 | } |
|
|
2008 | break; |
|
|
2009 | } |
1929 | } |
2010 | } |
1930 | } |
|
|
1931 | |
2011 | |
1932 | /* RGB 32 */ |
2012 | free (lookup); |
1933 | static void |
|
|
1934 | shade_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 | } |
2013 | } |
2003 | |
|
|
2004 | #endif |
2014 | #endif |
2005 | |
2015 | |
2006 | /* |
2016 | /* |
2007 | * Check our parents are still who we think they are. |
2017 | * Check our parents are still who we think they are. |
2008 | * Do transparency updates if required |
2018 | * Do transparency updates if required |
… | |
… | |
2057 | i = (xa[XA_XSETROOTID] |
2067 | i = (xa[XA_XSETROOTID] |
2058 | && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], |
2068 | && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], |
2059 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2069 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2060 | &nitems, &bytes_after, &prop) == Success); |
2070 | &nitems, &bytes_after, &prop) == Success); |
2061 | |
2071 | |
2062 | if (!i || prop == NULL || !rs[Rs_color + Color_tint]) |
2072 | if (!i || prop == NULL |
|
|
2073 | #if TINTING |
|
|
2074 | || !rs[Rs_color + Color_tint] |
|
|
2075 | #endif |
|
|
2076 | ) |
2063 | have_pixmap = 0; |
2077 | have_pixmap = 0; |
2064 | else |
2078 | else |
2065 | { |
2079 | { |
2066 | have_pixmap = 1; |
2080 | have_pixmap = 1; |
2067 | rootpixmap = *(Pixmap *)prop; |
2081 | rootpixmap = *(Pixmap *)prop; |
… | |
… | |
2078 | Window cr; |
2092 | Window cr; |
2079 | XImage *image; |
2093 | XImage *image; |
2080 | GC gc; |
2094 | GC gc; |
2081 | XGCValues gcvalue; |
2095 | XGCValues gcvalue; |
2082 | |
2096 | |
2083 | XTranslateCoordinates (display->display, TermWin.vt, display->root, |
2097 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
2084 | 0, 0, &sx, &sy, &cr); |
2098 | 0, 0, &sx, &sy, &cr); |
2085 | nw = (unsigned int)szHint.width; |
2099 | nw = (unsigned int)szHint.width; |
2086 | nh = (unsigned int)szHint.height; |
2100 | nh = (unsigned int)szHint.height; |
2087 | nx = ny = 0; |
2101 | nx = ny = 0; |
2088 | |
2102 | |
… | |
… | |
2130 | |
2144 | |
2131 | #if TINTING |
2145 | #if TINTING |
2132 | if (ISSET_PIXCOLOR (Color_tint)) |
2146 | if (ISSET_PIXCOLOR (Color_tint)) |
2133 | { |
2147 | { |
2134 | unsigned short rm, gm, bm; |
2148 | unsigned short rm, gm, bm; |
2135 | if (rs[Rs_shade]) |
2149 | 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); |
2150 | |
2137 | else |
|
|
2138 | PixColorsFocused[Color_tint].get (display, rm, gm, bm); |
2151 | PixColorsFocused[Color_tint].get (display, rm, gm, bm); |
2139 | |
2152 | |
2140 | rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but... |
2153 | 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 | } |
2154 | } |
2151 | #endif |
2155 | #endif |
2152 | |
2156 | |
2153 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
2157 | TermWin.pixmap = XCreatePixmap (display->display, TermWin.vt, |
2154 | szHint.width, szHint.height, image->depth); |
2158 | szHint.width, szHint.height, image->depth); |
2155 | gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); |
2159 | gc = XCreateGC (display->display, TermWin.vt, 0UL, &gcvalue); |
2156 | XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, |
2160 | XPutImage (display->display, TermWin.pixmap, gc, image, 0, 0, |
2157 | nx, ny, image->width, image->height); |
2161 | nx, ny, image->width, image->height); |
2158 | XFreeGC (display->display, gc); |
2162 | XFreeGC (display->display, gc); |
2159 | XDestroyImage (image); |
2163 | XDestroyImage (image); |
2160 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap); |
2164 | XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap); |
|
|
2165 | XClearWindow (display->display, TermWin.parent[0]); |
2161 | |
2166 | |
2162 | if (!am_transparent || !am_pixmap_trans) |
2167 | if (!am_transparent || !am_pixmap_trans) |
2163 | pchanged = 1; |
2168 | pchanged = 1; |
2164 | |
2169 | |
2165 | am_transparent = am_pixmap_trans = 1; |
2170 | am_transparent = am_pixmap_trans = 1; |
… | |
… | |
2209 | } |
2214 | } |
2210 | } |
2215 | } |
2211 | |
2216 | |
2212 | if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) |
2217 | if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0]))) |
2213 | { |
2218 | { |
2214 | D_X ((stderr, "InheritPixmap Turning off")); /* Mikachu? */ |
2219 | D_X ((stderr, "InheritPixmap Turning off")); |
2215 | XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]); |
2220 | XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]); |
2216 | XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]); |
2221 | XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]); |
2217 | am_transparent = 0; |
2222 | am_transparent = 0; |
2218 | /* XXX: also turn off Opt_transparent? */ |
2223 | /* XXX: also turn off Opt_transparent? */ |
2219 | } |
2224 | } |
… | |
… | |
2224 | * needed for fvwm2.2.2 (and before?) */ |
2229 | * needed for fvwm2.2.2 (and before?) */ |
2225 | sleep (1); |
2230 | sleep (1); |
2226 | #endif |
2231 | #endif |
2227 | D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); |
2232 | D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1)); |
2228 | for (n = 0; n < (unsigned int)i; n++) |
2233 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2234 | { |
2229 | XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); |
2235 | XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative); |
|
|
2236 | XClearWindow (display->display, TermWin.parent[n]); |
|
|
2237 | } |
2230 | |
2238 | |
2231 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); |
2239 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); |
2232 | am_transparent = 1; |
2240 | am_transparent = 1; |
2233 | } |
2241 | } |
2234 | |
2242 | |
2235 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2243 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2236 | 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); |
2237 | } |
2254 | } |
2238 | |
2255 | |
2239 | return pchanged; |
2256 | return pchanged; |
2240 | } |
2257 | } |
2241 | #endif |
2258 | #endif |
… | |
… | |
2284 | { |
2301 | { |
2285 | nlines++; |
2302 | nlines++; |
2286 | refresh_count++; |
2303 | refresh_count++; |
2287 | |
2304 | |
2288 | if (! (Options & Opt_jumpScroll) |
2305 | if (! (Options & Opt_jumpScroll) |
2289 | || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) |
2306 | || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) |
2290 | { |
2307 | { |
2291 | refreshnow = true; |
2308 | refreshnow = true; |
2292 | flag = true; |
|
|
2293 | ch = NOCHAR; |
2309 | ch = NOCHAR; |
2294 | break; |
2310 | break; |
2295 | } |
2311 | } |
2296 | |
2312 | |
2297 | // scr_add_lines only works for nlines < TermWin.nrow - 1. |
2313 | // scr_add_lines only works for nlines < TermWin.nrow - 1. |
… | |
… | |
2315 | /* |
2331 | /* |
2316 | * 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 |
2317 | * 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. |
2318 | * the number of pages between refreshes is refresh_limit, which |
2334 | * the number of pages between refreshes is refresh_limit, which |
2319 | * is incremented here because we must be doing flat-out scrolling. |
2335 | * 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 | */ |
2336 | */ |
2324 | if (refreshnow) |
2337 | if (refreshnow) |
2325 | { |
2338 | { |
2326 | if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2339 | if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2327 | refresh_limit++; |
2340 | refresh_limit++; |
2328 | else |
2341 | else |
|
|
2342 | { |
|
|
2343 | flag = true; |
2329 | scr_refresh (refresh_type); |
2344 | scr_refresh (refresh_type); |
|
|
2345 | } |
2330 | } |
2346 | } |
2331 | |
2347 | |
2332 | } |
2348 | } |
2333 | else |
2349 | else |
2334 | { |
2350 | { |