fix build on Ubuntu

This commit is contained in:
Gwenolé Leroy-Ferrec
2024-03-25 16:55:40 +01:00
parent eb2917cb41
commit f809f1c36e
2 changed files with 15 additions and 8 deletions

View File

@@ -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

13
main.c
View File

@@ -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);