mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
Add -W,--window-size-chars, and foot.ini:initial-window-size-chars
* Add -W,--window-size-chars command line option * Add initial-window-size-chars foot.ini option * Add -w,--window-size-pixels command line option * Add initial-window-size-pixels foot.ini option * Deprecate -g,--geometry command line option in favor of -w,--window-size-pixels * Deprecate geometry option in foot.ini in favor of initial-window-size-pixels
This commit is contained in:
parent
fa6ad0f030
commit
eb6737ca25
10 changed files with 199 additions and 57 deletions
|
|
@ -56,7 +56,14 @@
|
||||||
character width of 1. Must be explicitly enabled with
|
character width of 1. Must be explicitly enabled with
|
||||||
`tweak.allow-overflowing-double-width-glyphs`
|
`tweak.allow-overflowing-double-width-glyphs`
|
||||||
(https://codeberg.org/dnkl/foot/issues/116).
|
(https://codeberg.org/dnkl/foot/issues/116).
|
||||||
|
* **initial-window-size-pixels** options to `foot.ini` and
|
||||||
|
`-w,--window-size-pixels` command line option to `foot`. This option
|
||||||
|
replaces the now deprecated **geometry** and `-g,--geometry`
|
||||||
|
options.
|
||||||
|
* **initial-window-size-chars** option to `foot.ini` and
|
||||||
|
`-W,--window-size-chars` command line option to `foot`. This option
|
||||||
|
configures the initial window size in **characters**, and is an
|
||||||
|
alternative to **initial-window-size-pixels**.
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ _arguments \
|
||||||
'--maximized[start in maximized mode]' \
|
'--maximized[start in maximized mode]' \
|
||||||
'--fullscreen[start in fullscreen mode]' \
|
'--fullscreen[start in fullscreen mode]' \
|
||||||
'--login-shell[start shell as a login shell]' \
|
'--login-shell[start shell as a login shell]' \
|
||||||
'(-g --geometry)'{-g,--geometry}'[window WIDTHxHEIGHT, in pixels (700x500)]:geometry:()' \
|
'(-w --window-size-pixels)'{-w,--window-size-pixels}'[window WIDTHxHEIGHT, in pixels (700x500)]:size_pixels:()' \
|
||||||
|
'(-W --window-size-chars)'{-W,--window-size-chars}'[window WIDTHxHEIGHT, in characters (not set)]:size_chars:()' \
|
||||||
'(-s --server)'{-s,--server}'[run as server; open terminals by running footclient]:server:_files' \
|
'(-s --server)'{-s,--server}'[run as server; open terminals by running footclient]:server:_files' \
|
||||||
'--hold[remain open after child process exits]' \
|
'--hold[remain open after child process exits]' \
|
||||||
'(-p --print-pid)'{-p,--print-pid}'[print PID to this file or FD when up and running (server mode only)]:pidfile:_files' \
|
'(-p --print-pid)'{-p,--print-pid}'[print PID to this file or FD when up and running (server mode only)]:pidfile:_files' \
|
||||||
|
|
|
||||||
63
config.c
63
config.c
|
|
@ -452,18 +452,49 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
conf->app_id = xstrdup(value);
|
conf->app_id = xstrdup(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "geometry") == 0) {
|
else if (strcmp(key, "initial-window-size-pixels") == 0 ||
|
||||||
|
strcmp(key, "geometry") == 0 /* deprecated */)
|
||||||
|
{
|
||||||
|
if (strcmp(key, "geometry") == 0) {
|
||||||
|
LOG_WARN("deprecated: [default]: geometry: use 'initial-window-size-pixels' instead'");
|
||||||
|
|
||||||
|
const char *fmt = "%s:%d: \033[1mgeometry\033[21m, use \033[1minitial-window-size-pixels\033[21m instead";
|
||||||
|
char *text = xasprintf(fmt, path, lineno);
|
||||||
|
|
||||||
|
struct user_notification deprecation = {
|
||||||
|
.kind = USER_NOTIFICATION_DEPRECATED,
|
||||||
|
.text = text,
|
||||||
|
};
|
||||||
|
tll_push_back(conf->notifications, deprecation);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
if (sscanf(value, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
if (sscanf(value, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
LOG_AND_NOTIFY_ERR(
|
LOG_AND_NOTIFY_ERR(
|
||||||
"%s: %d: [default]: geometry: expected WIDTHxHEIGHT, "
|
"%s: %d: [default]: initial-window-size-pixels: "
|
||||||
"where both are positive integers, got '%s'",
|
"expected WIDTHxHEIGHT, where both are positive integers, "
|
||||||
path, lineno, value);
|
"got '%s'", path, lineno, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf->width = width;
|
conf->size.type = CONF_SIZE_PX;
|
||||||
conf->height = height;
|
conf->size.px.width = width;
|
||||||
|
conf->size.px.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "initial-window-size-chars") == 0) {
|
||||||
|
unsigned width, height;
|
||||||
|
if (sscanf(value, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
|
LOG_AND_NOTIFY_ERR(
|
||||||
|
"%s: %d: [default]: initial-window-size-chars: "
|
||||||
|
"expected WIDTHxHEIGHT, where both are positive integers, "
|
||||||
|
"got '%s'", path, lineno, value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf->size.type = CONF_SIZE_CELLS;
|
||||||
|
conf->size.cells.width = width;
|
||||||
|
conf->size.cells.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "pad") == 0) {
|
else if (strcmp(key, "pad") == 0) {
|
||||||
|
|
@ -1721,7 +1752,8 @@ add_default_mouse_bindings(struct config *conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
config_load(struct config *conf, const char *conf_path, bool errors_are_fatal)
|
config_load(struct config *conf, const char *conf_path,
|
||||||
|
user_notifications_t *initial_user_notifications, bool errors_are_fatal)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
|
|
@ -1730,8 +1762,13 @@ config_load(struct config *conf, const char *conf_path, bool errors_are_fatal)
|
||||||
.shell = get_shell(),
|
.shell = get_shell(),
|
||||||
.title = xstrdup("foot"),
|
.title = xstrdup("foot"),
|
||||||
.app_id = xstrdup("foot"),
|
.app_id = xstrdup("foot"),
|
||||||
.width = 700,
|
.size = {
|
||||||
.height = 500,
|
.type = CONF_SIZE_PX,
|
||||||
|
.px = {
|
||||||
|
.width = 700,
|
||||||
|
.height = 500,
|
||||||
|
},
|
||||||
|
},
|
||||||
.pad_x = 2,
|
.pad_x = 2,
|
||||||
.pad_y = 2,
|
.pad_y = 2,
|
||||||
.startup_mode = STARTUP_WINDOWED,
|
.startup_mode = STARTUP_WINDOWED,
|
||||||
|
|
@ -1810,6 +1847,10 @@ config_load(struct config *conf, const char *conf_path, bool errors_are_fatal)
|
||||||
.notifications = tll_init(),
|
.notifications = tll_init(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tll_foreach(*initial_user_notifications, it)
|
||||||
|
tll_push_back(conf->notifications, it->item);
|
||||||
|
tll_free(*initial_user_notifications);
|
||||||
|
|
||||||
add_default_key_bindings(conf);
|
add_default_key_bindings(conf);
|
||||||
add_default_search_bindings(conf);
|
add_default_search_bindings(conf);
|
||||||
add_default_mouse_bindings(conf);
|
add_default_mouse_bindings(conf);
|
||||||
|
|
@ -1887,9 +1928,7 @@ config_free(struct config conf)
|
||||||
tll_free(conf.bindings.mouse);
|
tll_free(conf.bindings.mouse);
|
||||||
tll_free(conf.bindings.search);
|
tll_free(conf.bindings.search);
|
||||||
|
|
||||||
tll_foreach(conf.notifications, it)
|
user_notifications_free(&conf.notifications);
|
||||||
free(it->item.text);
|
|
||||||
tll_free(conf.notifications);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct config_font
|
struct config_font
|
||||||
|
|
|
||||||
24
config.h
24
config.h
|
|
@ -9,6 +9,8 @@
|
||||||
#include "user-notification.h"
|
#include "user-notification.h"
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
|
|
||||||
|
enum conf_size_type {CONF_SIZE_PX, CONF_SIZE_CELLS};
|
||||||
|
|
||||||
struct config_font {
|
struct config_font {
|
||||||
char *pattern;
|
char *pattern;
|
||||||
double pt_size;
|
double pt_size;
|
||||||
|
|
@ -52,10 +54,24 @@ struct config {
|
||||||
char *title;
|
char *title;
|
||||||
char *app_id;
|
char *app_id;
|
||||||
bool login_shell;
|
bool login_shell;
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
struct {
|
||||||
|
enum conf_size_type type;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
} px;
|
||||||
|
struct {
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
} cells;
|
||||||
|
};
|
||||||
|
} size;
|
||||||
|
|
||||||
unsigned pad_x;
|
unsigned pad_x;
|
||||||
unsigned pad_y;
|
unsigned pad_y;
|
||||||
|
|
||||||
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
||||||
|
|
||||||
tll(struct config_font) fonts;
|
tll(struct config_font) fonts;
|
||||||
|
|
@ -156,7 +172,9 @@ struct config {
|
||||||
user_notifications_t notifications;
|
user_notifications_t notifications;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool config_load(struct config *conf, const char *path, bool errors_are_fatal);
|
bool config_load(
|
||||||
|
struct config *conf, const char *path,
|
||||||
|
user_notifications_t *initial_user_notifications, bool errors_are_fatal);
|
||||||
void config_free(struct config conf);
|
void config_free(struct config conf);
|
||||||
|
|
||||||
struct config_font config_font_parse(const char *pattern);
|
struct config_font config_font_parse(const char *pattern);
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,14 @@ the foot command line
|
||||||
|
|
||||||
Default: _monospace_.
|
Default: _monospace_.
|
||||||
|
|
||||||
|
*-w*,*--window-size-pixels*=_WIDTHxHEIGHT_
|
||||||
|
Set initial window width and height, in pixels. Default: _700x500_.
|
||||||
|
|
||||||
|
*-W*,*--window-size-chars*=_WIDTHxHEIGHT_
|
||||||
|
Set initial window width and height, in characters. Default: _not set_.
|
||||||
|
|
||||||
*-g*,*--geometry*=_WIDTHxHEIGHT_
|
*-g*,*--geometry*=_WIDTHxHEIGHT_
|
||||||
Set initial window width and height. Default: *700x500*.
|
Deprecated. Alias for *-w*,*--window-size-pixels*.
|
||||||
|
|
||||||
*-t*,*--term*=_TERM_
|
*-t*,*--term*=_TERM_
|
||||||
Value to set the environment variable *TERM* to. Default: _foot_.
|
Value to set the environment variable *TERM* to. Default: _foot_.
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,28 @@ in this order:
|
||||||
|
|
||||||
Default: _monospace_.
|
Default: _monospace_.
|
||||||
|
|
||||||
*geometry*
|
|
||||||
Initial window width and height in pixels (subject to output
|
|
||||||
scaling), on the form _WIDTHxHEIGHT_. Default: _700x500_.
|
|
||||||
|
|
||||||
*pad*
|
*pad*
|
||||||
Padding between border and glyphs, in pixels (subject to output
|
Padding between border and glyphs, in pixels (subject to output
|
||||||
scaling), on the form _XxY_. Default: _2x2_.
|
scaling), on the form _XxY_. Default: _2x2_.
|
||||||
|
|
||||||
|
*initial-window-size-pixels*
|
||||||
|
Initial window width and height in _pixels_ (subject to output
|
||||||
|
scaling), on the form _WIDTHxHEIGHT_. The height _includes_ the
|
||||||
|
titlebar when using CSDs. Mutually exclusive to
|
||||||
|
*initial-window-size-chars*. Default: _700x500_.
|
||||||
|
|
||||||
|
*initial-window-size-chars*
|
||||||
|
Initial window width and height in _characters_, on the form
|
||||||
|
_WIDTHxHEIGHT_. Mutually exclusive to
|
||||||
|
*initial-window-size-pixels*. Default: _not set_.
|
||||||
|
|
||||||
*initial-window-mode*
|
*initial-window-mode*
|
||||||
Initial window mode for each newly spawned window: *windowed*,
|
Initial window mode for each newly spawned window: *windowed*,
|
||||||
*maximized* or *fullscreen*. Default: _windowed_.
|
*maximized* or *fullscreen*. Default: _windowed_.
|
||||||
|
|
||||||
|
*geometry*
|
||||||
|
Deprecated. Alias for *initial-window-size-pixels*.
|
||||||
|
|
||||||
*shell*
|
*shell*
|
||||||
Executable to launch. Typically a shell. Default: _$SHELL_ if set,
|
Executable to launch. Typically a shell. Default: _$SHELL_ if set,
|
||||||
otherwise the user's default shell (as specified in
|
otherwise the user's default shell (as specified in
|
||||||
|
|
|
||||||
5
foot.ini
5
foot.ini
|
|
@ -1,9 +1,10 @@
|
||||||
# -*- conf -*-
|
# -*- conf -*-
|
||||||
|
|
||||||
# font=monospace
|
# font=monospace
|
||||||
# geometry=700x500
|
# initial-window-size-pixels=700x500 # Or,
|
||||||
# pad=2x2
|
# initial-window-size-chars=<COLSxROWS>
|
||||||
# initial-window-mode=windowed
|
# initial-window-mode=windowed
|
||||||
|
# pad=2x2
|
||||||
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
|
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
|
||||||
# term=foot
|
# term=foot
|
||||||
# login-shell=no
|
# login-shell=no
|
||||||
|
|
|
||||||
95
main.c
95
main.c
|
|
@ -55,7 +55,8 @@ print_usage(const char *prog_name)
|
||||||
" --maximized start in maximized mode\n"
|
" --maximized start in maximized mode\n"
|
||||||
" --fullscreen start in fullscreen mode\n"
|
" --fullscreen start in fullscreen mode\n"
|
||||||
" --login-shell start shell as a login shell\n"
|
" --login-shell start shell as a login shell\n"
|
||||||
" -g,--geometry=WIDTHxHEIGHT set initial width and height\n"
|
" -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels (alternative to '--dimensions')\n"
|
||||||
|
" -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters (alternative to '--geometry')\n"
|
||||||
" -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n"
|
" -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n"
|
||||||
" Without PATH, $XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock will be used.\n"
|
" Without PATH, $XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock will be used.\n"
|
||||||
" --hold remain open after child process exits\n"
|
" --hold remain open after child process exits\n"
|
||||||
|
|
@ -143,25 +144,27 @@ main(int argc, char *const *argv)
|
||||||
const char *const prog_name = argv[0];
|
const char *const prog_name = argv[0];
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"config", required_argument, NULL, 'c'},
|
{"config", required_argument, NULL, 'c'},
|
||||||
{"check-config", no_argument, NULL, 'C'},
|
{"check-config", no_argument, NULL, 'C'},
|
||||||
{"term", required_argument, NULL, 't'},
|
{"term", required_argument, NULL, 't'},
|
||||||
{"title", required_argument, NULL, 'T'},
|
{"title", required_argument, NULL, 'T'},
|
||||||
{"app-id", required_argument, NULL, 'a'},
|
{"app-id", required_argument, NULL, 'a'},
|
||||||
{"login-shell", no_argument, NULL, 'L'},
|
{"login-shell", no_argument, NULL, 'L'},
|
||||||
{"font", required_argument, NULL, 'f'},
|
{"font", required_argument, NULL, 'f'},
|
||||||
{"geometry", required_argument, NULL, 'g'},
|
{"geometry", required_argument, NULL, 'g'}, /* Deprecated */
|
||||||
{"server", optional_argument, NULL, 's'},
|
{"window-size-pixels", required_argument, NULL, 'w'},
|
||||||
{"hold", no_argument, NULL, 'H'},
|
{"window-size-chars", required_argument, NULL, 'W'},
|
||||||
{"maximized", no_argument, NULL, 'm'},
|
{"server", optional_argument, NULL, 's'},
|
||||||
{"fullscreen", no_argument, NULL, 'F'},
|
{"hold", no_argument, NULL, 'H'},
|
||||||
{"presentation-timings", no_argument, NULL, 'P'}, /* Undocumented */
|
{"maximized", no_argument, NULL, 'm'},
|
||||||
{"print-pid", required_argument, NULL, 'p'},
|
{"fullscreen", no_argument, NULL, 'F'},
|
||||||
{"log-colorize", optional_argument, NULL, 'l'},
|
{"presentation-timings", no_argument, NULL, 'P'}, /* Undocumented */
|
||||||
{"log-no-syslog", no_argument, NULL, 'S'},
|
{"print-pid", required_argument, NULL, 'p'},
|
||||||
{"version", no_argument, NULL, 'v'},
|
{"log-colorize", optional_argument, NULL, 'l'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"log-no-syslog", no_argument, NULL, 'S'},
|
||||||
{NULL, no_argument, NULL, 0},
|
{"version", no_argument, NULL, 'v'},
|
||||||
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{NULL, no_argument, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool check_config = false;
|
bool check_config = false;
|
||||||
|
|
@ -171,6 +174,7 @@ main(int argc, char *const *argv)
|
||||||
const char *conf_app_id = NULL;
|
const char *conf_app_id = NULL;
|
||||||
bool login_shell = false;
|
bool login_shell = false;
|
||||||
tll(char *) conf_fonts = tll_init();
|
tll(char *) conf_fonts = tll_init();
|
||||||
|
enum conf_size_type conf_size_type = CONF_SIZE_PX;
|
||||||
int conf_width = -1;
|
int conf_width = -1;
|
||||||
int conf_height = -1;
|
int conf_height = -1;
|
||||||
bool as_server = false;
|
bool as_server = false;
|
||||||
|
|
@ -183,9 +187,10 @@ main(int argc, char *const *argv)
|
||||||
const char *pid_file = NULL;
|
const char *pid_file = NULL;
|
||||||
enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
|
enum log_colorize log_colorize = LOG_COLORIZE_AUTO;
|
||||||
bool log_syslog = true;
|
bool log_syslog = true;
|
||||||
|
user_notifications_t user_notifications = tll_init();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int c = getopt_long(argc, argv, "+c:Ct:a:Lf:g:s::Pp:l::Svh", longopts, NULL);
|
int c = getopt_long(argc, argv, "+c:Ct:a:Lf:g:w:W:s::Pp:l::Svh", longopts, NULL);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -237,12 +242,37 @@ main(int argc, char *const *argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g': {
|
case 'g': {
|
||||||
|
LOG_WARN("deprecated: -g,--geometry command line option. Use -w,--window-size-pixels instead");
|
||||||
|
struct user_notification deprecation = {
|
||||||
|
.kind = USER_NOTIFICATION_DEPRECATED,
|
||||||
|
.text = xstrdup(
|
||||||
|
"\033[1m-g,--geometry\033[21m command line option. "
|
||||||
|
"Use \033[1m-w,--window-size-pixels\033[21m instead"),
|
||||||
|
};
|
||||||
|
tll_push_back(user_notifications, deprecation);
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
}
|
||||||
|
case 'w': {
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
fprintf(stderr, "error: invalid geometry: %s\n", optarg);
|
fprintf(stderr, "error: invalid window-size-pixels: %s\n", optarg);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf_size_type = CONF_SIZE_PX;
|
||||||
|
conf_width = width;
|
||||||
|
conf_height = height;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'W': {
|
||||||
|
unsigned width, height;
|
||||||
|
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
|
||||||
|
fprintf(stderr, "error: invalid window-size-chars: %s\n", optarg);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf_size_type = CONF_SIZE_CELLS;
|
||||||
conf_width = width;
|
conf_width = width;
|
||||||
conf_height = height;
|
conf_height = height;
|
||||||
break;
|
break;
|
||||||
|
|
@ -323,7 +353,7 @@ main(int argc, char *const *argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct config conf = {NULL};
|
struct config conf = {NULL};
|
||||||
if (!config_load(&conf, conf_path, check_config)) {
|
if (!config_load(&conf, conf_path, &user_notifications, check_config)) {
|
||||||
config_free(conf);
|
config_free(conf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -362,10 +392,21 @@ main(int argc, char *const *argv)
|
||||||
tll_push_back(conf.fonts, config_font_parse(it->item));
|
tll_push_back(conf.fonts, config_font_parse(it->item));
|
||||||
tll_free(conf_fonts);
|
tll_free(conf_fonts);
|
||||||
}
|
}
|
||||||
if (conf_width > 0)
|
if (conf_width > 0 && conf_height > 0) {
|
||||||
conf.width = conf_width;
|
conf.size.type = conf_size_type;
|
||||||
if (conf_height > 0)
|
|
||||||
conf.height = conf_height;
|
switch (conf_size_type) {
|
||||||
|
case CONF_SIZE_PX:
|
||||||
|
conf.size.px.width = conf_width;
|
||||||
|
conf.size.px.height = conf_height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CONF_SIZE_CELLS:
|
||||||
|
conf.size.cells.width = conf_width;
|
||||||
|
conf.size.cells.height = conf_height;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (conf_server_socket_path != NULL) {
|
if (conf_server_socket_path != NULL) {
|
||||||
free(conf.server_socket_path);
|
free(conf.server_socket_path);
|
||||||
conf.server_socket_path = xstrdup(conf_server_socket_path);
|
conf.server_socket_path = xstrdup(conf_server_socket_path);
|
||||||
|
|
|
||||||
23
render.c
23
render.c
|
|
@ -2032,13 +2032,24 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
||||||
width = term->unmaximized_width;
|
width = term->unmaximized_width;
|
||||||
height = term->unmaximized_height;
|
height = term->unmaximized_height;
|
||||||
} else {
|
} else {
|
||||||
width = term->conf->width;
|
switch (term->conf->size.type) {
|
||||||
height = term->conf->height;
|
case CONF_SIZE_PX:
|
||||||
|
width = term->conf->size.px.width;
|
||||||
|
height = term->conf->size.px.height;
|
||||||
|
|
||||||
if (term->window->use_csd == CSD_YES) {
|
if (term->window->use_csd == CSD_YES) {
|
||||||
/* Take CSD title bar into account */
|
/* Take CSD title bar into account */
|
||||||
assert(!term->window->is_fullscreen);
|
assert(!term->window->is_fullscreen);
|
||||||
height -= term->conf->csd.title_height;
|
height -= term->conf->csd.title_height;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CONF_SIZE_CELLS:
|
||||||
|
width = 2 * term->conf->pad_x;
|
||||||
|
height = 2 * term->conf->pad_y;
|
||||||
|
width += term->conf->size.cells.width * term->cell_width;
|
||||||
|
height += term->conf->size.cells.height * term->cell_height;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
width *= scale;
|
width *= scale;
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,11 @@ struct user_notification {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef tll(struct user_notification) user_notifications_t;
|
typedef tll(struct user_notification) user_notifications_t;
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
user_notifications_free(user_notifications_t *notifications)
|
||||||
|
{
|
||||||
|
tll_foreach(*notifications, it)
|
||||||
|
free(it->item.text);
|
||||||
|
tll_free(*notifications);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue