1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 01:34:11 +00:00

Add configuration setting imlib_image_alpha

This option is passed verbatim to both calls to
imlib_image_set_has_alpha. When false, imlib will not merge the alpha
channel when blending the image into the window visual, which means that
own_window_argb_visual will not result in transparent images. The option
is enabled by default to preserve the current behaviour.
This commit is contained in:
Bas Pape 2014-06-17 20:45:02 +02:00
parent e8e21a9ff9
commit c6d2a43d28
5 changed files with 26 additions and 4 deletions

View File

@ -354,6 +354,19 @@
to 0 to disable the image cache.<para/>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>
<option>imlib_image_alpha</option>
</command>
</term>
<listitem>
Boolean, use transparency for images? Enabled by
default. If own_window_visual_argb is enabled, images
appear transparent; disable this option to make images
appear opaque.<para/>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>

View File

@ -5,7 +5,7 @@
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
## Configuration items
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_size|default_color|default_gauge_size|default_graph_size|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_specials|max_text_width|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
color green "\<(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_size|default_color|default_gauge_size|default_graph_size|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|imlib_image_alpha|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_specials|max_text_width|max_user_text|maximum_width|minimum_size|mpd_host|mpd_password|mpd_port|music_player_interval|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
## Configuration item constants
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\>"

View File

@ -12,7 +12,7 @@ endif
syn region ConkyrcComment start=/^\s*#/ end=/$/
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_size default_color default_gauge_size default_graph_size default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades extra_newline font format_human_readable gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook mail_spool max_port_monitor_connections max_specials max_text_width max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval net_avg_samples no_buffers nvidia_display out_to_console out_to_ncurses out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size times_in_seconds top_cpu_separate top_name_width total_run_times update_interval update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
syn keyword ConkyrcSetting alignment append_file background border_inner_margin border_outer_margin border_width color0 color1 color2 color3 color4 color5 color6 color7 color8 color9 colorN cpu_avg_samples default_bar_size default_color default_gauge_size default_graph_size default_outline_color default_shade_color diskio_avg_samples display double_buffer draw_borders draw_graph_borders draw_outline draw_shades extra_newline font format_human_readable gap_x gap_y if_up_strictness imap imlib_cache_flush_interval imlib_cache_size imlib_image_alpha lua_draw_hook_post lua_draw_hook_pre lua_load lua_shutdown_hook lua_startup_hook mail_spool max_port_monitor_connections max_specials max_text_width max_user_text maximum_width minimum_size mpd_host mpd_password mpd_port music_player_interval net_avg_samples no_buffers nvidia_display out_to_console out_to_ncurses out_to_stderr out_to_x override_utf8_locale overwrite_file own_window own_window_class own_window_colour own_window_hints own_window_title own_window_transparent own_window_type pad_percents pop3 sensor_device short_units show_graph_range show_graph_scale stippled_borders temperature_unit template template0 template1 template2 template3 template4 template5 template6 template7 template8 template9 text text_buffer_size times_in_seconds top_cpu_separate top_name_width total_run_times update_interval update_interval_on_battery uppercase use_spacer use_xft xftalpha xftfont
syn keyword ConkyrcConstant
\ above

View File

@ -5196,6 +5196,9 @@ char load_config_file(const char *f)
cimlib_set_cache_flush_interval(atoi(value));
}
}
CONF("imlib_image_alpha") {
cimlib_set_image_alpha(string_to_bool(value));
}
#endif /* IMLIB2 */
#endif /* X11 */
CONF("update_interval_on_battery") {

View File

@ -56,6 +56,7 @@ static int cache_size_set = 0;
/* flush the image cache ever X seconds */
static int cimlib_cache_flush_interval = 0;
static int cimlib_cache_flush_last = 0;
static int cimlib_image_alpha = 1;
#define DEFAULT_IMLIB2_CACHE_SIZE 4096 * 1024 /* default cache size for loaded images */
@ -74,6 +75,11 @@ void cimlib_set_cache_flush_interval(long interval)
}
}
void cimlib_set_image_alpha(int alpha)
{
cimlib_image_alpha = alpha;
}
void cimlib_cleanup(void)
{
struct image_list_s *cur = image_list_start, *last = NULL;
@ -191,7 +197,7 @@ static void cimlib_draw_image(struct image_list_s *cur, int *clip_x, int
imlib_context_set_image(image);
/* turn alpha channel on */
imlib_image_set_has_alpha(1);
imlib_image_set_has_alpha(cimlib_image_alpha);
w = imlib_image_get_width();
h = imlib_image_get_height();
if (!cur->wh_set) {
@ -250,7 +256,7 @@ void cimlib_render(int x, int y, int width, int height)
/* we can blend stuff now */
imlib_context_set_blend(1);
/* turn alpha channel on */
imlib_image_set_has_alpha(1);
imlib_image_set_has_alpha(cimlib_image_alpha);
cimlib_draw_all(&clip_x, &clip_y, &clip_x2, &clip_y2);