1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 02:25:09 +00:00

some imlib2 work

This commit is contained in:
Brenden Matthews 2009-03-18 22:02:25 -06:00
parent d399a128c9
commit 5378d13cfb
3 changed files with 46 additions and 24 deletions

View File

@ -321,18 +321,17 @@ dnl
dnl IMLIB2 dnl IMLIB2
dnl dnl
dnl --commented out until brenden finishes it -- AC_ARG_ENABLE([imlib2],
dnl AC_ARG_ENABLE([imlib2], AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]),
dnl AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]), [want_imlib2="$enableval"], [want_imlib2=no])
dnl [want_imlib2="$enableval"], [want_imlib2=no])
dnl AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
dnl AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes) if test x$want_imlib2 = xyes; then
dnl if test x$want_imlib2 = xyes; then PKG_CHECK_MODULES([Imlib2], [imlib2])
dnl PKG_CHECK_MODULES([Imlib2], [imlib2]) CFLAGS="$CFLAGS $Imlib2_CFLAGS"
dnl CFLAGS="$CFLAGS $Imlib2_CFLAGS" LIBS="$LIBS $Imlib2_LIBS"
dnl LIBS="$LIBS $Imlib2_LIBS" AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
dnl AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support]) fi
dnl fi
dnl dnl
@ -732,4 +731,5 @@ $PACKAGE $VERSION configured successfully:
nvidia: $want_nvidia nvidia: $want_nvidia
eve-online: $want_eve eve-online: $want_eve
config-output: $want_config_output config-output: $want_config_output
IMLIB2: $want_imlib2
EOF EOF

View File

@ -203,13 +203,16 @@ static void print_version(void)
#endif /* IBM */ #endif /* IBM */
#ifdef NVIDIA #ifdef NVIDIA
" * nvidia\n" " * nvidia\n"
#endif #endif /* NVIDIA */
#ifdef EVE #ifdef EVE
" * eve-online\n" " * eve-online\n"
#endif /* EVE */ #endif /* EVE */
#ifdef CONFIG_OUTPUT #ifdef CONFIG_OUTPUT
" * config-output\n" " * config-output\n"
#endif /* CONFIG_OUTPUT */ #endif /* CONFIG_OUTPUT */
#ifdef IMLIB2
" * IMLIB2\n"
#endif /* IMLIB2 */
); );
exit(0); exit(0);
@ -3490,27 +3493,19 @@ static void generate_text_internal(char *p, int p_max_size,
Imlib_Image image, buffer; Imlib_Image image, buffer;
image = imlib_load_image(obj->data.s); image = imlib_load_image(obj->data.s);
imlib_context_set_image(image);
if (image) { if (image) {
int w, h; int w, h;
imlib_context_set_image(image);
w = imlib_image_get_width(); w = imlib_image_get_width();
h = imlib_image_get_height(); h = imlib_image_get_height();
buffer = imlib_create_image(w, h); buffer = imlib_create_image(w, h);
imlib_context_set_display(display);
imlib_context_set_drawable(window.drawable);
imlib_context_set_colormap(DefaultColormap(display,
screen));
imlib_context_set_visual(DefaultVisual(display,
screen));
imlib_context_set_image(buffer); imlib_context_set_image(buffer);
imlib_blend_image_onto_image(image, 0, 0, 0, w, h, imlib_blend_image_onto_image(image, 0, 0, 0, w, h,
text_start_x, text_start_y, w, h); text_start_x, text_start_y, w, h);
imlib_render_image_on_drawable(text_start_x, imlib_render_image_on_drawable(text_start_x,
text_start_y); text_start_y);
imlib_free_image(); imlib_free_image();
imlib_context_set_image(image);
imlib_free_image();
} }
} }
} }

View File

@ -35,6 +35,9 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef IMLIB2
#include <Imlib2.h>
#endif /* IMLIB2 */
#ifdef XFT #ifdef XFT
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
@ -47,6 +50,11 @@ int use_xdbe;
/* some basic X11 stuff */ /* some basic X11 stuff */
Display *display; Display *display;
#ifdef IMLIB2
Visual *visual;
Colormap colourmap;
int depth;
#endif /* IMLIB2 */
int display_width; int display_width;
int display_height; int display_height;
int screen; int screen;
@ -418,6 +426,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
fflush(stderr); fflush(stderr);
XMapWindow(display, window.window); XMapWindow(display, window.window);
} else /* if (own_window) { */ } else /* if (own_window) { */
#endif #endif
/* root / desktop window */ /* root / desktop window */
@ -463,7 +472,25 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
fprintf(stderr, PACKAGE_NAME": drawing to single buffer\n"); fprintf(stderr, PACKAGE_NAME": drawing to single buffer\n");
} }
#endif #endif
#ifdef IMLIB2
visual = DefaultVisual(display, DefaultScreen(display));
depth = DefaultDepth(display, DefaultScreen(display));
colourmap = DefaultColormap(display, DefaultScreen(display));
/* set our cache to 4MiB so it doesn't have to go hit the disk as long as */
/* the images we use use less than 4MiB of RAM (that is uncompressed) */
imlib_set_cache_size(4092 * 1024);
/* set the font cache to 512KiB - again to avoid re-loading */
imlib_set_font_cache_size(512 * 1024);
/* set the maximum number of colors to allocate for 8bpp and less to 128 */
imlib_set_color_usage(128);
/* dither for depths < 24bpp */
imlib_context_set_dither(1);
/* set the display , visual, colormap and drawable we are using */
imlib_context_set_display(display);
imlib_context_set_visual(visual);
imlib_context_set_colormap(colourmap);
imlib_context_set_drawable(window.drawable);
#endif /* IMLIB2 */
XFlush(display); XFlush(display);
/* set_transparent_background(window.window); /* set_transparent_background(window.window);