2005-08-24
* More configure and makefile updates
* Added scale arg for net graphs
- * Fixed bug in own_window stuff
+ * Fixed bug in own_window stuff--amazing fake transparency now works
+ properly
+ * added own_window_colour, own_window_transparent
2005-08-23
* Added maximum_width
Boolean, create own window to draw?
+ own_window_transparent
+ Boolean, set pseudo-transparency?
+
+
+ own_window_colour colour
+ If own_window_transparent no, set a specified background colour
+ (defaults to black). Takes either a hex value (#ffffff) or a
+ valid RGB name (see /usr/lib/X11/rgb.txt)
+
+
pad_percents
Pad percentages to this many decimals (0 = no padding)
</varlistentry>
<varlistentry>
+ <term><command><option>own_window_transparent</option></command></term>
+ <listitem>
+ Boolean, set pseudo-transparency?
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+ <term><command><option>own_window_colour</option></command>
+ <option>colour</option>
+ </term>
+ <listitem>
+ If own_window_transparent no, set a specified background colour (defaults to black). Takes either a hex value (#ffffff) or a valid RGB name (see /usr/lib/X11/rgb.txt)
+ <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
<term><command><option>pad_percents</option></command></term>
<listitem>
Pad percentages to this many decimals (0 = no padding)
/* create own window or draw stuff to root? */
static int own_window = 0;
+static int set_transparent = 0;
+static int background_colour = 0;
+
#ifdef OWN_WINDOW
/* fixed size/pos is set if wm/user changes them */
need_to_update = 0;
update_text_area();
-
#ifdef OWN_WINDOW
if (own_window) {
/* resize window if it isn't right size */
window.window,
window.width,
window.height);
+ set_transparent_background(window.window);
}
/* move window if it isn't in right position */
while (XPending(display)) {
XEvent ev;
XNextEvent(display, &ev);
-
switch (ev.type) {
case Expose:
{
#ifdef OWN_WINDOW
case ReparentNotify:
/* set background to ParentRelative for all parents */
- if (own_window)
+ if (own_window) {
set_transparent_background(window.
window);
+ }
break;
case ConfigureNotify:
use_xdbe = 0;
#endif
}
+ CONF("own_window_transparent") {
+ set_transparent = string_to_bool(value);
+ }
+ CONF("own_window_colour") {
+ background_colour = get_x11_color(value);
+ }
#endif
CONF("stippled_borders") {
if (value)
(own_window,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
- on_bottom, fixed_pos);
+ on_bottom, fixed_pos, set_transparent, background_colour);
#else
init_window
(own_window,
text_width + border_margin * 2 + 1,
text_height + border_margin * 2 + 1,
- on_bottom);
+ on_bottom, set_transparent, background_colour);
#endif
void init_X11();
#if defined OWN_WINDOW
-void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos);
+void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour);
#else
-void init_window(int use_own_window, int width, int height, int on_bottom);
+void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour);
#endif
void create_gc();
void set_transparent_background(Window win);
int display_width;
int display_height;
int screen;
+static int set_transparent;
+static int background_colour;
/* workarea from _NET_WORKAREA, this is where window / text is aligned */
int workarea[4];
/* sets background to ParentRelative for the Window and all parents */
void set_transparent_background(Window win)
{
- Window parent = win;
- unsigned int i;
- for (i = 0; i < 16 && parent != RootWindow(display, screen); i++) {
- Window r, *children;
- unsigned int n;
-
- XSetWindowBackgroundPixmap(display, parent,
- ParentRelative);
-
- XQueryTree(display, parent, &r, &parent, &children, &n);
- XFree(children);
+ if (set_transparent) {
+ Window parent = win;
+ unsigned int i;
+ for (i = 0; i < 16 && parent != RootWindow(display, screen); i++) {
+ Window r, *children;
+ unsigned int n;
+
+ XSetWindowBackgroundPixmap(display, parent, ParentRelative);
+
+ XQueryTree(display, parent, &r, &parent, &children, &n);
+ XFree(children);
+ }
+ } else {
+ XSetWindowBackground(display, win, background_colour);
}
XClearWindow(display, win);
}
#if defined OWN_WINDOW
-void init_window(int own_window, int w, int h, int l, int fixed_pos)
+void init_window(int own_window, int w, int h, int l, int fixed_pos, int set_trans, int back_colour)
#else
-void init_window(int own_window, int w, int h, int l)
+void init_window(int own_window, int w, int h, int l, int set_trans, int back_colour)
#endif
{
/* There seems to be some problems with setting transparent background (on
* fluxbox this time). It doesn't happen always and I don't know why it
* happens but I bet the bug is somewhere here. */
+ set_transparent = set_trans;
+ background_colour = back_colour;
#ifdef OWN_WINDOW
if (own_window) {
+
/* looks like root pixmap isn't needed for anything */
{
XSetWindowAttributes attrs;
XFlush(display);
- /* set_transparent_background() must be done after double buffer stuff? */
+ /*set_transparent_background(window.window); must be done after double buffer stuff? */
#ifdef OWN_WINDOW
if (own_window) {
set_transparent_background(window.window);