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.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
1740 { 1755 {
1741 pix_colors = pix_colors_focused; 1756 pix_colors = pix_colors_focused;
1742 scr_recolour (); 1757 scr_recolour ();
1743 } 1758 }
1744#endif 1759#endif
1760#if ENABLE_FRILLS
1761 if (option (Opt_urgentOnBell))
1762 {
1763 XWMHints *h;
1764
1765 h = XGetWMHints(dpy, parent[0]);
1766 if (h != NULL)
1767 {
1768 h->flags &= ~XUrgencyHint;
1769 XSetWMHints(dpy, parent[0], h);
1770 }
1771 }
1772#endif
1745 } 1773 }
1746} 1774}
1747 1775
1748void 1776void
1749rxvt_term::focus_out () 1777rxvt_term::focus_out ()
1818 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1846 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1819 return; 1847 return;
1820 1848
1821 /* FALLTHROUGH */ 1849 /* FALLTHROUGH */
1822 case ReparentNotify: 1850 case ReparentNotify:
1823 if (option (Opt_transparent) && check_our_parents () && am_transparent) 1851 if (option (Opt_transparent))
1824 want_refresh = want_full_refresh = 1; 1852 check_our_parents ();
1825 break; 1853 break;
1826 } 1854 }
1827# endif 1855# endif
1828} 1856}
1829#endif 1857#endif
2207 } 2235 }
2208 } 2236 }
2209} 2237}
2210 2238
2211#ifdef TRANSPARENT 2239#ifdef TRANSPARENT
2212#if TINTING 2240#if TINTING && !defined(HAVE_AFTERIMAGE)
2213/* taken from aterm-0.4.2 */ 2241/* taken from aterm-0.4.2 */
2214 2242
2215typedef uint32_t RUINT32T; 2243typedef uint32_t RUINT32T;
2216 2244
2217void 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)
2445 * Do transparency updates if required 2473 * Do transparency updates if required
2446 */ 2474 */
2447int 2475int
2448rxvt_term::check_our_parents () 2476rxvt_term::check_our_parents ()
2449{ 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{
2450 int i, pchanged, aformat, have_pixmap, rootdepth; 2488 int i, pchanged, aformat, have_pixmap, rootdepth;
2451 unsigned long nitems, bytes_after; 2489 unsigned long nitems, bytes_after;
2452 Atom atype; 2490 Atom atype;
2453 unsigned char *prop = NULL; 2491 unsigned char *prop = NULL;
2454 Window root, oldp, *list; 2492 Window root, oldp, *list;
2455 Pixmap rootpixmap = None; 2493 Pixmap rootpixmap = None;
2456 XWindowAttributes wattr, wrootattr; 2494 XWindowAttributes wattr, wrootattr;
2495 int sx, sy;
2496 Window cr;
2457 2497
2458 pchanged = 0; 2498 pchanged = 0;
2459 2499
2460 if (!option (Opt_transparent)) 2500 if (!option (Opt_transparent))
2461 return pchanged; /* Don't try any more */ 2501 return /*pchanged*/; /* Don't try any more */
2462 2502
2463 XGetWindowAttributes (dpy, display->root, &wrootattr); 2503 XGetWindowAttributes (dpy, display->root, &wrootattr);
2464 rootdepth = wrootattr.depth; 2504 rootdepth = wrootattr.depth;
2465 2505
2466 XGetWindowAttributes (dpy, parent[0], &wattr); 2506 XGetWindowAttributes (dpy, parent[0], &wattr);
2472 pchanged = 1; 2512 pchanged = 1;
2473 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); 2513 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2474 am_transparent = am_pixmap_trans = 0; 2514 am_transparent = am_pixmap_trans = 0;
2475 } 2515 }
2476 2516
2477 return pchanged; /* Don't try any more */ 2517 return /*pchanged*/; /* Don't try any more */
2478 } 2518 }
2479 2519
2480 /* 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. */
2481 XSync (dpy, False); 2521 XSync (dpy, False);
2482 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 */ ;
2483 /* 2530 /*
2484 * Make the frame window set by the window manager have 2531 * Make the frame window set by the window manager have
2485 * the root background. Some window managers put multiple nested frame 2532 * the root background. Some window managers put multiple nested frame
2486 * 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.
2487 */ 2534 */
2496 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2543 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2497 &nitems, &bytes_after, &prop) == Success); 2544 &nitems, &bytes_after, &prop) == Success);
2498 2545
2499 if (!i || prop == NULL 2546 if (!i || prop == NULL
2500#if TINTING 2547#if TINTING
2501 || !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 )
2502#endif 2553#endif
2503 ) 2554 )
2504 have_pixmap = 0; 2555 have_pixmap = 0;
2505 else 2556 else
2506 { 2557 {
2509 XFree (prop); 2560 XFree (prop);
2510 } 2561 }
2511 2562
2512 if (have_pixmap) 2563 if (have_pixmap)
2513 { 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 {
2514 /* 2687 /*
2515 * Copy display->root pixmap transparency 2688 * Copy display->root pixmap transparency
2516 */ 2689 */
2517 int sx, sy, nx, ny; 2690 int nx, ny;
2518 unsigned int nw, nh; 2691 unsigned int nw, nh;
2519 Window cr;
2520 XImage *image; 2692 XImage *image;
2521 GC gc;
2522 XGCValues gcvalue;
2523 2693
2524 XTranslateCoordinates (dpy, parent[0], display->root,
2525 0, 0, &sx, &sy, &cr);
2526 nw = (unsigned int)szHint.width; 2694 nw = (unsigned int)szHint.width;
2527 nh = (unsigned int)szHint.height; 2695 nh = (unsigned int)szHint.height;
2528 nx = ny = 0; 2696 nx = ny = 0;
2529 2697
2530 if (sx < 0) 2698 if (sx < 0)
2531 { 2699 {
2532 nw += sx; 2700 nw += sx;
2533 nx = -sx; 2701 nx = -sx;
2534 sx = 0; 2702 sx = 0;
2535 } 2703 }
2536 2704
2537 if (sy < 0) 2705 if (sy < 0)
2538 { 2706 {
2539 nh += sy; 2707 nh += sy;
2540 ny = -sy; 2708 ny = -sy;
2541 sy = 0; 2709 sy = 0;
2542 } 2710 }
2543 2711
2544 min_it (nw, (unsigned int) (wrootattr.width - sx)); 2712 min_it (nw, (unsigned int) (wrootattr.width - sx));
2545 min_it (nh, (unsigned int) (wrootattr.height - sy)); 2713 min_it (nh, (unsigned int) (wrootattr.height - sy));
2546 2714
2547 XSync (dpy, False); 2715 XSync (dpy, False);
2548 allowedxerror = -1; 2716 allowedxerror = -1;
2549 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2717 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2550 2718
2551 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2719 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2552 /* XXX: may need a delay here? */ 2720 /* XXX: may need a delay here? */
2553 allowedxerror = 0; 2721 allowedxerror = 0;
2554
2555 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)
2556 { 2751 {
2557 if (am_transparent && am_pixmap_trans) 2752 if (am_transparent && am_pixmap_trans)
2558 { 2753 {
2559 pchanged = 1; 2754 pchanged = 1;
2560 if (pixmap != None) 2755 if (pixmap != None)
2566 2761
2567 am_pixmap_trans = 0; 2762 am_pixmap_trans = 0;
2568 } 2763 }
2569 else 2764 else
2570 { 2765 {
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); 2766 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2593 XClearWindow (dpy, parent[0]); 2767 XClearWindow (dpy, parent[0]);
2594 2768
2595 if (!am_transparent || !am_pixmap_trans) 2769 if (!am_transparent || !am_pixmap_trans)
2596 pchanged = 1; 2770 pchanged = 1;
2674 want_refresh = want_full_refresh = 1; 2848 want_refresh = want_full_refresh = 1;
2675 if (am_pixmap_trans) 2849 if (am_pixmap_trans)
2676 flush (); 2850 flush ();
2677 } 2851 }
2678 2852
2679 return pchanged; 2853// return pchanged;
2680} 2854}
2681#endif 2855#endif
2682 2856
2683/*}}} */ 2857/*}}} */
2684 2858
3925#ifdef XPM_BACKGROUND 4099#ifdef XPM_BACKGROUND
3926 resize_pixmap (); 4100 resize_pixmap ();
3927 scr_touch (true); 4101 scr_touch (true);
3928#endif 4102#endif
3929 } 4103 }
4104#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
4105 if (option(Opt_transparent))
4106 check_our_parents ();
4107#endif
4108
3930 } 4109 }
3931 break; 4110 break;
3932 4111
3933 case Rxvt_restoreFG: 4112 case Rxvt_restoreFG:
3934 set_window_color (Color_fg, str); 4113 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines