1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-26 16:48:28 +00:00

Fix "wrong type of arguments for cairo_set_dash", sf.net #3014648

I am not particularly proud of this solution. If you have a better one, feel free to implement
it.
This commit is contained in:
Pavel Labath 2010-06-13 18:47:07 +02:00
parent 2232641b8e
commit c80deb2d69
4 changed files with 44 additions and 18 deletions

View File

@ -20,26 +20,34 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
function(wrap_tolua VAR)
if(NOT ARGN)
message(SEND_ERROR "Error: wrap_tolua called without any files")
return()
endif(NOT ARGN)
function(wrap_tolua VAR FIL)
SET(INCL)
SET(${VAR})
FOREACH(FIL ${ARGN})
GET_FILENAME_COMPONENT(ABS_FIL ${FIL} ABSOLUTE)
GET_FILENAME_COMPONENT(FIL_WE ${FIL} NAME_WE)
LIST(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c")
ADD_CUSTOM_COMMAND( OUTPUT ${${VAR}} ${INCL} COMMAND ${APP_TOLUA} -n
${FIL_WE} -o ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c ${ABS_FIL} DEPENDS
${ABS_FIL} COMMENT "Running tolua++ on ${FIL}"
VERBATIM )
GET_FILENAME_COMPONENT(ABS_FIL ${FIL} ABSOLUTE)
GET_FILENAME_COMPONENT(FIL_WE ${FIL} NAME_WE)
LIST(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c")
if(DEFINED ARGV2)
GET_FILENAME_COMPONENT(PATCH ${ARGV2} ABSOLUTE)
SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.c)
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c
COMMAND patch -s ${TOLUA_OUT} ${PATCH} -o ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c
DEPENDS ${TOLUA_OUT} ${PATCH}
COMMENT "Patching lib${FIL_WE}-orig.c"
VERBATIM)
SET_SOURCE_FILES_PROPERTIES(${TOLUA_OUT} PROPERTIES GENERATED TRUE)
else()
SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c)
endif(DEFINED ARGV2)
ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND ${APP_TOLUA} -n
${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} DEPENDS
${ABS_FIL} COMMENT "Running tolua++ on ${FIL}"
VERBATIM )
SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)
ENDFOREACH(FIL)
SET(${VAR} ${${VAR}} PARENT_SCOPE)

View File

@ -30,7 +30,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "-ggdb")
if(BUILD_LUA_CAIRO)
include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR})
wrap_tolua(luacairo_src cairo.pkg)
# 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)
add_library(cairo SHARED ${luacairo_src})

View File

@ -240,7 +240,7 @@ typedef enum _cairo_line_join {
void cairo_set_line_join(cairo_t * cr, cairo_line_join_t line_join);
void cairo_set_dash(cairo_t * cr, const double *dashes, int num_dashes, double offset);
void cairo_set_dash(cairo_t * cr, const double dashes[num_dashes], int num_dashes, double offset);
void cairo_set_miter_limit(cairo_t * cr, double limit);

16
lua/libcairo.patch Normal file
View File

@ -0,0 +1,16 @@
--- lua/libcairo.c~ 2010-06-11 23:14:43.000000000 +0200
+++ lua/libcairo.c 2010-06-12 10:47:51.000000000 +0200
@@ -1452,12 +1452,12 @@
#endif
{
struct _cairo* cr = (( struct _cairo*) tolua_tousertype(tolua_S,1,0));
+ int num_dashes = ((int) tolua_tonumber(tolua_S,3,0));
#ifdef __cplusplus
double* dashes = Mtolua_new_dim(double, num_dashes);
#else
double* dashes = (double*) malloc((num_dashes)*sizeof(double));
#endif
- int num_dashes = ((int) tolua_tonumber(tolua_S,3,0));
double offset = ((double) tolua_tonumber(tolua_S,4,0));
{
#ifndef TOLUA_RELEASE