Merge branch 'obsd-master' into master

This commit is contained in:
Thomas Adam 2021-10-13 14:01:16 +01:00
commit fb23df679b
7 changed files with 59 additions and 10 deletions

View File

@ -747,7 +747,7 @@ mode_tree_draw(struct mode_tree_data *mtd)
mti = mti->parent; mti = mti->parent;
screen_write_cursormove(&ctx, 0, h, 0); screen_write_cursormove(&ctx, 0, h, 0);
screen_write_box(&ctx, w, sy - h); screen_write_box(&ctx, w, sy - h, NULL);
if (mtd->sort_list != NULL) { if (mtd->sort_list != NULL) {
xasprintf(&text, " %s (sort: %s%s)", mti->name, xasprintf(&text, " %s (sort: %s%s)", mti->name,

View File

@ -981,6 +981,24 @@ const struct options_table_entry options_table[] = {
.text = "The default colour palette for colours zero to 255." .text = "The default colour palette for colours zero to 255."
}, },
{ .name = "popup-style",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ",",
.text = "Default style of popups."
},
{ .name = "popup-border-style",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ",",
.text = "Default style of popup borders."
},
{ .name = "remain-on-exit", { .name = "remain-on-exit",
.type = OPTIONS_TABLE_CHOICE, .type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,

14
popup.c
View File

@ -211,16 +211,22 @@ popup_draw_cb(struct client *c, void *data, struct screen_redraw_ctx *rctx)
u_int i, px = pd->px, py = pd->py; u_int i, px = pd->px, py = pd->py;
struct colour_palette *palette = &pd->palette; struct colour_palette *palette = &pd->palette;
struct grid_cell gc; struct grid_cell gc;
struct grid_cell bgc;
struct options *o = c->session->curw->window->options;
screen_init(&s, pd->sx, pd->sy, 0); screen_init(&s, pd->sx, pd->sy, 0);
screen_write_start(&ctx, &s); screen_write_start(&ctx, &s);
screen_write_clearscreen(&ctx, 8); screen_write_clearscreen(&ctx, 8);
memcpy(&bgc, &grid_default_cell, sizeof bgc);
style_apply(&bgc, o, "popup-border-style", NULL);
bgc.attr = 0;
if (pd->flags & POPUP_NOBORDER) { if (pd->flags & POPUP_NOBORDER) {
screen_write_cursormove(&ctx, 0, 0, 0); screen_write_cursormove(&ctx, 0, 0, 0);
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx, pd->sy); screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx, pd->sy);
} else if (pd->sx > 2 && pd->sy > 2) { } else if (pd->sx > 2 && pd->sy > 2) {
screen_write_box(&ctx, pd->sx, pd->sy); screen_write_box(&ctx, pd->sx, pd->sy, &bgc);
screen_write_cursormove(&ctx, 1, 1, 0); screen_write_cursormove(&ctx, 1, 1, 0);
screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2, screen_write_fast_copy(&ctx, &pd->s, 0, 0, pd->sx - 2,
pd->sy - 2); pd->sy - 2);
@ -228,8 +234,10 @@ popup_draw_cb(struct client *c, void *data, struct screen_redraw_ctx *rctx)
screen_write_stop(&ctx); screen_write_stop(&ctx);
memcpy(&gc, &grid_default_cell, sizeof gc); memcpy(&gc, &grid_default_cell, sizeof gc);
gc.fg = pd->palette.fg; style_apply(&gc, o, "popup-style", NULL);
gc.bg = pd->palette.bg; gc.attr = 0;
palette->fg = gc.fg;
palette->bg = gc.bg;
if (pd->md != NULL) { if (pd->md != NULL) {
c->overlay_check = menu_check_cb; c->overlay_check = menu_check_cb;

View File

@ -645,7 +645,7 @@ screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu,
memcpy(&default_gc, &grid_default_cell, sizeof default_gc); memcpy(&default_gc, &grid_default_cell, sizeof default_gc);
screen_write_box(ctx, menu->width + 4, menu->count + 2); screen_write_box(ctx, menu->width + 4, menu->count + 2, NULL);
screen_write_cursormove(ctx, cx + 2, cy, 0); screen_write_cursormove(ctx, cx + 2, cy, 0);
format_draw(ctx, &default_gc, menu->width, menu->title, NULL); format_draw(ctx, &default_gc, menu->width, menu->title, NULL);
@ -677,16 +677,20 @@ screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu,
/* Draw a box on screen. */ /* Draw a box on screen. */
void void
screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny) screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny,
const struct grid_cell *gcp)
{ {
struct screen *s = ctx->s; struct screen *s = ctx->s;
struct grid_cell gc; struct grid_cell gc;
u_int cx, cy, i; u_int cx, cy, i;
cx = s->cx; cx = s->cx;
cy = s->cy; cy = s->cy;
memcpy(&gc, &grid_default_cell, sizeof gc); if (gcp != NULL)
memcpy(&gc, gcp, sizeof gc);
else
memcpy(&gc, &grid_default_cell, sizeof gc);
gc.attr |= GRID_ATTR_CHARSET; gc.attr |= GRID_ATTR_CHARSET;
gc.flags |= GRID_FLAG_NOPALETTE; gc.flags |= GRID_FLAG_NOPALETTE;

18
tmux.1
View File

@ -4258,6 +4258,24 @@ see the
section. section.
Attributes are ignored. Attributes are ignored.
.Pp .Pp
.It Ic popup-style Ar style
Set the popup style.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
Attributes are ignored.
.Pp
.It Ic popup-border-style Ar style
Set the popup border style.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
Attributes are ignored.
.Pp
.It Ic window-status-activity-style Ar style .It Ic window-status-activity-style Ar style
Set status line style for windows with an activity alert. Set status line style for windows with an activity alert.
For how to specify For how to specify

3
tmux.h
View File

@ -2700,7 +2700,8 @@ void screen_write_hline(struct screen_write_ctx *, u_int, int, int);
void screen_write_vline(struct screen_write_ctx *, u_int, int, int); void screen_write_vline(struct screen_write_ctx *, u_int, int, int);
void screen_write_menu(struct screen_write_ctx *, struct menu *, int, void screen_write_menu(struct screen_write_ctx *, struct menu *, int,
const struct grid_cell *); const struct grid_cell *);
void screen_write_box(struct screen_write_ctx *, u_int, u_int); void screen_write_box(struct screen_write_ctx *, u_int, u_int,
const struct grid_cell *gc);
void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int, void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int,
u_int); u_int);
void screen_write_backspace(struct screen_write_ctx *); void screen_write_backspace(struct screen_write_ctx *);

View File

@ -519,7 +519,7 @@ window_tree_draw_label(struct screen_write_ctx *ctx, u_int px, u_int py,
if (ox > 1 && ox + len < sx - 1 && sy >= 3) { if (ox > 1 && ox + len < sx - 1 && sy >= 3) {
screen_write_cursormove(ctx, px + ox - 1, py + oy - 1, 0); screen_write_cursormove(ctx, px + ox - 1, py + oy - 1, 0);
screen_write_box(ctx, len + 2, 3); screen_write_box(ctx, len + 2, 3, NULL);
} }
screen_write_cursormove(ctx, px + ox, py + oy, 0); screen_write_cursormove(ctx, px + ox, py + oy, 0);
screen_write_puts(ctx, gc, "%s", label); screen_write_puts(ctx, gc, "%s", label);