From 278f016684645eea1f427d1261e54a8647ab0467 Mon Sep 17 00:00:00 2001 From: DepressedTWM Date: Mon, 25 May 2026 10:34:04 +0400 Subject: [PATCH] BSD build support --- CMakeLists.txt | 11 ++++++++++- src/bitmap.cpp | 9 +++------ src/bitmap.h | 30 +++++++++--------------------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf08778..519be8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,15 @@ elseif(LINUX) list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS}) list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c) list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h) +elseif(BSD) + find_package(PkgConfig REQUIRED) + pkg_check_modules(LINUXPKGS REQUIRED gtk+-3.0 libxfconf-0) + include_directories(${LINUXPKGS_INCLUDE_DIRS}) + add_compile_options(${LINUXPKGS_CFLAGS_OTHER}) + list(APPEND PLATFORM_LIBRARIES ${LINUXPKGS_LDFLAGS}) + list(APPEND MAIN_SOURCE src/xdg-user-dir-lookup.c) + list(APPEND MAIN_HEADERS src/xdg-user-dir-lookup.h) + set(STEAM OFF) endif() if (STEAM) @@ -283,7 +292,7 @@ set(BINDING_SOURCE binding-mri/module_rpg.cpp binding-mri/filesystem-binding.cpp binding-mri/oneshot-binding.cpp - binding-mri/sunshine-binding.cpp + binding-mri/sunshine-binding.cpp binding-mri/steam-binding.cpp binding-mri/wallpaper-binding.cpp binding-mri/journal-binding.cpp diff --git a/src/bitmap.cpp b/src/bitmap.cpp index a43317a..e553f64 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -125,8 +125,7 @@ struct BitmapPrivate{ void addTaintedArea(const IntRect &rect){ IntRect norm = normalizedRect(rect); - pixman_region_union_rect - (&tainted, &tainted, norm.x, norm.y, norm.w, norm.h); + pixman_region_union_rect(&tainted, &tainted, norm.x, norm.y, norm.w, norm.h); } void substractTaintedArea(const IntRect &rect){ @@ -148,8 +147,7 @@ struct BitmapPrivate{ box.x2 = rect.x + rect.w; box.y2 = rect.y + rect.h; - pixman_region_overlap_t result = - pixman_region_contains_rectangle(&tainted, &box); + pixman_region_overlap_t result = pixman_region_contains_rectangle(&tainted, &box); return result != PIXMAN_REGION_OUT; } @@ -1103,8 +1101,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align){ /* http://www.lemoda.net/c/utf8-to-ucs2/index.html */ static uint16_t utf8_to_ucs2(const char *_input, const char **end_ptr){ - const unsigned char *input = - reinterpret_cast(_input); + const unsigned char *input = reinterpret_cast(_input); *end_ptr = _input; if (input[0] == 0) diff --git a/src/bitmap.h b/src/bitmap.h index fef102e..9881b43 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -48,26 +48,17 @@ public: int height() const; IntRect rect() const; - void blt(int x, int y, - const Bitmap &source, IntRect rect, - int opacity = 255); + void blt(int x, int y, const Bitmap &source, IntRect rect, int opacity = 255); - void stretchBlt(const IntRect &destRect, - const Bitmap &source, const IntRect &sourceRect, - int opacity = 255); + void stretchBlt(const IntRect &destRect, const Bitmap &source, const IntRect &sourceRect, int opacity = 255); + + void fillRect(int x, int y, int width, int height, const Vec4 &color); - void fillRect(int x, int y, - int width, int height, - const Vec4 &color); void fillRect(const IntRect &rect, const Vec4 &color); - void gradientFillRect(int x, int y, - int width, int height, - const Vec4 &color1, const Vec4 &color2, - bool vertical = false); - void gradientFillRect(const IntRect &rect, - const Vec4 &color1, const Vec4 &color2, - bool vertical = false); + void gradientFillRect(int x, int y, int width, int height, const Vec4 &color1, const Vec4 &color2, bool vertical = false); + + void gradientFillRect(const IntRect &rect, const Vec4 &color1, const Vec4 &color2, bool vertical = false); void clearRect(int x, int y, int width, int height); @@ -89,12 +80,9 @@ public: Right = 2 }; - void drawText(int x, int y, - int width, int height, - const char *str, int align = Left); + void drawText(int x, int y, int width, int height, const char *str, int align = Left); - void drawText(const IntRect &rect, - const char *str, int align = Left); + void drawText(const IntRect &rect, const char *str, int align = Left); IntRect textSize(const char *str);