diff options
| author | Victor Kareh <[email protected]> | 2026-03-16 14:58:57 -0400 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-05-06 13:28:07 -0400 |
| commit | a4311214f6e2dc7ec7ff06878ed268ef011c7c67 (patch) | |
| tree | c2c5f860d3c43b0c543f24391ff443898e5a6b89 /src | |
| parent | f075475a3a6f4cb0714b4f1e29b66d37cb439ad1 (diff) | |
| download | mate-terminal-a4311214f6e2dc7ec7ff06878ed268ef011c7c67.tar.bz2 mate-terminal-a4311214f6e2dc7ec7ff06878ed268ef011c7c67.tar.xz | |
profile-editor: fix color scheme combo not restoring selection
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/profile-editor.c | 4 | ||||
| -rw-r--r-- | src/terminal-profile.c | 2 | ||||
| -rw-r--r-- | src/terminal-profile.h | 3 |
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 */ |
