Re: [PATCH 2/3] Centralise window/session choose-mode code.

2010-12-28 Thread Nicholas Marriott
On Tue, Dec 28, 2010 at 08:25:50PM +, Thomas Adam wrote: > On Tue, Dec 28, 2010 at 07:56:26PM +, Nicholas Marriott wrote: > > The best thing rather than messing around with a union or long might be > > to make the closure for the choose callback a struct which has the stuff > > to identify

Re: [PATCH 2/3] Centralise window/session choose-mode code.

2010-12-28 Thread Thomas Adam
On Tue, Dec 28, 2010 at 07:56:26PM +, Nicholas Marriott wrote: > The best thing rather than messing around with a union or long might be > to make the closure for the choose callback a struct which has the stuff > to identify session and window and client, then each command just uses > whicheve

Re: [PATCH 2/3] Centralise window/session choose-mode code.

2010-12-28 Thread Nicholas Marriott
I'm not sure about the type_flags stuff in here. I'd probably have some smaller functions like window_choose_add_window and window_choose_add_session which add 1 line with the window or session. Then for choose-window you do: for each window in session: if (window_choose_add_window(s, w, 0))

[PATCH 2/3] Centralise window/session choose-mode code.

2010-12-27 Thread Thomas Adam
Factor out the code which puts the choice of choosing windows and/or sessions into a common place. --- cmd-choose-session.c | 28 + cmd-choose-window.c | 35 ++-- window-choose.c | 107 ++ 3 files changed, 113 inser