summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-03-16 14:58:57 -0400
committerVictor Kareh <[email protected]>2026-03-16 15:22:29 -0400
commit370ef4ba3ccf88bec959a647249f8f720204cc17 (patch)
tree3be2e2f2c7b604a8b724c5daa853a58f22997cd1
parent40a129a26d9006e51dd63ddcde6cd2e210d30b92 (diff)
downloadmate-terminal-fix-color-scheme-combo.tar.bz2
mate-terminal-fix-color-scheme-combo.tar.xz
profile-editor: fix color scheme combo not restoring selectionfix-color-scheme-combo
The built-in color scheme dropdown always showed "Custom" when reopening the profile editor. Two bugs were present: - color comparison was called as pointer-to-pointer comparison, which always fails. - gdk_rgba_equal does exact floating-point comparison, which is too strict for colors that have been round-tripped through GSettings string serialization. Using the fuzzy rgba_equal function fixes that. Fixes #486
-rw-r--r--src/profile-editor.c4
-rw-r--r--src/terminal-profile.c2
-rw-r--r--src/terminal-profile.h3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/profile-editor.c b/src/profile-editor.c
index f4959db..520a61b 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -380,8 +380,8 @@ profile_colors_notify_scheme_combo_cb (TerminalProfile *profile,
{
for (i = 0; i < G_N_ELEMENTS (color_schemes); ++i)
{
- if (gdk_rgba_equal (&fg, &color_schemes[i].foreground) &&
- gdk_rgba_equal (&bg, &color_schemes[i].background))
+ if (rgba_equal (fg, &color_schemes[i].foreground) &&
+ rgba_equal (bg, &color_schemes[i].background))
break;
}
}
diff --git a/src/terminal-profile.c b/src/terminal-profile.c
index f789f66..69bf5ac 100644
--- a/src/terminal-profile.c
+++ b/src/terminal-profile.c
@@ -311,7 +311,7 @@ static GQuark gsettings_key_quark;
G_DEFINE_TYPE_WITH_PRIVATE (TerminalProfile, terminal_profile, G_TYPE_OBJECT);
/* gdk_rgba_equal is too strict! */
-static gboolean
+gboolean
rgba_equal (const GdkRGBA *a,
const GdkRGBA *b)
{
diff --git a/src/terminal-profile.h b/src/terminal-profile.h
index 5ce6ece..ff9b0a7 100644
--- a/src/terminal-profile.h
+++ b/src/terminal-profile.h
@@ -189,6 +189,9 @@ gboolean terminal_profile_modify_palette_entry (TerminalProfile *prof
guint i,
const GdkRGBA *color);
+gboolean rgba_equal (const GdkRGBA *a,
+ const GdkRGBA *b);
+
G_END_DECLS
#endif /* TERMINAL_PROFILE_H */