mirror of
https://github.com/tmux/tmux.git
synced 2026-10-10 04:04:27 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Add some additional simple events. fix window_copy_mouse_in_selection() indentation; ok nicm@ Work out a single layout for the entire prompt so it can all be drawn together, fixes centered prompts. GitHub issue 5328. Allow drag on a selection to modify it, from Michael Grant. Make split-window inside a floating pane work more nicely and not immediately create an overlapping pane, from Dane Jensen. Set other cell when creating layout set, from Dane Jensen. Size comparison should be >= not >, from Yayo Razo. Remove worflow from master
This commit is contained in:
51
session.c
51
session.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: session.c,v 1.105 2026/07/10 13:38:45 nicm Exp $ */
|
||||
/* $OpenBSD: session.c,v 1.106 2026/07/13 13:01:14 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -471,6 +471,29 @@ session_last(struct session *s)
|
||||
return (session_set_current(s, wl));
|
||||
}
|
||||
|
||||
/* Fire session window changed. */
|
||||
static void
|
||||
session_fire_window_changed(struct session *s, struct winlink *wl,
|
||||
struct winlink *old)
|
||||
{
|
||||
struct event_payload *ep;
|
||||
struct cmd_find_state fs;
|
||||
|
||||
ep = event_payload_create();
|
||||
cmd_find_from_winlink(&fs, wl, 0);
|
||||
event_payload_set_target(ep, &fs);
|
||||
event_payload_set_session(ep, "session", s);
|
||||
event_payload_set_window(ep, "window", wl->window);
|
||||
event_payload_set_window(ep, "new_window", wl->window);
|
||||
event_payload_set_int(ep, "window_index", wl->idx);
|
||||
event_payload_set_int(ep, "new_window_index", wl->idx);
|
||||
if (old != NULL) {
|
||||
event_payload_set_window(ep, "old_window", old->window);
|
||||
event_payload_set_int(ep, "old_window_index", old->idx);
|
||||
}
|
||||
events_fire("session-window-changed", ep);
|
||||
}
|
||||
|
||||
/* Set current winlink to wl .*/
|
||||
int
|
||||
session_set_current(struct session *s, struct winlink *wl)
|
||||
@@ -493,7 +516,7 @@ session_set_current(struct session *s, struct winlink *wl)
|
||||
winlink_clear_flags(wl);
|
||||
window_update_activity(wl->window);
|
||||
tty_update_window_offset(wl->window);
|
||||
events_fire_session("session-window-changed", s);
|
||||
session_fire_window_changed(s, wl, old);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -540,12 +563,33 @@ session_group_new(const char *name)
|
||||
return (sg);
|
||||
}
|
||||
|
||||
/* Fire session group changed. */
|
||||
static void
|
||||
session_group_fire(const char *name, struct session_group *sg,
|
||||
struct session *s)
|
||||
{
|
||||
struct event_payload *ep;
|
||||
struct cmd_find_state fs;
|
||||
|
||||
ep = event_payload_create();
|
||||
if (session_alive(s)) {
|
||||
cmd_find_from_session(&fs, s, 0);
|
||||
event_payload_set_target(ep, &fs);
|
||||
}
|
||||
event_payload_set_session(ep, "session", s);
|
||||
event_payload_set_string(ep, "group", "%s", sg->name);
|
||||
event_payload_set_uint(ep, "group_size", session_group_count(sg));
|
||||
events_fire(name, ep);
|
||||
}
|
||||
|
||||
/* Add a session to a session group. */
|
||||
void
|
||||
session_group_add(struct session_group *sg, struct session *s)
|
||||
{
|
||||
if (session_group_contains(s) == NULL)
|
||||
if (session_group_contains(s) == NULL) {
|
||||
TAILQ_INSERT_TAIL(&sg->sessions, s, gentry);
|
||||
session_group_fire("session-added-to-group", sg, s);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove a session from its group and destroy the group if empty. */
|
||||
@@ -556,6 +600,7 @@ session_group_remove(struct session *s)
|
||||
|
||||
if ((sg = session_group_contains(s)) == NULL)
|
||||
return;
|
||||
session_group_fire("session-removed-from-group", sg, s);
|
||||
TAILQ_REMOVE(&sg->sessions, s, gentry);
|
||||
if (TAILQ_EMPTY(&sg->sessions)) {
|
||||
RB_REMOVE(session_groups, &session_groups, sg);
|
||||
|
||||
Reference in New Issue
Block a user