diff --git a/CMakeLists.txt b/CMakeLists.txt index 81548bc..585fb4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ endif() file( GLOB SOURCES - src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c + external/libz/src/*.c src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c ) list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c") @@ -103,7 +103,7 @@ else() file( GLOB IMAGE_SOURCES - external/libz/src/*.c external/libjpeg/src/*.c external/libpng/src/*.c + external/libjpeg/src/*.c external/libpng/src/*.c ) target_sources( Mw @@ -113,7 +113,7 @@ else() target_include_directories( Mw PRIVATE - external/libz/include external/libjpeg/include external/libpng/include + external/libjpeg/include external/libpng/include ) endif() @@ -239,6 +239,12 @@ if(APPLE AND MW_BUILD_OPENGL) ) endif() +target_include_directories( + Mw + PRIVATE + external/libz/include +) + target_include_directories( Mw PUBLIC diff --git a/examples/basic/periodic.c b/examples/basic/periodic.c index 51e1fc5..593e766 100644 --- a/examples/basic/periodic.c +++ b/examples/basic/periodic.c @@ -9,7 +9,7 @@ MwWidget window, menu, box; MwWidget boxes[32]; int n = 0, row = -1; -MwMenu e; +MwMenu e; static void resize(MwWidget handle, void* user, void* call) { int w = MwGetInteger(window, MwNwidth); @@ -140,7 +140,7 @@ static MwWidget child(MwWidget w) { return MwGetVoid(w, "VhandledWidget"); } -static void menu_handler(MwWidget handle, void* user, void* call){ +static void menu_handler(MwWidget handle, void* user, void* call) { if(call == e) MwDestroyWidget(window); } @@ -149,8 +149,8 @@ int main() { MwWidget f, w; MwListBoxPacket* pkt; int index; - MwMenu m, m2; - void* v; + MwMenu m, m2; + void* v; MwLibraryInit(); @@ -187,7 +187,7 @@ int main() { MwMenuAdd(menu, m, "Month"); MwMenuAdd(menu, m, "Year"); - m = MwMenuAdd(menu, NULL, "Options"); + m = MwMenuAdd(menu, NULL, "Options"); m2 = MwMenuAdd(menu, m, "Font"); MwMenuAdd(menu, m2, "Small"); MwMenuAdd(menu, m2, "Medium"); @@ -255,13 +255,13 @@ int main() { add(f); f = frame("ProgressBar", -PaddingContent, 24, MwProgressBarClass, - MwNvalue, 25, - NULL); + MwNvalue, 25, + NULL); add(f); f = frame("ScrollBar", -PaddingContent, 16, MwScrollBarClass, - MwNorientation, MwHORIZONTAL, - NULL); + MwNorientation, MwHORIZONTAL, + NULL); add(f); f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL); diff --git a/include/Mw/TypeDefs.h b/include/Mw/TypeDefs.h index 1f82cb2..779bdec 100644 --- a/include/Mw/TypeDefs.h +++ b/include/Mw/TypeDefs.h @@ -27,7 +27,7 @@ typedef struct _MwListBoxEntry MwListBoxEntry; typedef struct _MwTreeViewEntry MwTreeViewEntry; typedef struct _MwDirectoryEntry MwDirectoryEntry; typedef struct _MwListBoxPacket MwListBoxPacket; -typedef struct _MwBox* MwBox; +typedef struct _MwBox* MwBox; #ifdef _MILSKO typedef struct _MwWidget* MwWidget; #else diff --git a/pl/rules.pl b/pl/rules.pl index 36b7f36..a707f81 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -43,7 +43,7 @@ if (grep(/^wayland$/, @backends)) { scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1"); scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1"); scan_wayland_protocol("unstable", "pointer-constraints", "-unstable-v1"); - scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1"); + scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1"); $gl_libs = "-lGL -lGLU"; } @@ -64,7 +64,8 @@ if (grep(/^cocoa$/, @backends)) { if (param_get("stb-image")) { add_cflags("-DUSE_STB_IMAGE"); -}else{ +} +else { new_object("external/libjpeg/src/*.c"); new_object("external/libpng/src/*.c"); add_incdir("-Iexternal/libjpeg/include -Iexternal/libpng/include"); diff --git a/src/draw.c b/src/draw.c index ae9f701..12ccb51 100644 --- a/src/draw.c +++ b/src/draw.c @@ -117,7 +117,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounde MwRect r = *rect; int roundness = MwGetInteger(handle, MwNroundness); double div; - if(rect->width <= 0 || rect->height <= 0){ + if(rect->width <= 0 || rect->height <= 0) { free(data); return; } diff --git a/src/widget/box.c b/src/widget/box.c index 4d88f73..0cc8df1 100644 --- a/src/widget/box.c +++ b/src/widget/box.c @@ -21,7 +21,7 @@ static int create(MwWidget handle) { return 0; } -static void destroy(MwWidget handle){ +static void destroy(MwWidget handle) { MwBox b = handle->internal; free(b); } @@ -78,7 +78,7 @@ static void layout(MwWidget handle) { static void draw(MwWidget handle) { MwRect r; MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); - MwBox b = handle->internal; + MwBox b = handle->internal; r.x = 0; r.y = 0; @@ -93,7 +93,7 @@ static void draw(MwWidget handle) { MwLLFreeColor(base); - if(b->layout){ + if(b->layout) { layout(handle); b->layout = 0; @@ -101,8 +101,8 @@ static void draw(MwWidget handle) { } static void prop_change(MwWidget handle, const char* key) { - if(strcmp(key, MwNorientation) == 0){ - MwBox b = handle->internal; + if(strcmp(key, MwNorientation) == 0) { + MwBox b = handle->internal; b->layout = 1; MwForceRender(handle); @@ -112,8 +112,8 @@ static void prop_change(MwWidget handle, const char* key) { static void children_prop_change(MwWidget handle, MwWidget child, const char* key) { (void)child; - if(strcmp(key, MwNratio) == 0 || strcmp(key, MwNfixedSize) == 0){ - MwBox b = handle->internal; + if(strcmp(key, MwNratio) == 0 || strcmp(key, MwNfixedSize) == 0) { + MwBox b = handle->internal; b->layout = 1; MwForceRender(handle); @@ -121,14 +121,14 @@ static void children_prop_change(MwWidget handle, MwWidget child, const char* ke } static void resize(MwWidget handle) { - MwBox b = handle->internal; + MwBox b = handle->internal; b->layout = 1; MwForceRender(handle); } static void children_update(MwWidget handle) { - MwBox b = handle->internal; + MwBox b = handle->internal; b->layout = 1; MwForceRender(handle); diff --git a/tools/genmk.pl b/tools/genmk.pl index 1cd0a9e..f451403 100755 --- a/tools/genmk.pl +++ b/tools/genmk.pl @@ -93,7 +93,7 @@ sub generate { print(OUT "LD = $link\n"); print(OUT "\n"); print(OUT -"CFLAGS = ${inc}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n" +"CFLAGS = ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n" ); print(OUT "LDFLAGS = $dll"); print(OUT "\n"); @@ -143,6 +143,7 @@ sub generate { scan("src"); scan("external"); +scan("external/libz/src"); scan("src/icon"); scan("src/cursor"); scan("src/widget");