Added style as resource, deps issue on ubuntu/debian

This commit is contained in:
2024-03-25 14:37:05 +01:00
parent cd1f26c3b6
commit eb2917cb41
3 changed files with 13 additions and 2 deletions

7
main.c
View File

@@ -225,6 +225,9 @@ 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 )
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 */
@@ -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 */

3
ressources/kyou.css Normal file
View File

@@ -0,0 +1,3 @@
window {
background: transparent;
}

View File

@@ -1,6 +1,7 @@
<gresources>
<gresource prefix="/dev/chenco/tiny-kyoukai">
<file>kyoukai_peek.png</file>
<file>kyou.css</file>
<file alias="icons/48x48/apps/tiny-kyoukai.png">hicolor/48x48/apps/tiny-kyoukai.png</file>
</gresource>
</gresources>