1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 13:39:10 +00:00

An attempt at making lua bindings work

This commit is contained in:
Pavel Labath 2010-01-11 00:35:22 +01:00
parent bdda06f4ea
commit 47509b38bd
4 changed files with 28 additions and 22 deletions

View File

@ -85,7 +85,13 @@
#cmakedefine HAVE_ICONV 1
#cmakedefine LUA_EXTRAS 1
#cmakedefine BUILD_LUA_CAIRO 1
#cmakedefine BUILD_LUA_IMLIB2 1
#if defined(BUILD_LUA_CAIRO) || defined(BUILD_LUA_IMLIB2)
#define BUILD_LUA_EXTRAS
#endif
#cmakedefine BUILD_IBM 1

View File

@ -54,9 +54,9 @@
#ifdef BUILD_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
#include "imlib2.h"
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
#endif /* BUILD_X11 */
#include <sys/types.h>
#include <sys/stat.h>
@ -1755,9 +1755,9 @@ static void draw_text(void)
static void draw_stuff(void)
{
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
cimlib_render(text_start_x, text_start_y, window.width, window.height);
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
if (overwrite_file) {
overwrite_fpointer = fopen(overwrite_file, "w");
if(!overwrite_fpointer)
@ -1845,9 +1845,9 @@ static int need_to_update;
/* update_text() generates new text and clears old text area */
static void update_text(void)
{
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
cimlib_cleanup();
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
generate_text();
#ifdef BUILD_X11
if (output_methods & TO_X)
@ -2460,10 +2460,10 @@ void clean_up(void *memtofree1, void* memtofree2)
llua_shutdown_hook();
llua_close();
#endif /* BUILD_LUA */
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
if (output_methods & TO_X)
cimlib_deinit();
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
#ifdef BUILD_WEATHER_XOAP
xmlCleanupParser();
#endif /* BUILD_WEATHER_XOAP */
@ -3458,7 +3458,7 @@ char load_config_file(const char *f)
stippled_borders = 4;
}
}
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
CONF("imlib_cache_size") {
if (value) {
cimlib_set_cache_size(atoi(value));
@ -3469,7 +3469,7 @@ char load_config_file(const char *f)
cimlib_set_cache_flush_interval(atoi(value));
}
}
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
#endif /* BUILD_X11 */
CONF("update_interval_on_battery") {
if (value) {

View File

@ -28,11 +28,11 @@
#include "logging.h"
#include "build.h"
#ifdef BUILD_LUA_EXTRAS
extern "C" {
#ifdef LUA_EXTRAS
#include <tolua++.h>
#endif /* LUA_EXTRAS */
}
#endif /* BUILD_LUA_EXTRAS */
#ifdef HAVE_SYS_INOTIFY_H
#include <sys/inotify.h>
@ -129,7 +129,7 @@ void llua_init(void)
lua_pushcfunction(lua_L, &llua_conky_set_update_interval);
lua_setglobal(lua_L, "conky_set_update_interval");
#if defined(BUILD_X11) && defined(LUA_EXTRAS)
#if defined(BUILD_X11) && defined(BUILD_LUA_EXTRAS)
/* register tolua++ user types */
tolua_open(lua_L);
tolua_usertype(lua_L, "Drawable");
@ -455,13 +455,13 @@ void llua_set_draw_post_hook(const char *args)
draw_post_hook = strdup(args);
}
#ifdef LUA_EXTRAS
#ifdef BUILD_LUA_EXTRAS
void llua_set_userdata(const char *key, const char *type, void *value)
{
tolua_pushusertype(lua_L, value, type);
lua_setfield(lua_L, -2, key);
}
#endif /* LUA_EXTRAS */
#endif /* BUILD_LUA_EXTRAS */
void llua_setup_window_table(int text_start_x, int text_start_y, int text_width, int text_height)
{
@ -469,11 +469,11 @@ void llua_setup_window_table(int text_start_x, int text_start_y, int text_width,
lua_newtable(lua_L);
if (output_methods & TO_X) {
#ifdef LUA_EXTRAS
#ifdef BUILD_LUA_EXTRAS
llua_set_userdata("drawable", "Drawable", (void*)&window.drawable);
llua_set_userdata("visual", "Visual", window.visual);
llua_set_userdata("display", "Display", display);
#endif /* LUA_EXTRAS */
#endif /* BUILD_LUA_EXTRAS */
llua_set_number("width", window.width);

View File

@ -38,9 +38,9 @@
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include <X11/Xutil.h>
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
#include "imlib2.h"
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
#ifdef BUILD_XFT
#include <X11/Xft/Xft.h>
@ -567,11 +567,11 @@ 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");
}
#endif
#ifdef IMLIB2
#ifdef BUILD_IMLIB2
{
cimlib_init(display, window.drawable, window.visual, window.colourmap);
}
#endif /* IMLIB2 */
#endif /* BUILD_IMLIB2 */
XFlush(display);
XSelectInput(display, window.window, ExposureMask | PropertyChangeMask