ui/gtk/toolkit.c

changeset 42
9af327d0e0e4
parent 39
ef4e2f560fa5
child 44
473954dc6b74
--- a/ui/gtk/toolkit.c	Fri Jun 14 18:24:31 2024 +0200
+++ b/ui/gtk/toolkit.c	Sun Jun 16 11:36:27 2024 +0200
@@ -304,6 +304,8 @@
 
 void ui_css_init(void) {
     ui_gtk_css_provider = gtk_css_provider_new();
+    
+#ifdef UI_GTK3
     gtk_css_provider_load_from_data(ui_gtk_css_provider, ui_gtk_css, -1, NULL);
     
     GdkScreen *screen = gdk_screen_get_default();
@@ -311,6 +313,21 @@
             screen,
             GTK_STYLE_PROVIDER(ui_gtk_css_provider),
             GTK_STYLE_PROVIDER_PRIORITY_USER);
+#endif /* UI_GTK3 */
+    
+#ifdef UI_GTK4
+    
+    
+#if GTK_MINOR_VERSION < 12
+    gtk_css_provider_load_from_data(ui_gtk_css_provider, ui_gtk_css, -1);
+#else
+    gtk_css_provider_load_from_string(ui_gtk_css_provider, ui_gtk_css);
+#endif /* GTK_MINOR_VERSION < 12 */
+    
+    GdkDisplay *display = gdk_display_get_default();
+    gtk_style_context_add_provider_for_display(display, GTK_STYLE_PROVIDER(ui_gtk_css_provider), GTK_STYLE_PROVIDER_PRIORITY_USER);
+    
+#endif /* UI_GTK4 */
 }
 
 

mercurial