1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-28 13:00:45 +00:00

make own_window_transparent a lua setting

This commit is contained in:
Pavel Labath 2010-02-26 18:38:15 +01:00
parent 94be4f6eb9
commit 518045eaf6
3 changed files with 9 additions and 18 deletions

View File

@ -361,9 +361,6 @@ static int draw_shades, draw_outline;
long default_fg_color, default_bg_color, default_out_color;
/* create own window or draw stuff to root? */
static int set_transparent = 0;
#ifdef OWN_WINDOW
static int background_colour = 0;
@ -2695,11 +2692,11 @@ static void X11_create_window(void)
if (out_to_x.get(*state)) {
#ifdef OWN_WINDOW
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, background_colour,
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, background_colour,
xargv, xargc);
#else /* OWN_WINDOW */
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, 0,
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0,
xargv, xargc);
#endif /* OWN_WINDOW */
@ -3240,11 +3237,6 @@ char load_config_file(const char *f)
}
#ifdef BUILD_X11
#ifdef OWN_WINDOW
CONF("own_window_transparent") {
if (value) {
set_transparent = string_to_bool(value);
}
}
CONF("own_window_hints") {
if (value) {
char *p_hint, *p_save;

View File

@ -61,7 +61,6 @@ Display *display = NULL;
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 */
@ -186,7 +185,7 @@ void set_transparent_background(Window win, int alpha)
#ifdef BUILD_ARGB
if (have_argb_visual) {
// real transparency
if (set_transparent) {
if (set_transparent.get(*state)) {
XSetWindowBackground(display, win, 0x00);
} else if (colour_set != background_colour) {
XSetWindowBackground(display, win,
@ -197,7 +196,7 @@ void set_transparent_background(Window win, int alpha)
#endif /* BUILD_ARGB */
// pseudo transparency
if (set_transparent) {
if (set_transparent.get(*state)) {
Window parent = win;
unsigned int i;
@ -262,13 +261,11 @@ void destroy_window(void)
colour_set = -1;
}
void init_window(int w, int h, int set_trans, int back_colour,
char **argv, int argc)
void init_window(int w, int h, int back_colour, char **argv, int argc)
{
/* 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;
window_created = 1;
@ -937,6 +934,8 @@ conky::config_setting<bool> out_to_x("out_to_x", conky::simple_accessors<bool>(f
#ifdef OWN_WINDOW
conky::config_setting<bool> own_window("own_window", conky::simple_accessors<bool>(false, false));
conky::config_setting<bool> set_transparent("own_window_transparent",
conky::simple_accessors<bool>(false, false));
conky::config_setting<std::string> own_window_class("own_window_class",
conky::simple_accessors<std::string>(PACKAGE_NAME, false));

View File

@ -116,8 +116,7 @@ extern struct conky_window window;
extern char window_created;
void init_X11(const char*);
void init_window(int width, int height, int set_trans,
int back_colour, char **argv, int argc);
void init_window(int width, int height, int back_colour, char **argv, int argc);
void destroy_window(void);
void create_gc(void);
void set_transparent_background(Window win, int alpha);
@ -154,6 +153,7 @@ extern conky::config_setting<bool> out_to_x;
#ifdef OWN_WINDOW
extern conky::config_setting<bool> own_window;
extern conky::config_setting<bool> set_transparent;
extern conky::config_setting<std::string> own_window_class;
extern conky::config_setting<std::string> own_window_title;
#ifdef BUILD_ARGB