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.322 by ayin, Wed May 2 23:06:32 2007 UTC vs.
Revision 1.325 by ayin, Sat Jun 9 09:05:38 2007 UTC

497 { 497 {
498 commit_iso14755 (); 498 commit_iso14755 ();
499 iso14755buf = ISO_14755_51; 499 iso14755buf = ISO_14755_51;
500# if ISO_14755 500# if ISO_14755
501 iso14755_51 (0); 501 iso14755_51 (0);
502# endif
503 return;
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);
502# endif 510# endif
503 return; 511 return;
504 } 512 }
505 else if ((hv = hex_keyval (ev)) >= 0) 513 else if ((hv = hex_keyval (ev)) >= 0)
506 { 514 {
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");
1481 1489
1482 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1483 { 1491 {
1484 seen_resize = 1; 1492 seen_resize = 1;
1485 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
1486 } 1501 }
1487 1502
1488 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1503 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1489 1504
1490#ifdef TRANSPARENT 1505#ifdef TRANSPARENT
1831 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1846 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1832 return; 1847 return;
1833 1848
1834 /* FALLTHROUGH */ 1849 /* FALLTHROUGH */
1835 case ReparentNotify: 1850 case ReparentNotify:
1836 if (option (Opt_transparent) && check_our_parents () && am_transparent) 1851 if (option (Opt_transparent))
1837 want_refresh = want_full_refresh = 1; 1852 check_our_parents ();
1838 break; 1853 break;
1839 } 1854 }
1840# endif 1855# endif
1841} 1856}
1842#endif 1857#endif
2220 } 2235 }
2221 } 2236 }
2222} 2237}
2223 2238
2224#ifdef TRANSPARENT 2239#ifdef TRANSPARENT
2225#if TINTING 2240#if TINTING && !defined(HAVE_AFTERIMAGE)
2226/* taken from aterm-0.4.2 */ 2241/* taken from aterm-0.4.2 */
2227 2242
2228typedef uint32_t RUINT32T; 2243typedef uint32_t RUINT32T;
2229 2244
2230void 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)
2458 * Do transparency updates if required 2473 * Do transparency updates if required
2459 */ 2474 */
2460int 2475int
2461rxvt_term::check_our_parents () 2476rxvt_term::check_our_parents ()
2462{ 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{
2463 int i, pchanged, aformat, have_pixmap, rootdepth; 2488 int i, pchanged, aformat, have_pixmap, rootdepth;
2464 unsigned long nitems, bytes_after; 2489 unsigned long nitems, bytes_after;
2465 Atom atype; 2490 Atom atype;
2466 unsigned char *prop = NULL; 2491 unsigned char *prop = NULL;
2467 Window root, oldp, *list; 2492 Window root, oldp, *list;
2468 Pixmap rootpixmap = None; 2493 Pixmap rootpixmap = None;
2469 XWindowAttributes wattr, wrootattr; 2494 XWindowAttributes wattr, wrootattr;
2495 int sx, sy;
2496 Window cr;
2470 2497
2471 pchanged = 0; 2498 pchanged = 0;
2472 2499
2473 if (!option (Opt_transparent)) 2500 if (!option (Opt_transparent))
2474 return pchanged; /* Don't try any more */ 2501 return /*pchanged*/; /* Don't try any more */
2475 2502
2476 XGetWindowAttributes (dpy, display->root, &wrootattr); 2503 XGetWindowAttributes (dpy, display->root, &wrootattr);
2477 rootdepth = wrootattr.depth; 2504 rootdepth = wrootattr.depth;
2478 2505
2479 XGetWindowAttributes (dpy, parent[0], &wattr); 2506 XGetWindowAttributes (dpy, parent[0], &wattr);
2485 pchanged = 1; 2512 pchanged = 1;
2486 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); 2513 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2487 am_transparent = am_pixmap_trans = 0; 2514 am_transparent = am_pixmap_trans = 0;
2488 } 2515 }
2489 2516
2490 return pchanged; /* Don't try any more */ 2517 return /*pchanged*/; /* Don't try any more */
2491 } 2518 }
2492 2519
2493 /* Get all X ops out of the queue so that our information is up-to-date. */ 2520 /* Get all X ops out of the queue so that our information is up-to-date. */
2494 XSync (dpy, False); 2521 XSync (dpy, False);
2495 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 */ ;
2496 /* 2530 /*
2497 * Make the frame window set by the window manager have 2531 * Make the frame window set by the window manager have
2498 * the root background. Some window managers put multiple nested frame 2532 * the root background. Some window managers put multiple nested frame
2499 * windows for each client, so we have to take care about that. 2533 * windows for each client, so we have to take care about that.
2500 */ 2534 */
2509 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2543 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2510 &nitems, &bytes_after, &prop) == Success); 2544 &nitems, &bytes_after, &prop) == Success);
2511 2545
2512 if (!i || prop == NULL 2546 if (!i || prop == NULL
2513#if TINTING 2547#if TINTING
2514 || !ISSET_PIXCOLOR (Color_tint) 2548 || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL
2549#ifdef HAVE_AFTERIMAGE
2550 && original_asim == NULL && rs[Rs_blurradius] == NULL
2551#endif
2552 )
2515#endif 2553#endif
2516 ) 2554 )
2517 have_pixmap = 0; 2555 have_pixmap = 0;
2518 else 2556 else
2519 { 2557 {
2522 XFree (prop); 2560 XFree (prop);
2523 } 2561 }
2524 2562
2525 if (have_pixmap) 2563 if (have_pixmap)
2526 { 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 {
2527 /* 2687 /*
2528 * Copy display->root pixmap transparency 2688 * Copy display->root pixmap transparency
2529 */ 2689 */
2530 int sx, sy, nx, ny; 2690 int nx, ny;
2531 unsigned int nw, nh; 2691 unsigned int nw, nh;
2532 Window cr;
2533 XImage *image; 2692 XImage *image;
2534 GC gc;
2535 XGCValues gcvalue;
2536 2693
2537 XTranslateCoordinates (dpy, parent[0], display->root,
2538 0, 0, &sx, &sy, &cr);
2539 nw = (unsigned int)szHint.width; 2694 nw = (unsigned int)szHint.width;
2540 nh = (unsigned int)szHint.height; 2695 nh = (unsigned int)szHint.height;
2541 nx = ny = 0; 2696 nx = ny = 0;
2542 2697
2543 if (sx < 0) 2698 if (sx < 0)
2544 { 2699 {
2545 nw += sx; 2700 nw += sx;
2546 nx = -sx; 2701 nx = -sx;
2547 sx = 0; 2702 sx = 0;
2548 } 2703 }
2549 2704
2550 if (sy < 0) 2705 if (sy < 0)
2551 { 2706 {
2552 nh += sy; 2707 nh += sy;
2553 ny = -sy; 2708 ny = -sy;
2554 sy = 0; 2709 sy = 0;
2555 } 2710 }
2556 2711
2557 min_it (nw, (unsigned int) (wrootattr.width - sx)); 2712 min_it (nw, (unsigned int) (wrootattr.width - sx));
2558 min_it (nh, (unsigned int) (wrootattr.height - sy)); 2713 min_it (nh, (unsigned int) (wrootattr.height - sy));
2559 2714
2560 XSync (dpy, False); 2715 XSync (dpy, False);
2561 allowedxerror = -1; 2716 allowedxerror = -1;
2562 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2717 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2563 2718
2564 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2719 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2565 /* XXX: may need a delay here? */ 2720 /* XXX: may need a delay here? */
2566 allowedxerror = 0; 2721 allowedxerror = 0;
2567
2568 if (image == NULL) 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)
2569 { 2751 {
2570 if (am_transparent && am_pixmap_trans) 2752 if (am_transparent && am_pixmap_trans)
2571 { 2753 {
2572 pchanged = 1; 2754 pchanged = 1;
2573 if (pixmap != None) 2755 if (pixmap != None)
2579 2761
2580 am_pixmap_trans = 0; 2762 am_pixmap_trans = 0;
2581 } 2763 }
2582 else 2764 else
2583 { 2765 {
2584 if (pixmap != None)
2585 XFreePixmap (dpy, pixmap);
2586
2587#if TINTING
2588 if (ISSET_PIXCOLOR (Color_tint))
2589 {
2590 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2591
2592 rgba c;
2593 pix_colors_focused [Color_tint].get (c);
2594
2595 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2596 }
2597#endif
2598
2599 pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth);
2600 gc = XCreateGC (dpy, vt, 0UL, &gcvalue);
2601 XPutImage (dpy, pixmap, gc, image, 0, 0,
2602 nx, ny, image->width, image->height);
2603 XFreeGC (dpy, gc);
2604 XDestroyImage (image);
2605 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); 2766 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2606 XClearWindow (dpy, parent[0]); 2767 XClearWindow (dpy, parent[0]);
2607 2768
2608 if (!am_transparent || !am_pixmap_trans) 2769 if (!am_transparent || !am_pixmap_trans)
2609 pchanged = 1; 2770 pchanged = 1;
2687 want_refresh = want_full_refresh = 1; 2848 want_refresh = want_full_refresh = 1;
2688 if (am_pixmap_trans) 2849 if (am_pixmap_trans)
2689 flush (); 2850 flush ();
2690 } 2851 }
2691 2852
2692 return pchanged; 2853// return pchanged;
2693} 2854}
2694#endif 2855#endif
2695 2856
2696/*}}} */ 2857/*}}} */
2697 2858
3938#ifdef XPM_BACKGROUND 4099#ifdef XPM_BACKGROUND
3939 resize_pixmap (); 4100 resize_pixmap ();
3940 scr_touch (true); 4101 scr_touch (true);
3941#endif 4102#endif
3942 } 4103 }
4104#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
4105 if (option(Opt_transparent))
4106 check_our_parents ();
4107#endif
4108
3943 } 4109 }
3944 break; 4110 break;
3945 4111
3946 case Rxvt_restoreFG: 4112 case Rxvt_restoreFG:
3947 set_window_color (Color_fg, str); 4113 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines