… | |
… | |
201 | #endif |
201 | #endif |
202 | } |
202 | } |
203 | |
203 | |
204 | // clean up the most important stuff, do *not* call x or free mem etc. |
204 | // clean up the most important stuff, do *not* call x or free mem etc. |
205 | // for use before an emergency exit |
205 | // for use before an emergency exit |
|
|
206 | void |
206 | void rxvt_term::emergency_cleanup () |
207 | rxvt_term::emergency_cleanup () |
207 | { |
208 | { |
208 | if (cmd_pid) |
209 | if (cmd_pid) |
209 | kill (-cmd_pid, SIGHUP); |
210 | kill (-cmd_pid, SIGHUP); |
210 | |
211 | |
211 | pty_ev.stop (); |
212 | pty_ev.stop (); |
… | |
… | |
527 | XSelectInput (dpy, display->root, PropertyChangeMask); |
528 | XSelectInput (dpy, display->root, PropertyChangeMask); |
528 | rootwin_ev.start (display, display->root); |
529 | rootwin_ev.start (display, display->root); |
529 | } |
530 | } |
530 | #endif |
531 | #endif |
531 | |
532 | |
532 | #ifdef XPM_BACKGROUND |
533 | #ifdef BG_IMAGE_FROM_FILE |
533 | if (rs[Rs_backgroundPixmap] != NULL) |
534 | if (rs[Rs_backgroundPixmap] != NULL) |
534 | { |
535 | { |
535 | const char *p = rs[Rs_backgroundPixmap]; |
536 | const char *p = rs[Rs_backgroundPixmap]; |
536 | |
537 | |
537 | if ((p = strchr (p, ';')) != NULL) |
538 | if ((p = strchr (p, ';')) != NULL) |
… | |
… | |
541 | } |
542 | } |
542 | else |
543 | else |
543 | bgPixmap.set_defaultGeometry (); |
544 | bgPixmap.set_defaultGeometry (); |
544 | |
545 | |
545 | if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) |
546 | if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) |
546 | if (!option (Opt_transparent)) |
547 | if (!bgPixmap.window_position_sensitive ()) |
547 | update_background (); |
548 | update_background (); |
548 | } |
549 | } |
549 | #endif |
550 | #endif |
550 | } |
551 | } |
551 | #endif |
552 | #endif |
… | |
… | |
901 | } |
902 | } |
902 | |
903 | |
903 | return true; |
904 | return true; |
904 | } |
905 | } |
905 | |
906 | |
|
|
907 | void |
906 | void rxvt_term::set_string_property (Atom prop, const char *str, int len) |
908 | rxvt_term::set_string_property (Atom prop, const char *str, int len) |
907 | { |
909 | { |
908 | XChangeProperty (dpy, parent[0], |
910 | XChangeProperty (dpy, parent[0], |
909 | prop, XA_STRING, 8, PropModeReplace, |
911 | prop, XA_STRING, 8, PropModeReplace, |
910 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
912 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
911 | } |
913 | } |
912 | |
914 | |
|
|
915 | void |
913 | void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
916 | rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
914 | { |
917 | { |
915 | wchar_t *ws = rxvt_mbstowcs (str, len); |
918 | wchar_t *ws = rxvt_mbstowcs (str, len); |
916 | char *s = rxvt_wcstoutf8 (ws); |
919 | char *s = rxvt_wcstoutf8 (ws); |
917 | |
920 | |
918 | XChangeProperty (dpy, parent[0], |
921 | XChangeProperty (dpy, parent[0], |
… | |
… | |
942 | #if ENABLE_EWMH |
945 | #if ENABLE_EWMH |
943 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
946 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
944 | #endif |
947 | #endif |
945 | } |
948 | } |
946 | |
949 | |
|
|
950 | void |
|
|
951 | rxvt_term::set_window_color (int idx, const char *color) |
|
|
952 | { |
947 | #ifdef XTERM_COLOR_CHANGE |
953 | #ifdef XTERM_COLOR_CHANGE |
948 | void |
|
|
949 | rxvt_term::set_window_color (int idx, const char *color) |
|
|
950 | { |
|
|
951 | rxvt_color xcol; |
954 | rxvt_color xcol; |
952 | int i; |
955 | int i; |
953 | |
956 | |
954 | if (color == NULL || *color == '\0') |
957 | if (color == NULL || *color == '\0') |
955 | return; |
958 | return; |
… | |
… | |
992 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
995 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
993 | |
996 | |
994 | update_fade_color (idx); |
997 | update_fade_color (idx); |
995 | recolour_cursor (); |
998 | recolour_cursor (); |
996 | scr_recolour (); |
999 | scr_recolour (); |
997 | } |
|
|
998 | |
|
|
999 | #else |
|
|
1000 | # define set_window_color (idx,color) ((void)0) |
|
|
1001 | #endif /* XTERM_COLOR_CHANGE */ |
1000 | #endif /* XTERM_COLOR_CHANGE */ |
|
|
1001 | } |
1002 | |
1002 | |
1003 | void |
1003 | void |
1004 | rxvt_term::recolour_cursor () |
1004 | rxvt_term::recolour_cursor () |
1005 | { |
1005 | { |
1006 | XColor fg, bg; |
1006 | XColor fg, bg; |
… | |
… | |
1038 | |
1038 | |
1039 | for (i = Color_Black; i <= Color_White; i++) |
1039 | for (i = Color_Black; i <= Color_White; i++) |
1040 | if (pix_colors[Color_bg] == pix_colors[i]) |
1040 | if (pix_colors[Color_bg] == pix_colors[i]) |
1041 | { |
1041 | { |
1042 | sprintf (bstr, "%d", (i - Color_Black)); |
1042 | sprintf (bstr, "%d", (i - Color_Black)); |
1043 | #ifdef XPM_BACKGROUND |
1043 | #ifdef BG_IMAGE_FROM_FILE |
1044 | xpmb = "default;"; |
1044 | xpmb = "default;"; |
1045 | #endif |
1045 | #endif |
1046 | break; |
1046 | break; |
1047 | } |
1047 | } |
1048 | |
1048 | |
… | |
… | |
1146 | window_vt_x, window_vt_y, |
1146 | window_vt_x, window_vt_y, |
1147 | width, height); |
1147 | width, height); |
1148 | |
1148 | |
1149 | #ifdef HAVE_BG_PIXMAP |
1149 | #ifdef HAVE_BG_PIXMAP |
1150 | if (bgPixmap.window_size_sensitive ()) |
1150 | if (bgPixmap.window_size_sensitive ()) |
1151 | update_background (); |
1151 | update_background (); |
1152 | #endif |
1152 | #endif |
1153 | |
1153 | |
1154 | scr_clear (); |
1154 | scr_clear (); |
1155 | } |
1155 | } |
1156 | |
1156 | |
… | |
… | |
1700 | |
1700 | |
1701 | XFree (preedit_attr); |
1701 | XFree (preedit_attr); |
1702 | } |
1702 | } |
1703 | #endif /* USE_XIM */ |
1703 | #endif /* USE_XIM */ |
1704 | |
1704 | |
|
|
1705 | void |
|
|
1706 | rxvt_term::get_window_origin (int &x, int &y) |
|
|
1707 | { |
|
|
1708 | Window cr; |
|
|
1709 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
|
|
1710 | /* fprintf( stderr, "origin is %+d%+d\n", x, y);*/ |
|
|
1711 | } |
|
|
1712 | |
|
|
1713 | Pixmap |
|
|
1714 | rxvt_term::get_pixmap_property (int prop_id) |
|
|
1715 | { |
|
|
1716 | if (prop_id > 0 && prop_id < NUM_XA) |
|
|
1717 | if (xa[prop_id]) |
|
|
1718 | { |
|
|
1719 | int aformat; |
|
|
1720 | unsigned long nitems, bytes_after; |
|
|
1721 | Atom atype; |
|
|
1722 | unsigned char *prop = NULL; |
|
|
1723 | int result = XGetWindowProperty (dpy, display->root, xa[prop_id], |
|
|
1724 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
1725 | &nitems, &bytes_after, &prop); |
|
|
1726 | if (result == Success && prop && atype == XA_PIXMAP) |
|
|
1727 | { |
|
|
1728 | return *(Pixmap *)prop; |
|
|
1729 | } |
|
|
1730 | } |
|
|
1731 | return None; |
|
|
1732 | } |
|
|
1733 | |
|
|
1734 | #ifdef HAVE_BG_PIXMAP |
|
|
1735 | int |
|
|
1736 | rxvt_term::update_background () |
|
|
1737 | { |
|
|
1738 | bgPixmap.invalidate (); |
|
|
1739 | |
|
|
1740 | /* no chance of real time refresh if we are blurring ! */ |
|
|
1741 | if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) |
|
|
1742 | bgPixmap.render (); |
|
|
1743 | else |
|
|
1744 | { |
|
|
1745 | update_background_ev.stop (); |
|
|
1746 | if (!bgPixmap.need_client_side_rendering()) |
|
|
1747 | update_background_ev.start (NOW + .05); |
|
|
1748 | else if (bgPixmap.flags & bgPixmap_t::blurNeeded) |
|
|
1749 | update_background_ev.start (NOW + .2); /* very slow !!! */ |
|
|
1750 | else |
|
|
1751 | update_background_ev.start (NOW + .07); |
|
|
1752 | } |
|
|
1753 | return 0; |
|
|
1754 | } |
|
|
1755 | |
|
|
1756 | void |
|
|
1757 | rxvt_term::update_background_cb (time_watcher &w) |
|
|
1758 | { |
|
|
1759 | bgPixmap.render (); |
|
|
1760 | } |
|
|
1761 | |
|
|
1762 | #endif /* HAVE_BG_PIXMAP */ |
|
|
1763 | |
1705 | /*----------------------- end-of-file (C source) -----------------------*/ |
1764 | /*----------------------- end-of-file (C source) -----------------------*/ |