Package: gucharmap
Version: 1:17.0.2-2
Severity: minor
Control: tags -1 + patch

Dear Maintainer,

The "annotations and cross-reference" section of the "details" page for
a given character can contain links which, depending on the active
theme, are unreadable or difficult to read because gucharmap hardcodes
the text colour as "blue" (#0000ff).

Hardcoding a foreground colour but not the corresponding background
colour (or viceversa) is braindamaged.

Should use the theme's link colour instead.

Attached is a patch.

Also attached is a patch I needed in order to build with muon.  I'm not
sure if the problem is in gucharmap's meson.build, in meson, or in muon.
I'm also not sure if I fixed it the proper way; but it worked.

Also attached is a patch that fixes a GCC warning is the same function.

-- System Information:
Debian Release: forky/sid
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'unstable'), (500, 'testing'), 
(500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.105+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gucharmap depends on:
ii  dconf-gsettings-backend [gsettings-backend]  0.49.0-4+b1
ii  libatk1.0-0t64                               2.61.1-1
ii  libc6                                        2.43-4
ii  libcairo2                                    1.18.4-3+b1
ii  libglib2.0-0t64                              2.89.3-5
ii  libgtk-3-0t64                                3.24.52-1
ii  libgucharmap-2-90-7                          1:17.0.2-2
ii  libpango-1.0-0                               1.58.0-1
ii  libpangocairo-1.0-0                          1.58.0-1

Versions of packages gucharmap recommends:
ii  yelp  49.1-3

gucharmap suggests no packages.

-- no debconf information
Add explicit dependency on "gucharmap-menus.ui"

This fixes building with muon.  Without it, glib-compile-resources fails
because it cannot find the source file "gucharmap-menus.ui" when
processing "gucharmap.gresource.xml".

---
 gucharmap/meson.build |    1 +
 1 file changed, 1 insertion(+)

Index: b/gucharmap/meson.build
===================================================================
--- a/gucharmap/meson.build
+++ b/gucharmap/meson.build
@@ -259,6 +259,7 @@ gucharmap_gtk3_sources += gnome.compile_
   'gucharmap-resources',
   'gucharmap.gresource.xml',
   c_name: 'gucharmap',
+  dependencies: files('gucharmap-menus.ui'),
 )
 
 gucharmap_gtk3_cppflags = disable_deprecated_cppflags + [
Avoid warning due to truncation of NUL terminator

The LHS is a string constant, it already has an implicit NUL terminator.

---
 gucharmap/gucharmap-charmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/gucharmap/gucharmap-charmap.c
===================================================================
--- a/gucharmap/gucharmap-charmap.c
+++ b/gucharmap/gucharmap-charmap.c
@@ -552,7 +552,7 @@ insert_codepoint (GucharmapCharmap *char
   char buf[7];
   GUnicodeType t;
   gboolean is_graph, is_Mn;
-  char nbsp[3] = "\302\240\0"; /* U+00A0 NO-BREAK SPACE */
+  char nbsp[3] = "\302\240"; /* U+00A0 NO-BREAK SPACE */
 
   t = g_unichar_type (uc);
   is_Mn = t == G_UNICODE_NON_SPACING_MARK /* Mn */;
Don't hardcode link colour in the details page

Hardcoding a foreground colour but not the corresponding background
colour (or viceversa) is braindamaged and leads to unreadable text
depending on the active theme.

Use the theme's link colour instead.

---
 gucharmap/gucharmap-charmap.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: b/gucharmap/gucharmap-charmap.c
===================================================================
--- a/gucharmap/gucharmap-charmap.c
+++ b/gucharmap/gucharmap-charmap.c
@@ -547,12 +547,18 @@ insert_codepoint (GucharmapCharmap *char
                   GtkTextIter *iter,
                   gunichar uc)
 {
-  gchar *str;
+  GucharmapCharmapPrivate *priv = charmap->priv;
   GtkTextTag *tag;
+  GtkStyleContext *stylectx;
+  gchar *str;
   char buf[7];
   GUnicodeType t;
   gboolean is_graph, is_Mn;
   char nbsp[3] = "\302\240"; /* U+00A0 NO-BREAK SPACE */
+  GdkRGBA link_colour = {0, 0, 1, 1}; /* "blue" */
+
+  stylectx = gtk_widget_get_style_context (GTK_WIDGET (priv->details_view));
+  gtk_style_context_get_color (stylectx, GTK_STATE_FLAG_LINK, &link_colour);
 
   t = g_unichar_type (uc);
   is_Mn = t == G_UNICODE_NON_SPACING_MARK /* Mn */;
@@ -569,9 +575,10 @@ insert_codepoint (GucharmapCharmap *char
                          gucharmap_get_unicode_name (uc));
 
   tag = gtk_text_buffer_create_tag (buffer, NULL,
-                                    "foreground", "blue",
                                     "underline", PANGO_UNDERLINE_SINGLE,
                                     NULL);
+  g_object_set (tag, "foreground-rgba", &link_colour, NULL);
+
   /* add one so that zero is the "nothing" value, since U+0000 is a character */
   g_object_set_data (G_OBJECT (tag), "link-character", GUINT_TO_POINTER (uc + 1));
 

Reply via email to