#include <X11/extensions/Xdamage.h>
#endif
#ifdef IMLIB2
-#include <Imlib2.h>
+#include "imlib2.h"
#endif /* IMLIB2 */
#endif /* X11 */
#include <sys/types.h>
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;
/* 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)
if (output_methods & TO_X) {
XFlush(display);
+#ifdef IMLIB2
+ cimlib_event_start();
+#endif /* IMLIB2 */
+
/* wait for X event or timeout */
if (!XPending(display)) {
r.width = ev.xexpose.width;
r.height = ev.xexpose.height;
XUnionRectWithRegion(&r, region, region);
+#ifdef IMLIB2
+ cimlib_event_expose(&ev);
+#endif /* IMLIB2 */
break;
}
}
#endif
draw_stuff();
+#ifdef IMLIB2
+ cimlib_event_end(/*window.x, window.y, */0, 0, window.width, window.height);
+#endif /* IMLIB2 */
XDestroyRegion(region);
region = XCreateRegion();
}
XFreeGC(display, window.gc);
free_fonts();
}
+
#endif /* X11 */
free_text_objects(&global_root_object);
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> "
#include <X11/Xmd.h>
#include <X11/Xutil.h>
#ifdef IMLIB2
-#include <Imlib2.h>
+#include "imlib2.h"
#endif /* IMLIB2 */
#ifdef XFT
/* some basic X11 stuff */
Display *display;
-#ifdef IMLIB2
-Visual *visual;
-Colormap colourmap;
-int depth;
-#endif /* IMLIB2 */
int display_width;
int display_height;
int screen;
}
#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);