Commit Graph

228 Commits (56447d73c1348c708f36a624416c008e6b262293)

Author SHA1 Message Date
Tiago Cunha e8424d333e Sync OpenBSD patchset 528:
Free the pane bufferevent when the fd is closed (the signal could come before
the error callback).
2009-11-13 16:52:46 +00:00
Tiago Cunha 1b4a76d58f Sync OpenBSD patchset 527:
Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-13 16:51:49 +00:00
Nicholas Marriott 7230fe1648 OS X is still broken, so ask libevent not to use kqueue or poll. 2009-11-11 09:54:07 +00:00
Tiago Cunha fb22aaf87f Sync OpenBSD patchset 510:
EVLOOP_ONCE takes care of the wakeup, so no need to call event_loopexit(NULL).
2009-11-08 23:28:40 +00:00
Tiago Cunha 5ac6ea61bd Sync OpenBSD patchset 509:
Now all timers are events, there is no longer any need to wake up every 50 ms -
only wake up when an event happens.
2009-11-08 23:27:58 +00:00
Tiago Cunha 915031b049 Sync OpenBSD patchset 505:
Move status timer check into the global once-per-second timer, this could maybe
be done better but one every second is better than once every 50 ms.
2009-11-08 23:12:35 +00:00
Tiago Cunha bee17719d8 Sync OpenBSD patchset 503:
Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
2009-11-08 23:09:36 +00:00
Tiago Cunha 40b6941c0f Sync OpenBSD patchset 500:
Tell the client to exit on configuration file error.
2009-11-08 23:06:25 +00:00
Tiago Cunha 2df0882722 Sync OpenBSD patchset 498:
Convert the window pane (pty master side) fd over to use a bufferevent.

The evbuffer API is very similar to the existing tmux buffer API so this was
remarkably painless. Not many possible ways to do it, I suppose.
2009-11-08 23:02:56 +00:00
Tiago Cunha 70b2f1981e Sync OpenBSD patchset 497:
Call event_init() before loading the config file, since potentially it could
set up events.
2009-11-08 23:00:44 +00:00
Tiago Cunha 53ef4c2bab Sync OpenBSD patchset 493:
Switch jobs over to use a bufferevent.
2009-11-08 22:56:04 +00:00
Tiago Cunha dd36982ad5 Sync OpenBSD patchset 491:
Initial changes to move tmux to libevent.

This moves the client-side loops are pretty much fully over to event-based only
(tmux.c and client.c) but server-side (server.c and friends) treats libevent as
a sort of clever poll, waking up after every event to run various things.

Moving the server stuff over to bufferevents and timers and so on will come
later.
2009-11-08 22:40:36 +00:00
Tiago Cunha bbad75fb6c Sync OpenBSD patchset 483:
Change session and client activity and creation time members to have more
meaningful names.

Also, remove the code to try and update the session activity time for the
command client when a command message is received as is pointless because it
des not have a session.
2009-11-04 22:42:31 +00:00
Tiago Cunha ee1cc9f415 Sync OpenBSD patchset 476:
Reorder slightly to tidy code.
2009-11-02 21:39:34 +00:00
Tiago Cunha f4514f5c60 Sync OpenBSD patchset 468:
Move the poll registration functions into the server-*.c files.
2009-10-28 23:14:15 +00:00
Tiago Cunha a5acabd923 Sync OpenBSD patchset 467:
tabs are better; ok nicm
2009-10-28 23:12:38 +00:00
Tiago Cunha e65aa04ad7 Sync OpenBSD patchset 466:
Clear signal flags /before/ taking action and continue afterwards to reduce
chance of dropping signals. Pointed out by deraadt@.
2009-10-28 23:11:07 +00:00
Tiago Cunha cc9ef11985 Sync OpenBSD patchset 438:
Split the server code handling clients, jobs and windows off into separate
files from server.c (merging server-msg.c into the client file) and rather than
iterating over each set after poll(), allow a callback to be specified when the
fd is added and just walk once over the returned pollfds calling each callback
where needed.

More to come, getting this in so it is tested.
2009-10-23 17:49:47 +00:00
Tiago Cunha 941032b707 Sync OpenBSD patchset 403:
When a session is unattached, reset its activity timer to prevent it locking
instantly when reattached.
2009-10-15 01:43:16 +00:00
Tiago Cunha 8bdcc10c8f Sync OpenBSD patchset 393:
Similarly add a tty_cursor_pane function to tidy up most of the calls.
2009-10-15 01:30:00 +00:00
Tiago Cunha 6369fca253 Sync OpenBSD patchset 392:
_absolute is redundant, just use tty_region.
2009-10-15 01:28:14 +00:00
Tiago Cunha 9b771a96f0 Sync OpenBSD patchset 391:
Cleanup: use two functions for region setting, one for absolute and one inside
pane.
2009-10-15 01:26:50 +00:00
Tiago Cunha 6091b051fb Sync OpenBSD patchset 387:
Add a pipe-pane command to allow a pane to be piped to a shell command, for
example:

        pipe-pane 'cat >~/out'

No arguments stops outputing and closes the pipe; the -o flag toggles a pipe
and on and off (useful for key bindings).

Suggested by espie@.
2009-10-12 00:35:08 +00:00
Tiago Cunha 197f8b88bf Sync OpenBSD patchset 384:
Switch run-shell over to queue the command in the background like #().
2009-10-12 00:25:25 +00:00
Tiago Cunha 1b03bc2404 Sync OpenBSD patchset 382:
Collect status from dead jobs and don't invoke the callback until both
all input (the socket is closed) and status is available.
2009-10-12 00:21:08 +00:00
Tiago Cunha b26ea8462e Sync OpenBSD patchset 381:
Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around.

As a side-effect this fixes incorrectly rejecting high cursor positions
(because it was comparing them as signed char), reported by Tom Doherty.
2009-10-12 00:18:19 +00:00
Tiago Cunha 323469723b Sync OpenBSD patchset 380:
Braek some bits out of server_fill_client() that aren't really related to
polling into their own function.
2009-10-12 00:14:44 +00:00
Tiago Cunha d7fa9bc056 Sync OpenBSD patchset 379:
Put all jobs on a global all_jobs list and use that in server.c instead of
running through all the clients.
2009-10-12 00:12:33 +00:00
Tiago Cunha bc236109fd Sync OpenBSD patchset 374:
Rather than running status-left, status-right and window title #() with popen
immediately every redraw, queue them up and run them in the background,
starting each once every status-interval. The actual status line uses the
output from the last run.

This brings several advantages:

- tmux itself may be called from inside #() without causing the server to hang;
- likewise, sleep or similar doesn't cause the server to block;
- commands aren't run excessively often when redrawing;
- commands shared by status-left and status-right, or used multiple times, will
  only be run once.

run-shell and if-shell still use system()/popen() but will be changed over to
use this too later.
2009-10-11 23:55:26 +00:00
Tiago Cunha ea1721bcb0 Sync OpenBSD patchset 373:
New option, mouse-select-pane. If on, the mouse may be used to select the
current pane.

Suggested by sthen@ and also by someone else ages ago who I have forgotten.
2009-10-11 23:46:02 +00:00
Tiago Cunha 6a1ebb11df Sync OpenBSD patchset 371:
Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.

Had this around for a while, tested by a couple of people.
2009-10-11 23:38:16 +00:00
Tiago Cunha 91e4dc83fc Sync OpenBSD patchset 370:
Support for individual session idle time locking. May be enabled by turning off
the lock-server option (it is on by default). When this is off, each session
locks when it has been idle for the lock-after-time setting. When on, the
entire server locks when ALL sessions have been idle for their individual
lock-after-time settings.

This replaces one global-only option (lock-after-time) with another
(lock-server), but the default behaviour is usually preferable so there don't
seem to be many alternatives.

Diff/idea largely from Thomas Adam, tweaked by me.
2009-10-11 23:30:28 +00:00
Tiago Cunha a4ea6a9d19 Sync OpenBSD patchset 369:
Instead of passing a struct pollfd ** around through various functions, build
them into a tree and then convert into a flat poll array before and after poll.

This adds a little code but should reduce annoying problems with ordering when
adding new things that also need to be polled.
2009-10-11 23:25:44 +00:00
Tiago Cunha eb7f8b6d33 Sync OpenBSD patchset 360:
If no target client is specified to commands which accept one, try to guess the
current client, in a similar manner to how sessions already work: if the
current session can be established and has only one client, use that; otherwise
use the most recently created client.
2009-10-06 14:00:50 +00:00
Tiago Cunha 804b8696a4 Sync OpenBSD patchset 352:
Don't allow locked or suspended clients to limit the size of active clients.
2009-09-25 17:47:42 +00:00
Tiago Cunha 4dd332c95e Sync OpenBSD patchset 349:
On SIGTERM, just abandon any suspended/locked clients and leave them to it,
otherwise the server will hang around (refusing new connections) until they
exit properly.
2009-09-23 15:10:37 +00:00
Tiago Cunha 1310ea2729 Sync OpenBSD patchset 347:
Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in
each client.

This means each terminal has to be unlocked individually but simplifies the
code and allows the system password to be used to unlock.

Note that the set-password command is gone, so it will need to be removed from
configuration files, and the -U command line flag has been removed.

This is the third protocol version change so again it is best to stop the tmux
server before upgrading.
2009-09-23 15:00:09 +00:00
Tiago Cunha df7b68480c Sync OpenBSD patchset 343:
Permit multiple prefix keys to be defined, separated by commas, for example:

set -g prefix ^a,^b

Any key in the list acts as the prefix. The send-prefix command always sends
the first key in the list.
2009-09-22 14:22:21 +00:00
Tiago Cunha 3266fb5441 Sync OpenBSD patchset 332:
Regularise some fatal messages.
2009-09-20 22:11:27 +00:00
Tiago Cunha 23d7ed3187 Sync OpenBSD patchset 331:
New option, set-titles-string, to allow the window title to be specified (as
for status-left/right) if set-titles is on. Also only update the title when the
status line is being redrawn.
2009-09-19 18:53:01 +00:00
Tiago Cunha dbaa28492e Sync OpenBSD patchset 327:
The default terminal size should be 80x24, not 80x25.
2009-09-15 23:52:30 +00:00
Tiago Cunha 960cd3da69 Sync OpenBSD patchset 326:
Nuke unused server_client_index function, pointed out by martynas@.
2009-09-15 23:50:32 +00:00
Tiago Cunha 4d4ec52df8 Zap unused variables. 2009-09-13 20:43:21 +00:00
Tiago Cunha 69e7f4af19 Sync OpenBSD patchset 324:
Tidy some common code for destroying sessions into a new function.
2009-09-13 20:37:37 +00:00
Tiago Cunha 0ec1ce005c Sync OpenBSD patchset 322:
Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
2009-09-11 14:13:52 +00:00
Tiago Cunha f0cb57d8ac Sync OpenBSD patchset 321:
While the display-panes indicator is on screen, make the number keys select the
pane with that index.
2009-09-08 00:01:11 +00:00
Tiago Cunha 930f67f474 Sync OpenBSD patchset 320:
Reference count clients and sessions rather than relying on a saved index for
cmd-choose-*.
2009-09-07 23:59:19 +00:00
Tiago Cunha 1de812d5a8 Sync OpenBSD patchset 319:
Tiny cleanup.

ok nicm@
2009-09-07 23:50:07 +00:00
Tiago Cunha bb2d57dcbf Sync OpenBSD patchset 316:
Only redraw all clients once when the backoff timer expires rather than every
second all the time.

Reported by Simon Nicolussi.
2009-09-05 19:03:41 +00:00
Tiago Cunha 51a1f25247 Sync OpenBSD patchset 314:
Tell the user when sleeping due to password backoff.
2009-09-04 20:27:06 +00:00