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 <[email protected]>
  • Loading branch information
Caellian committed May 4, 2024
1 parent 063b50f commit 4828216
Show file tree
Hide file tree
Showing 8 changed files with 359 additions and 305 deletions.
3 changes: 1 addition & 2 deletions lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ if(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)
target_link_libraries(conky-cairo_imlib2_helper
${luacairo_libs}
${luaimlib2_libs}
toluapp_lib_static
conky_logging)
toluapp_lib_static)
set(lua_libs ${lua_libs} conky-cairo_imlib2_helper)
endif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)

Expand Down
23 changes: 16 additions & 7 deletions lua/libcairo_imlib2_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@
#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, "conky: "); \
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 +93,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 +111,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 4828216

Please sign in to comment.