aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--config.c4
-rw-r--r--config.h1
-rw-r--r--doc/foot.ini.5.scd4
-rw-r--r--foot.ini1
-rw-r--r--input.c5
-rw-r--r--tests/test-config.c2
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
diff --git a/config.c b/config.c
index 5c38aef5..735ccd74 100644
--- a/config.c
+++ b/config.c
@@ -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,
diff --git a/config.h b/config.h
index 20c07f6c..8189e56d 100644
--- a/config.h
+++ b/config.h
@@ -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
diff --git a/foot.ini b/foot.ini
index 2735d370..b4e4c603 100644
--- a/foot.ini
+++ b/foot.ini
@@ -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
diff --git a/input.c b/input.c
index 3bf6535a..b2b4adf6 100644
--- a/input.c
+++ b/input.c
@@ -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 */