Skip to content

Commit

Permalink
Remove logger from libcairo_imlib2_helper
Browse files Browse the repository at this point in the history
Separate logger from logging header.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
  • Loading branch information
Caellian committed May 4, 2024
1 parent 063b50f commit eeccc71
Show file tree
Hide file tree
Showing 8 changed files with 363 additions and 309 deletions.
13 changes: 7 additions & 6 deletions lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if(BUILD_LUA_IMLIB2)
add_library(conky-imlib2 MODULE ${luaimlib2_src})
set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME "imlib2")

target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static)
target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static )
set(lua_libs ${lua_libs} conky-imlib2)

print_target_properties(conky-imlib2)
Expand All @@ -83,15 +83,16 @@ if(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)
${CMAKE_CURRENT_SOURCE_DIR})
wrap_tolua(luacairo_imlib2_helper_src cairo_imlib2_helper.pkg)

set(imlib_helper_libs ${luacairo_libs} ${luaimlib2_libs} toluapp_lib_static)
if(BUILD_I18N)
set(imlib_helper_libs ${imlib_helper_libs} -lintl)
endif()

add_library(conky-cairo_imlib2_helper MODULE ${luacairo_imlib2_helper_src})
set_target_properties(conky-cairo_imlib2_helper
PROPERTIES OUTPUT_NAME "cairo_imlib2_helper")

target_link_libraries(conky-cairo_imlib2_helper
${luacairo_libs}
${luaimlib2_libs}
toluapp_lib_static
conky_logging)
target_link_libraries(conky-cairo_imlib2_helper ${imlib_helper_libs})
set(lua_libs ${lua_libs} conky-cairo_imlib2_helper)
endif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)

Expand Down
22 changes: 15 additions & 7 deletions lua/libcairo_imlib2_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@
#include <Imlib2.h>
#include <cairo.h>

#include "logging.h"
#include "config.h"

void cairo_place_image(const char *file, cairo_t *cr, int x, int y,
int width, int height, double alpha) {
#ifdef BUILD_I18N
#include <libintl.h>
#else
#define gettext
#endif

#define NORM_ERR(Format, ...) \
fprintf(stderr, gettext(Format), ##__VA_ARGS__);

void cairo_place_image(const char *file, cairo_t *cr, int x, int y, int width,
int height, double alpha) {
int w, h, stride;
Imlib_Image alpha_image, image, premul;
cairo_surface_t *result;
Expand Down Expand Up @@ -83,12 +92,12 @@ void cairo_place_image(const char *file, cairo_t *cr, int x, int y,
/* and use the alpha channel of the source image */
imlib_image_copy_alpha_to_image(alpha_image, 0, 0);

stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width);
stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);

/* now pass the result to cairo */
result = cairo_image_surface_create_for_data(
(unsigned char *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,
width, height, stride);
(unsigned char *)imlib_image_get_data_for_reading_only(),
CAIRO_FORMAT_ARGB32, width, height, stride);

cairo_set_source_surface(cr, result, x, y);
cairo_paint_with_alpha(cr, alpha);
Expand All @@ -101,7 +110,6 @@ void cairo_place_image(const char *file, cairo_t *cr, int x, int y,
imlib_free_image();

cairo_surface_destroy(result);

}

void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ execute_process(
COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E
)


add_library(conky_logging logging.cc logging.h)
set(conky_libs ${conky_libs} conky_logging)

set(conky_sources
${conky_sources}
c++wrap.cc
Expand Down
1 change: 0 additions & 1 deletion src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,6 @@ void clean_up(void) {

conky::cleanup_config_settings(*state);
state.reset();
conky::log::terminate_logging();
}

void handle_terminate() {
Expand Down
Loading

0 comments on commit eeccc71

Please sign in to comment.