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.323 by ayin, Mon May 28 18:38:03 2007 UTC vs.
Revision 1.327 by ayin, Mon Jun 11 13:33:34 2007 UTC

973 scr_overlay_off (); 973 scr_overlay_off ();
974# endif 974# endif
975 if (iso14755buf & ISO_14755_51) 975 if (iso14755buf & ISO_14755_51)
976 commit_iso14755 (); 976 commit_iso14755 ();
977#if ISO_14755 977#if ISO_14755
978 else if (iso14755buf & ISO_14755_STARTED) 978 else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED)
979 { 979 {
980 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
981 981
982 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);
983 scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); 983 scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE");
1489 1489
1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1491 { 1491 {
1492 seen_resize = 1; 1492 seen_resize = 1;
1493 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1493 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1494#ifdef XPM_BACKGROUND
1495 if (!option(Opt_transparent) && bgPixmap.auto_resize)
1496 {
1497 resize_pixmap ();
1498 scr_touch (true);
1499 }
1500#endif
1494 } 1501 }
1495 1502
1496 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1503 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1497 1504
1498#ifdef TRANSPARENT 1505#ifdef TRANSPARENT
1839 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1846 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1840 return; 1847 return;
1841 1848
1842 /* FALLTHROUGH */ 1849 /* FALLTHROUGH */
1843 case ReparentNotify: 1850 case ReparentNotify:
1844 if (option (Opt_transparent) && check_our_parents () && am_transparent) 1851 if (option (Opt_transparent))
1845 want_refresh = want_full_refresh = 1; 1852 check_our_parents ();
1846 break; 1853 break;
1847 } 1854 }
1848# endif 1855# endif
1849} 1856}
1850#endif 1857#endif
2228 } 2235 }
2229 } 2236 }
2230} 2237}
2231 2238
2232#ifdef TRANSPARENT 2239#ifdef TRANSPARENT
2233#if TINTING 2240#if TINTING && !defined(HAVE_AFTERIMAGE)
2234/* taken from aterm-0.4.2 */ 2241/* taken from aterm-0.4.2 */
2235 2242
2236typedef uint32_t RUINT32T; 2243typedef uint32_t RUINT32T;
2237 2244
2238void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) 2245void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm)
2466 * Do transparency updates if required 2473 * Do transparency updates if required
2467 */ 2474 */
2468int 2475int
2469rxvt_term::check_our_parents () 2476rxvt_term::check_our_parents ()
2470{ 2477{
2478 check_our_parents_ev.stop ();
2479 check_our_parents_ev.start (NOW + .1);
2480 return 0;
2481}
2482
2483void
2484rxvt_term::check_our_parents_cb (time_watcher &w)
2485{
2471 int i, pchanged, aformat, have_pixmap, rootdepth; 2486 int i, pchanged, aformat, have_pixmap, rootdepth;
2472 unsigned long nitems, bytes_after; 2487 unsigned long nitems, bytes_after;
2473 Atom atype; 2488 Atom atype;
2474 unsigned char *prop = NULL; 2489 unsigned char *prop = NULL;
2475 Window root, oldp, *list; 2490 Window root, oldp, *list;
2476 Pixmap rootpixmap = None; 2491 Pixmap rootpixmap = None;
2477 XWindowAttributes wattr, wrootattr; 2492 XWindowAttributes wattr, wrootattr;
2493 int sx, sy;
2494 Window cr;
2478 2495
2479 pchanged = 0; 2496 pchanged = 0;
2480 2497
2481 if (!option (Opt_transparent)) 2498 if (!option (Opt_transparent))
2482 return pchanged; /* Don't try any more */ 2499 return /*pchanged*/; /* Don't try any more */
2483 2500
2484 XGetWindowAttributes (dpy, display->root, &wrootattr); 2501 XGetWindowAttributes (dpy, display->root, &wrootattr);
2485 rootdepth = wrootattr.depth; 2502 rootdepth = wrootattr.depth;
2486 2503
2487 XGetWindowAttributes (dpy, parent[0], &wattr); 2504 XGetWindowAttributes (dpy, parent[0], &wattr);
2493 pchanged = 1; 2510 pchanged = 1;
2494 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); 2511 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2495 am_transparent = am_pixmap_trans = 0; 2512 am_transparent = am_pixmap_trans = 0;
2496 } 2513 }
2497 2514
2498 return pchanged; /* Don't try any more */ 2515 return /*pchanged*/; /* Don't try any more */
2499 } 2516 }
2500 2517
2501 /* Get all X ops out of the queue so that our information is up-to-date. */ 2518 /* Get all X ops out of the queue so that our information is up-to-date. */
2502 XSync (dpy, False); 2519 XSync (dpy, False);
2503 2520
2521 XTranslateCoordinates (dpy, parent[0], display->root,
2522 0, 0, &sx, &sy, &cr);
2523
2524 /* check if we are outside of the visible part of the virtual screen : */
2525 if( sx + (int)szHint.width <= 0 || sy + (int)szHint.height <= 0
2526 || sx >= wrootattr.width || sy >= wrootattr.height )
2527 return /* 0 */ ;
2504 /* 2528 /*
2505 * Make the frame window set by the window manager have 2529 * Make the frame window set by the window manager have
2506 * the root background. Some window managers put multiple nested frame 2530 * the root background. Some window managers put multiple nested frame
2507 * windows for each client, so we have to take care about that. 2531 * windows for each client, so we have to take care about that.
2508 */ 2532 */
2517 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2541 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2518 &nitems, &bytes_after, &prop) == Success); 2542 &nitems, &bytes_after, &prop) == Success);
2519 2543
2520 if (!i || prop == NULL 2544 if (!i || prop == NULL
2521#if TINTING 2545#if TINTING
2522 || !ISSET_PIXCOLOR (Color_tint) 2546 || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL
2547#ifdef HAVE_AFTERIMAGE
2548 && original_asim == NULL && rs[Rs_blurradius] == NULL
2549#endif
2550 )
2523#endif 2551#endif
2524 ) 2552 )
2525 have_pixmap = 0; 2553 have_pixmap = 0;
2526 else 2554 else
2527 { 2555 {
2530 XFree (prop); 2558 XFree (prop);
2531 } 2559 }
2532 2560
2533 if (have_pixmap) 2561 if (have_pixmap)
2534 { 2562 {
2563 Bool success = False ;
2564 GC gc;
2565 XGCValues gcvalue;
2566#ifdef HAVE_AFTERIMAGE
2567 {
2568 Pixmap tmp_pmap = None ;
2569 ShadingInfo shade;
2570 ARGB32 tint ;
2571 unsigned int pmap_w = 0, pmap_h = 0;
2572
2573 if (get_drawable_size( rootpixmap, &pmap_w, &pmap_h ))
2574 {
2575 int root_x = 0, root_y = 0;
2576
2577 shade.shading = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2578 if (ISSET_PIXCOLOR (Color_tint))
2579 {
2580 rgba c;
2581 pix_colors_focused [Color_tint].get (c);
2582 shade.tintColor.red = c.r;
2583 shade.tintColor.green = c.g;
2584 shade.tintColor.blue = c.b;
2585 }
2586 else
2587 shade.tintColor.red = shade.tintColor.green = shade.tintColor.blue = 0xFFFF;
2588 tint = shading2tint32( &shade );
2589 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2590 if (GetWinPosition (parent[0], &root_x, &root_y) )
2591 {
2592 ASImageLayer *layers = create_image_layers( 2 );
2593 ASImage *merged_im = NULL;
2594 int back_x, back_y, back_w, back_h;
2595 /* merge_layers does good job at tiling background appropriately,
2596 so all we need is to cut out smallest possible piece : */
2597#define MAKE_ROOTPMAP_GEOM(xy,wh,widthheight) \
2598 do{ while( root_##xy < 0 ) root_##xy += (int)wrootattr.widthheight; \
2599 back_##xy = root_##xy % pmap_##wh; /* that gives us left side of the closest tile : */ \
2600 if( pmap_##wh >= back_##xy + szHint.widthheight ) \
2601 back_##wh = szHint.widthheight;/* background is large - limit it by our size */ \
2602 else \
2603 { /* small background - need the whole of it for successfull tiling :*/ \
2604 back_##xy = 0; \
2605 back_##wh = pmap_##wh; \
2606 }}while(0)
2607
2608 MAKE_ROOTPMAP_GEOM(x,w,width);
2609 MAKE_ROOTPMAP_GEOM(y,h,height);
2610
2611 layers[0].im = pixmap2asimage (display->asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100);
2612 layers[0].clip_x = (back_w == pmap_w)?root_x:0;
2613 layers[0].clip_y = (back_h == pmap_h)?root_y:0;
2614 layers[0].clip_width = szHint.width;
2615 layers[0].clip_height = szHint.height;
2616 layers[0].tint = tint;
2617 if (rs[Rs_blurradius] && layers[0].im)
2618 {
2619 double r = atof(rs[Rs_blurradius]);
2620 ASImage* tmp = blur_asimage_gauss(display->asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT );
2621 if( tmp )
2622 {
2623 destroy_asimage( &layers[0].im );
2624 layers[0].im = tmp;
2625 }
2626 }
2627 if (original_asim != NULL)
2628 {
2629 int fore_w, fore_h;
2630 layers[1].im = original_asim;
2631 if( bgPixmap.auto_resize )
2632 {
2633 fore_w = szHint.width;
2634 fore_h = szHint.height;
2635 }
2636 else
2637 {
2638 fore_w = bgPixmap.w;
2639 fore_h = bgPixmap.h;
2640 }
2641 if (fore_w != original_asim->width
2642 || fore_h != original_asim->height)
2643 {
2644 layers[1].im = scale_asimage( display->asv,
2645 original_asim,
2646 fore_w, fore_h,
2647 ASA_ASImage, 100,
2648 ASIMAGE_QUALITY_DEFAULT );
2649 }
2650
2651 layers[1].clip_width = szHint.width;
2652 layers[1].clip_height = szHint.height;
2653
2654 if (rs[Rs_blendtype])
2655 {
2656 layers[1].merge_scanlines = blend_scanlines_name2func(rs[Rs_blendtype]);
2657 if( layers[1].merge_scanlines == NULL )
2658 layers[1].merge_scanlines = alphablend_scanlines;
2659 }
2660 }
2661 merged_im = merge_layers( display->asv, layers, layers[1].im?2:1,
2662 szHint.width, szHint.height,
2663 ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT );
2664 if (layers[1].im != original_asim)
2665 destroy_asimage( &(layers[1].im) );
2666 destroy_asimage( &(layers[0].im) );
2667 if (merged_im != NULL)
2668 {
2669 tmp_pmap = asimage2pixmap( display->asv, DefaultRootWindow(dpy), merged_im, gc, True );
2670 destroy_asimage( &merged_im );
2671 }
2672 free( layers );
2673 }
2674 }
2675 if (tmp_pmap != None)
2676 {
2677 success = True;
2678 if (pixmap != None)
2679 XFreePixmap (dpy, pixmap);
2680 pixmap = tmp_pmap;
2681 }
2682 }
2683#else /* HAVE_AFTERIMAGE */
2684 {
2535 /* 2685 /*
2536 * Copy display->root pixmap transparency 2686 * Copy display->root pixmap transparency
2537 */ 2687 */
2538 int sx, sy, nx, ny; 2688 int nx, ny;
2539 unsigned int nw, nh; 2689 unsigned int nw, nh;
2540 Window cr;
2541 XImage *image; 2690 XImage *image;
2542 GC gc;
2543 XGCValues gcvalue;
2544 2691
2545 XTranslateCoordinates (dpy, parent[0], display->root,
2546 0, 0, &sx, &sy, &cr);
2547 nw = (unsigned int)szHint.width; 2692 nw = (unsigned int)szHint.width;
2548 nh = (unsigned int)szHint.height; 2693 nh = (unsigned int)szHint.height;
2549 nx = ny = 0; 2694 nx = ny = 0;
2550 2695
2551 if (sx < 0) 2696 if (sx < 0)
2552 { 2697 {
2553 nw += sx; 2698 nw += sx;
2554 nx = -sx; 2699 nx = -sx;
2555 sx = 0; 2700 sx = 0;
2556 } 2701 }
2557 2702
2558 if (sy < 0) 2703 if (sy < 0)
2559 { 2704 {
2560 nh += sy; 2705 nh += sy;
2561 ny = -sy; 2706 ny = -sy;
2562 sy = 0; 2707 sy = 0;
2563 } 2708 }
2564 2709
2565 min_it (nw, (unsigned int) (wrootattr.width - sx)); 2710 min_it (nw, (unsigned int) (wrootattr.width - sx));
2566 min_it (nh, (unsigned int) (wrootattr.height - sy)); 2711 min_it (nh, (unsigned int) (wrootattr.height - sy));
2567 2712
2568 XSync (dpy, False); 2713 XSync (dpy, False);
2569 allowedxerror = -1; 2714 allowedxerror = -1;
2570 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2715 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2571 2716
2572 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2717 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2573 /* XXX: may need a delay here? */ 2718 /* XXX: may need a delay here? */
2574 allowedxerror = 0; 2719 allowedxerror = 0;
2575
2576 if (image == NULL) 2720 if (image != NULL)
2721 {
2722 if (pixmap != None)
2723 XFreePixmap (dpy, pixmap);
2724
2725#if TINTING
2726 if (ISSET_PIXCOLOR (Color_tint))
2727 {
2728 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2729
2730 rgba c;
2731 pix_colors_focused [Color_tint].get (c);
2732 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2733 }
2734#endif
2735
2736 pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth);
2737 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2738 XPutImage (dpy, pixmap, gc, image, 0, 0,
2739 nx, ny, image->width, image->height);
2740 XDestroyImage (image);
2741 success = True ;
2742 }
2743 }
2744#endif /* HAVE_AFTERIMAGE */
2745 if (gc != NULL)
2746 XFreeGC (dpy, gc);
2747
2748 if (!success)
2577 { 2749 {
2578 if (am_transparent && am_pixmap_trans) 2750 if (am_transparent && am_pixmap_trans)
2579 { 2751 {
2580 pchanged = 1; 2752 pchanged = 1;
2581 if (pixmap != None) 2753 if (pixmap != None)
2587 2759
2588 am_pixmap_trans = 0; 2760 am_pixmap_trans = 0;
2589 } 2761 }
2590 else 2762 else
2591 { 2763 {
2592 if (pixmap != None)
2593 XFreePixmap (dpy, pixmap);
2594
2595#if TINTING
2596 if (ISSET_PIXCOLOR (Color_tint))
2597 {
2598 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2599
2600 rgba c;
2601 pix_colors_focused [Color_tint].get (c);
2602
2603 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2604 }
2605#endif
2606
2607 pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth);
2608 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2609 XPutImage (dpy, pixmap, gc, image, 0, 0,
2610 nx, ny, image->width, image->height);
2611 XFreeGC (dpy, gc);
2612 XDestroyImage (image);
2613 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); 2764 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2614 XClearWindow (dpy, parent[0]); 2765 XClearWindow (dpy, parent[0]);
2615 2766
2616 if (!am_transparent || !am_pixmap_trans) 2767 if (!am_transparent || !am_pixmap_trans)
2617 pchanged = 1; 2768 pchanged = 1;
2695 want_refresh = want_full_refresh = 1; 2846 want_refresh = want_full_refresh = 1;
2696 if (am_pixmap_trans) 2847 if (am_pixmap_trans)
2697 flush (); 2848 flush ();
2698 } 2849 }
2699 2850
2700 return pchanged; 2851// return pchanged;
2701} 2852}
2702#endif 2853#endif
2703 2854
2704/*}}} */ 2855/*}}} */
2705 2856
3946#ifdef XPM_BACKGROUND 4097#ifdef XPM_BACKGROUND
3947 resize_pixmap (); 4098 resize_pixmap ();
3948 scr_touch (true); 4099 scr_touch (true);
3949#endif 4100#endif
3950 } 4101 }
4102#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
4103 if (option(Opt_transparent))
4104 check_our_parents ();
4105#endif
4106
3951 } 4107 }
3952 break; 4108 break;
3953 4109
3954 case Rxvt_restoreFG: 4110 case Rxvt_restoreFG:
3955 set_window_color (Color_fg, str); 4111 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines