13
0

Allow to set transparency to 100%

Despite what the docs say Gtk::HScale(0,1,s) with a step-size
s > 0 has a range [0, 1 - s]. GTKMM does allow for a step-size
of zero, which also works around this issue.
This works because gtkmm sidesteps gtk_hscale_new_with_range() which
would fail with g_return_val_if_fail (step != 0.0, NULL);

The reason for this is that gtkmm creates an Adjustment with a
page-size = step-size:

```
Adjustment* adjustment = manage(new Adjustment(min, min, max, step, 10 * step, step));
```
and `gtk_adjustment_configure` limits the range:
```
value = MIN (value, upper - page_size);
```
This commit is contained in:
Robin Gareus 2023-02-06 01:27:06 +01:00
parent 5ee7941895
commit e74cb666ed
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -193,7 +193,8 @@ ColorThemeManager::setup_modifiers ()
for (UIConfiguration::Modifiers::const_iterator m = modifiers.begin(); m != modifiers.end(); ++m) {
mod_hbox = manage (new HBox);
mod_scale = manage (new HScale (0.0, 1.0, 0.01));
Adjustment* adj = manage (new Adjustment (0.0, 0.0, 1.0, 0.01, 0.1, 0));
mod_scale = manage (new HScale (*adj));
mod_scale->set_draw_value (false);
mod_scale->set_value (m->second.a());
mod_scale->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);