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.321 by root, Tue May 1 21:30:01 2007 UTC vs.
Revision 1.333 by ayin, Tue Jun 26 09:55:22 2007 UTC

500# if ISO_14755 500# if ISO_14755
501 iso14755_51 (0); 501 iso14755_51 (0);
502# endif 502# endif
503 return; 503 return;
504 } 504 }
505 else if (keysym == XK_BackSpace)
506 {
507 iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51;
508# if ISO_14755
509 iso14755_51 (iso14755buf & ISO_14755_MASK);
510# endif
511 return;
512 }
505 else if ((hv = hex_keyval (ev)) >= 0) 513 else if ((hv = hex_keyval (ev)) >= 0)
506 { 514 {
507 iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) 515 iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK)
508 | hv | ISO_14755_51; 516 | hv | ISO_14755_51;
509# if ISO_14755 517# if ISO_14755
528 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); 536 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1);
529 scr_overlay_set (0, 0, "ISO 14755 mode"); 537 scr_overlay_set (0, 0, "ISO 14755 mode");
530# endif 538# endif
531 } 539 }
532#endif 540#endif
533 541
534#ifdef PRINTPIPE 542#ifdef PRINTPIPE
535 if (keysym == XK_Print) 543 if (keysym == XK_Print)
536 { 544 {
537 scr_printscreen (ctrl | shft); 545 scr_printscreen (ctrl | shft);
538 return; 546 return;
965 scr_overlay_off (); 973 scr_overlay_off ();
966# endif 974# endif
967 if (iso14755buf & ISO_14755_51) 975 if (iso14755buf & ISO_14755_51)
968 commit_iso14755 (); 976 commit_iso14755 ();
969#if ISO_14755 977#if ISO_14755
970 else if (iso14755buf & ISO_14755_STARTED) 978 else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED)
971 { 979 {
972 iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair 980 iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair
973 981
974 scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); 982 scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1);
975 scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); 983 scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE");
1027void 1035void
1028rxvt_term::flush () 1036rxvt_term::flush ()
1029{ 1037{
1030 flush_ev.stop (); 1038 flush_ev.stop ();
1031 1039
1032#ifdef TRANSPARENT 1040#ifdef ENABLE_TRANSPARENCY
1033 if (want_full_refresh) 1041 if (want_full_refresh)
1034 { 1042 {
1035 want_full_refresh = 0; 1043 want_full_refresh = 0;
1036 scr_clear (); 1044 scr_clear ();
1037 scr_touch (false); 1045 scr_touch (false);
1102void 1110void
1103rxvt_term::flush_cb (time_watcher &w) 1111rxvt_term::flush_cb (time_watcher &w)
1104{ 1112{
1105 make_current (); 1113 make_current ();
1106 1114
1107 refresh_limit = 1;
1108 refresh_count = 0; 1115 refresh_count = 0;
1109 flush (); 1116 flush ();
1110} 1117}
1111 1118
1112#ifdef CURSOR_BLINK 1119#ifdef CURSOR_BLINK
1178 1185
1179#if LINUX_YIELD_HACK 1186#if LINUX_YIELD_HACK
1180static struct event_handler 1187static struct event_handler
1181{ 1188{
1182 check_watcher yield_ev; 1189 check_watcher yield_ev;
1183 1190
1184 void yield_cb (check_watcher &w) 1191 void yield_cb (check_watcher &w)
1185 { 1192 {
1186 // this should really be sched_yield(), but the linux guys thought 1193 // this should really be sched_yield(), but the linux guys thought
1187 // that giving a process calling sched_yield () less cpu time than 1194 // that giving a process calling sched_yield () less cpu time than
1188 // ones with high nice levels is a useful thing to do. It surely is is 1195 // ones with high nice levels is a useful thing to do. It surely is is
1235 pty_ev.stop (); 1242 pty_ev.stop ();
1236 1243
1237 if (!option (Opt_hold)) 1244 if (!option (Opt_hold))
1238 destroy (); 1245 destroy ();
1239 } 1246 }
1240 1247
1241 return false; 1248 return false;
1242} 1249}
1243 1250
1244void 1251void
1245rxvt_term::pty_cb (io_watcher &w, short revents) 1252rxvt_term::pty_cb (io_watcher &w, short revents)
1481 1488
1482 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1489 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1483 { 1490 {
1484 seen_resize = 1; 1491 seen_resize = 1;
1485 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1492 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1493#ifdef XPM_BACKGROUND
1494 if (!option (Opt_transparent) && bgPixmap.auto_resize)
1495 {
1496 resize_pixmap ();
1497 scr_touch (true);
1498 }
1499#endif
1486 } 1500 }
1487 1501
1488 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1502 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1489 1503
1490#ifdef TRANSPARENT 1504#ifdef ENABLE_TRANSPARENCY
1491 if (option (Opt_transparent)) 1505 if (option (Opt_transparent))
1492 check_our_parents (); 1506 check_our_parents ();
1493#endif 1507#endif
1494 } 1508 }
1495 break; 1509 break;
1529 text_blink_ev.stop (); 1543 text_blink_ev.stop ();
1530#endif 1544#endif
1531 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1545 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1532 break; 1546 break;
1533 1547
1534#ifdef TRANSPARENT 1548#ifdef ENABLE_TRANSPARENCY
1535 case ReparentNotify: 1549 case ReparentNotify:
1536 rootwin_cb (ev); 1550 rootwin_cb (ev);
1537 break; 1551 break;
1538#endif /* TRANSPARENT */ 1552#endif /* ENABLE_TRANSPARENCY */
1539 1553
1540 case GraphicsExpose: 1554 case GraphicsExpose:
1541 case Expose: 1555 case Expose:
1542 if (ev.xany.window == vt) 1556 if (ev.xany.window == vt)
1543 { 1557 {
1567 { 1581 {
1568 scrollBar.setIdle (); 1582 scrollBar.setIdle ();
1569 scrollbar_show (0); 1583 scrollbar_show (0);
1570 } 1584 }
1571 1585
1572#ifdef TRANSPARENT 1586#ifdef ENABLE_TRANSPARENCY
1573 if (am_transparent && ev.xany.window == parent[0]) 1587 if (am_transparent && ev.xany.window == parent[0])
1574 XClearWindow (dpy, ev.xany.window); 1588 XClearWindow (dpy, ev.xany.window);
1575#endif 1589#endif
1576 } 1590 }
1577 break; 1591 break;
1678 &ev.xbutton.x, &ev.xbutton.y, 1692 &ev.xbutton.x, &ev.xbutton.y,
1679 &unused_mask); 1693 &unused_mask);
1680 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1694 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1681 scrollbar_size ()); 1695 scrollbar_size ());
1682 want_refresh = 1; 1696 want_refresh = 1;
1683 refresh_limit = 0;
1684 scrollbar_show (1); 1697 scrollbar_show (1);
1685 } 1698 }
1686 break; 1699 break;
1687 } 1700 }
1688 1701
1740 { 1753 {
1741 pix_colors = pix_colors_focused; 1754 pix_colors = pix_colors_focused;
1742 scr_recolour (); 1755 scr_recolour ();
1743 } 1756 }
1744#endif 1757#endif
1758#if ENABLE_FRILLS
1759 if (option (Opt_urgentOnBell))
1760 {
1761 XWMHints *h;
1762
1763 h = XGetWMHints(dpy, parent[0]);
1764 if (h != NULL)
1765 {
1766 h->flags &= ~XUrgencyHint;
1767 XSetWMHints(dpy, parent[0], h);
1768 }
1769 }
1770#endif
1745 } 1771 }
1746} 1772}
1747 1773
1748void 1774void
1749rxvt_term::focus_out () 1775rxvt_term::focus_out ()
1794 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); 1820 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
1795 } 1821 }
1796#endif 1822#endif
1797} 1823}
1798 1824
1799#if TRANSPARENT || ENABLE_PERL 1825#if ENABLE_TRANSPARENCY || ENABLE_PERL
1800void 1826void
1801rxvt_term::rootwin_cb (XEvent &ev) 1827rxvt_term::rootwin_cb (XEvent &ev)
1802{ 1828{
1803 make_current (); 1829 make_current ();
1804 1830
1805 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1831 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1806 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1832 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1807 return; 1833 return;
1808 1834
1809# if TRANSPARENT 1835# if ENABLE_TRANSPARENCY
1810 switch (ev.type) 1836 switch (ev.type)
1811 { 1837 {
1812 case PropertyNotify: 1838 case PropertyNotify:
1813 /* 1839 /*
1814 * if user used some Esetroot compatible prog to set the root bg, 1840 * if user used some Esetroot compatible prog to set the root bg,
1818 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1844 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1819 return; 1845 return;
1820 1846
1821 /* FALLTHROUGH */ 1847 /* FALLTHROUGH */
1822 case ReparentNotify: 1848 case ReparentNotify:
1823 if (option (Opt_transparent) && check_our_parents () && am_transparent) 1849 if (option (Opt_transparent))
1824 want_refresh = want_full_refresh = 1; 1850 check_our_parents ();
1825 break; 1851 break;
1826 } 1852 }
1827# endif 1853# endif
1828} 1854}
1829#endif 1855#endif
2206#endif 2232#endif
2207 } 2233 }
2208 } 2234 }
2209} 2235}
2210 2236
2211#ifdef TRANSPARENT
2212#if TINTING
2213/* taken from aterm-0.4.2 */
2214
2215typedef uint32_t RUINT32T;
2216
2217void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm)
2218{
2219 int sh_r, sh_g, sh_b;
2220 RUINT32T mask_r, mask_g, mask_b;
2221 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
2222 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
2223 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
2224 int i;
2225
2226 Visual *visual = term->visual;
2227
2228 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
2229
2230 /* for convenience */
2231 mask_r = visual->red_mask;
2232 mask_g = visual->green_mask;
2233 mask_b = visual->blue_mask;
2234
2235 /* boring lookup table pre-initialization */
2236 switch (srcImage->bits_per_pixel) {
2237 case 15:
2238 if ((mask_r != 0x7c00) ||
2239 (mask_g != 0x03e0) ||
2240 (mask_b != 0x001f))
2241 return;
2242 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32));
2243 lookup_r = lookup;
2244 lookup_g = lookup+32;
2245 lookup_b = lookup+32+32;
2246 sh_r = 10;
2247 sh_g = 5;
2248 sh_b = 0;
2249 break;
2250 case 16:
2251 if ((mask_r != 0xf800) ||
2252 (mask_g != 0x07e0) ||
2253 (mask_b != 0x001f))
2254 return;
2255 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32));
2256 lookup_r = lookup;
2257 lookup_g = lookup+32;
2258 lookup_b = lookup+32+64;
2259 sh_r = 11;
2260 sh_g = 5;
2261 sh_b = 0;
2262 break;
2263 case 24:
2264 if ((mask_r != 0xff0000) ||
2265 (mask_g != 0x00ff00) ||
2266 (mask_b != 0x0000ff))
2267 return;
2268 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
2269 lookup_r = lookup;
2270 lookup_g = lookup+256;
2271 lookup_b = lookup+256+256;
2272 sh_r = 16;
2273 sh_g = 8;
2274 sh_b = 0;
2275 break;
2276 case 32:
2277 if ((mask_r != 0xff0000) ||
2278 (mask_g != 0x00ff00) ||
2279 (mask_b != 0x0000ff))
2280 return;
2281 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
2282 lookup_r = lookup;
2283 lookup_g = lookup+256;
2284 lookup_b = lookup+256+256;
2285 sh_r = 16;
2286 sh_g = 8;
2287 sh_b = 0;
2288 break;
2289 default:
2290 return; /* we do not support this color depth */
2291 }
2292
2293 /* prepare limits for color transformation (each channel is handled separately) */
2294 if (shade < 0) {
2295 shade = -shade;
2296 if (shade < 0) shade = 0;
2297 if (shade > 100) shade = 100;
2298
2299 lower_lim_r = 65535-rm;
2300 lower_lim_g = 65535-gm;
2301 lower_lim_b = 65535-bm;
2302
2303 lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100);
2304 lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100);
2305 lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100);
2306
2307 upper_lim_r = upper_lim_g = upper_lim_b = 65535;
2308 } else {
2309 if (shade < 0) shade = 0;
2310 if (shade > 100) shade = 100;
2311
2312 lower_lim_r = lower_lim_g = lower_lim_b = 0;
2313
2314 upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100);
2315 upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100);
2316 upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100);
2317 }
2318
2319 /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */
2320 if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 ))
2321 {
2322 unsigned int tmp;
2323
2324 tmp = lower_lim_r;
2325 lower_lim_r = lower_lim_b;
2326 lower_lim_b = tmp;
2327
2328 tmp = upper_lim_r;
2329 upper_lim_r = upper_lim_b;
2330 upper_lim_b = tmp;
2331 }
2332
2333 /* fill our lookup tables */
2334 for (i = 0; i <= mask_r>>sh_r; i++)
2335 {
2336 RUINT32T tmp;
2337 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r));
2338 tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r);
2339 lookup_r[i] = (tmp/65535)<<sh_r;
2340 }
2341 for (i = 0; i <= mask_g>>sh_g; i++)
2342 {
2343 RUINT32T tmp;
2344 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g));
2345 tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g);
2346 lookup_g[i] = (tmp/65535)<<sh_g;
2347 }
2348 for (i = 0; i <= mask_b>>sh_b; i++)
2349 {
2350 RUINT32T tmp;
2351 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b));
2352 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
2353 lookup_b[i] = (tmp/65535)<<sh_b;
2354 }
2355
2356 /* apply table to input image (replacing colors by newly calculated ones) */
2357 switch (srcImage->bits_per_pixel)
2358 {
2359 case 15:
2360 {
2361 unsigned short *p1, *pf, *p, *pl;
2362 p1 = (unsigned short *) srcImage->data;
2363 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2364 while (p1 < pf)
2365 {
2366 p = p1;
2367 pl = p1 + srcImage->width;
2368 for (; p < pl; p++)
2369 {
2370 *p = lookup_r[(*p & 0x7c00)>>10] |
2371 lookup_g[(*p & 0x03e0)>> 5] |
2372 lookup_b[(*p & 0x001f)];
2373 }
2374 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
2375 }
2376 break;
2377 }
2378 case 16:
2379 {
2380 unsigned short *p1, *pf, *p, *pl;
2381 p1 = (unsigned short *) srcImage->data;
2382 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2383 while (p1 < pf)
2384 {
2385 p = p1;
2386 pl = p1 + srcImage->width;
2387 for (; p < pl; p++)
2388 {
2389 *p = lookup_r[(*p & 0xf800)>>11] |
2390 lookup_g[(*p & 0x07e0)>> 5] |
2391 lookup_b[(*p & 0x001f)];
2392 }
2393 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
2394 }
2395 break;
2396 }
2397 case 24:
2398 {
2399 unsigned char *p1, *pf, *p, *pl;
2400 p1 = (unsigned char *) srcImage->data;
2401 pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2402 while (p1 < pf)
2403 {
2404 p = p1;
2405 pl = p1 + srcImage->width * 3;
2406 for (; p < pl; p += 3)
2407 {
2408 p[0] = lookup_r[(p[0] & 0xff0000)>>16];
2409 p[1] = lookup_r[(p[1] & 0x00ff00)>> 8];
2410 p[2] = lookup_r[(p[2] & 0x0000ff)];
2411 }
2412 p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line);
2413 }
2414 break;
2415 }
2416 case 32:
2417 {
2418 RUINT32T *p1, *pf, *p, *pl;
2419 p1 = (RUINT32T *) srcImage->data;
2420 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2421
2422 while (p1 < pf)
2423 {
2424 p = p1;
2425 pl = p1 + srcImage->width;
2426 for (; p < pl; p++)
2427 {
2428 *p = lookup_r[(*p & 0xff0000)>>16] |
2429 lookup_g[(*p & 0x00ff00)>> 8] |
2430 lookup_b[(*p & 0x0000ff)] |
2431 (*p & ~0xffffff);
2432 }
2433 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
2434 }
2435 break;
2436 }
2437 }
2438
2439 free (lookup);
2440}
2441#endif
2442
2443/*
2444 * Check our parents are still who we think they are.
2445 * Do transparency updates if required
2446 */
2447int
2448rxvt_term::check_our_parents ()
2449{
2450 int i, pchanged, aformat, have_pixmap, rootdepth;
2451 unsigned long nitems, bytes_after;
2452 Atom atype;
2453 unsigned char *prop = NULL;
2454 Window root, oldp, *list;
2455 Pixmap rootpixmap = None;
2456 XWindowAttributes wattr, wrootattr;
2457
2458 pchanged = 0;
2459
2460 if (!option (Opt_transparent))
2461 return pchanged; /* Don't try any more */
2462
2463 XGetWindowAttributes (dpy, display->root, &wrootattr);
2464 rootdepth = wrootattr.depth;
2465
2466 XGetWindowAttributes (dpy, parent[0], &wattr);
2467
2468 if (rootdepth != wattr.depth)
2469 {
2470 if (am_transparent)
2471 {
2472 pchanged = 1;
2473 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2474 am_transparent = am_pixmap_trans = 0;
2475 }
2476
2477 return pchanged; /* Don't try any more */
2478 }
2479
2480 /* Get all X ops out of the queue so that our information is up-to-date. */
2481 XSync (dpy, False);
2482
2483 /*
2484 * Make the frame window set by the window manager have
2485 * the root background. Some window managers put multiple nested frame
2486 * windows for each client, so we have to take care about that.
2487 */
2488 i = (xa[XA_XROOTPMAP_ID]
2489 && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID],
2490 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2491 &nitems, &bytes_after, &prop) == Success);
2492
2493 if (!i || prop == NULL)
2494 i = (xa[XA_ESETROOT_PMAP_ID]
2495 && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID],
2496 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2497 &nitems, &bytes_after, &prop) == Success);
2498
2499 if (!i || prop == NULL
2500#if TINTING
2501 || !ISSET_PIXCOLOR (Color_tint)
2502#endif
2503 )
2504 have_pixmap = 0;
2505 else
2506 {
2507 have_pixmap = 1;
2508 rootpixmap = *(Pixmap *)prop;
2509 XFree (prop);
2510 }
2511
2512 if (have_pixmap)
2513 {
2514 /*
2515 * Copy display->root pixmap transparency
2516 */
2517 int sx, sy, nx, ny;
2518 unsigned int nw, nh;
2519 Window cr;
2520 XImage *image;
2521 GC gc;
2522 XGCValues gcvalue;
2523
2524 XTranslateCoordinates (dpy, parent[0], display->root,
2525 0, 0, &sx, &sy, &cr);
2526 nw = (unsigned int)szHint.width;
2527 nh = (unsigned int)szHint.height;
2528 nx = ny = 0;
2529
2530 if (sx < 0)
2531 {
2532 nw += sx;
2533 nx = -sx;
2534 sx = 0;
2535 }
2536
2537 if (sy < 0)
2538 {
2539 nh += sy;
2540 ny = -sy;
2541 sy = 0;
2542 }
2543
2544 min_it (nw, (unsigned int) (wrootattr.width - sx));
2545 min_it (nh, (unsigned int) (wrootattr.height - sy));
2546
2547 XSync (dpy, False);
2548 allowedxerror = -1;
2549 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2550
2551 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2552 /* XXX: may need a delay here? */
2553 allowedxerror = 0;
2554
2555 if (image == NULL)
2556 {
2557 if (am_transparent && am_pixmap_trans)
2558 {
2559 pchanged = 1;
2560 if (pixmap != None)
2561 {
2562 XFreePixmap (dpy, pixmap);
2563 pixmap = None;
2564 }
2565 }
2566
2567 am_pixmap_trans = 0;
2568 }
2569 else
2570 {
2571 if (pixmap != None)
2572 XFreePixmap (dpy, pixmap);
2573
2574#if TINTING
2575 if (ISSET_PIXCOLOR (Color_tint))
2576 {
2577 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2578
2579 rgba c;
2580 pix_colors_focused [Color_tint].get (c);
2581
2582 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2583 }
2584#endif
2585
2586 pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth);
2587 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2588 XPutImage (dpy, pixmap, gc, image, 0, 0,
2589 nx, ny, image->width, image->height);
2590 XFreeGC (dpy, gc);
2591 XDestroyImage (image);
2592 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2593 XClearWindow (dpy, parent[0]);
2594
2595 if (!am_transparent || !am_pixmap_trans)
2596 pchanged = 1;
2597
2598 am_transparent = am_pixmap_trans = 1;
2599 }
2600 }
2601
2602 if (am_pixmap_trans)
2603 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2604 else
2605 {
2606 unsigned int n;
2607 /*
2608 * InheritPixmap transparency
2609 */
2610 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2611 {
2612 oldp = parent[i];
2613 XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n);
2614 XFree (list);
2615
2616 if (parent[i] == display->root)
2617 {
2618 if (oldp != None)
2619 pchanged = 1;
2620
2621 break;
2622 }
2623
2624 if (oldp != parent[i])
2625 pchanged = 1;
2626 }
2627
2628 n = 0;
2629
2630 if (pchanged)
2631 for (; n < (unsigned int)i; n++)
2632 {
2633 XGetWindowAttributes (dpy, parent[n], &wattr);
2634
2635 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2636 {
2637 n = (int) (sizeof (parent) / sizeof (Window)) + 1;
2638 break;
2639 }
2640 }
2641
2642 if (n > (sizeof (parent) / sizeof (parent[0])))
2643 {
2644 XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]);
2645 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2646 am_transparent = 0;
2647 /* XXX: also turn off Opt_transparent? */
2648 }
2649 else
2650 {
2651 for (n = 0; n < (unsigned int)i; n++)
2652 {
2653 XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative);
2654 XClearWindow (dpy, parent[n]);
2655 }
2656
2657 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2658 am_transparent = 1;
2659 }
2660
2661 for (; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2662 parent[i] = None;
2663 }
2664
2665 if (scrollBar.win)
2666 {
2667 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
2668 scrollBar.setIdle ();
2669 scrollbar_show (0);
2670 }
2671
2672 if (am_transparent)
2673 {
2674 want_refresh = want_full_refresh = 1;
2675 if (am_pixmap_trans)
2676 flush ();
2677 }
2678
2679 return pchanged;
2680}
2681#endif
2682
2683/*}}} */ 2237/*}}} */
2684 2238
2685bool 2239bool
2686rxvt_term::cmd_parse () 2240rxvt_term::cmd_parse ()
2687{ 2241{
2735 if (ch == C0_LF) 2289 if (ch == C0_LF)
2736 nlines++; 2290 nlines++;
2737 2291
2738 refresh_count++; 2292 refresh_count++;
2739 2293
2740 if (!option (Opt_jumpScroll) 2294 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2741 || (refresh_count >= refresh_limit * (nrow - 1)))
2742 { 2295 {
2743 refreshnow = true;
2744 refresh_count = 0; 2296 refresh_count = 0;
2297
2298 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.)
2299 {
2300 refreshnow = true;
2745 ch = NOCHAR; 2301 ch = NOCHAR;
2746 break; 2302 break;
2303 }
2747 } 2304 }
2748 2305
2749 // scr_add_lines only works for nlines <= nrow - 1. 2306 // scr_add_lines only works for nlines <= nrow - 1.
2750 if (nlines >= nrow - 1) 2307 if (nlines >= nrow - 1)
2751 { 2308 {
2779 && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) 2336 && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))))
2780 scr_add_lines (buf, str - buf, nlines); 2337 scr_add_lines (buf, str - buf, nlines);
2781 2338
2782 /* 2339 /*
2783 * If there have been a lot of new lines, then update the screen 2340 * If there have been a lot of new lines, then update the screen
2784 * What the heck I'll cheat and only refresh less than every page-full. 2341 * What the heck we'll cheat and only refresh less than every page-full.
2785 * the number of pages between refreshes is refresh_limit, which 2342 * if skipScroll is enabled.
2786 * is incremented here because we must be doing flat-out scrolling.
2787 */ 2343 */
2788 if (refreshnow) 2344 if (refreshnow)
2789 { 2345 {
2790 if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2791 refresh_limit++;
2792 else
2793 {
2794 flag = true; 2346 flag = true;
2795 //TODO: due to popular request, implement "skipscroll" option here
2796 scr_refresh (); 2347 scr_refresh ();
2797 want_refresh = 1; 2348 want_refresh = 1;
2798 }
2799 } 2349 }
2800 2350
2801 } 2351 }
2802 else 2352 else
2803 { 2353 {
2952 { 2502 {
2953 if ((buf[len++] = cmd_getc ()) == 'i') 2503 if ((buf[len++] = cmd_getc ()) == 'i')
2954 break; /* done = 1 */ 2504 break; /* done = 1 */
2955 } 2505 }
2956 } 2506 }
2957 2507
2958 for (i = 0; i < len; i++) 2508 for (i = 0; i < len; i++)
2959 if (putc (buf[i], fd) == EOF) 2509 if (putc (buf[i], fd) == EOF)
2960 { 2510 {
2961 done = 1; 2511 done = 1;
2962 break; 2512 break;
3024 process_dcs_seq (); 2574 process_dcs_seq ();
3025 break; 2575 break;
3026 case 0x9b: /* CSI */ 2576 case 0x9b: /* CSI */
3027 process_csi_seq (); 2577 process_csi_seq ();
3028 break; 2578 break;
3029 case 0x9d: /* CSI */ 2579 case 0x9d: /* OSC */
3030 process_osc_seq (); 2580 process_osc_seq ();
3031 break; 2581 break;
3032#endif 2582#endif
3033 } 2583 }
3034} 2584}
3780 int saveop = op; 3330 int saveop = op;
3781 3331
3782 dLocal (Display *, dpy); 3332 dLocal (Display *, dpy);
3783 3333
3784 assert (str != NULL); 3334 assert (str != NULL);
3785 3335
3786 if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) 3336 if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END)))
3787 return; 3337 return;
3788 3338
3789 switch (op) 3339 switch (op)
3790 { 3340 {
3885 break; 3435 break;
3886 case URxvt_Color_IT: 3436 case URxvt_Color_IT:
3887 process_color_seq (op, Color_IT, str, resp); 3437 process_color_seq (op, Color_IT, str, resp);
3888 break; 3438 break;
3889#endif 3439#endif
3890#if TRANSPARENT && TINTING 3440#if ENABLE_TRANSPARENCY && TINTING
3891 case URxvt_Color_tint: 3441 case URxvt_Color_tint:
3892 process_color_seq (op, Color_tint, str, resp); 3442 process_color_seq (op, Color_tint, str, resp);
3893 3443
3894 check_our_parents (); 3444 check_our_parents ();
3895 3445
3925#ifdef XPM_BACKGROUND 3475#ifdef XPM_BACKGROUND
3926 resize_pixmap (); 3476 resize_pixmap ();
3927 scr_touch (true); 3477 scr_touch (true);
3928#endif 3478#endif
3929 } 3479 }
3480#if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE)
3481 if (option (Opt_transparent))
3482 check_our_parents ();
3483#endif
3930 } 3484 }
3931 break; 3485 break;
3932 3486
3933 case Rxvt_restoreFG: 3487 case Rxvt_restoreFG:
3934 set_window_color (Color_fg, str); 3488 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines