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.325 by ayin, Sat Jun 9 09:05:38 2007 UTC vs.
Revision 1.333 by ayin, Tue Jun 26 09:55:22 2007 UTC

536 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); 536 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1);
537 scr_overlay_set (0, 0, "ISO 14755 mode"); 537 scr_overlay_set (0, 0, "ISO 14755 mode");
538# endif 538# endif
539 } 539 }
540#endif 540#endif
541 541
542#ifdef PRINTPIPE 542#ifdef PRINTPIPE
543 if (keysym == XK_Print) 543 if (keysym == XK_Print)
544 { 544 {
545 scr_printscreen (ctrl | shft); 545 scr_printscreen (ctrl | shft);
546 return; 546 return;
1035void 1035void
1036rxvt_term::flush () 1036rxvt_term::flush ()
1037{ 1037{
1038 flush_ev.stop (); 1038 flush_ev.stop ();
1039 1039
1040#ifdef TRANSPARENT 1040#ifdef ENABLE_TRANSPARENCY
1041 if (want_full_refresh) 1041 if (want_full_refresh)
1042 { 1042 {
1043 want_full_refresh = 0; 1043 want_full_refresh = 0;
1044 scr_clear (); 1044 scr_clear ();
1045 scr_touch (false); 1045 scr_touch (false);
1110void 1110void
1111rxvt_term::flush_cb (time_watcher &w) 1111rxvt_term::flush_cb (time_watcher &w)
1112{ 1112{
1113 make_current (); 1113 make_current ();
1114 1114
1115 refresh_limit = 1;
1116 refresh_count = 0; 1115 refresh_count = 0;
1117 flush (); 1116 flush ();
1118} 1117}
1119 1118
1120#ifdef CURSOR_BLINK 1119#ifdef CURSOR_BLINK
1186 1185
1187#if LINUX_YIELD_HACK 1186#if LINUX_YIELD_HACK
1188static struct event_handler 1187static struct event_handler
1189{ 1188{
1190 check_watcher yield_ev; 1189 check_watcher yield_ev;
1191 1190
1192 void yield_cb (check_watcher &w) 1191 void yield_cb (check_watcher &w)
1193 { 1192 {
1194 // this should really be sched_yield(), but the linux guys thought 1193 // this should really be sched_yield(), but the linux guys thought
1195 // that giving a process calling sched_yield () less cpu time than 1194 // that giving a process calling sched_yield () less cpu time than
1196 // 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
1243 pty_ev.stop (); 1242 pty_ev.stop ();
1244 1243
1245 if (!option (Opt_hold)) 1244 if (!option (Opt_hold))
1246 destroy (); 1245 destroy ();
1247 } 1246 }
1248 1247
1249 return false; 1248 return false;
1250} 1249}
1251 1250
1252void 1251void
1253rxvt_term::pty_cb (io_watcher &w, short revents) 1252rxvt_term::pty_cb (io_watcher &w, short revents)
1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1489 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1491 { 1490 {
1492 seen_resize = 1; 1491 seen_resize = 1;
1493 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1492 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1494#ifdef XPM_BACKGROUND 1493#ifdef XPM_BACKGROUND
1495 if (!option(Opt_transparent) && bgPixmap.auto_resize) 1494 if (!option (Opt_transparent) && bgPixmap.auto_resize)
1496 { 1495 {
1497 resize_pixmap (); 1496 resize_pixmap ();
1498 scr_touch (true); 1497 scr_touch (true);
1499 } 1498 }
1500#endif 1499#endif
1501 } 1500 }
1502 1501
1503 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1502 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1504 1503
1505#ifdef TRANSPARENT 1504#ifdef ENABLE_TRANSPARENCY
1506 if (option (Opt_transparent)) 1505 if (option (Opt_transparent))
1507 check_our_parents (); 1506 check_our_parents ();
1508#endif 1507#endif
1509 } 1508 }
1510 break; 1509 break;
1544 text_blink_ev.stop (); 1543 text_blink_ev.stop ();
1545#endif 1544#endif
1546 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1545 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1547 break; 1546 break;
1548 1547
1549#ifdef TRANSPARENT 1548#ifdef ENABLE_TRANSPARENCY
1550 case ReparentNotify: 1549 case ReparentNotify:
1551 rootwin_cb (ev); 1550 rootwin_cb (ev);
1552 break; 1551 break;
1553#endif /* TRANSPARENT */ 1552#endif /* ENABLE_TRANSPARENCY */
1554 1553
1555 case GraphicsExpose: 1554 case GraphicsExpose:
1556 case Expose: 1555 case Expose:
1557 if (ev.xany.window == vt) 1556 if (ev.xany.window == vt)
1558 { 1557 {
1582 { 1581 {
1583 scrollBar.setIdle (); 1582 scrollBar.setIdle ();
1584 scrollbar_show (0); 1583 scrollbar_show (0);
1585 } 1584 }
1586 1585
1587#ifdef TRANSPARENT 1586#ifdef ENABLE_TRANSPARENCY
1588 if (am_transparent && ev.xany.window == parent[0]) 1587 if (am_transparent && ev.xany.window == parent[0])
1589 XClearWindow (dpy, ev.xany.window); 1588 XClearWindow (dpy, ev.xany.window);
1590#endif 1589#endif
1591 } 1590 }
1592 break; 1591 break;
1693 &ev.xbutton.x, &ev.xbutton.y, 1692 &ev.xbutton.x, &ev.xbutton.y,
1694 &unused_mask); 1693 &unused_mask);
1695 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1694 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1696 scrollbar_size ()); 1695 scrollbar_size ());
1697 want_refresh = 1; 1696 want_refresh = 1;
1698 refresh_limit = 0;
1699 scrollbar_show (1); 1697 scrollbar_show (1);
1700 } 1698 }
1701 break; 1699 break;
1702 } 1700 }
1703 1701
1822 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);
1823 } 1821 }
1824#endif 1822#endif
1825} 1823}
1826 1824
1827#if TRANSPARENT || ENABLE_PERL 1825#if ENABLE_TRANSPARENCY || ENABLE_PERL
1828void 1826void
1829rxvt_term::rootwin_cb (XEvent &ev) 1827rxvt_term::rootwin_cb (XEvent &ev)
1830{ 1828{
1831 make_current (); 1829 make_current ();
1832 1830
1833 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1831 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1834 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1832 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1835 return; 1833 return;
1836 1834
1837# if TRANSPARENT 1835# if ENABLE_TRANSPARENCY
1838 switch (ev.type) 1836 switch (ev.type)
1839 { 1837 {
1840 case PropertyNotify: 1838 case PropertyNotify:
1841 /* 1839 /*
1842 * 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,
2234#endif 2232#endif
2235 } 2233 }
2236 } 2234 }
2237} 2235}
2238 2236
2239#ifdef TRANSPARENT
2240#if TINTING && !defined(HAVE_AFTERIMAGE)
2241/* taken from aterm-0.4.2 */
2242
2243typedef uint32_t RUINT32T;
2244
2245void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm)
2246{
2247 int sh_r, sh_g, sh_b;
2248 RUINT32T mask_r, mask_g, mask_b;
2249 RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
2250 unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
2251 unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
2252 int i;
2253
2254 Visual *visual = term->visual;
2255
2256 if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
2257
2258 /* for convenience */
2259 mask_r = visual->red_mask;
2260 mask_g = visual->green_mask;
2261 mask_b = visual->blue_mask;
2262
2263 /* boring lookup table pre-initialization */
2264 switch (srcImage->bits_per_pixel) {
2265 case 15:
2266 if ((mask_r != 0x7c00) ||
2267 (mask_g != 0x03e0) ||
2268 (mask_b != 0x001f))
2269 return;
2270 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32));
2271 lookup_r = lookup;
2272 lookup_g = lookup+32;
2273 lookup_b = lookup+32+32;
2274 sh_r = 10;
2275 sh_g = 5;
2276 sh_b = 0;
2277 break;
2278 case 16:
2279 if ((mask_r != 0xf800) ||
2280 (mask_g != 0x07e0) ||
2281 (mask_b != 0x001f))
2282 return;
2283 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32));
2284 lookup_r = lookup;
2285 lookup_g = lookup+32;
2286 lookup_b = lookup+32+64;
2287 sh_r = 11;
2288 sh_g = 5;
2289 sh_b = 0;
2290 break;
2291 case 24:
2292 if ((mask_r != 0xff0000) ||
2293 (mask_g != 0x00ff00) ||
2294 (mask_b != 0x0000ff))
2295 return;
2296 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
2297 lookup_r = lookup;
2298 lookup_g = lookup+256;
2299 lookup_b = lookup+256+256;
2300 sh_r = 16;
2301 sh_g = 8;
2302 sh_b = 0;
2303 break;
2304 case 32:
2305 if ((mask_r != 0xff0000) ||
2306 (mask_g != 0x00ff00) ||
2307 (mask_b != 0x0000ff))
2308 return;
2309 lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
2310 lookup_r = lookup;
2311 lookup_g = lookup+256;
2312 lookup_b = lookup+256+256;
2313 sh_r = 16;
2314 sh_g = 8;
2315 sh_b = 0;
2316 break;
2317 default:
2318 return; /* we do not support this color depth */
2319 }
2320
2321 /* prepare limits for color transformation (each channel is handled separately) */
2322 if (shade < 0) {
2323 shade = -shade;
2324 if (shade < 0) shade = 0;
2325 if (shade > 100) shade = 100;
2326
2327 lower_lim_r = 65535-rm;
2328 lower_lim_g = 65535-gm;
2329 lower_lim_b = 65535-bm;
2330
2331 lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100);
2332 lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100);
2333 lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100);
2334
2335 upper_lim_r = upper_lim_g = upper_lim_b = 65535;
2336 } else {
2337 if (shade < 0) shade = 0;
2338 if (shade > 100) shade = 100;
2339
2340 lower_lim_r = lower_lim_g = lower_lim_b = 0;
2341
2342 upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100);
2343 upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100);
2344 upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100);
2345 }
2346
2347 /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */
2348 if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 ))
2349 {
2350 unsigned int tmp;
2351
2352 tmp = lower_lim_r;
2353 lower_lim_r = lower_lim_b;
2354 lower_lim_b = tmp;
2355
2356 tmp = upper_lim_r;
2357 upper_lim_r = upper_lim_b;
2358 upper_lim_b = tmp;
2359 }
2360
2361 /* fill our lookup tables */
2362 for (i = 0; i <= mask_r>>sh_r; i++)
2363 {
2364 RUINT32T tmp;
2365 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r));
2366 tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r);
2367 lookup_r[i] = (tmp/65535)<<sh_r;
2368 }
2369 for (i = 0; i <= mask_g>>sh_g; i++)
2370 {
2371 RUINT32T tmp;
2372 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g));
2373 tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g);
2374 lookup_g[i] = (tmp/65535)<<sh_g;
2375 }
2376 for (i = 0; i <= mask_b>>sh_b; i++)
2377 {
2378 RUINT32T tmp;
2379 tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b));
2380 tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
2381 lookup_b[i] = (tmp/65535)<<sh_b;
2382 }
2383
2384 /* apply table to input image (replacing colors by newly calculated ones) */
2385 switch (srcImage->bits_per_pixel)
2386 {
2387 case 15:
2388 {
2389 unsigned short *p1, *pf, *p, *pl;
2390 p1 = (unsigned short *) srcImage->data;
2391 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2392 while (p1 < pf)
2393 {
2394 p = p1;
2395 pl = p1 + srcImage->width;
2396 for (; p < pl; p++)
2397 {
2398 *p = lookup_r[(*p & 0x7c00)>>10] |
2399 lookup_g[(*p & 0x03e0)>> 5] |
2400 lookup_b[(*p & 0x001f)];
2401 }
2402 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
2403 }
2404 break;
2405 }
2406 case 16:
2407 {
2408 unsigned short *p1, *pf, *p, *pl;
2409 p1 = (unsigned short *) srcImage->data;
2410 pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2411 while (p1 < pf)
2412 {
2413 p = p1;
2414 pl = p1 + srcImage->width;
2415 for (; p < pl; p++)
2416 {
2417 *p = lookup_r[(*p & 0xf800)>>11] |
2418 lookup_g[(*p & 0x07e0)>> 5] |
2419 lookup_b[(*p & 0x001f)];
2420 }
2421 p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
2422 }
2423 break;
2424 }
2425 case 24:
2426 {
2427 unsigned char *p1, *pf, *p, *pl;
2428 p1 = (unsigned char *) srcImage->data;
2429 pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2430 while (p1 < pf)
2431 {
2432 p = p1;
2433 pl = p1 + srcImage->width * 3;
2434 for (; p < pl; p += 3)
2435 {
2436 p[0] = lookup_r[(p[0] & 0xff0000)>>16];
2437 p[1] = lookup_r[(p[1] & 0x00ff00)>> 8];
2438 p[2] = lookup_r[(p[2] & 0x0000ff)];
2439 }
2440 p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line);
2441 }
2442 break;
2443 }
2444 case 32:
2445 {
2446 RUINT32T *p1, *pf, *p, *pl;
2447 p1 = (RUINT32T *) srcImage->data;
2448 pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
2449
2450 while (p1 < pf)
2451 {
2452 p = p1;
2453 pl = p1 + srcImage->width;
2454 for (; p < pl; p++)
2455 {
2456 *p = lookup_r[(*p & 0xff0000)>>16] |
2457 lookup_g[(*p & 0x00ff00)>> 8] |
2458 lookup_b[(*p & 0x0000ff)] |
2459 (*p & ~0xffffff);
2460 }
2461 p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
2462 }
2463 break;
2464 }
2465 }
2466
2467 free (lookup);
2468}
2469#endif
2470
2471/*
2472 * Check our parents are still who we think they are.
2473 * Do transparency updates if required
2474 */
2475int
2476rxvt_term::check_our_parents ()
2477{
2478#if TRANSPARENT || ENABLE_PERL
2479 check_our_aprents_ev.stop();
2480 check_our_aprents_ev.start(NOW + 1./3.);
2481#endif
2482 return 0;
2483}
2484
2485void
2486rxvt_term::check_our_parents_cb (time_watcher &w)
2487{
2488 int i, pchanged, aformat, have_pixmap, rootdepth;
2489 unsigned long nitems, bytes_after;
2490 Atom atype;
2491 unsigned char *prop = NULL;
2492 Window root, oldp, *list;
2493 Pixmap rootpixmap = None;
2494 XWindowAttributes wattr, wrootattr;
2495 int sx, sy;
2496 Window cr;
2497
2498 pchanged = 0;
2499
2500 if (!option (Opt_transparent))
2501 return /*pchanged*/; /* Don't try any more */
2502
2503 XGetWindowAttributes (dpy, display->root, &wrootattr);
2504 rootdepth = wrootattr.depth;
2505
2506 XGetWindowAttributes (dpy, parent[0], &wattr);
2507
2508 if (rootdepth != wattr.depth)
2509 {
2510 if (am_transparent)
2511 {
2512 pchanged = 1;
2513 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2514 am_transparent = am_pixmap_trans = 0;
2515 }
2516
2517 return /*pchanged*/; /* Don't try any more */
2518 }
2519
2520 /* Get all X ops out of the queue so that our information is up-to-date. */
2521 XSync (dpy, False);
2522
2523 XTranslateCoordinates (dpy, parent[0], display->root,
2524 0, 0, &sx, &sy, &cr);
2525
2526 /* check if we are outside of the visible part of the virtual screen : */
2527 if( sx + (int)szHint.width <= 0 || sy + (int)szHint.height <= 0
2528 || sx >= wrootattr.width || sy >= wrootattr.height )
2529 return /* 0 */ ;
2530 /*
2531 * Make the frame window set by the window manager have
2532 * the root background. Some window managers put multiple nested frame
2533 * windows for each client, so we have to take care about that.
2534 */
2535 i = (xa[XA_XROOTPMAP_ID]
2536 && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID],
2537 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2538 &nitems, &bytes_after, &prop) == Success);
2539
2540 if (!i || prop == NULL)
2541 i = (xa[XA_ESETROOT_PMAP_ID]
2542 && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID],
2543 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2544 &nitems, &bytes_after, &prop) == Success);
2545
2546 if (!i || prop == NULL
2547#if TINTING
2548 || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL
2549#ifdef HAVE_AFTERIMAGE
2550 && original_asim == NULL && rs[Rs_blurradius] == NULL
2551#endif
2552 )
2553#endif
2554 )
2555 have_pixmap = 0;
2556 else
2557 {
2558 have_pixmap = 1;
2559 rootpixmap = *(Pixmap *)prop;
2560 XFree (prop);
2561 }
2562
2563 if (have_pixmap)
2564 {
2565 Bool success = False ;
2566 GC gc;
2567 XGCValues gcvalue;
2568#ifdef HAVE_AFTERIMAGE
2569 {
2570 Pixmap tmp_pmap = None ;
2571 ShadingInfo shade;
2572 ARGB32 tint ;
2573 unsigned int pmap_w = 0, pmap_h = 0;
2574
2575 if (get_drawable_size( rootpixmap, &pmap_w, &pmap_h ))
2576 {
2577 int root_x = 0, root_y = 0;
2578
2579 shade.shading = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2580 if (ISSET_PIXCOLOR (Color_tint))
2581 {
2582 rgba c;
2583 pix_colors_focused [Color_tint].get (c);
2584 shade.tintColor.red = c.r;
2585 shade.tintColor.green = c.g;
2586 shade.tintColor.blue = c.b;
2587 }
2588 else
2589 shade.tintColor.red = shade.tintColor.green = shade.tintColor.blue = 0xFFFF;
2590 tint = shading2tint32( &shade );
2591 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2592 if (GetWinPosition (parent[0], &root_x, &root_y) )
2593 {
2594 ASImageLayer *layers = create_image_layers( 2 );
2595 ASImage *merged_im = NULL;
2596 int back_x, back_y, back_w, back_h;
2597 /* merge_layers does good job at tiling background appropriately,
2598 so all we need is to cut out smallest possible piece : */
2599#define MAKE_ROOTPMAP_GEOM(xy,wh,widthheight) \
2600 do{ while( root_##xy < 0 ) root_##xy += (int)wrootattr.widthheight; \
2601 back_##xy = root_##xy % pmap_##wh; /* that gives us left side of the closest tile : */ \
2602 if( pmap_##wh >= back_##xy + szHint.widthheight ) \
2603 back_##wh = szHint.widthheight;/* background is large - limit it by our size */ \
2604 else \
2605 { /* small background - need the whole of it for successfull tiling :*/ \
2606 back_##xy = 0; \
2607 back_##wh = pmap_##wh; \
2608 }}while(0)
2609
2610 MAKE_ROOTPMAP_GEOM(x,w,width);
2611 MAKE_ROOTPMAP_GEOM(y,h,height);
2612
2613 layers[0].im = pixmap2asimage (display->asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100);
2614 layers[0].clip_x = (back_w == pmap_w)?root_x:0;
2615 layers[0].clip_y = (back_h == pmap_h)?root_y:0;
2616 layers[0].clip_width = szHint.width;
2617 layers[0].clip_height = szHint.height;
2618 layers[0].tint = tint;
2619 if (rs[Rs_blurradius] && layers[0].im)
2620 {
2621 double r = atof(rs[Rs_blurradius]);
2622 ASImage* tmp = blur_asimage_gauss(display->asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT );
2623 if( tmp )
2624 {
2625 destroy_asimage( &layers[0].im );
2626 layers[0].im = tmp;
2627 }
2628 }
2629 if (original_asim != NULL)
2630 {
2631 int fore_w, fore_h;
2632 layers[1].im = original_asim;
2633 if( bgPixmap.auto_resize )
2634 {
2635 fore_w = szHint.width;
2636 fore_h = szHint.height;
2637 }
2638 else
2639 {
2640 fore_w = bgPixmap.w;
2641 fore_h = bgPixmap.h;
2642 }
2643 if (fore_w != original_asim->width
2644 || fore_h != original_asim->height)
2645 {
2646 layers[1].im = scale_asimage( display->asv,
2647 original_asim,
2648 fore_w, fore_h,
2649 ASA_ASImage, 100,
2650 ASIMAGE_QUALITY_DEFAULT );
2651 }
2652
2653 layers[1].clip_width = szHint.width;
2654 layers[1].clip_height = szHint.height;
2655
2656 if (rs[Rs_blendtype])
2657 {
2658 layers[1].merge_scanlines = blend_scanlines_name2func(rs[Rs_blendtype]);
2659 if( layers[1].merge_scanlines == NULL )
2660 layers[1].merge_scanlines = alphablend_scanlines;
2661 }
2662 }
2663 merged_im = merge_layers( display->asv, layers, layers[1].im?2:1,
2664 szHint.width, szHint.height,
2665 ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT );
2666 if (layers[1].im != original_asim)
2667 destroy_asimage( &(layers[1].im) );
2668 destroy_asimage( &(layers[0].im) );
2669 if (merged_im != NULL)
2670 {
2671 tmp_pmap = asimage2pixmap( display->asv, DefaultRootWindow(dpy), merged_im, gc, True );
2672 destroy_asimage( &merged_im );
2673 }
2674 free( layers );
2675 }
2676 }
2677 if (tmp_pmap != None)
2678 {
2679 success = True;
2680 if (pixmap != None)
2681 XFreePixmap (dpy, pixmap);
2682 pixmap = tmp_pmap;
2683 }
2684 }
2685#else /* HAVE_AFTERIMAGE */
2686 {
2687 /*
2688 * Copy display->root pixmap transparency
2689 */
2690 int nx, ny;
2691 unsigned int nw, nh;
2692 XImage *image;
2693
2694 nw = (unsigned int)szHint.width;
2695 nh = (unsigned int)szHint.height;
2696 nx = ny = 0;
2697
2698 if (sx < 0)
2699 {
2700 nw += sx;
2701 nx = -sx;
2702 sx = 0;
2703 }
2704
2705 if (sy < 0)
2706 {
2707 nh += sy;
2708 ny = -sy;
2709 sy = 0;
2710 }
2711
2712 min_it (nw, (unsigned int) (wrootattr.width - sx));
2713 min_it (nh, (unsigned int) (wrootattr.height - sy));
2714
2715 XSync (dpy, False);
2716 allowedxerror = -1;
2717 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2718
2719 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2720 /* XXX: may need a delay here? */
2721 allowedxerror = 0;
2722 if (image != NULL)
2723 {
2724 if (pixmap != None)
2725 XFreePixmap (dpy, pixmap);
2726
2727#if TINTING
2728 if (ISSET_PIXCOLOR (Color_tint))
2729 {
2730 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2731
2732 rgba c;
2733 pix_colors_focused [Color_tint].get (c);
2734 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2735 }
2736#endif
2737
2738 pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth);
2739 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2740 XPutImage (dpy, pixmap, gc, image, 0, 0,
2741 nx, ny, image->width, image->height);
2742 XDestroyImage (image);
2743 success = True ;
2744 }
2745 }
2746#endif /* HAVE_AFTERIMAGE */
2747 if (gc != NULL)
2748 XFreeGC (dpy, gc);
2749
2750 if (!success)
2751 {
2752 if (am_transparent && am_pixmap_trans)
2753 {
2754 pchanged = 1;
2755 if (pixmap != None)
2756 {
2757 XFreePixmap (dpy, pixmap);
2758 pixmap = None;
2759 }
2760 }
2761
2762 am_pixmap_trans = 0;
2763 }
2764 else
2765 {
2766 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2767 XClearWindow (dpy, parent[0]);
2768
2769 if (!am_transparent || !am_pixmap_trans)
2770 pchanged = 1;
2771
2772 am_transparent = am_pixmap_trans = 1;
2773 }
2774 }
2775
2776 if (am_pixmap_trans)
2777 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2778 else
2779 {
2780 unsigned int n;
2781 /*
2782 * InheritPixmap transparency
2783 */
2784 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2785 {
2786 oldp = parent[i];
2787 XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n);
2788 XFree (list);
2789
2790 if (parent[i] == display->root)
2791 {
2792 if (oldp != None)
2793 pchanged = 1;
2794
2795 break;
2796 }
2797
2798 if (oldp != parent[i])
2799 pchanged = 1;
2800 }
2801
2802 n = 0;
2803
2804 if (pchanged)
2805 for (; n < (unsigned int)i; n++)
2806 {
2807 XGetWindowAttributes (dpy, parent[n], &wattr);
2808
2809 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2810 {
2811 n = (int) (sizeof (parent) / sizeof (Window)) + 1;
2812 break;
2813 }
2814 }
2815
2816 if (n > (sizeof (parent) / sizeof (parent[0])))
2817 {
2818 XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]);
2819 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2820 am_transparent = 0;
2821 /* XXX: also turn off Opt_transparent? */
2822 }
2823 else
2824 {
2825 for (n = 0; n < (unsigned int)i; n++)
2826 {
2827 XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative);
2828 XClearWindow (dpy, parent[n]);
2829 }
2830
2831 XSetWindowBackgroundPixmap (dpy, vt, ParentRelative);
2832 am_transparent = 1;
2833 }
2834
2835 for (; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2836 parent[i] = None;
2837 }
2838
2839 if (scrollBar.win)
2840 {
2841 XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative);
2842 scrollBar.setIdle ();
2843 scrollbar_show (0);
2844 }
2845
2846 if (am_transparent)
2847 {
2848 want_refresh = want_full_refresh = 1;
2849 if (am_pixmap_trans)
2850 flush ();
2851 }
2852
2853// return pchanged;
2854}
2855#endif
2856
2857/*}}} */ 2237/*}}} */
2858 2238
2859bool 2239bool
2860rxvt_term::cmd_parse () 2240rxvt_term::cmd_parse ()
2861{ 2241{
2909 if (ch == C0_LF) 2289 if (ch == C0_LF)
2910 nlines++; 2290 nlines++;
2911 2291
2912 refresh_count++; 2292 refresh_count++;
2913 2293
2914 if (!option (Opt_jumpScroll) 2294 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2915 || (refresh_count >= refresh_limit * (nrow - 1)))
2916 { 2295 {
2917 refreshnow = true;
2918 refresh_count = 0; 2296 refresh_count = 0;
2297
2298 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.)
2299 {
2300 refreshnow = true;
2919 ch = NOCHAR; 2301 ch = NOCHAR;
2920 break; 2302 break;
2303 }
2921 } 2304 }
2922 2305
2923 // scr_add_lines only works for nlines <= nrow - 1. 2306 // scr_add_lines only works for nlines <= nrow - 1.
2924 if (nlines >= nrow - 1) 2307 if (nlines >= nrow - 1)
2925 { 2308 {
2953 && 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))))
2954 scr_add_lines (buf, str - buf, nlines); 2337 scr_add_lines (buf, str - buf, nlines);
2955 2338
2956 /* 2339 /*
2957 * 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
2958 * 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.
2959 * the number of pages between refreshes is refresh_limit, which 2342 * if skipScroll is enabled.
2960 * is incremented here because we must be doing flat-out scrolling.
2961 */ 2343 */
2962 if (refreshnow) 2344 if (refreshnow)
2963 { 2345 {
2964 if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2965 refresh_limit++;
2966 else
2967 {
2968 flag = true; 2346 flag = true;
2969 //TODO: due to popular request, implement "skipscroll" option here
2970 scr_refresh (); 2347 scr_refresh ();
2971 want_refresh = 1; 2348 want_refresh = 1;
2972 }
2973 } 2349 }
2974 2350
2975 } 2351 }
2976 else 2352 else
2977 { 2353 {
3126 { 2502 {
3127 if ((buf[len++] = cmd_getc ()) == 'i') 2503 if ((buf[len++] = cmd_getc ()) == 'i')
3128 break; /* done = 1 */ 2504 break; /* done = 1 */
3129 } 2505 }
3130 } 2506 }
3131 2507
3132 for (i = 0; i < len; i++) 2508 for (i = 0; i < len; i++)
3133 if (putc (buf[i], fd) == EOF) 2509 if (putc (buf[i], fd) == EOF)
3134 { 2510 {
3135 done = 1; 2511 done = 1;
3136 break; 2512 break;
3198 process_dcs_seq (); 2574 process_dcs_seq ();
3199 break; 2575 break;
3200 case 0x9b: /* CSI */ 2576 case 0x9b: /* CSI */
3201 process_csi_seq (); 2577 process_csi_seq ();
3202 break; 2578 break;
3203 case 0x9d: /* CSI */ 2579 case 0x9d: /* OSC */
3204 process_osc_seq (); 2580 process_osc_seq ();
3205 break; 2581 break;
3206#endif 2582#endif
3207 } 2583 }
3208} 2584}
3954 int saveop = op; 3330 int saveop = op;
3955 3331
3956 dLocal (Display *, dpy); 3332 dLocal (Display *, dpy);
3957 3333
3958 assert (str != NULL); 3334 assert (str != NULL);
3959 3335
3960 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)))
3961 return; 3337 return;
3962 3338
3963 switch (op) 3339 switch (op)
3964 { 3340 {
4059 break; 3435 break;
4060 case URxvt_Color_IT: 3436 case URxvt_Color_IT:
4061 process_color_seq (op, Color_IT, str, resp); 3437 process_color_seq (op, Color_IT, str, resp);
4062 break; 3438 break;
4063#endif 3439#endif
4064#if TRANSPARENT && TINTING 3440#if ENABLE_TRANSPARENCY && TINTING
4065 case URxvt_Color_tint: 3441 case URxvt_Color_tint:
4066 process_color_seq (op, Color_tint, str, resp); 3442 process_color_seq (op, Color_tint, str, resp);
4067 3443
4068 check_our_parents (); 3444 check_our_parents ();
4069 3445
4099#ifdef XPM_BACKGROUND 3475#ifdef XPM_BACKGROUND
4100 resize_pixmap (); 3476 resize_pixmap ();
4101 scr_touch (true); 3477 scr_touch (true);
4102#endif 3478#endif
4103 } 3479 }
4104#if TRANSPARENT && defined(HAVE_AFTERIMAGE) 3480#if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE)
4105 if (option(Opt_transparent)) 3481 if (option (Opt_transparent))
4106 check_our_parents (); 3482 check_our_parents ();
4107#endif 3483#endif
4108
4109 } 3484 }
4110 break; 3485 break;
4111 3486
4112 case Rxvt_restoreFG: 3487 case Rxvt_restoreFG:
4113 set_window_color (Color_fg, str); 3488 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines