… | |
… | |
74 | #include <X11/cursorfont.h> |
74 | #include <X11/cursorfont.h> |
75 | #include <X11/keysym.h> |
75 | #include <X11/keysym.h> |
76 | #include <X11/keysymdef.h> |
76 | #include <X11/keysymdef.h> |
77 | #include <X11/Xatom.h> |
77 | #include <X11/Xatom.h> |
78 | |
78 | |
|
|
79 | #ifdef HAVE_AFTERIMAGE |
|
|
80 | # include <afterimage.h> |
|
|
81 | # undef min |
|
|
82 | # undef max |
|
|
83 | #endif |
|
|
84 | |
|
|
85 | #ifdef HAVE_PIXBUF |
|
|
86 | # include <gdk-pixbuf/gdk-pixbuf.h> |
|
|
87 | #endif |
|
|
88 | |
|
|
89 | #if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) |
|
|
90 | # define HAVE_BG_PIXMAP 1 |
|
|
91 | #endif |
|
|
92 | |
79 | #include "encoding.h" |
93 | #include "encoding.h" |
80 | #include "rxvtutil.h" |
94 | #include "rxvtutil.h" |
81 | #include "rxvtfont.h" |
95 | #include "rxvtfont.h" |
82 | #include "rxvttoolkit.h" |
96 | #include "rxvttoolkit.h" |
83 | #include "scrollbar.h" |
97 | #include "scrollbar.h" |
… | |
… | |
101 | * SYSTEM HACKS |
115 | * SYSTEM HACKS |
102 | ***************************************************************************** |
116 | ***************************************************************************** |
103 | */ |
117 | */ |
104 | |
118 | |
105 | #include <termios.h> |
119 | #include <termios.h> |
106 | |
|
|
107 | #include "background.h" |
|
|
108 | |
120 | |
109 | #ifndef STDIN_FILENO |
121 | #ifndef STDIN_FILENO |
110 | # define STDIN_FILENO 0 |
122 | # define STDIN_FILENO 0 |
111 | # define STDOUT_FILENO 1 |
123 | # define STDOUT_FILENO 1 |
112 | # define STDERR_FILENO 2 |
124 | # define STDERR_FILENO 2 |
… | |
… | |
1100 | struct mouse_event MEvent; |
1112 | struct mouse_event MEvent; |
1101 | XComposeStatus compose; |
1113 | XComposeStatus compose; |
1102 | static struct termios def_tio; |
1114 | static struct termios def_tio; |
1103 | row_col_t oldcursor; |
1115 | row_col_t oldcursor; |
1104 | #ifdef HAVE_BG_PIXMAP |
1116 | #ifdef HAVE_BG_PIXMAP |
1105 | bgPixmap_t bgPixmap; |
1117 | void bg_init (); |
|
|
1118 | void bg_destroy (); |
|
|
1119 | |
|
|
1120 | enum { |
|
|
1121 | //subset returned by make_transparency_pixmap |
|
|
1122 | isValid = 1 << 0, |
|
|
1123 | tintNeeded = 1 << 1, |
|
|
1124 | blurNeeded = 1 << 2, |
|
|
1125 | |
|
|
1126 | effectsFlags = tintNeeded | blurNeeded, |
|
|
1127 | |
|
|
1128 | propScale = 1 << 3, |
|
|
1129 | rootAlign = 1 << 4, |
|
|
1130 | geometryFlags = propScale | rootAlign, |
|
|
1131 | |
|
|
1132 | tintSet = 1 << 5, |
|
|
1133 | tintWholesome = 1 << 6, |
|
|
1134 | tintFlags = tintNeeded | tintWholesome, |
|
|
1135 | |
|
|
1136 | HAS_RENDER = 1 << 7, |
|
|
1137 | HAS_RENDER_CONV = 1 << 8, |
|
|
1138 | CLIENT_RENDER = 1 << 9, |
|
|
1139 | |
|
|
1140 | isTransparent = 1 << 10, |
|
|
1141 | hasChanged = 1 << 11, |
|
|
1142 | sizeSensitive = 1 << 12, |
|
|
1143 | }; |
|
|
1144 | |
|
|
1145 | unsigned int bg_flags; |
|
|
1146 | |
|
|
1147 | # ifdef BG_IMAGE_FROM_FILE |
|
|
1148 | void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); |
|
|
1149 | bool render_image (unsigned long tr_flags); |
|
|
1150 | bool have_image; |
|
|
1151 | |
|
|
1152 | enum { |
|
|
1153 | noScale = 0, |
|
|
1154 | windowScale = 100, |
|
|
1155 | defaultScale = windowScale, |
|
|
1156 | centerAlign = 50, |
|
|
1157 | defaultAlign = centerAlign, |
|
|
1158 | }; |
|
|
1159 | |
|
|
1160 | unsigned int h_scale, v_scale; /* percents of the window size */ |
|
|
1161 | int h_align, v_align; /* percents of the window size: |
|
|
1162 | 0 - left align, 50 - center, 100 - right */ |
|
|
1163 | |
|
|
1164 | bool bg_set_geometry (const char *geom, bool update = false); |
|
|
1165 | void bg_set_default_geometry () |
|
|
1166 | { |
|
|
1167 | h_scale = v_scale = defaultScale; |
|
|
1168 | h_align = v_align = defaultAlign; |
|
|
1169 | } |
|
|
1170 | |
|
|
1171 | bool bg_set_file (const char *file); |
|
|
1172 | # endif |
|
|
1173 | |
|
|
1174 | # ifdef ENABLE_TRANSPARENCY |
|
|
1175 | Pixmap root_pixmap; /* current root pixmap set */ |
|
|
1176 | rxvt_color tint; |
|
|
1177 | int shade; |
|
|
1178 | int h_blurRadius, v_blurRadius; |
|
|
1179 | |
|
|
1180 | bool bg_set_transparent (); |
|
|
1181 | void bg_set_root_pixmap (); |
|
|
1182 | bool bg_set_tint (rxvt_color &new_tint); |
|
|
1183 | bool bg_set_shade (const char *shade_str); |
|
|
1184 | bool bg_set_blur (const char *geom); |
|
|
1185 | |
|
|
1186 | bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
|
|
1187 | bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
|
|
1188 | unsigned long make_transparency_pixmap (); |
|
|
1189 | # endif |
|
|
1190 | |
|
|
1191 | double bg_valid_since; |
|
|
1192 | |
|
|
1193 | Pixmap bg_pixmap; |
|
|
1194 | unsigned int bg_pmap_width, bg_pmap_height; |
|
|
1195 | |
|
|
1196 | int target_x; |
|
|
1197 | int target_y; |
|
|
1198 | bool bg_set_position (int x, int y); |
|
|
1199 | bool bg_window_size_sensitive (); |
|
|
1200 | bool bg_window_position_sensitive (); |
|
|
1201 | |
|
|
1202 | bool bg_render (); |
|
|
1203 | void bg_invalidate () |
|
|
1204 | { |
|
|
1205 | bg_flags &= ~isValid; |
|
|
1206 | } |
1106 | #endif |
1207 | #endif |
1107 | #ifdef HAVE_AFTERIMAGE |
1208 | #ifdef HAVE_AFTERIMAGE |
|
|
1209 | ASImage *original_asim; |
1108 | ASVisual *asv; |
1210 | ASVisual *asv; |
1109 | ASImageManager *asimman; |
1211 | ASImageManager *asimman; |
1110 | |
1212 | |
1111 | void init_asv () |
1213 | void init_asv () |
1112 | { |
1214 | { |
1113 | if (!asv) |
1215 | if (!asv) |
1114 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
1216 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
1115 | } |
1217 | } |
|
|
1218 | #endif |
|
|
1219 | #ifdef HAVE_PIXBUF |
|
|
1220 | GdkPixbuf *pixbuf; |
|
|
1221 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
|
|
1222 | int src_x, int src_y, int dst_x, int dst_y, |
|
|
1223 | unsigned int width, unsigned int height); |
1116 | #endif |
1224 | #endif |
1117 | |
1225 | |
1118 | #if ENABLE_OVERLAY |
1226 | #if ENABLE_OVERLAY |
1119 | overlay_base ov; |
1227 | overlay_base ov; |
1120 | |
1228 | |