… | |
… | |
170 | #endif |
170 | #endif |
171 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
171 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
172 | slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); |
172 | slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); |
173 | #endif |
173 | #endif |
174 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
174 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
175 | rootwin_ev.set <rxvt_term, &rxvt_term::x_cb> (this), |
175 | rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), |
176 | #endif |
176 | #endif |
177 | #ifdef HAVE_SCROLLBARS |
177 | #ifdef HAVE_SCROLLBARS |
178 | scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), |
178 | scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), |
179 | #endif |
179 | #endif |
180 | #ifdef USE_XIM |
180 | #ifdef USE_XIM |
… | |
… | |
275 | #endif |
275 | #endif |
276 | } |
276 | } |
277 | |
277 | |
278 | clear (); |
278 | clear (); |
279 | } |
279 | } |
280 | |
|
|
281 | delete [] pix_colors_focused; |
|
|
282 | #if OFF_FOCUS_FADING |
|
|
283 | delete [] pix_colors_unfocused; |
|
|
284 | #endif |
|
|
285 | |
280 | |
286 | #ifdef HAVE_BG_PIXMAP |
281 | #ifdef HAVE_BG_PIXMAP |
287 | bgPixmap.destroy (); |
282 | bgPixmap.destroy (); |
288 | #endif |
283 | #endif |
289 | display->flush (); /* ideally .put should do this */ |
284 | display->flush (); /* ideally .put should do this */ |
… | |
… | |
521 | |
516 | |
522 | #ifdef ENABLE_TRANSPARENCY |
517 | #ifdef ENABLE_TRANSPARENCY |
523 | if (option (Opt_transparent)) |
518 | if (option (Opt_transparent)) |
524 | { |
519 | { |
525 | bgPixmap.set_transparent (); |
520 | bgPixmap.set_transparent (); |
|
|
521 | |
526 | #ifdef HAVE_AFTERIMAGE |
522 | #ifdef HAVE_AFTERIMAGE |
527 | if (rs [Rs_blurradius]) |
523 | if (rs [Rs_blurradius]) |
528 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
524 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
529 | #endif |
525 | #endif |
530 | if (ISSET_PIXCOLOR (Color_tint)) |
526 | if (ISSET_PIXCOLOR (Color_tint)) |
531 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
527 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
528 | |
532 | if (rs [Rs_shade]) |
529 | if (rs [Rs_shade]) |
533 | bgPixmap.set_shade (rs [Rs_shade]); |
530 | bgPixmap.set_shade (rs [Rs_shade]); |
534 | |
531 | |
535 | bgPixmap.set_root_pixmap (); |
532 | bgPixmap.set_root_pixmap (); |
536 | XSelectInput (dpy, display->root, PropertyChangeMask); |
533 | XSelectInput (dpy, display->root, PropertyChangeMask); |
537 | rootwin_ev.start (display, display->root); |
534 | rootwin_ev.start (display, display->root); |
538 | } |
535 | } |
539 | #endif |
536 | #endif |
540 | |
537 | |
541 | #ifdef BG_IMAGE_FROM_FILE |
538 | #ifdef BG_IMAGE_FROM_FILE |
542 | if (rs[Rs_backgroundPixmap] != NULL) |
539 | if (rs[Rs_backgroundPixmap]) |
543 | { |
540 | { |
544 | const char *p = rs[Rs_backgroundPixmap]; |
541 | const char *p = rs[Rs_backgroundPixmap]; |
545 | |
542 | |
546 | if ((p = strchr (p, ';')) != NULL) |
543 | if ((p = strchr (p, ';')) != 0) |
547 | { |
544 | { |
548 | p++; |
545 | p++; |
549 | bgPixmap.set_geometry (p); |
546 | bgPixmap.set_geometry (p); |
550 | } |
547 | } |
551 | else |
548 | else |
… | |
… | |
584 | } |
581 | } |
585 | #endif |
582 | #endif |
586 | |
583 | |
587 | XMapWindow (dpy, vt); |
584 | XMapWindow (dpy, vt); |
588 | XMapWindow (dpy, parent[0]); |
585 | XMapWindow (dpy, parent[0]); |
|
|
586 | |
|
|
587 | refresh_check (); |
589 | } |
588 | } |
590 | |
589 | |
591 | static struct sig_handlers |
590 | static struct sig_handlers |
592 | { |
591 | { |
593 | ev::sig sw_term, sw_int; |
592 | ev::sig sw_term, sw_int; |
… | |
… | |
1677 | void |
1676 | void |
1678 | rxvt_term::get_window_origin (int &x, int &y) |
1677 | rxvt_term::get_window_origin (int &x, int &y) |
1679 | { |
1678 | { |
1680 | Window cr; |
1679 | Window cr; |
1681 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1680 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1682 | /* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ |
1681 | /* fprintf (stderr, "origin is %+d%+d\n", x, y);*/ |
1683 | } |
1682 | } |
1684 | |
1683 | |
1685 | Pixmap |
1684 | Pixmap |
1686 | rxvt_term::get_pixmap_property (int prop_id) |
1685 | rxvt_term::get_pixmap_property (int prop_id) |
1687 | { |
1686 | { |
… | |
… | |
1694 | unsigned char *prop = NULL; |
1693 | unsigned char *prop = NULL; |
1695 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1694 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1696 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
1695 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
1697 | &nitems, &bytes_after, &prop); |
1696 | &nitems, &bytes_after, &prop); |
1698 | if (result == Success && prop && atype == XA_PIXMAP) |
1697 | if (result == Success && prop && atype == XA_PIXMAP) |
1699 | { |
|
|
1700 | return *(Pixmap *)prop; |
1698 | return *(Pixmap *)prop; |
1701 | } |
|
|
1702 | } |
1699 | } |
|
|
1700 | |
1703 | return None; |
1701 | return None; |
1704 | } |
1702 | } |
1705 | |
1703 | |
1706 | #ifdef HAVE_BG_PIXMAP |
1704 | #ifdef HAVE_BG_PIXMAP |
1707 | # if TRACE_PIXMAPS |
1705 | # if TRACE_PIXMAPS |
1708 | # undef update_background |
1706 | # undef update_background |
|
|
1707 | void |
1709 | int rxvt_term::trace_update_background (const char *file, int line) |
1708 | rxvt_term::trace_update_background (const char *file, int line) |
1710 | { |
1709 | { |
1711 | fprintf (stderr, "%s:%d:update_background()\n", file, line); |
1710 | fprintf (stderr, "%s:%d:update_background()\n", file, line); |
1712 | update_background (); |
1711 | update_background (); |
1713 | } |
1712 | } |
1714 | # endif |
1713 | # endif |
1715 | |
1714 | |
1716 | int |
1715 | void |
1717 | rxvt_term::update_background () |
1716 | rxvt_term::update_background () |
1718 | { |
1717 | { |
|
|
1718 | if (update_background_ev.is_active ()) |
|
|
1719 | return; |
|
|
1720 | |
1719 | bgPixmap.invalidate (); |
1721 | bgPixmap.invalidate (); |
1720 | |
1722 | |
1721 | /* no chance of real time refresh if we are blurring! */ |
1723 | ev_tstamp to_wait = 0.5 - (ev::now () - bgPixmap.valid_since); |
1722 | if (bgPixmap.invalid_since + 0.5 < ev::now () && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) |
1724 | |
|
|
1725 | if (to_wait <= 0.) |
1723 | bgPixmap.render (); |
1726 | bgPixmap.render (); |
1724 | else |
1727 | else |
1725 | { |
|
|
1726 | ev_tstamp refresh; |
|
|
1727 | update_background_ev.stop (); |
|
|
1728 | |
|
|
1729 | if (!bgPixmap.need_client_side_rendering ()) |
|
|
1730 | refresh = .05; |
|
|
1731 | else if (bgPixmap.flags & bgPixmap_t::blurNeeded) |
|
|
1732 | refresh = .20; /* very slow !!! */ |
|
|
1733 | else |
|
|
1734 | refresh = .07; |
|
|
1735 | update_background_ev.start (refresh); |
1728 | update_background_ev.start (to_wait); |
1736 | } |
|
|
1737 | |
|
|
1738 | return 0; |
|
|
1739 | } |
1729 | } |
1740 | |
1730 | |
1741 | void |
1731 | void |
1742 | rxvt_term::update_background_cb (ev::timer &w, int revents) |
1732 | rxvt_term::update_background_cb (ev::timer &w, int revents) |
1743 | { |
1733 | { |
1744 | make_current (); |
1734 | make_current (); |
|
|
1735 | |
|
|
1736 | update_background_ev.stop (); |
1745 | bgPixmap.render (); |
1737 | bgPixmap.render (); |
1746 | refresh_check (); |
1738 | refresh_check (); |
1747 | } |
1739 | } |
1748 | |
1740 | |
1749 | #endif /* HAVE_BG_PIXMAP */ |
1741 | #endif /* HAVE_BG_PIXMAP */ |