File: Allow-background-color-and-color-on-VteTerminal-widgets-t.patch

package info (click to toggle)
vte2.91 0.82.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,936 kB
  • sloc: cpp: 96,499; ansic: 8,990; python: 3,073; sh: 996; perl: 100; makefile: 87; xml: 27; javascript: 4
file content (74 lines) | stat: -rw-r--r-- 3,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From: Iain Lane <laney@debian.org>
Date: Fri, 6 Nov 2020 13:33:13 +0000
Subject: Allow background-color and color on VteTerminal widgets to be
 customised via the theme

Yaru and Ambiance/Radiance need this. Add fallback style class and
move the CSS rules to it so that they can be overridden.

Forwarded: not-needed
Last-Update: 2021-11-08
---
 src/vtegtk.cc | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 7302336..39aaa67 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -134,6 +134,7 @@ sanitise_widget_size_request(int* minimum,
 }
 
 struct _VteTerminalClassPrivate {
+        GtkStyleProvider *fallback_style_provider;
         GtkStyleProvider *style_provider;
 };
 
@@ -960,6 +961,9 @@ try
 	GtkStyleContext *context;
 
         context = gtk_widget_get_style_context(&terminal->widget);
+        gtk_style_context_add_provider (context,
+                                        VTE_TERMINAL_GET_CLASS (terminal)->priv->fallback_style_provider,
+                                        GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
         gtk_style_context_add_provider (context,
                                         VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider,
                                         VTE_TERMINAL_CSS_PRIORITY);
@@ -2787,6 +2791,24 @@ vte_terminal_class_init(VteTerminalClass *klass)
 
         klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, VTE_TYPE_TERMINAL, VteTerminalClassPrivate);
 
+        klass->priv->fallback_style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
+        /* Some themes don't define text_view_bg */
+        gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->fallback_style_provider),
+                                         "@define-color text_view_bg @theme_base_color;\n"
+                                         "VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n"
+#if (VTE_GTK == 4) || ((VTE_GTK == 3) && GTK_CHECK_VERSION (3, 24, 22))
+                                         "background-color: @text_view_bg;\n"
+#else
+                                         "background-color: @theme_base_color;\n"
+#endif
+                                         "color: @theme_text_color;\n"
+                                         "}\n",
+                                         -1
+#if VTE_GTK == 3
+                                         , NULL
+#endif
+                                         );
+
         klass->priv->style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
 #if VTE_GTK == 3
         auto err = vte::glib::Error{};
@@ -2797,12 +2819,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
         gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider),
                                          "VteTerminal, " VTE_TERMINAL_CSS_NAME " {\n"
                                          "padding: 1px 1px 1px 1px;\n"
-#if (VTE_GTK == 4) || ((VTE_GTK == 3) && GTK_CHECK_VERSION (3, 24, 22))
-                                         "background-color: @text_view_bg;\n"
-#else
-                                         "background-color: @theme_base_color;\n"
-#endif
-                                         "color: @theme_text_color;\n"
                                          "}\n",
                                          -1
 #if VTE_GTK == 3