| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
| |
Handle the CSDs and the search box the same way we handle the main
grid; when we need to redraw them, call
render_refresh_{csd,search}(). This sets a flag that is checked after
each FDM iteration. All actual rendering is done here.
This also ties the commits of the Wayland sub-surfaces to the commit
of the main surface.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Some fonts, even monospaced ones, have a negative line gap (line
height < ascent + descent).
Using the font's line height as cell height will result in some glyphs
overflowing into the cell above or below.
Workaround by using which ever value is the largest: the line height
or ascent + descent.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For now, this behavior is controlled with an ifdef. At least kwin
seems very buggy when the decorations are positioned like this (but
normally you'd use server-side decorations with kwin anyway).
This commit also changes 'use_csd' to be a tri-state variable;
when instantiating a window it is set to 'unknown'.
If there's no decoration manager available (e.g. weston), we
immediately set it to 'yes' (use CSDs).
Otherwise, we wait for the decoration manager callback to indicate
whether we should use CSDs or not.
|
| |
|
|
|
|
|
| |
We draw the CSDs in a darker color when we're inactive.
Weston seems to be buggy with synchronized subsurfaces, so temporarily
reconfigure them to desynchronized surfaces.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
This is needed to handle pointer motion and button events correctly,
since mouse actions in e.g. CSD surfaces are very different from mouse
actions in the main window.
|
| | |
|
| |
|
|
|
| |
This ensures sixel images are removed, regardless of _how_ the screen
was erased.
|
| | |
|
| | |
|
| |
|
|
|
| |
When printing a character, or starting a new sixel image, purge all
images that cover the cursor's current row.
|
| |
|
|
|
| |
This implements the CSI escapes for retrieving and (re)setting the
palette size.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In unhook, add the generated image to a list of finished sixel images,
along with positioning and size information.
When rendering, loop this list of images, and render the images (or
parts of) that are visible.
When scrolling, check if any part of the images cover the re-cycled
lines, and if so, remove the *entire* image from the list.
This means we have the following limitations:
* The renderer always renders the whole (visible area of) the
image(s). There are times when this isn't necessary - for example,
when the image is scrolled inside the visible area.
* It would be nice if we could crop the image when parts of it is
scrolled out.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function reloads the font *if* the DPI has changed. To handle
user run-time adjusted font sizes, we record the number of adjustments
made.
Then, when re-loading the font, we first load the font as specified in
the configuration. Then, we re-apply the size adjustment using
font_size_adjust().
Note that this means we end up loading the fonts twice; first using
the default size (but with adjusted DPI), and then again with the
adjusted size. This can probably be improved upon.
The existing font code has been refactored to avoid code
duplication. For example, term_init() now calls
term_font_dpi_changed() to load the initial fonts, instead of directly
instantiating them.
Finally, the way we calculate the DPI to use has changed: instead of
using the highest DPI of all available outputs, we use the highest DPI
of the output's we're actually mapped on. If we're not mapped at all,
we use the globally highest DPI.
Doing it this way means we usually only have to load the fonts
once. Otherwise, we'd end up using the default DPI of 96 when the
terminal is first instantiated (since it's not mapped at that time).
On a single monitor system, we'll use the globally highest DPI at
first, before being mapped. Then when we get mapped, we re-load the
fonts using the highest mapped DPI. But since they'll be the same,
we can skip actually reloading the fonts.
|
| |
|
|
|
| |
This will both zero out the cells, *and* re-initialize the row
properties correctly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To do text reflow, we only need to know if a line has been explicitly
linebreaked or not. If not, that means it wrapped, and that we
should *not* insert a linebreak when reflowing text.
When reflowing text, when reaching the end of a row in the old grid,
only insert a linebreak in the new grid if the old row had been
explicitly linebreaked.
Furthermore, when reflowing text and wrapping a row in the new grid,
mark the previous row as linebreaked if either the last cell was
(the last column in the last row) empty, or the current cell (the
first column in the new row) is empty. If both are non-empty, then we
assume a linewrap.
|
| |
|
|
|
|
| |
When cursor.lcf is set, that means the cursor column was *not*
incremented when we printed the last character. Thus, we should *not*
decrement the column before setting the linefeed bit.
|
| |\ |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
To handle text reflow correctly when a line has a printable character
in the last column, but was still line breaked, we need to track the
fact that the slave inserted a line break here.
Otherwise, when the window width is increased, we'll end up pulling up
the next line, when we really should have inserted a line break.
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
But place an upper limit on the number of iterations we read, to
prevent starvation caused by a bad behaving client to constantly
writes data.
|
| |
|
|
| |
When specified, we don't exit when the slave/client process exits.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
When term_print() was implemented, it introduced a regression where
printing a character when the last cursor was in the last column on a
line would print the character in the wrong column.
This is because term_print() retrieved a pointer to the current
cell *before* line wrapping (and possibly inserting empty cells).
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Allow/disallow subpixel antialiasing in font_glyph_for_wc(), not using
font_enable_subpixel_antialias().
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|