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.327 by ayin, Mon Jun 11 13:33:34 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 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{
2463 int i, pchanged, aformat, have_pixmap, rootdepth; 2486 int i, pchanged, aformat, have_pixmap, rootdepth;
2464 unsigned long nitems, bytes_after; 2487 unsigned long nitems, bytes_after;
2465 Atom atype; 2488 Atom atype;
2466 unsigned char *prop = NULL; 2489 unsigned char *prop = NULL;
2467 Window root, oldp, *list; 2490 Window root, oldp, *list;
2468 Pixmap rootpixmap = None; 2491 Pixmap rootpixmap = None;
2469 XWindowAttributes wattr, wrootattr; 2492 XWindowAttributes wattr, wrootattr;
2493 int sx, sy;
2494 Window cr;
2470 2495
2471 pchanged = 0; 2496 pchanged = 0;
2472 2497
2473 if (!option (Opt_transparent)) 2498 if (!option (Opt_transparent))
2474 return pchanged; /* Don't try any more */ 2499 return /*pchanged*/; /* Don't try any more */
2475 2500
2476 XGetWindowAttributes (dpy, display->root, &wrootattr); 2501 XGetWindowAttributes (dpy, display->root, &wrootattr);
2477 rootdepth = wrootattr.depth; 2502 rootdepth = wrootattr.depth;
2478 2503
2479 XGetWindowAttributes (dpy, parent[0], &wattr); 2504 XGetWindowAttributes (dpy, parent[0], &wattr);
2485 pchanged = 1; 2510 pchanged = 1;
2486 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); 2511 XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]);
2487 am_transparent = am_pixmap_trans = 0; 2512 am_transparent = am_pixmap_trans = 0;
2488 } 2513 }
2489 2514
2490 return pchanged; /* Don't try any more */ 2515 return /*pchanged*/; /* Don't try any more */
2491 } 2516 }
2492 2517
2493 /* 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. */
2494 XSync (dpy, False); 2519 XSync (dpy, False);
2495 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 */ ;
2496 /* 2528 /*
2497 * Make the frame window set by the window manager have 2529 * Make the frame window set by the window manager have
2498 * the root background. Some window managers put multiple nested frame 2530 * the root background. Some window managers put multiple nested frame
2499 * 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.
2500 */ 2532 */
2509 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2541 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2510 &nitems, &bytes_after, &prop) == Success); 2542 &nitems, &bytes_after, &prop) == Success);
2511 2543
2512 if (!i || prop == NULL 2544 if (!i || prop == NULL
2513#if TINTING 2545#if TINTING
2514 || !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 )
2515#endif 2551#endif
2516 ) 2552 )
2517 have_pixmap = 0; 2553 have_pixmap = 0;
2518 else 2554 else
2519 { 2555 {
2522 XFree (prop); 2558 XFree (prop);
2523 } 2559 }
2524 2560
2525 if (have_pixmap) 2561 if (have_pixmap)
2526 { 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 {
2527 /* 2685 /*
2528 * Copy display->root pixmap transparency 2686 * Copy display->root pixmap transparency
2529 */ 2687 */
2530 int sx, sy, nx, ny; 2688 int nx, ny;
2531 unsigned int nw, nh; 2689 unsigned int nw, nh;
2532 Window cr;
2533 XImage *image; 2690 XImage *image;
2534 GC gc;
2535 XGCValues gcvalue;
2536 2691
2537 XTranslateCoordinates (dpy, parent[0], display->root,
2538 0, 0, &sx, &sy, &cr);
2539 nw = (unsigned int)szHint.width; 2692 nw = (unsigned int)szHint.width;
2540 nh = (unsigned int)szHint.height; 2693 nh = (unsigned int)szHint.height;
2541 nx = ny = 0; 2694 nx = ny = 0;
2542 2695
2543 if (sx < 0) 2696 if (sx < 0)
2544 { 2697 {
2545 nw += sx; 2698 nw += sx;
2546 nx = -sx; 2699 nx = -sx;
2547 sx = 0; 2700 sx = 0;
2548 } 2701 }
2549 2702
2550 if (sy < 0) 2703 if (sy < 0)
2551 { 2704 {
2552 nh += sy; 2705 nh += sy;
2553 ny = -sy; 2706 ny = -sy;
2554 sy = 0; 2707 sy = 0;
2555 } 2708 }
2556 2709
2557 min_it (nw, (unsigned int) (wrootattr.width - sx)); 2710 min_it (nw, (unsigned int) (wrootattr.width - sx));
2558 min_it (nh, (unsigned int) (wrootattr.height - sy)); 2711 min_it (nh, (unsigned int) (wrootattr.height - sy));
2559 2712
2560 XSync (dpy, False); 2713 XSync (dpy, False);
2561 allowedxerror = -1; 2714 allowedxerror = -1;
2562 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2715 image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2563 2716
2564 /* XXX: handle BadMatch - usually because we're outside the pixmap */ 2717 /* XXX: handle BadMatch - usually because we're outside the pixmap */
2565 /* XXX: may need a delay here? */ 2718 /* XXX: may need a delay here? */
2566 allowedxerror = 0; 2719 allowedxerror = 0;
2567
2568 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)
2569 { 2749 {
2570 if (am_transparent && am_pixmap_trans) 2750 if (am_transparent && am_pixmap_trans)
2571 { 2751 {
2572 pchanged = 1; 2752 pchanged = 1;
2573 if (pixmap != None) 2753 if (pixmap != None)
2579 2759
2580 am_pixmap_trans = 0; 2760 am_pixmap_trans = 0;
2581 } 2761 }
2582 else 2762 else
2583 { 2763 {
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); 2764 XSetWindowBackgroundPixmap (dpy, parent[0], pixmap);
2606 XClearWindow (dpy, parent[0]); 2765 XClearWindow (dpy, parent[0]);
2607 2766
2608 if (!am_transparent || !am_pixmap_trans) 2767 if (!am_transparent || !am_pixmap_trans)
2609 pchanged = 1; 2768 pchanged = 1;
2687 want_refresh = want_full_refresh = 1; 2846 want_refresh = want_full_refresh = 1;
2688 if (am_pixmap_trans) 2847 if (am_pixmap_trans)
2689 flush (); 2848 flush ();
2690 } 2849 }
2691 2850
2692 return pchanged; 2851// return pchanged;
2693} 2852}
2694#endif 2853#endif
2695 2854
2696/*}}} */ 2855/*}}} */
2697 2856
3938#ifdef XPM_BACKGROUND 4097#ifdef XPM_BACKGROUND
3939 resize_pixmap (); 4098 resize_pixmap ();
3940 scr_touch (true); 4099 scr_touch (true);
3941#endif 4100#endif
3942 } 4101 }
4102#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
4103 if (option(Opt_transparent))
4104 check_our_parents ();
4105#endif
4106
3943 } 4107 }
3944 break; 4108 break;
3945 4109
3946 case Rxvt_restoreFG: 4110 case Rxvt_restoreFG:
3947 set_window_color (Color_fg, str); 4111 set_window_color (Color_fg, str);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines