mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-11 18:38:45 +00:00
* Xdamage support
* Initial Imlib2 support (broken and not implemented correctly yet, im too tired to finish it tonight git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@661 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
f95097fe89
commit
2b40f6bc41
@ -1,5 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2006-05-24
|
||||||
|
* Xdamage support for composite and pals
|
||||||
|
|
||||||
2006-05-23
|
2006-05-23
|
||||||
* CPU voltage support via $voltage_mv and $voltage_v (thanks to Peter
|
* CPU voltage support via $voltage_mv and $voltage_v (thanks to Peter
|
||||||
Tarjan for the patch)
|
Tarjan for the patch)
|
||||||
|
17
configure.in
17
configure.in
@ -316,6 +316,23 @@ if test x$want_xmms2 = xyes; then
|
|||||||
AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
|
AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl IMLIB2
|
||||||
|
dnl
|
||||||
|
|
||||||
|
want_imlib2=no
|
||||||
|
AC_ARG_ENABLE(imlib2,
|
||||||
|
[ --enable-imlib2 enable if you want Imlib2 support [[default=no]]],
|
||||||
|
[want_imlib2="$enableval"])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
|
||||||
|
if test x$want_imlib2 = xyes; then
|
||||||
|
PKG_CHECK_MODULES([Imlib2], [imlib2])
|
||||||
|
CFLAGS="$CFLAGS $Imlib2_CFLAGS"
|
||||||
|
LIBS="$LIBS $Imlib2_LIBS"
|
||||||
|
AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl PORT_MONITORS
|
dnl PORT_MONITORS
|
||||||
dnl
|
dnl
|
||||||
|
60
src/conky.c
60
src/conky.c
@ -27,6 +27,9 @@
|
|||||||
#ifdef X11
|
#ifdef X11
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
|
#ifdef IMLIB2
|
||||||
|
#include <Imlib2.h>
|
||||||
|
#endif /* IMLIB2 */
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -47,6 +50,13 @@
|
|||||||
|
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
|
|
||||||
|
/*
|
||||||
|
* text size
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int text_start_x, text_start_y; /* text start position in window */
|
||||||
|
static int text_width, text_height;
|
||||||
|
|
||||||
/* alignments */
|
/* alignments */
|
||||||
enum alignment {
|
enum alignment {
|
||||||
TOP_LEFT = 1,
|
TOP_LEFT = 1,
|
||||||
@ -833,6 +843,7 @@ enum text_object_type {
|
|||||||
OBJ_downspeedgraph,
|
OBJ_downspeedgraph,
|
||||||
OBJ_else,
|
OBJ_else,
|
||||||
OBJ_endif,
|
OBJ_endif,
|
||||||
|
OBJ_image,
|
||||||
OBJ_exec,
|
OBJ_exec,
|
||||||
OBJ_execi,
|
OBJ_execi,
|
||||||
OBJ_texeci,
|
OBJ_texeci,
|
||||||
@ -1740,6 +1751,9 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
|
|||||||
case OBJ_text: case OBJ_font:
|
case OBJ_text: case OBJ_font:
|
||||||
free(objs[i].data.s);
|
free(objs[i].data.s);
|
||||||
break;
|
break;
|
||||||
|
case OBJ_image:
|
||||||
|
free(objs[i].data.s);
|
||||||
|
break;
|
||||||
case OBJ_exec:
|
case OBJ_exec:
|
||||||
free(objs[i].data.s);
|
free(objs[i].data.s);
|
||||||
break;
|
break;
|
||||||
@ -2183,6 +2197,8 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
|||||||
ERR("$endif: no matching $if_*");
|
ERR("$endif: no matching $if_*");
|
||||||
}
|
}
|
||||||
END
|
END
|
||||||
|
OBJ(image, 0) obj->data.s = strdup(arg ? arg : "");
|
||||||
|
END
|
||||||
#ifdef HAVE_POPEN
|
#ifdef HAVE_POPEN
|
||||||
OBJ(exec, 0) obj->data.s = strdup(arg ? arg : "");
|
OBJ(exec, 0) obj->data.s = strdup(arg ? arg : "");
|
||||||
END OBJ(execbar, 0) obj->data.s = strdup(arg ? arg : "");
|
END OBJ(execbar, 0) obj->data.s = strdup(arg ? arg : "");
|
||||||
@ -3419,7 +3435,33 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
|||||||
snprintf(p, p_max_size, "%d",
|
snprintf(p, p_max_size, "%d",
|
||||||
obj->data.net->linkstatus);
|
obj->data.net->linkstatus);
|
||||||
}
|
}
|
||||||
|
#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);
|
||||||
|
imlib_context_set_image(image);
|
||||||
|
if (image) {
|
||||||
|
int w, h;
|
||||||
|
w = imlib_image_get_width();
|
||||||
|
h = imlib_image_get_height();
|
||||||
|
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_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();
|
||||||
|
imlib_context_set_image(image);
|
||||||
|
imlib_free_image();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* IMLIB2 */
|
||||||
OBJ(exec) {
|
OBJ(exec) {
|
||||||
FILE *fp = popen(obj->data.s, "r");
|
FILE *fp = popen(obj->data.s, "r");
|
||||||
int length = fread(p, 1, p_max_size, fp);
|
int length = fread(p, 1, p_max_size, fp);
|
||||||
@ -4701,14 +4743,6 @@ static void set_font()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* text size
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int text_start_x, text_start_y; /* text start position in window */
|
|
||||||
static int text_width, text_height;
|
|
||||||
|
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
static inline int get_string_width(const char *s)
|
static inline int get_string_width(const char *s)
|
||||||
@ -5544,12 +5578,7 @@ static void main_loop()
|
|||||||
if (!XDamageQueryExtension (display, &event_base, &error_base)) {
|
if (!XDamageQueryExtension (display, &event_base, &error_base)) {
|
||||||
ERR("Xdamage extension unavailable");
|
ERR("Xdamage extension unavailable");
|
||||||
}
|
}
|
||||||
// Damage damage = XDamageCreate(display, window.drawable, XDamageReportRawRectangles);
|
|
||||||
// Damage damage = XDamageCreate(display, window.drawable, XDamageReportDeltaRectangles);
|
|
||||||
// Damage damage = XDamageCreate(display, window.drawable, XDamageReportBoundingBox);
|
|
||||||
Damage damage = XDamageCreate(display, window.window, XDamageReportNonEmpty);
|
Damage damage = XDamageCreate(display, window.window, XDamageReportNonEmpty);
|
||||||
/* XserverRegion region2 = XFixesCreateRegion(display, 0, 0);
|
|
||||||
XserverRegion part = XFixesCreateRegion(display, 0, 0);*/
|
|
||||||
XserverRegion region2 = XFixesCreateRegionFromWindow(display, window.window, 0);
|
XserverRegion region2 = XFixesCreateRegionFromWindow(display, window.window, 0);
|
||||||
XserverRegion part = XFixesCreateRegionFromWindow(display, window.window, 0);
|
XserverRegion part = XFixesCreateRegionFromWindow(display, window.window, 0);
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
@ -5767,9 +5796,6 @@ static void main_loop()
|
|||||||
default:
|
default:
|
||||||
if (ev.type == event_base + XDamageNotify) {
|
if (ev.type == event_base + XDamageNotify) {
|
||||||
XDamageNotifyEvent *dev = (XDamageNotifyEvent *) &ev;
|
XDamageNotifyEvent *dev = (XDamageNotifyEvent *) &ev;
|
||||||
/* printf ("Damage %3d, %3d x %3d, %3d\n",
|
|
||||||
dev->area.x, dev->area.x + dev->area.width,
|
|
||||||
dev->area.y, dev->area.y + dev->area.height);*/
|
|
||||||
XFixesSetRegion(display, part, &dev->area, 1);
|
XFixesSetRegion(display, part, &dev->area, 1);
|
||||||
XFixesUnionRegion(display, region2, region2, part);
|
XFixesUnionRegion(display, region2, region2, part);
|
||||||
XDamageSubtract(display, damage, region2, None);
|
XDamageSubtract(display, damage, region2, None);
|
||||||
|
Loading…
Reference in New Issue
Block a user