| Commit message (Collapse) | Author | Age | Lines |
| | |
|
| |
|
|
|
| |
If synchronized updates are already enabled when we receive a request
to enable them, extend the timeout.
|
| |
|
|
|
| |
Disable the delayed rendering timers when enabling application
synchronized updates, not every time we've received ptmx data.
|
| |
|
|
| |
From render -> terminal
|
| |
|
|
|
| |
This ensures we can recover from a crashing (or bad behaving)
application that sends a BSU but then never sends an ESU.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This reverts commit f5e27b49eb53ec64a592236680deee0c68c32f0f.
|
| | |
|
| |
|
|
|
|
|
|
| |
This means that the read handler now has to keep reading until we get
EAGAIN.
But it also means we don't have to flip the EPOLLOUT flag in the FDM
handler back and forth when writing to the PTY.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With a bad behaving client (e.g. 'less' with mouse support enabled),
we can end up with a *lot* of xcursor updates (so much, that we
flooded the wayland socket before we implemented a blocking
wayl_flush()).
Since there's little point in updating the cursor more than once per
frame interval, use frame callbacks to throttle the updates.
This works more or lesslike normal terminal refreshes:
render_xcursor_set() stores the last terminal (window) that had (and
updated) the cursor.
The renderer's FDM hook checks if we have such a pending terminal set,
and if so, tries to refresh the cursor.
This is done by first checking if we're already waiting for a callback
from a previous cursor update, and if so we do nothing; the callback
will update the cursor for the next frame. If we're *not* already
waiting for a callback, we update the cursor immediately.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wl_display_dispatch() calls poll(), which is unnecessary since we
already know the FD is readable.
Use the more lower level wl_display_read_events() +
wl_display_dispatch_pending().
These require wl_display_prepare_read() to have been called.
The idea is to call wl_display_prepare_read() **before** calling
poll().
Thus, we do this more or less last in wayl_init(), and at the **end**
of the FDM handler.
However, having taking this lock also means we no longer can call
wl_display_roundtrip() directly (it will hang).
So, add a wrapper, wayl_roundtrip(), that cancels the read intent,
does the roundtrip, and then re-acquires the read intent.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of having `wayl_win_init()` call
`wl_display_roundtrip()` (which it itself doesn't need), call it from
`term_init()`.
This allows us to add ourselves (the new terminal instance) to the
terminal list in the wayland backend, before triggering the wayland
events caused by `wayl_win_init()`.
This is turn allows the wayland backend to find/lookup the new
terminal when those events occur..
|
| | |
|
| |
|
|
|
|
|
| |
These functions should be called when the terminal gets or loses
visual focus.
Note that this isn't necessarily the same as having keyboard focus.
|
| | |
|
| | |
|
| |
|
|
|
| |
Emacs with a split screen often goes above 200µs. 500µs is still much
better than 2000µs...
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows us to measure the time between to refresh delays. That is,
when we decide to delay a refresh, we store the current time.
If we hit that code path _again_, without having refreshed, we
calculate the time that has passed.
This gives us an estimate for how we should set our lower delay
timeout.
This is of course application dependent, but is still much better than
simply guessing a value...
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a flag, -p,--presentation-timings, that enables input lag
measuring using the presentation time Wayland protocol.
When enabled, we store a timestamp when we *send* a key to the
slave. Then, when we commit a frame for rendering to the compositor,
we request presentation feedback. We also store a timestamp for when
the frame was committed.
The 'presented' callback then looks at the input and commit
timestamps, and compares it with the presented timestamp.
The delay is logged at INFO when the delay was less than one frame
interval, at WARN when it was one frame interval, and at ERR when it
was two or more frame intervals.
We also update statistic counters that we log when foot is shut down.
|
| |
|
|
|
|
|
|
|
|
| |
This is used when spawning the slave, to set its current working
directory just before we exec() the client.
In a regular foot instance, we set the cwd from getcwd().
In a foot server instance, each connecting client sends its cwd to the
server, and we use that.
|
| |
|
|
|
|
|
| |
This sets the initial current working directory, as it is when the
terminal is instantiated.
We chdir() to it just before spawning a new terminal.
|
| | |
|
| |
|
|
| |
Bind ctrl+shift+return to it
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Increase the low timeout, to try to give clients/slaves more time to
emit data.
Decrease the upper timeout. On average, we should have ~½ frame left
until the next frame. So a maximum delay of a whole frame *will* delay
the update one extra frame in many cases.
Hopefully, the low timeout is still low enough that we don't miss the
next frame, on average.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of trying to figure out if we had to render
something (i.e. something in the grid was dirty), and using that to
determine whether to post a callback or not, we now let
render_refresh() set a flag indication we need to render another
frame.
This simplifies render_grid(), which now _always_ renders, and pushes
it to the compositor.
The callback handler checks the pending flag and simply doesn't call
render_grid() when there's no more pending state to render.
This ends up reducing the number of wakeups when e.g. having a
blinking cursor.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Normally we don't dirty the cell on cursor movement. But, since a
blinking cursor isn't a cursor that has moved, our normal cursor
rendering wont work.
Dirty the cursor cell to force a redraw of it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Blinking can be enabled either by setting the cursor style with
CSI Ps SP q
and selecting a blinking style.
Or, with 'CSI ? 12 h'
Note that both affect the same internal state. I.e. you can disable
blinking with CSI ? 12l after having selected a blinking cursor
style. This is consistent with XTerm behavior.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
In most cases (i.e. when there's only a single output/monitor), this
will be *the* DPI value.
In other cases, well...
The _right_ thing to do is track the outputs our window is actually
mapped on, and re-instantiate fonts depending on the current output's
DPI. But that's for the future...
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The mouse reporting functions are called from input when we receive
Wayland mouse events.
We used to pass the current keyboard modifier (shift, alt, ctrl, etc)
to the terminal functions.
This however is wrong, since we may receive Wayland mouse events
without having keyboard focus. When we don't have keyboard focus, the
modifier state doesn't apply to us.
Remove the modifier arguments from the terminal mouse reporting
functions. These functions now read this state directly instead, but
only when the terminal instance in question has keyboard focus.
|
| |
|
|
|
|
| |
When this returns true, it means we have keyboard focus and are
grabbing the mouse (for e.g. selections), regardless of whether the
client has enabled mouse tracking or not.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Instead of duplicating the code from selection_enabled() that deals
with forced selection, just call selection_enabled().
This was previously not possible since selection_enabled() didn't
require keyboard_focus. Now it does.
|
| | |
|
| |
|
|
|
|
|
| |
We've just re-set the grid offsets, meaning rows 0..term->rows may not
all have been initialized.
Call grid_row_and_alloc() to ensure they are.
|
| |
|
|
|
| |
Mouse tracking always reports clicks, so using a cursor that suggests
you can click makes sense I think.
|
| |
|
|
|
|
|
|
|
|
| |
Show 'text' cursor when:
* we have no mouse tracking enabled
* forced selection has been enabled (shift being held down)
* We're *not* scrollback searching
In all other cases, show the 'left_ptr' cursor.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
When trying to write (to e.g. the slave, or to a clipboard receiver),
we first try to send the data synchronously, and only if that fails do
we switch to asynchronous mode.
However, the first synchronous may (in fact, is likely to) succeed
partially.
|
| |
|
|
| |
TODO: use actual output PPI. Question is *which* output...
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
When we're shutting down a terminal, we destroy our Wayland window,
and assume that will unmap us.
There are cases when this isn't true (most likely when e.g. a screen
locker is active, and the unmap is being deferred).
Handle by explicitly setting focused to NULL.
|
| | |
|
| |
|
|
|
|
| |
In the legacy mouse reporting mode, line and column numbers are
limited to 223 (255-32). In case the current coordinate falls outside
this, simply ignore it (don't report it).
|
| |
|
|
|
| |
This mouse mode is never enabled. I.e. we don't support it. Add
asserts to catch usage of it, should we ever decide to implement it.
|
| |
|
|
|
|
|
|
| |
When support was added for DECOM (absolute/relative row addressing), a
small but noticeable (~3.5%) performance regression was introduced.
Try to improve the situation by simplifying the relative-to-absolute
conversion; only the row needs to be transformed.
|
| |
|
|
| |
This reverts commit 686405b7031736445eeb35206e4a797a8dd78d91.
|
| |
|
|
|
|
|
| |
Adds a linebreak (+ scroll if necessary) if we're in a deferred wrap
and auto-margins are enabled.
Return true when we wrapped, false otherwise.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This list is intended to store tab stop columns
|
| |
|
|
|
|
|
|
|
|
|
| |
The default is absolute mode, where 0,0 is the upper left corner of
the screen.
In relative mode, the origin is relative the top scroll margin.
Internally, we always track the current cursor position in absolute
mode. Every time we the client *sets* or *queries* the cursor position
in relative mode, we translate it to absolute.
|
| | |
|
| | |
|
| |
|
|
| |
TODO: try writing synchronously first
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
A terminal with lots of scrollback history will have allocated a lot
of memory.
Normally, free() wont return this memory to the OS, and we don't seem
to trigger the automatic trim calls.
This means the server would accumulate quite a lot of memory over
time, as terminals come and go.
Now we explicitly trim the memory every time a terminal is destroyed.
|
| | |
|
| | |
|
| |
|
|
|
| |
Break out actual writing to a separate function, and call this
function both from the synchronous and the asynchronous code paths.
|
| |
|
|
|
|
|
|
|
|
| |
Make ptmx non-blocking. Then, when writing data to the slave would
have blocked, use the FDM to asynchronously write the remaining data.
This is done by enabling EPOLLOUT on ptmx, and enqueueing all outgoing
data. The FDM handler will go through the enqueued data, and once all
of it has been written, we turn off EPOLLOUT again (thus switching
back to synchronous writes)
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
While unusual, it *is* possible for a client *not* to terminate when
we close ptmx.
We need to handle this *somehow*. Since it is so unusual, we'll go
with a fairly easy, but synchronous method:
* Register a signal handler for SIGALRM, and setup a 2 second alarm
* Wait for slave to die
* If it didn't die, sent SIGTERM, then re-set the alarm for another 2
seconds.
* If it still hasn't died, send SIGKILL (this time without an alarm).
|
| | |
|
| |
|
|
|
|
| |
When there hasn't been a timeout (or in our case, there was a timeout,
but we reset the timer before we got to the read()), read() returns,
not 0, but -1 with errno == EAGAIN.
|
| |
|
|
|
|
|
|
|
|
|
| |
Since we cancel the timers every now and then, there's a (small)
chance that one handler cancels a timer that has triggered in the same
epoll() iteration.
When this happens, read() blocks.
Fix by making the timer FDs non-blocking, and simply returning when we
read 0 bytes.
|
| | |
|
| | |
|
| |
|
|
| |
main uses this to get the exit code of the terminal.
|
| |
|
|
|
| |
* Close FDs, then delay destruction to next epoll() call
* Destroy window before destroying terminal
|
| | |
|
| |
|
|
| |
This would happen if *both* timers triggered in the same epoll() call.
|
| | |
|