mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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
This commit is contained in:
parent
3cd0e2adb0
commit
3f7be59062
7 changed files with 19 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
4
config.c
4
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,
|
||||
|
|
|
|||
1
config.h
1
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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
1
foot.ini
1
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
|
||||
|
|
|
|||
5
input.c
5
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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue