=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/notify.c,v retrieving revision 1.41 retrieving revision 1.42 diff -c -r1.41 -r1.42 *** src/usr.bin/tmux/notify.c 2022/05/30 12:55:25 1.41 --- src/usr.bin/tmux/notify.c 2022/08/15 09:10:34 1.42 *************** *** 1,4 **** ! /* $OpenBSD: notify.c,v 1.41 2022/05/30 12:55:25 nicm Exp $ */ /* * Copyright (c) 2012 George Nachman --- 1,4 ---- ! /* $OpenBSD: notify.c,v 1.42 2022/08/15 09:10:34 nicm Exp $ */ /* * Copyright (c) 2012 George Nachman *************** *** 33,38 **** --- 33,39 ---- struct session *session; struct window *window; int pane; + const char *pbname; }; static struct cmdq_item * *************** *** 150,155 **** --- 151,158 ---- control_notify_session_closed(ne->session); if (strcmp(ne->name, "session-window-changed") == 0) control_notify_session_window_changed(ne->session); + if (strcmp(ne->name, "paste-buffer-changed") == 0) + control_notify_paste_buffer_changed(ne->pbname); notify_insert_hook(item, ne); *************** *** 165,170 **** --- 168,174 ---- format_free(ne->formats); free((void *)ne->name); + free((void *)ne->pbname); free(ne); return (CMD_RETURN_NORMAL); *************** *** 172,178 **** static void notify_add(const char *name, struct cmd_find_state *fs, struct client *c, ! struct session *s, struct window *w, struct window_pane *wp) { struct notify_entry *ne; struct cmdq_item *item; --- 176,183 ---- static void notify_add(const char *name, struct cmd_find_state *fs, struct client *c, ! struct session *s, struct window *w, struct window_pane *wp, ! const char *pbname) { struct notify_entry *ne; struct cmdq_item *item; *************** *** 188,193 **** --- 193,199 ---- ne->session = s; ne->window = w; ne->pane = (wp != NULL ? wp->id : -1); + ne->pbname = (pbname != NULL ? xstrdup(pbname) : NULL); ne->formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS); format_add(ne->formats, "hook", "%s", name); *************** *** 249,255 **** struct cmd_find_state fs; cmd_find_from_client(&fs, c, 0); ! notify_add(name, &fs, c, NULL, NULL, NULL); } void --- 255,261 ---- struct cmd_find_state fs; cmd_find_from_client(&fs, c, 0); ! notify_add(name, &fs, c, NULL, NULL, NULL, NULL); } void *************** *** 261,267 **** cmd_find_from_session(&fs, s, 0); else cmd_find_from_nothing(&fs, 0); ! notify_add(name, &fs, NULL, s, NULL, NULL); } void --- 267,273 ---- cmd_find_from_session(&fs, s, 0); else cmd_find_from_nothing(&fs, 0); ! notify_add(name, &fs, NULL, s, NULL, NULL, NULL); } void *************** *** 270,276 **** struct cmd_find_state fs; cmd_find_from_winlink(&fs, wl, 0); ! notify_add(name, &fs, NULL, wl->session, wl->window, NULL); } void --- 276,282 ---- struct cmd_find_state fs; cmd_find_from_winlink(&fs, wl, 0); ! notify_add(name, &fs, NULL, wl->session, wl->window, NULL, NULL); } void *************** *** 279,285 **** struct cmd_find_state fs; cmd_find_from_session_window(&fs, s, w, 0); ! notify_add(name, &fs, NULL, s, w, NULL); } void --- 285,291 ---- struct cmd_find_state fs; cmd_find_from_session_window(&fs, s, w, 0); ! notify_add(name, &fs, NULL, s, w, NULL, NULL); } void *************** *** 288,294 **** struct cmd_find_state fs; cmd_find_from_window(&fs, w, 0); ! notify_add(name, &fs, NULL, NULL, w, NULL); } void --- 294,300 ---- struct cmd_find_state fs; cmd_find_from_window(&fs, w, 0); ! notify_add(name, &fs, NULL, NULL, w, NULL, NULL); } void *************** *** 297,301 **** struct cmd_find_state fs; cmd_find_from_pane(&fs, wp, 0); ! notify_add(name, &fs, NULL, NULL, NULL, wp); } --- 303,316 ---- struct cmd_find_state fs; cmd_find_from_pane(&fs, wp, 0); ! notify_add(name, &fs, NULL, NULL, NULL, wp, NULL); ! } ! ! void ! notify_paste_buffer(const char *pbname) ! { ! struct cmd_find_state fs; ! ! cmd_find_clear_state(&fs, 0); ! notify_add("paste-buffer-changed", &fs, NULL, NULL, NULL, NULL, pbname); }