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

More build fixes, warning fixes.

This commit is contained in:
Brenden Matthews 2018-12-22 15:37:53 -05:00
parent e2b2e33f33
commit dfd10667fd
No known key found for this signature in database
GPG Key ID: 60FBD122E62B0D30
3 changed files with 20 additions and 9 deletions

View File

@ -50,6 +50,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND
VERBATIM )
SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES(${${VAR}} PROPERTIES COMPILE_FLAGS "-Wno-bad-function-cast -Wno-unused-parameter -Wno-cast-qual")
SET(${VAR} ${${VAR}} PARENT_SCOPE)

View File

@ -24,8 +24,14 @@ include(ToLua)
add_definitions(-DTOLUA_RELEASE)
if(BUILD_X11)
if(BUILD_LUA_CAIRO)
include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR})
# Need the directory for -lSM
get_filename_component(X11_SM_LIB_PATH ${X11_SM_LIB} DIRECTORY)
link_directories(${X11_SM_LIB_PATH})
# cairo_set_dash() needs this special hack to work properly
# if you have a better solution, please let me know
wrap_tolua(luacairo_src cairo.pkg libcairo.patch)

View File

@ -31,19 +31,23 @@
void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
double scale_x, double scale_y, double *return_scale_w,
double *return_scale_h) {
int w, h;
double scaled_w, scaled_h;
Imlib_Image premul;
cairo_surface_t *result;
cairo_t *cr;
Imlib_Image *image = imlib_load_image(file);
if (!image) {
return;
}
if (!image) { return; }
imlib_context_set_image(image);
int w = imlib_image_get_width(), h = imlib_image_get_height();
w = imlib_image_get_width();
h = imlib_image_get_height();
double scaled_w = *return_scale_w = scale_x * (double)w,
scaled_h = *return_scale_h = scale_y * (double)h;
scaled_w = *return_scale_w = scale_x * (double)w;
scaled_h = *return_scale_h = scale_y * (double)h;
/* create temporary image */
Imlib_Image premul = imlib_create_image(scaled_w, scaled_h);
premul = imlib_create_image(scaled_w, scaled_h);
/* FIXME: add error handling */
/* fill with opaque black */
@ -59,11 +63,11 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
imlib_image_copy_alpha_to_image(image, 0, 0);
/* now pass the result to cairo */
cairo_surface_t *result = cairo_image_surface_create_for_data(
result = cairo_image_surface_create_for_data(
(void *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,
scaled_w, scaled_h, sizeof(DATA32) * scaled_w);
cairo_t *cr = cairo_create(cs);
cr = cairo_create(cs);
cairo_set_source_surface(cr, result, x, y);
cairo_paint(cr);