From eb2917cb4180241be58f449591c3c886c8dd4883 Mon Sep 17 00:00:00 2001 From: HerrCraziDev Date: Mon, 25 Mar 2024 14:37:05 +0100 Subject: [PATCH] Added style as resource, deps issue on ubuntu/debian --- main.c | 11 +++++++++-- ressources/kyou.css | 3 +++ ressources/tiny-kyoukai.gresource.xml | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 ressources/kyou.css diff --git a/main.c b/main.c index 55e2591..4d15c19 100644 --- a/main.c +++ b/main.c @@ -225,7 +225,10 @@ 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); - gtk_picture_set_content_fit(GTK_PICTURE(kyou), GTK_CONTENT_FIT_CONTAIN); + if ( gtk_get_major_version() != 4 && gtk_get_minor_version() <= 8 ) + gtk_picture_set_keep_aspect_ratio( GTK_PICTURE(kyou), true ); + else + gtk_picture_set_content_fit(GTK_PICTURE(kyou), GTK_CONTENT_FIT_CONTAIN); /* Setup event listeners */ ev_key = gtk_event_controller_key_new(); @@ -249,7 +252,11 @@ static void activate(GtkApplication *app, gpointer user_data) { /* Make window background transparent */ GtkCssProvider *provider = gtk_css_provider_new(); +#ifndef KYOU_PORTABLE gtk_css_provider_load_from_string(provider, "window {background: transparent;}"); +#else + gtk_css_provider_load_from_resource(provider, KYOU_RESOURCES "/kyou.css"); +#endif gtk_style_context_add_provider_for_display(gdk_display_get_default(),GTK_STYLE_PROVIDER(provider),GTK_STYLE_PROVIDER_PRIORITY_USER); /* Hide window frame and title bar */ @@ -297,4 +304,4 @@ int main(int argc, char **argv) { "\n\tLet blood boil over!\n" ); return status; -} \ No newline at end of file +} diff --git a/ressources/kyou.css b/ressources/kyou.css new file mode 100644 index 0000000..57fcd94 --- /dev/null +++ b/ressources/kyou.css @@ -0,0 +1,3 @@ +window { + background: transparent; +} \ No newline at end of file diff --git a/ressources/tiny-kyoukai.gresource.xml b/ressources/tiny-kyoukai.gresource.xml index 81894bc..8e2bf8a 100644 --- a/ressources/tiny-kyoukai.gresource.xml +++ b/ressources/tiny-kyoukai.gresource.xml @@ -1,6 +1,7 @@ kyoukai_peek.png + kyou.css hicolor/48x48/apps/tiny-kyoukai.png \ No newline at end of file