From f809f1c36e16add4434169f9c3bb8e7e8a8f87ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Leroy-Ferrec?= Date: Mon, 25 Mar 2024 16:55:40 +0100 Subject: [PATCH] fix build on Ubuntu --- Makefile | 10 +++++----- main.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index bf84c92..0972e59 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,12 @@ LIBS = x11 gtk4 gtk4-x11 STATIC_LIBS = INCLUDES = -I$(HEADER_DIR) ifdef LIBS -LDLIBS = $(shell pkg-config -libs $(LIBS)) -INCLUDES += $(shell pkg-config -cflags $(LIBS)) +LDLIBS = $(shell pkg-config --libs $(LIBS)) +INCLUDES += $(shell pkg-config --cflags $(LIBS)) endif ifdef STATIC_LIBS -LDLIBS += -Wl,-Bstatic $(shell pkg-config -libs $(STATIC_LIBS)) -Wl,-Bdynamic -INCLUDES += $(shell pkg-config -cflags $(STATIC_LIBS)) +LDLIBS += -Wl,-Bstatic $(shell pkg-config --libs $(STATIC_LIBS)) -Wl,-Bdynamic +INCLUDES += $(shell pkg-config --cflags $(STATIC_LIBS)) endif SRC = $(shell find $(SOURCE_DIR)/ -type f -name '*.c') main.c @@ -157,7 +157,7 @@ clean: # @rm -rif $(BUILD_DIR)/*.o $(BUILD_DIR)/*.gch clear: clean - @rm $(PROJECT_NAME) $(RES_INC) + @rm -if $(PROJECT_NAME) $(RES_INC) .PHONY: always init SUSSYBAKA test test-res clear clean run pregen-res \ No newline at end of file diff --git a/main.c b/main.c index 4d15c19..444f8e0 100644 --- a/main.c +++ b/main.c @@ -41,6 +41,12 @@ #include "tiny-kyoukai.gresource.h" #endif +#if glib_minor_version < 74 + #define APP_FLAGS G_APPLICATION_FLAGS_NONE +#else + #define APP_FLAGS G_APPLICATION_DEFAULT_FLAGS +#endif + /* Files and resources */ #define KYOU_ICON_PATH "ressources/" #define KYOU_ICON_NAME TINYKYOU_NAME @@ -225,10 +231,11 @@ static void activate(GtkApplication *app, gpointer user_data) { kyou = gtk_picture_new_for_resource( KYOU_IMAGE_RESOURCE ); #endif gtk_picture_set_can_shrink(GTK_PICTURE(kyou), FALSE); - if ( gtk_get_major_version() != 4 && gtk_get_minor_version() <= 8 ) +#if ( gtk_minor_version < 8 ) gtk_picture_set_keep_aspect_ratio( GTK_PICTURE(kyou), true ); - else +#else gtk_picture_set_content_fit(GTK_PICTURE(kyou), GTK_CONTENT_FIT_CONTAIN); +#endif /* Setup event listeners */ ev_key = gtk_event_controller_key_new(); @@ -293,7 +300,7 @@ int main(int argc, char **argv) { "-----------------------\n" ); printf( "~\e[31m羌瘣小ささ\e[0m!~\n" ); - app = gtk_application_new("dev.chenco.tiny-kyoukai",G_APPLICATION_DEFAULT_FLAGS); + app = gtk_application_new("dev.chenco.tiny-kyoukai", APP_FLAGS); g_signal_connect(app, "activate", G_CALLBACK(activate), &options); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app);