Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-04-14 12:01:08 +01:00
6 changed files with 48 additions and 23 deletions

View File

@@ -828,6 +828,9 @@ control_stop(struct client *c)
struct control_block *cb, *cb1; struct control_block *cb, *cb1;
struct control_sub *csub, *csub1; struct control_sub *csub, *csub1;
if (cs == NULL)
return;
if (~c->flags & CLIENT_CONTROLCONTROL) if (~c->flags & CLIENT_CONTROLCONTROL)
bufferevent_free(cs->write_event); bufferevent_free(cs->write_event);
bufferevent_free(cs->read_event); bufferevent_free(cs->read_event);
@@ -841,6 +844,7 @@ control_stop(struct client *c)
control_free_block(cs, cb); control_free_block(cs, cb);
control_reset_offsets(c); control_reset_offsets(c);
c->control_state = NULL;
free(cs); free(cs);
} }

View File

@@ -90,6 +90,9 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
/* Maimum repeat size. */ /* Maimum repeat size. */
#define FORMAT_MAX_REPEAT 10000 #define FORMAT_MAX_REPEAT 10000
/* Maimum precision. */
#define FORMAT_MAX_PRECISION 100
/* Format modifiers. */ /* Format modifiers. */
#define FORMAT_TIMESTRING 0x1 #define FORMAT_TIMESTRING 0x1
#define FORMAT_BASENAME 0x2 #define FORMAT_BASENAME 0x2
@@ -4868,7 +4871,8 @@ format_replace_expression(struct format_modifier *mexp,
/* The third argument may be precision. */ /* The third argument may be precision. */
if (argc >= 3) { if (argc >= 3) {
prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr); prec = strtonum(mexp->argv[2], -FORMAT_MAX_PRECISION,
FORMAT_MAX_PRECISION, &errstr);
if (errstr != NULL) { if (errstr != NULL) {
format_log(es, "expression precision %s: %s", errstr, format_log(es, "expression precision %s: %s", errstr,
mexp->argv[2]); mexp->argv[2]);

View File

@@ -29,7 +29,8 @@
" 'Previous' 'p' {switch-client -p}" \ " 'Previous' 'p' {switch-client -p}" \
" ''" \ " ''" \
" 'Renumber' 'N' {move-window -r}" \ " 'Renumber' 'N' {move-window -r}" \
" 'Rename' 'n' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ " 'Rename' 'r' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \
" 'Detach' 'd' {detach-client}" \
" ''" \ " ''" \
" 'New Session' 's' {new-session}" \ " 'New Session' 's' {new-session}" \
" 'New Window' 'w' {new-window}" " 'New Window' 'w' {new-window}"

View File

@@ -208,8 +208,12 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c,
format_add(ne->formats, "hook_window", "@%u", w->id); format_add(ne->formats, "hook_window", "@%u", w->id);
format_add(ne->formats, "hook_window_name", "%s", w->name); format_add(ne->formats, "hook_window_name", "%s", w->name);
} }
if (wp != NULL) if (wp != NULL) {
format_add(ne->formats, "hook_pane", "%%%d", wp->id); format_add(ne->formats, "hook_pane", "%%%d", wp->id);
format_add(ne->formats, "hook_window", "@%u", wp->window->id);
format_add(ne->formats, "hook_window_name", "%s",
wp->window->name);
}
format_log_debug(ne->formats, __func__); format_log_debug(ne->formats, __func__);
if (c != NULL) if (c != NULL)

View File

@@ -414,10 +414,10 @@ const struct options_table_entry options_table[] = {
.choices = options_table_get_clipboard_list, .choices = options_table_get_clipboard_list,
.default_num = 1, .default_num = 1,
.text = "When an application requests the clipboard, whether to " .text = "When an application requests the clipboard, whether to "
"ignore the request ('off'); respond with the newest buffer " "ignore the request ('off'); respond with the newest buffer "
"('buffer'); request the clipboard from the most recently " "('buffer'); request the clipboard from the most recently "
"used terminal ('request'); or to request the clipboard, " "used terminal ('request'); or to request the clipboard, "
"create a buffer, and send it to the application ('both')." "create a buffer, and send it to the application ('both')."
}, },
{ .name = "history-file", { .name = "history-file",
@@ -1024,7 +1024,8 @@ const struct options_table_entry options_table[] = {
.scope = OPTIONS_TABLE_SESSION, .scope = OPTIONS_TABLE_SESSION,
.flags = OPTIONS_TABLE_IS_ARRAY, .flags = OPTIONS_TABLE_IS_ARRAY,
.default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK " .default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK "
"SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY", "SSH_AGENT_PID SSH_CONNECTION WAYLAND_DISPLAY "
"WINDOWID XAUTHORITY",
.text = "List of environment variables to update in the session " .text = "List of environment variables to update in the session "
"environment when a client is attached." "environment when a client is attached."
}, },

41
popup.c
View File

@@ -103,6 +103,27 @@ static const struct menu_item popup_internal_menu_items[] = {
{ NULL, KEYC_NONE, NULL } { NULL, KEYC_NONE, NULL }
}; };
static void
popup_free(struct popup_data *pd)
{
server_client_unref(pd->c);
if (pd->job != NULL)
job_free(pd->job);
input_free(pd->ictx);
free(pd->or[0].ranges);
free(pd->or[1].ranges);
free(pd->r.ranges);
screen_free(&pd->s);
colour_palette_free(&pd->palette);
free(pd->title);
free(pd->style);
free(pd->border_style);
free(pd);
}
static void static void
popup_reapply_styles(struct popup_data *pd) popup_reapply_styles(struct popup_data *pd)
{ {
@@ -343,22 +364,8 @@ popup_free_cb(struct client *c, void *data)
cmdq_get_client(item)->retval = pd->status; cmdq_get_client(item)->retval = pd->status;
cmdq_continue(item); cmdq_continue(item);
} }
server_client_unref(pd->c);
if (pd->job != NULL) popup_free(pd);
job_free(pd->job);
input_free(pd->ictx);
free(pd->or[0].ranges);
free(pd->or[1].ranges);
free(pd->r.ranges);
screen_free(&pd->s);
colour_palette_free(&pd->palette);
free(pd->title);
free(pd->style);
free(pd->border_style);
free(pd);
} }
static void static void
@@ -857,6 +864,10 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px,
pd->job = job_run(shellcmd, argc, argv, env, s, cwd, pd->job = job_run(shellcmd, argc, argv, env, s, cwd,
popup_job_update_cb, popup_job_complete_cb, NULL, pd, popup_job_update_cb, popup_job_complete_cb, NULL, pd,
JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE|JOB_DEFAULTSHELL, jx, jy); JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE|JOB_DEFAULTSHELL, jx, jy);
if (pd->job == NULL) {
popup_free(pd);
return (-1);
}
pd->ictx = input_init(NULL, job_get_event(pd->job), pd->ictx = input_init(NULL, job_get_event(pd->job),
&pd->palette, c); &pd->palette, c);
} }