mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-28 13:00:45 +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
|
nvidia = nvidia.c nvidia.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if BUILD_IMLIB2
|
||||||
|
imlib2 = imlib2.c imlib2.h
|
||||||
|
endif
|
||||||
|
|
||||||
conky_SOURCES = \
|
conky_SOURCES = \
|
||||||
$(config_output) \
|
$(config_output) \
|
||||||
$(config_cookie) \
|
$(config_cookie) \
|
||||||
@ -153,7 +157,8 @@ conky_SOURCES = \
|
|||||||
text_object.h \
|
text_object.h \
|
||||||
text_object.c \
|
text_object.c \
|
||||||
algebra.h \
|
algebra.h \
|
||||||
algebra.c
|
algebra.c \
|
||||||
|
$(imlib2)
|
||||||
|
|
||||||
conky_LDFLAGS = \
|
conky_LDFLAGS = \
|
||||||
$(PTHREAD_LIBS) \
|
$(PTHREAD_LIBS) \
|
||||||
@ -209,7 +214,9 @@ EXTRA_DIST = \
|
|||||||
ibm.c \
|
ibm.c \
|
||||||
ibm.h \
|
ibm.h \
|
||||||
sony.h \
|
sony.h \
|
||||||
users.c
|
users.c \
|
||||||
|
imlib2.c \
|
||||||
|
imlib2.h
|
||||||
|
|
||||||
|
|
||||||
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
|
# 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>
|
#include <X11/extensions/Xdamage.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMLIB2
|
#ifdef IMLIB2
|
||||||
#include <Imlib2.h>
|
#include "imlib2.h"
|
||||||
#endif /* IMLIB2 */
|
#endif /* IMLIB2 */
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
#include <sys/types.h>
|
#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");
|
strcpy(p, "0.0.0.0");
|
||||||
}
|
}
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#if defined(IMLIB2) && defined(X11)
|
#if defined(IMLIB2) && defined(X11)
|
||||||
OBJ(image) {
|
OBJ(image) {
|
||||||
if (obj->a < 1) {
|
/* doesn't actually draw anything, just queues it omp. the
|
||||||
obj->a++;
|
* image will get drawn after the X event loop */
|
||||||
} else {
|
cimlib_add_image(obj->data.s);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* IMLIB2 */
|
#endif /* IMLIB2 */
|
||||||
|
|
||||||
OBJ(eval) {
|
OBJ(eval) {
|
||||||
struct information *tmp_info;
|
struct information *tmp_info;
|
||||||
struct text_object subroot, subroot2;
|
struct text_object subroot, subroot2;
|
||||||
@ -5952,6 +5932,9 @@ static int need_to_update;
|
|||||||
/* update_text() generates new text and clears old text area */
|
/* update_text() generates new text and clears old text area */
|
||||||
static void update_text(void)
|
static void update_text(void)
|
||||||
{
|
{
|
||||||
|
#ifdef IMLIB2
|
||||||
|
cimlib_cleanup();
|
||||||
|
#endif /* IMLIB2 */
|
||||||
generate_text();
|
generate_text();
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
if (output_methods & TO_X)
|
if (output_methods & TO_X)
|
||||||
@ -6009,6 +5992,10 @@ static void main_loop(void)
|
|||||||
if (output_methods & TO_X) {
|
if (output_methods & TO_X) {
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
|
||||||
|
#ifdef IMLIB2
|
||||||
|
cimlib_event_start();
|
||||||
|
#endif /* IMLIB2 */
|
||||||
|
|
||||||
/* wait for X event or timeout */
|
/* wait for X event or timeout */
|
||||||
|
|
||||||
if (!XPending(display)) {
|
if (!XPending(display)) {
|
||||||
@ -6101,6 +6088,9 @@ static void main_loop(void)
|
|||||||
r.width = ev.xexpose.width;
|
r.width = ev.xexpose.width;
|
||||||
r.height = ev.xexpose.height;
|
r.height = ev.xexpose.height;
|
||||||
XUnionRectWithRegion(&r, region, region);
|
XUnionRectWithRegion(&r, region, region);
|
||||||
|
#ifdef IMLIB2
|
||||||
|
cimlib_event_expose(&ev);
|
||||||
|
#endif /* IMLIB2 */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6241,6 +6231,9 @@ static void main_loop(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
draw_stuff();
|
draw_stuff();
|
||||||
|
#ifdef IMLIB2
|
||||||
|
cimlib_event_end(/*window.x, window.y, */0, 0, window.width, window.height);
|
||||||
|
#endif /* IMLIB2 */
|
||||||
XDestroyRegion(region);
|
XDestroyRegion(region);
|
||||||
region = XCreateRegion();
|
region = XCreateRegion();
|
||||||
}
|
}
|
||||||
@ -6414,6 +6407,7 @@ static void clean_up(void)
|
|||||||
XFreeGC(display, window.gc);
|
XFreeGC(display, window.gc);
|
||||||
free_fonts();
|
free_fonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
free_text_objects(&global_root_object);
|
free_text_objects(&global_root_object);
|
||||||
@ -7220,6 +7214,11 @@ static void load_config_file(const char *f)
|
|||||||
stippled_borders = 4;
|
stippled_borders = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CONF("imlib_cache_size") {
|
||||||
|
if (value) {
|
||||||
|
cimlib_set_cache_size(atoi(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
CONF("temp1") {
|
CONF("temp1") {
|
||||||
ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> "
|
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/Xmd.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#ifdef IMLIB2
|
#ifdef IMLIB2
|
||||||
#include <Imlib2.h>
|
#include "imlib2.h"
|
||||||
#endif /* IMLIB2 */
|
#endif /* IMLIB2 */
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef XFT
|
||||||
@ -50,11 +50,6 @@ 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;
|
||||||
@ -473,23 +468,13 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMLIB2
|
#ifdef IMLIB2
|
||||||
visual = DefaultVisual(display, DefaultScreen(display));
|
{
|
||||||
depth = DefaultDepth(display, DefaultScreen(display));
|
Visual *visual;
|
||||||
colourmap = DefaultColormap(display, DefaultScreen(display));
|
Colormap colourmap;
|
||||||
/* set our cache to 4MiB so it doesn't have to go hit the disk as long as */
|
visual = DefaultVisual(display, DefaultScreen(display));
|
||||||
/* the images we use use less than 4MiB of RAM (that is uncompressed) */
|
colourmap = DefaultColormap(display, DefaultScreen(display));
|
||||||
imlib_set_cache_size(4092 * 1024);
|
cimlib_init(display, window.drawable, visual, colourmap);
|
||||||
/* 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 */
|
#endif /* IMLIB2 */
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user