… | |
… | |
527 | XSelectInput (dpy, display->root, PropertyChangeMask); |
527 | XSelectInput (dpy, display->root, PropertyChangeMask); |
528 | rootwin_ev.start (display, display->root); |
528 | rootwin_ev.start (display, display->root); |
529 | } |
529 | } |
530 | #endif |
530 | #endif |
531 | |
531 | |
532 | #ifdef XPM_BACKGROUND |
532 | #ifdef BG_IMAGE_FROM_FILE |
533 | if (rs[Rs_backgroundPixmap] != NULL) |
533 | if (rs[Rs_backgroundPixmap] != NULL) |
534 | { |
534 | { |
535 | const char *p = rs[Rs_backgroundPixmap]; |
535 | const char *p = rs[Rs_backgroundPixmap]; |
536 | |
536 | |
537 | if ((p = strchr (p, ';')) != NULL) |
537 | if ((p = strchr (p, ';')) != NULL) |
… | |
… | |
540 | bgPixmap.set_geometry (p); |
540 | bgPixmap.set_geometry (p); |
541 | } |
541 | } |
542 | else |
542 | else |
543 | bgPixmap.set_defaultGeometry (); |
543 | bgPixmap.set_defaultGeometry (); |
544 | |
544 | |
545 | bgPixmap.set_file (rs[Rs_backgroundPixmap]); |
545 | if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) |
|
|
546 | if (!bgPixmap.window_position_sensitive ()) |
|
|
547 | update_background (); |
546 | } |
548 | } |
547 | /* do not want to render Pixmap yet if we are size/position dependant - |
|
|
548 | * wait for ConfigureNotify at least |
|
|
549 | * TODO: this does not work for some reason when transparency is disabled !!!! |
|
|
550 | */ |
|
|
551 | if (!bgPixmap.window_size_sensitive ()) |
|
|
552 | update_background(); |
|
|
553 | #endif |
549 | #endif |
554 | } |
550 | } |
555 | #endif |
551 | #endif |
556 | |
552 | |
557 | #if ENABLE_PERL |
553 | #if ENABLE_PERL |
… | |
… | |
946 | #if ENABLE_EWMH |
942 | #if ENABLE_EWMH |
947 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
943 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
948 | #endif |
944 | #endif |
949 | } |
945 | } |
950 | |
946 | |
|
|
947 | void |
|
|
948 | rxvt_term::set_window_color (int idx, const char *color) |
|
|
949 | { |
951 | #ifdef XTERM_COLOR_CHANGE |
950 | #ifdef XTERM_COLOR_CHANGE |
952 | void |
|
|
953 | rxvt_term::set_window_color (int idx, const char *color) |
|
|
954 | { |
|
|
955 | rxvt_color xcol; |
951 | rxvt_color xcol; |
956 | int i; |
952 | int i; |
957 | |
953 | |
958 | if (color == NULL || *color == '\0') |
954 | if (color == NULL || *color == '\0') |
959 | return; |
955 | return; |
… | |
… | |
996 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
992 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
997 | |
993 | |
998 | update_fade_color (idx); |
994 | update_fade_color (idx); |
999 | recolour_cursor (); |
995 | recolour_cursor (); |
1000 | scr_recolour (); |
996 | scr_recolour (); |
1001 | } |
|
|
1002 | |
|
|
1003 | #else |
|
|
1004 | # define set_window_color (idx,color) ((void)0) |
|
|
1005 | #endif /* XTERM_COLOR_CHANGE */ |
997 | #endif /* XTERM_COLOR_CHANGE */ |
|
|
998 | } |
1006 | |
999 | |
1007 | void |
1000 | void |
1008 | rxvt_term::recolour_cursor () |
1001 | rxvt_term::recolour_cursor () |
1009 | { |
1002 | { |
1010 | XColor fg, bg; |
1003 | XColor fg, bg; |
… | |
… | |
1042 | |
1035 | |
1043 | for (i = Color_Black; i <= Color_White; i++) |
1036 | for (i = Color_Black; i <= Color_White; i++) |
1044 | if (pix_colors[Color_bg] == pix_colors[i]) |
1037 | if (pix_colors[Color_bg] == pix_colors[i]) |
1045 | { |
1038 | { |
1046 | sprintf (bstr, "%d", (i - Color_Black)); |
1039 | sprintf (bstr, "%d", (i - Color_Black)); |
1047 | #ifdef XPM_BACKGROUND |
1040 | #ifdef BG_IMAGE_FROM_FILE |
1048 | xpmb = "default;"; |
1041 | xpmb = "default;"; |
1049 | #endif |
1042 | #endif |
1050 | break; |
1043 | break; |
1051 | } |
1044 | } |
1052 | |
1045 | |
… | |
… | |
1148 | |
1141 | |
1149 | XMoveResizeWindow (dpy, vt, |
1142 | XMoveResizeWindow (dpy, vt, |
1150 | window_vt_x, window_vt_y, |
1143 | window_vt_x, window_vt_y, |
1151 | width, height); |
1144 | width, height); |
1152 | |
1145 | |
1153 | #ifdef XPM_BACKGROUND |
1146 | #ifdef HAVE_BG_PIXMAP |
1154 | /* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */ |
|
|
1155 | if (bgPixmap.window_size_sensitive ()) |
1147 | if (bgPixmap.window_size_sensitive ()) |
1156 | update_background (); |
1148 | update_background (); |
1157 | #endif |
1149 | #endif |
1158 | |
1150 | |
1159 | scr_clear (); |
1151 | scr_clear (); |
1160 | } |
1152 | } |
1161 | |
1153 | |
… | |
… | |
1705 | |
1697 | |
1706 | XFree (preedit_attr); |
1698 | XFree (preedit_attr); |
1707 | } |
1699 | } |
1708 | #endif /* USE_XIM */ |
1700 | #endif /* USE_XIM */ |
1709 | |
1701 | |
|
|
1702 | void |
|
|
1703 | rxvt_term::get_window_origin (int &x, int &y) |
|
|
1704 | { |
|
|
1705 | Window cr; |
|
|
1706 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
|
|
1707 | /* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ |
|
|
1708 | } |
|
|
1709 | |
|
|
1710 | Pixmap |
|
|
1711 | rxvt_term::get_pixmap_property (int prop_id) |
|
|
1712 | { |
|
|
1713 | if (prop_id > 0 && prop_id < NUM_XA) |
|
|
1714 | if (xa[prop_id]) |
|
|
1715 | { |
|
|
1716 | int aformat; |
|
|
1717 | unsigned long nitems, bytes_after; |
|
|
1718 | Atom atype; |
|
|
1719 | unsigned char *prop = NULL; |
|
|
1720 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
|
|
1721 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
1722 | &nitems, &bytes_after, &prop); |
|
|
1723 | if (result == Success && prop && atype == XA_PIXMAP) |
|
|
1724 | { |
|
|
1725 | return *(Pixmap *)prop; |
|
|
1726 | } |
|
|
1727 | } |
|
|
1728 | return None; |
|
|
1729 | } |
|
|
1730 | |
|
|
1731 | #ifdef HAVE_BG_PIXMAP |
|
|
1732 | int |
|
|
1733 | rxvt_term::update_background () |
|
|
1734 | { |
|
|
1735 | bgPixmap.invalidate (); |
|
|
1736 | |
|
|
1737 | /* no chance of real time refresh if we are blurring ! */ |
|
|
1738 | if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) |
|
|
1739 | bgPixmap.render (); |
|
|
1740 | else |
|
|
1741 | { |
|
|
1742 | update_background_ev.stop (); |
|
|
1743 | if (!bgPixmap.need_client_side_rendering()) |
|
|
1744 | update_background_ev.start (NOW + .05); |
|
|
1745 | else if (bgPixmap.flags & bgPixmap_t::blurNeeded) |
|
|
1746 | update_background_ev.start (NOW + .2); /* very slow !!! */ |
|
|
1747 | else |
|
|
1748 | update_background_ev.start (NOW + .07); |
|
|
1749 | } |
|
|
1750 | return 0; |
|
|
1751 | } |
|
|
1752 | |
|
|
1753 | void |
|
|
1754 | rxvt_term::update_background_cb (time_watcher &w) |
|
|
1755 | { |
|
|
1756 | bgPixmap.render (); |
|
|
1757 | } |
|
|
1758 | |
|
|
1759 | #endif /* HAVE_BG_PIXMAP */ |
|
|
1760 | |
1710 | /*----------------------- end-of-file (C source) -----------------------*/ |
1761 | /*----------------------- end-of-file (C source) -----------------------*/ |