mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-29 18:18:39 +00:00
make own_window_argb_value a lua setting
This commit is contained in:
parent
f6aa8a558f
commit
a4a08c82b5
19
src/conky.cc
19
src/conky.cc
@ -1094,7 +1094,7 @@ static inline void set_foreground_color(long c)
|
||||
if (out_to_x.get(*state)) {
|
||||
#ifdef BUILD_ARGB
|
||||
if (have_argb_visual) {
|
||||
current_color = c | (own_window_argb_value << 24);
|
||||
current_color = c | (own_window_argb_value.get(*state) << 24);
|
||||
} else {
|
||||
#endif /* BUILD_ARGB */
|
||||
current_color = c;
|
||||
@ -1964,7 +1964,7 @@ static void main_loop(void)
|
||||
draw_stuff(); /* redraw everything in our newly sized window */
|
||||
XResizeWindow(display, window.window, window.width,
|
||||
window.height); /* resize window */
|
||||
set_transparent_background(window.window, own_window_argb_value);
|
||||
set_transparent_background(window.window);
|
||||
#ifdef BUILD_XDBE
|
||||
/* swap buffers */
|
||||
xdbe_swap_buffers();
|
||||
@ -2068,7 +2068,7 @@ static void main_loop(void)
|
||||
case ReparentNotify:
|
||||
/* make background transparent */
|
||||
if (own_window.get(*state)) {
|
||||
set_transparent_background(window.window, own_window_argb_value);
|
||||
set_transparent_background(window.window);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2570,9 +2570,6 @@ static void set_default_configurations(void)
|
||||
maximum_width = 0;
|
||||
#ifdef OWN_WINDOW
|
||||
window.hints = 0;
|
||||
#ifdef BUILD_ARGB
|
||||
own_window_argb_value = 255;
|
||||
#endif
|
||||
#endif
|
||||
stippled_borders = 0;
|
||||
window.border_inner_margin = 3;
|
||||
@ -2708,7 +2705,7 @@ static void X11_create_window(void)
|
||||
if (not fixed_pos)
|
||||
XMoveWindow(display, window.window, window.x, window.y);
|
||||
|
||||
set_transparent_background(window.window, own_window_argb_value);
|
||||
set_transparent_background(window.window);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3268,14 +3265,6 @@ char load_config_file(const char *f)
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
#ifdef BUILD_ARGB
|
||||
CONF("own_window_argb_value") {
|
||||
own_window_argb_value = strtol(value, 0, 0);
|
||||
if (own_window_argb_value > 255 || own_window_argb_value < 0) {
|
||||
CONF_ERR2("own_window_argb_value must be <= 255 and >= 0");
|
||||
}
|
||||
}
|
||||
#endif /* BUILD_ARGB */
|
||||
#endif
|
||||
CONF("stippled_borders") {
|
||||
if (value) {
|
||||
|
11
src/x11.cc
11
src/x11.cc
@ -54,7 +54,6 @@ int use_xdbe;
|
||||
#ifdef BUILD_ARGB
|
||||
bool have_argb_visual;
|
||||
#endif /* BUILD_ARGB */
|
||||
int own_window_argb_value;
|
||||
|
||||
/* some basic X11 stuff */
|
||||
Display *display = NULL;
|
||||
@ -178,10 +177,8 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop)
|
||||
static int colour_set = -1;
|
||||
/* if no argb visual is configured sets background to ParentRelative for the Window and all parents,
|
||||
else real transparency is used */
|
||||
void set_transparent_background(Window win, int alpha)
|
||||
void set_transparent_background(Window win)
|
||||
{
|
||||
(void)alpha; /* disable warnings when unused */
|
||||
|
||||
#ifdef BUILD_ARGB
|
||||
if (have_argb_visual) {
|
||||
// real transparency
|
||||
@ -189,7 +186,7 @@ void set_transparent_background(Window win, int alpha)
|
||||
XSetWindowBackground(display, win, 0x00);
|
||||
} else if (colour_set != background_colour) {
|
||||
XSetWindowBackground(display, win,
|
||||
background_colour | (alpha << 24));
|
||||
background_colour | (own_window_argb_value.get(*state) << 24));
|
||||
colour_set = background_colour;
|
||||
}
|
||||
} else {
|
||||
@ -963,5 +960,9 @@ conky::config_setting<window_type> own_window_type("own_window_type",
|
||||
#ifdef BUILD_ARGB
|
||||
conky::config_setting<bool> use_argb_visual("own_window_argb_visual",
|
||||
conky::simple_accessors<bool>(false, false));
|
||||
conky::config_setting<int, conky::range_checking_accessors<int>>
|
||||
own_window_argb_value("own_window_argb_value",
|
||||
conky::range_checking_accessors<int>(0, 255, 255, false)
|
||||
);
|
||||
#endif
|
||||
#endif /*OWN_WINDOW*/
|
||||
|
@ -101,8 +101,6 @@ extern int use_xft;
|
||||
/* true if use_argb_visual=true and argb visual was found*/
|
||||
extern bool have_argb_visual;
|
||||
#endif
|
||||
/* range of 0-255 for alpha */
|
||||
extern int own_window_argb_value;
|
||||
|
||||
extern Display *display;
|
||||
extern int display_width;
|
||||
@ -118,7 +116,7 @@ void init_X11(const char*);
|
||||
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);
|
||||
void set_transparent_background(Window win);
|
||||
void get_x11_desktop_info(Display *display, Atom atom);
|
||||
void set_struts(int);
|
||||
|
||||
@ -158,6 +156,9 @@ extern conky::config_setting<std::string> own_window_title;
|
||||
extern conky::config_setting<window_type> own_window_type;
|
||||
#ifdef BUILD_ARGB
|
||||
extern conky::config_setting<bool> use_argb_visual;
|
||||
|
||||
/* range of 0-255 for alpha */
|
||||
extern conky::config_setting<int, conky::range_checking_accessors<int>> own_window_argb_value;
|
||||
#endif
|
||||
#endif /*OWN_WINDOW*/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user