diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-07-14 10:03:35 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-07-14 10:03:35 +0000 |
| commit | 3f7be59062f00cd99d832eaa5d389b880a3c512e (patch) | |
| tree | 2849470c94e9fc7a7300a60a7542a5e459bf70d8 | |
| parent | themes: enable custom cursor colors in all themes that define such colors (diff) | |
config: add csd.double-click-to-maximize=no|yes option
When enabled, double-clicking the CSD titlebar will (un)maximize the
window.
Defaults to ‘yes’ (since this is the old hard-coded behavior).
Closes #1293
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | config.c | 4 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | doc/foot.ini.5.scd | 4 | ||||
| -rw-r--r-- | foot.ini | 1 | ||||
| -rw-r--r-- | input.c | 5 | ||||
| -rw-r--r-- | tests/test-config.c | 2 |
7 files changed, 19 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bc18908a..891c973a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,9 +56,12 @@ * Support for the new `cursor-shape-v1` Wayland protocol, i.e. server side cursor shapes ([#1379][1379]). * Support for touchscreen input ([#517][517]). +* `csd.double-click-to-maximize` option to `foot.ini`. Defaults to + `yes` ([#1293][1293]). [1379]: https://codeberg.org/dnkl/foot/issues/1379 [517]: https://codeberg.org/dnkl/foot/issues/517 +[1293]: https://codeberg.org/dnkl/foot/issues/1293 ### Changed @@ -1475,6 +1475,9 @@ parse_section_csd(struct context *ctx) else if (strcmp(key, "hide-when-maximized") == 0) return value_to_bool(ctx, &conf->csd.hide_when_maximized); + else if (strcmp(key, "double-click-to-maximize") == 0) + return value_to_bool(ctx, &conf->csd.double_click_to_maximize); + else { LOG_CONTEXTUAL_ERR("not a valid action: %s", key); return false; @@ -3009,6 +3012,7 @@ config_load(struct config *conf, const char *conf_path, .preferred = CONF_CSD_PREFER_SERVER, .font = {0}, .hide_when_maximized = false, + .double_click_to_maximize = true, .title_height = 26, .border_width = 5, .border_width_visible = 0, @@ -285,6 +285,7 @@ struct config { uint16_t button_width; bool hide_when_maximized; + bool double_click_to_maximize; struct { bool title_set:1; diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 32482aa9..7fee8387 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -692,6 +692,10 @@ Examples: is maximized. The completely disable the titlebar, set *size* to 0 instead. Default: _no_. +*double-click-to-maximize* + Boolean. When enabled, double-clicking the CSD titlebar will + (un)maximize the window. Default: _yes_. + *border-width* Width of the border, in pixels (subject to output scaling). Note that the border encompasses the entire window, including the title @@ -123,6 +123,7 @@ # font=<primary font> # color=<foreground color> # hide-when-maximized=no +# double-click-to-maximize=yes # border-width=0 # border-color=<csd.color> # button-width=26 @@ -2287,7 +2287,10 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, struct wl_window *win = term->window; /* Toggle maximized state on double-click */ - if (button == BTN_LEFT && seat->mouse.count == 2) { + if (term->conf->csd.double_click_to_maximize && + button == BTN_LEFT && + seat->mouse.count == 2) + { if (win->is_maximized) xdg_toplevel_unset_maximized(win->xdg_toplevel); else diff --git a/tests/test-config.c b/tests/test-config.c index e59c104e..54efd13a 100644 --- a/tests/test-config.c +++ b/tests/test-config.c @@ -777,6 +777,8 @@ test_section_csd(void) &conf.csd.color.quit); test_boolean(&ctx, &parse_section_csd, "hide-when-maximized", &conf.csd.hide_when_maximized); + test_boolean(&ctx, &parse_section_csd, "double-click-to-maximize", + &conf.csd.double_click_to_maximize); /* TODO: verify the ‘set’ bit is actually set for colors */ /* TODO: font */ |
