mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-19 05:33:44 -04:00
Merge branch 'increase-sixel-default-max-size'
This commit is contained in:
commit
309e30ba97
5 changed files with 21 additions and 27 deletions
|
|
@ -90,6 +90,8 @@ means foot can be PGO:d in e.g. sandboxed build scripts. See
|
||||||
overflow into neighboring cells by default. Set
|
overflow into neighboring cells by default. Set
|
||||||
**tweak.allow-overflowing-double-width-glyphs** to ‘no’ to disable
|
**tweak.allow-overflowing-double-width-glyphs** to ‘no’ to disable
|
||||||
this.
|
this.
|
||||||
|
* Sixel default maximum size is now 10000x10000 instead of the current
|
||||||
|
window size.
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "async.h"
|
#include "async.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "sixel.h"
|
||||||
#include "user-notification.h"
|
#include "user-notification.h"
|
||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
|
|
@ -200,7 +201,12 @@ main(int argc, const char *const *argv)
|
||||||
.delayed_render_timer = {
|
.delayed_render_timer = {
|
||||||
.lower_fd = lower_fd,
|
.lower_fd = lower_fd,
|
||||||
.upper_fd = upper_fd
|
.upper_fd = upper_fd
|
||||||
}
|
},
|
||||||
|
.sixel = {
|
||||||
|
.palette_size = SIXEL_MAX_COLORS,
|
||||||
|
.max_width = SIXEL_MAX_WIDTH,
|
||||||
|
.max_height = SIXEL_MAX_HEIGHT,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
tll_push_back(wayl.terms, &term);
|
tll_push_back(wayl.terms, &term);
|
||||||
|
|
|
||||||
34
sixel.c
34
sixel.c
|
|
@ -778,24 +778,6 @@ sixel_unhook(struct terminal *term)
|
||||||
render_refresh(term);
|
render_refresh(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
|
||||||
max_width(const struct terminal *term)
|
|
||||||
{
|
|
||||||
/* foot extension - treat 0 to mean current terminal size */
|
|
||||||
return term->sixel.max_width == 0
|
|
||||||
? term->cols * term->cell_width
|
|
||||||
: term->sixel.max_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
max_height(const struct terminal *term)
|
|
||||||
{
|
|
||||||
/* foot extension - treat 0 to mean current terminal size */
|
|
||||||
return term->sixel.max_height == 0
|
|
||||||
? term->rows * term->cell_height
|
|
||||||
: term->sixel.max_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
resize(struct terminal *term, int new_width, int new_height)
|
resize(struct terminal *term, int new_width, int new_height)
|
||||||
{
|
{
|
||||||
|
|
@ -863,8 +845,8 @@ sixel_add(struct terminal *term, uint32_t color, uint8_t sixel)
|
||||||
{
|
{
|
||||||
//LOG_DBG("adding sixel %02hhx using color 0x%06x", sixel, color);
|
//LOG_DBG("adding sixel %02hhx using color 0x%06x", sixel, color);
|
||||||
|
|
||||||
if (term->sixel.pos.col >= max_width(term) ||
|
if (term->sixel.pos.col >= term->sixel.max_width ||
|
||||||
term->sixel.pos.row * 6 + 5 >= max_height(term))
|
term->sixel.pos.row * 6 + 5 >= term->sixel.max_height)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -990,7 +972,7 @@ decgra(struct terminal *term, uint8_t c)
|
||||||
pan, pad, pan / pad, ph, pv);
|
pan, pad, pan / pad, ph, pv);
|
||||||
|
|
||||||
if (ph >= term->sixel.image.height && pv >= term->sixel.image.width &&
|
if (ph >= term->sixel.image.height && pv >= term->sixel.image.width &&
|
||||||
ph <= max_height(term) && pv <= max_width(term))
|
ph <= term->sixel.max_height && pv <= term->sixel.max_width)
|
||||||
{
|
{
|
||||||
if (resize(term, ph, pv))
|
if (resize(term, ph, pv))
|
||||||
term->sixel.image.autosize = false;
|
term->sixel.image.autosize = false;
|
||||||
|
|
@ -1163,19 +1145,19 @@ sixel_geometry_report_current(struct terminal *term)
|
||||||
{
|
{
|
||||||
char reply[64];
|
char reply[64];
|
||||||
snprintf(reply, sizeof(reply), "\033[?2;0;%u;%uS",
|
snprintf(reply, sizeof(reply), "\033[?2;0;%u;%uS",
|
||||||
max_width(term), max_height(term));
|
term->sixel.max_width, term->sixel.max_height);
|
||||||
term_to_slave(term, reply, strlen(reply));
|
term_to_slave(term, reply, strlen(reply));
|
||||||
|
|
||||||
LOG_DBG("query response for current sixel geometry: %ux%u",
|
LOG_DBG("query response for current sixel geometry: %ux%u",
|
||||||
max_width(term), max_height(term));
|
term->sixel.max_width, term->sixel.max_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sixel_geometry_reset(struct terminal *term)
|
sixel_geometry_reset(struct terminal *term)
|
||||||
{
|
{
|
||||||
LOG_DBG("sixel geometry reset to %ux%u", max_width(term), max_height(term));
|
LOG_DBG("sixel geometry reset to %ux%u", SIXEL_MAX_WIDTH, SIXEL_MAX_HEIGHT);
|
||||||
term->sixel.max_width = 0;
|
term->sixel.max_width = SIXEL_MAX_WIDTH;
|
||||||
term->sixel.max_height = 0;
|
term->sixel.max_height = SIXEL_MAX_HEIGHT;
|
||||||
sixel_geometry_report_current(term);
|
sixel_geometry_report_current(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
sixel.h
2
sixel.h
|
|
@ -3,6 +3,8 @@
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
||||||
#define SIXEL_MAX_COLORS 1024u
|
#define SIXEL_MAX_COLORS 1024u
|
||||||
|
#define SIXEL_MAX_WIDTH 10000u
|
||||||
|
#define SIXEL_MAX_HEIGHT 10000u
|
||||||
|
|
||||||
void sixel_fini(struct terminal *term);
|
void sixel_fini(struct terminal *term);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1109,6 +1109,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
||||||
},
|
},
|
||||||
.sixel = {
|
.sixel = {
|
||||||
.palette_size = SIXEL_MAX_COLORS,
|
.palette_size = SIXEL_MAX_COLORS,
|
||||||
|
.max_width = SIXEL_MAX_WIDTH,
|
||||||
|
.max_height = SIXEL_MAX_HEIGHT,
|
||||||
},
|
},
|
||||||
.hold_at_exit = conf->hold_at_exit,
|
.hold_at_exit = conf->hold_at_exit,
|
||||||
.shutdown_cb = shutdown_cb,
|
.shutdown_cb = shutdown_cb,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue