… | |
… | |
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 |
… | |
… | |
225 | for (int i = RS_styleCount; --i; ) |
225 | for (int i = RS_styleCount; --i; ) |
226 | if (fontset[i] != fontset[0]) |
226 | if (fontset[i] != fontset[0]) |
227 | delete fontset[i]; |
227 | delete fontset[i]; |
228 | #endif |
228 | #endif |
229 | delete fontset[0]; |
229 | delete fontset[0]; |
|
|
230 | |
|
|
231 | #ifdef HAVE_BG_PIXMAP |
|
|
232 | bgPixmap.destroy (); |
|
|
233 | #endif |
230 | |
234 | |
231 | if (display) |
235 | if (display) |
232 | { |
236 | { |
233 | selection_clear (); |
237 | selection_clear (); |
234 | |
238 | |
… | |
… | |
274 | pix_colors_unfocused [i].free (this); |
278 | pix_colors_unfocused [i].free (this); |
275 | #endif |
279 | #endif |
276 | } |
280 | } |
277 | |
281 | |
278 | clear (); |
282 | clear (); |
279 | } |
|
|
280 | |
283 | |
281 | delete [] pix_colors_focused; |
|
|
282 | #if OFF_FOCUS_FADING |
|
|
283 | delete [] pix_colors_unfocused; |
|
|
284 | #endif |
|
|
285 | |
|
|
286 | #ifdef HAVE_BG_PIXMAP |
|
|
287 | bgPixmap.destroy (); |
|
|
288 | #endif |
|
|
289 | display->flush (); /* ideally .put should do this */ |
284 | display->flush (); /* ideally .put should do this */ |
290 | displays.put (display); |
285 | displays.put (display); |
|
|
286 | } |
291 | |
287 | |
292 | scr_release (); |
288 | scr_release (); |
293 | |
289 | |
294 | /* clear all resources */ |
290 | /* clear all resources */ |
295 | for (int i = 0; i < allocated.size (); i++) |
291 | for (int i = 0; i < allocated.size (); i++) |
… | |
… | |
516 | resize_scrollbar (); /* create and map scrollbar */ |
512 | resize_scrollbar (); /* create and map scrollbar */ |
517 | #endif |
513 | #endif |
518 | #ifdef HAVE_BG_PIXMAP |
514 | #ifdef HAVE_BG_PIXMAP |
519 | { |
515 | { |
520 | bgPixmap.set_target (this); |
516 | bgPixmap.set_target (this); |
|
|
517 | bgPixmap.invalidate (); |
521 | |
518 | |
522 | #ifdef ENABLE_TRANSPARENCY |
519 | #ifdef ENABLE_TRANSPARENCY |
523 | if (option (Opt_transparent)) |
520 | if (option (Opt_transparent)) |
524 | { |
521 | { |
525 | bgPixmap.set_transparent (); |
522 | bgPixmap.set_transparent (); |
|
|
523 | |
526 | #ifdef HAVE_AFTERIMAGE |
524 | #ifdef HAVE_AFTERIMAGE |
527 | if (rs [Rs_blurradius]) |
525 | if (rs [Rs_blurradius]) |
528 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
526 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
529 | #endif |
527 | #endif |
530 | if (ISSET_PIXCOLOR (Color_tint)) |
528 | if (ISSET_PIXCOLOR (Color_tint)) |
531 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
529 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
530 | |
532 | if (rs [Rs_shade]) |
531 | if (rs [Rs_shade]) |
533 | bgPixmap.set_shade (rs [Rs_shade]); |
532 | bgPixmap.set_shade (rs [Rs_shade]); |
534 | |
533 | |
535 | bgPixmap.set_root_pixmap (); |
534 | bgPixmap.set_root_pixmap (); |
536 | XSelectInput (dpy, display->root, PropertyChangeMask); |
535 | XSelectInput (dpy, display->root, PropertyChangeMask); |
537 | rootwin_ev.start (display, display->root); |
536 | rootwin_ev.start (display, display->root); |
538 | } |
537 | } |
539 | #endif |
538 | #endif |
540 | |
539 | |
541 | #ifdef BG_IMAGE_FROM_FILE |
540 | #ifdef BG_IMAGE_FROM_FILE |
542 | if (rs[Rs_backgroundPixmap] != NULL) |
541 | if (rs[Rs_backgroundPixmap]) |
543 | { |
542 | { |
544 | const char *p = rs[Rs_backgroundPixmap]; |
543 | const char *p = rs[Rs_backgroundPixmap]; |
545 | |
544 | |
546 | if ((p = strchr (p, ';')) != NULL) |
545 | if ((p = strchr (p, ';')) != 0) |
547 | { |
546 | { |
548 | p++; |
547 | p++; |
549 | bgPixmap.set_geometry (p); |
548 | bgPixmap.set_geometry (p); |
550 | } |
549 | } |
551 | else |
550 | else |
… | |
… | |
584 | } |
583 | } |
585 | #endif |
584 | #endif |
586 | |
585 | |
587 | XMapWindow (dpy, vt); |
586 | XMapWindow (dpy, vt); |
588 | XMapWindow (dpy, parent[0]); |
587 | XMapWindow (dpy, parent[0]); |
|
|
588 | |
|
|
589 | refresh_check (); |
589 | } |
590 | } |
590 | |
591 | |
591 | static struct sig_handlers |
592 | static struct sig_handlers |
592 | { |
593 | { |
593 | ev::sig sw_term, sw_int; |
594 | ev::sig sw_term, sw_int; |
… | |
… | |
1694 | unsigned char *prop = NULL; |
1695 | unsigned char *prop = NULL; |
1695 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1696 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
1696 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
1697 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
1697 | &nitems, &bytes_after, &prop); |
1698 | &nitems, &bytes_after, &prop); |
1698 | if (result == Success && prop && atype == XA_PIXMAP) |
1699 | if (result == Success && prop && atype == XA_PIXMAP) |
1699 | { |
|
|
1700 | return *(Pixmap *)prop; |
1700 | return *(Pixmap *)prop; |
1701 | } |
|
|
1702 | } |
1701 | } |
|
|
1702 | |
1703 | return None; |
1703 | return None; |
1704 | } |
1704 | } |
1705 | |
1705 | |
1706 | #ifdef HAVE_BG_PIXMAP |
1706 | #ifdef HAVE_BG_PIXMAP |
1707 | # if TRACE_PIXMAPS |
1707 | # if TRACE_PIXMAPS |
1708 | # undef update_background |
1708 | # undef update_background |
|
|
1709 | void |
1709 | int rxvt_term::trace_update_background (const char *file, int line) |
1710 | rxvt_term::trace_update_background (const char *file, int line) |
1710 | { |
1711 | { |
1711 | fprintf (stderr, "%s:%d:update_background()\n", file, line); |
1712 | fprintf (stderr, "%s:%d:update_background()\n", file, line); |
1712 | update_background (); |
1713 | update_background (); |
1713 | } |
1714 | } |
1714 | # endif |
1715 | # endif |
1715 | |
1716 | |
1716 | int |
1717 | void |
1717 | rxvt_term::update_background () |
1718 | rxvt_term::update_background () |
1718 | { |
1719 | { |
|
|
1720 | if (update_background_ev.is_active ()) |
|
|
1721 | return; |
|
|
1722 | |
1719 | bgPixmap.invalidate (); |
1723 | bgPixmap.invalidate (); |
1720 | |
1724 | |
1721 | /* no chance of real time refresh if we are blurring! */ |
1725 | 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)) |
1726 | |
|
|
1727 | if (to_wait <= 0.) |
1723 | bgPixmap.render (); |
1728 | bgPixmap.render (); |
1724 | else |
1729 | 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); |
1730 | update_background_ev.start (to_wait); |
1736 | } |
|
|
1737 | |
|
|
1738 | return 0; |
|
|
1739 | } |
1731 | } |
1740 | |
1732 | |
1741 | void |
1733 | void |
1742 | rxvt_term::update_background_cb (ev::timer &w, int revents) |
1734 | rxvt_term::update_background_cb (ev::timer &w, int revents) |
1743 | { |
1735 | { |
1744 | make_current (); |
1736 | make_current (); |
|
|
1737 | |
|
|
1738 | update_background_ev.stop (); |
1745 | bgPixmap.render (); |
1739 | bgPixmap.render (); |
1746 | refresh_check (); |
1740 | refresh_check (); |
1747 | } |
1741 | } |
1748 | |
1742 | |
1749 | #endif /* HAVE_BG_PIXMAP */ |
1743 | #endif /* HAVE_BG_PIXMAP */ |