=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window.c,v retrieving revision 1.70 retrieving revision 1.71 diff -c -r1.70 -r1.71 *** src/usr.bin/tmux/window.c 2012/01/29 02:22:11 1.70 --- src/usr.bin/tmux/window.c 2012/01/30 09:39:34 1.71 *************** *** 1,4 **** ! /* $OpenBSD: window.c,v 1.70 2012/01/29 02:22:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window.c,v 1.71 2012/01/30 09:39:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 58,64 **** /* Global panes tree. */ struct window_pane_tree all_window_panes; ! u_int next_window_pane; void window_pane_read_callback(struct bufferevent *, void *); void window_pane_error_callback(struct bufferevent *, short, void *); --- 58,65 ---- /* Global panes tree. */ struct window_pane_tree all_window_panes; ! u_int next_window_pane_id; ! u_int next_window_id; void window_pane_read_callback(struct bufferevent *, void *); void window_pane_error_callback(struct bufferevent *, short, void *); *************** *** 104,109 **** --- 105,122 ---- return (RB_FIND(winlinks, wwl, &wl)); } + struct winlink * + winlink_find_by_window_id(struct winlinks *wwl, u_int id) + { + struct winlink *wl; + + RB_FOREACH(wl, winlinks, wwl) { + if (wl->window->id == id) + return (wl); + } + return NULL; + } + int winlink_next_index(struct winlinks *wwl, int idx) { *************** *** 249,260 **** --- 262,288 ---- } struct window * + window_find_by_id(u_int id) + { + struct window *w; + u_int i; + + for (i = 0; i < ARRAY_LENGTH(&windows); i++) { + w = ARRAY_ITEM(&windows, i); + if (w->id == id) + return (w); + } + return NULL; + } + + struct window * window_create1(u_int sx, u_int sy) { struct window *w; u_int i; w = xcalloc(1, sizeof *w); + w->id = next_window_id++; w->name = NULL; w->flags = 0; *************** *** 571,577 **** wp = xcalloc(1, sizeof *wp); wp->window = w; ! wp->id = next_window_pane++; RB_INSERT(window_pane_tree, &all_window_panes, wp); wp->cmd = NULL; --- 599,605 ---- wp = xcalloc(1, sizeof *wp); wp->window = w; ! wp->id = next_window_pane_id++; RB_INSERT(window_pane_tree, &all_window_panes, wp); wp->cmd = NULL;