| 1 |
/* |
| 2 |
* background.h |
| 3 |
*/ |
| 4 |
|
| 5 |
#ifndef BACKGROUND_H_ |
| 6 |
#define BACKGROUND_H_ |
| 7 |
|
| 8 |
#ifdef HAVE_AFTERIMAGE |
| 9 |
# include <afterimage.h> |
| 10 |
# undef min |
| 11 |
# undef max |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifdef HAVE_PIXBUF |
| 15 |
#include <gdk-pixbuf/gdk-pixbuf.h> |
| 16 |
#endif |
| 17 |
|
| 18 |
#if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) |
| 19 |
# define HAVE_BG_PIXMAP 1 /* to simplify further usage */ |
| 20 |
struct bgPixmap_t |
| 21 |
{ |
| 22 |
bgPixmap_t (); |
| 23 |
void destroy (); |
| 24 |
|
| 25 |
enum { |
| 26 |
propScale = 1 << 1, |
| 27 |
rootAlign = 1 << 2, |
| 28 |
geometryFlags = propScale | rootAlign, |
| 29 |
|
| 30 |
tintSet = 1 << 8, |
| 31 |
tintNeeded = 1 << 9, |
| 32 |
tintWholesome = 1 << 10, |
| 33 |
tintFlags = tintNeeded | tintWholesome, |
| 34 |
|
| 35 |
blurNeeded = 1 << 11, |
| 36 |
|
| 37 |
effectsFlags = tintNeeded | blurNeeded, |
| 38 |
|
| 39 |
HAS_RENDER = 1 << 12, |
| 40 |
HAS_RENDER_CONV = 1 << 13, |
| 41 |
CLIENT_RENDER = 1 << 14, |
| 42 |
|
| 43 |
isTransparent = 1 << 16, |
| 44 |
isValid = 1 << 17, |
| 45 |
hasChanged = 1 << 19, |
| 46 |
sizeSensitive = 1 << 20, |
| 47 |
}; |
| 48 |
|
| 49 |
unsigned int flags; |
| 50 |
|
| 51 |
# ifdef BG_IMAGE_FROM_FILE |
| 52 |
# ifdef HAVE_AFTERIMAGE |
| 53 |
ASImage *original_asim; |
| 54 |
# endif |
| 55 |
|
| 56 |
# ifdef HAVE_PIXBUF |
| 57 |
GdkPixbuf *pixbuf; |
| 58 |
bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
| 59 |
int src_x, int src_y, int dst_x, int dst_y, |
| 60 |
unsigned int width, unsigned int height); |
| 61 |
# endif |
| 62 |
|
| 63 |
void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); |
| 64 |
bool render_image (unsigned long background_flags); |
| 65 |
bool have_image; |
| 66 |
|
| 67 |
enum { |
| 68 |
noScale = 0, |
| 69 |
windowScale = 100, |
| 70 |
defaultScale = windowScale, |
| 71 |
centerAlign = 50, |
| 72 |
defaultAlign = centerAlign, |
| 73 |
}; |
| 74 |
|
| 75 |
unsigned int h_scale, v_scale;/* percents of the window size */ |
| 76 |
int h_align, v_align; /* percents of the window size: |
| 77 |
0 - left align, 50 - center, 100 - right */ |
| 78 |
bool set_geometry (const char *geom, bool update = false); |
| 79 |
void set_defaultGeometry () |
| 80 |
{ |
| 81 |
h_scale = v_scale = defaultScale; |
| 82 |
h_align = v_align = defaultAlign; |
| 83 |
} |
| 84 |
|
| 85 |
bool set_file (const char *file); |
| 86 |
# endif /* BG_IMAGE_FROM_FILE */ |
| 87 |
|
| 88 |
rxvt_term *target; |
| 89 |
void set_target (rxvt_term *new_target); |
| 90 |
|
| 91 |
# ifdef ENABLE_TRANSPARENCY |
| 92 |
Pixmap root_pixmap; /* current root pixmap set */ |
| 93 |
rxvt_color tint; |
| 94 |
int shade; |
| 95 |
int h_blurRadius, v_blurRadius; |
| 96 |
|
| 97 |
bool set_transparent (); |
| 98 |
bool set_blur_radius (const char *geom); |
| 99 |
bool set_tint (rxvt_color &new_tint); |
| 100 |
bool set_shade (const char *shade_str); |
| 101 |
bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
| 102 |
bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
| 103 |
void set_root_pixmap (); |
| 104 |
|
| 105 |
unsigned long make_transparency_pixmap (); |
| 106 |
# endif |
| 107 |
double valid_since; |
| 108 |
|
| 109 |
Pixmap pixmap; |
| 110 |
unsigned int pmap_width, pmap_height; |
| 111 |
|
| 112 |
int target_x; |
| 113 |
int target_y; |
| 114 |
bool set_position (int x, int y); |
| 115 |
bool window_size_sensitive (); |
| 116 |
bool window_position_sensitive (); |
| 117 |
|
| 118 |
bool render (); |
| 119 |
void invalidate () |
| 120 |
{ |
| 121 |
flags &= ~isValid; |
| 122 |
} |
| 123 |
}; |
| 124 |
#else |
| 125 |
# undef HAVE_BG_PIXMAP |
| 126 |
#endif |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
#endif /* _BACKGROUND_H_ */ |