mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
An attempt at making lua bindings work
This commit is contained in:
parent
bdda06f4ea
commit
47509b38bd
@ -85,7 +85,13 @@
|
|||||||
|
|
||||||
#cmakedefine HAVE_ICONV 1
|
#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
|
#cmakedefine BUILD_IBM 1
|
||||||
|
|
||||||
|
20
src/conky.cc
20
src/conky.cc
@ -54,9 +54,9 @@
|
|||||||
#ifdef BUILD_XDAMAGE
|
#ifdef BUILD_XDAMAGE
|
||||||
#include <X11/extensions/Xdamage.h>
|
#include <X11/extensions/Xdamage.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
#include "imlib2.h"
|
#include "imlib2.h"
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -1755,9 +1755,9 @@ static void draw_text(void)
|
|||||||
|
|
||||||
static void draw_stuff(void)
|
static void draw_stuff(void)
|
||||||
{
|
{
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
cimlib_render(text_start_x, text_start_y, window.width, window.height);
|
cimlib_render(text_start_x, text_start_y, window.width, window.height);
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
if (overwrite_file) {
|
if (overwrite_file) {
|
||||||
overwrite_fpointer = fopen(overwrite_file, "w");
|
overwrite_fpointer = fopen(overwrite_file, "w");
|
||||||
if(!overwrite_fpointer)
|
if(!overwrite_fpointer)
|
||||||
@ -1845,9 +1845,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
|
#ifdef BUILD_IMLIB2
|
||||||
cimlib_cleanup();
|
cimlib_cleanup();
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
generate_text();
|
generate_text();
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
if (output_methods & TO_X)
|
if (output_methods & TO_X)
|
||||||
@ -2460,10 +2460,10 @@ void clean_up(void *memtofree1, void* memtofree2)
|
|||||||
llua_shutdown_hook();
|
llua_shutdown_hook();
|
||||||
llua_close();
|
llua_close();
|
||||||
#endif /* BUILD_LUA */
|
#endif /* BUILD_LUA */
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
if (output_methods & TO_X)
|
if (output_methods & TO_X)
|
||||||
cimlib_deinit();
|
cimlib_deinit();
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
#ifdef BUILD_WEATHER_XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
xmlCleanupParser();
|
xmlCleanupParser();
|
||||||
#endif /* BUILD_WEATHER_XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
@ -3458,7 +3458,7 @@ char load_config_file(const char *f)
|
|||||||
stippled_borders = 4;
|
stippled_borders = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
CONF("imlib_cache_size") {
|
CONF("imlib_cache_size") {
|
||||||
if (value) {
|
if (value) {
|
||||||
cimlib_set_cache_size(atoi(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));
|
cimlib_set_cache_flush_interval(atoi(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
CONF("update_interval_on_battery") {
|
CONF("update_interval_on_battery") {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
14
src/llua.cc
14
src/llua.cc
@ -28,11 +28,11 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
|
||||||
|
#ifdef BUILD_LUA_EXTRAS
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef LUA_EXTRAS
|
|
||||||
#include <tolua++.h>
|
#include <tolua++.h>
|
||||||
#endif /* LUA_EXTRAS */
|
|
||||||
}
|
}
|
||||||
|
#endif /* BUILD_LUA_EXTRAS */
|
||||||
|
|
||||||
#ifdef HAVE_SYS_INOTIFY_H
|
#ifdef HAVE_SYS_INOTIFY_H
|
||||||
#include <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_pushcfunction(lua_L, &llua_conky_set_update_interval);
|
||||||
lua_setglobal(lua_L, "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 */
|
/* register tolua++ user types */
|
||||||
tolua_open(lua_L);
|
tolua_open(lua_L);
|
||||||
tolua_usertype(lua_L, "Drawable");
|
tolua_usertype(lua_L, "Drawable");
|
||||||
@ -455,13 +455,13 @@ void llua_set_draw_post_hook(const char *args)
|
|||||||
draw_post_hook = strdup(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)
|
void llua_set_userdata(const char *key, const char *type, void *value)
|
||||||
{
|
{
|
||||||
tolua_pushusertype(lua_L, value, type);
|
tolua_pushusertype(lua_L, value, type);
|
||||||
lua_setfield(lua_L, -2, key);
|
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)
|
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);
|
lua_newtable(lua_L);
|
||||||
|
|
||||||
if (output_methods & TO_X) {
|
if (output_methods & TO_X) {
|
||||||
#ifdef LUA_EXTRAS
|
#ifdef BUILD_LUA_EXTRAS
|
||||||
llua_set_userdata("drawable", "Drawable", (void*)&window.drawable);
|
llua_set_userdata("drawable", "Drawable", (void*)&window.drawable);
|
||||||
llua_set_userdata("visual", "Visual", window.visual);
|
llua_set_userdata("visual", "Visual", window.visual);
|
||||||
llua_set_userdata("display", "Display", display);
|
llua_set_userdata("display", "Display", display);
|
||||||
#endif /* LUA_EXTRAS */
|
#endif /* BUILD_LUA_EXTRAS */
|
||||||
|
|
||||||
|
|
||||||
llua_set_number("width", window.width);
|
llua_set_number("width", window.width);
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
#include "imlib2.h"
|
#include "imlib2.h"
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
|
|
||||||
#ifdef BUILD_XFT
|
#ifdef BUILD_XFT
|
||||||
#include <X11/Xft/Xft.h>
|
#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");
|
fprintf(stderr, PACKAGE_NAME": drawing to single buffer\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
{
|
{
|
||||||
cimlib_init(display, window.drawable, window.visual, window.colourmap);
|
cimlib_init(display, window.drawable, window.visual, window.colourmap);
|
||||||
}
|
}
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
XFlush(display);
|
XFlush(display);
|
||||||
|
|
||||||
XSelectInput(display, window.window, ExposureMask | PropertyChangeMask
|
XSelectInput(display, window.window, ExposureMask | PropertyChangeMask
|
||||||
|
Loading…
Reference in New Issue
Block a user