mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 20:44:56 +00:00
Some work on imlib2 stuff.
This commit is contained in:
parent
76dedfd563
commit
31ed5ba178
@ -111,6 +111,10 @@ if BUILD_NVIDIA
|
||||
nvidia = nvidia.c nvidia.h
|
||||
endif
|
||||
|
||||
if BUILD_IMLIB2
|
||||
imlib2 = imlib2.c imlib2.h
|
||||
endif
|
||||
|
||||
conky_SOURCES = \
|
||||
$(config_output) \
|
||||
$(config_cookie) \
|
||||
@ -153,7 +157,8 @@ conky_SOURCES = \
|
||||
text_object.h \
|
||||
text_object.c \
|
||||
algebra.h \
|
||||
algebra.c
|
||||
algebra.c \
|
||||
$(imlib2)
|
||||
|
||||
conky_LDFLAGS = \
|
||||
$(PTHREAD_LIBS) \
|
||||
@ -209,7 +214,9 @@ EXTRA_DIST = \
|
||||
ibm.c \
|
||||
ibm.h \
|
||||
sony.h \
|
||||
users.c
|
||||
users.c \
|
||||
imlib2.c \
|
||||
imlib2.h
|
||||
|
||||
|
||||
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
||||
|
47
src/conky.c
47
src/conky.c
@ -49,7 +49,7 @@
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
#ifdef IMLIB2
|
||||
#include <Imlib2.h>
|
||||
#include "imlib2.h"
|
||||
#endif /* IMLIB2 */
|
||||
#endif /* X11 */
|
||||
#include <sys/types.h>
|
||||
@ -3557,33 +3557,13 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
strcpy(p, "0.0.0.0");
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if defined(IMLIB2) && defined(X11)
|
||||
OBJ(image) {
|
||||
if (obj->a < 1) {
|
||||
obj->a++;
|
||||
} else {
|
||||
Imlib_Image image, buffer;
|
||||
|
||||
image = imlib_load_image(obj->data.s);
|
||||
if (image) {
|
||||
int w, h;
|
||||
imlib_context_set_image(image);
|
||||
|
||||
w = imlib_image_get_width();
|
||||
h = imlib_image_get_height();
|
||||
buffer = imlib_create_image(w, h);
|
||||
imlib_context_set_image(buffer);
|
||||
imlib_blend_image_onto_image(image, 0, 0, 0, w, h,
|
||||
text_start_x, text_start_y, w, h);
|
||||
imlib_render_image_on_drawable(text_start_x,
|
||||
text_start_y);
|
||||
imlib_free_image();
|
||||
}
|
||||
}
|
||||
/* doesn't actually draw anything, just queues it omp. the
|
||||
* image will get drawn after the X event loop */
|
||||
cimlib_add_image(obj->data.s);
|
||||
}
|
||||
#endif /* IMLIB2 */
|
||||
|
||||
OBJ(eval) {
|
||||
struct information *tmp_info;
|
||||
struct text_object subroot, subroot2;
|
||||
@ -5952,6 +5932,9 @@ static int need_to_update;
|
||||
/* update_text() generates new text and clears old text area */
|
||||
static void update_text(void)
|
||||
{
|
||||
#ifdef IMLIB2
|
||||
cimlib_cleanup();
|
||||
#endif /* IMLIB2 */
|
||||
generate_text();
|
||||
#ifdef X11
|
||||
if (output_methods & TO_X)
|
||||
@ -6009,6 +5992,10 @@ static void main_loop(void)
|
||||
if (output_methods & TO_X) {
|
||||
XFlush(display);
|
||||
|
||||
#ifdef IMLIB2
|
||||
cimlib_event_start();
|
||||
#endif /* IMLIB2 */
|
||||
|
||||
/* wait for X event or timeout */
|
||||
|
||||
if (!XPending(display)) {
|
||||
@ -6101,6 +6088,9 @@ static void main_loop(void)
|
||||
r.width = ev.xexpose.width;
|
||||
r.height = ev.xexpose.height;
|
||||
XUnionRectWithRegion(&r, region, region);
|
||||
#ifdef IMLIB2
|
||||
cimlib_event_expose(&ev);
|
||||
#endif /* IMLIB2 */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6241,6 +6231,9 @@ static void main_loop(void)
|
||||
}
|
||||
#endif
|
||||
draw_stuff();
|
||||
#ifdef IMLIB2
|
||||
cimlib_event_end(/*window.x, window.y, */0, 0, window.width, window.height);
|
||||
#endif /* IMLIB2 */
|
||||
XDestroyRegion(region);
|
||||
region = XCreateRegion();
|
||||
}
|
||||
@ -6414,6 +6407,7 @@ static void clean_up(void)
|
||||
XFreeGC(display, window.gc);
|
||||
free_fonts();
|
||||
}
|
||||
|
||||
#endif /* X11 */
|
||||
|
||||
free_text_objects(&global_root_object);
|
||||
@ -7220,6 +7214,11 @@ static void load_config_file(const char *f)
|
||||
stippled_borders = 4;
|
||||
}
|
||||
}
|
||||
CONF("imlib_cache_size") {
|
||||
if (value) {
|
||||
cimlib_set_cache_size(atoi(value));
|
||||
}
|
||||
}
|
||||
#endif /* X11 */
|
||||
CONF("temp1") {
|
||||
ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> "
|
||||
|
31
src/x11.c
31
src/x11.c
@ -36,7 +36,7 @@
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef IMLIB2
|
||||
#include <Imlib2.h>
|
||||
#include "imlib2.h"
|
||||
#endif /* IMLIB2 */
|
||||
|
||||
#ifdef XFT
|
||||
@ -50,11 +50,6 @@ int use_xdbe;
|
||||
|
||||
/* some basic X11 stuff */
|
||||
Display *display;
|
||||
#ifdef IMLIB2
|
||||
Visual *visual;
|
||||
Colormap colourmap;
|
||||
int depth;
|
||||
#endif /* IMLIB2 */
|
||||
int display_width;
|
||||
int display_height;
|
||||
int screen;
|
||||
@ -473,23 +468,13 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
||||
}
|
||||
#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);
|
||||
{
|
||||
Visual *visual;
|
||||
Colormap colourmap;
|
||||
visual = DefaultVisual(display, DefaultScreen(display));
|
||||
colourmap = DefaultColormap(display, DefaultScreen(display));
|
||||
cimlib_init(display, window.drawable, visual, colourmap);
|
||||
}
|
||||
#endif /* IMLIB2 */
|
||||
XFlush(display);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user