Commit graph

4235 commits

Author SHA1 Message Date
Daniel Eklöf
e03257d342
box-drawing: U+256C - BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: add missing corner
The inner corner, where the upper/left lines meet, were missing
2021-05-17 17:58:29 +02:00
Daniel Eklöf
8d09ba5bd2
box-drawing: include pixman image in the buffer we’re passing around 2021-05-17 17:58:29 +02:00
Daniel Eklöf
ed60c66522
Merge branch 'reflow-performane-no-new-row-initialization'
Part of #504
2021-05-17 17:57:47 +02:00
Daniel Eklöf
1aa4a31c6f
grid: reflow: free old rows as soon as we’re done with them
This reduces the memory cost of reflowing text, as we no longer needs
to hold both the old and the new grid, in their entirety, in memory at
the same time.
2021-05-17 17:57:41 +02:00
Daniel Eklöf
11c7990ec8
grid: reflow: don’t initialize newly allocated rows
We’re going to write to it immediately anyway. In most cases, *all*
newly allocated, and zero-initialized, cells are overwritten.

So let’s skip the zero-initialization of the new cells.

There are two cases where we need to explicitly clear cells now:

* When inserting a hard line break - erase the remaining cells
* When done, the *last* row may not have been completely written -
  erase the remaining cells
2021-05-17 17:57:41 +02:00
Daniel Eklöf
ba23ee73e5
Merge branch 'font-scaling-factor-wrong'
Closes #509
2021-05-17 17:56:02 +02:00
Daniel Eklöf
2afc678236
term: get rid of term->font_scale, use term->scale only
We only needed term->font_scale to be able to detect scaling factor
changes (term->font_scale != term->scale).

But, we already have the old scaling factor in all places where
term_font_dpi_changed() is called, so let’s pass the old scaling
factor as an argument instead.
2021-05-17 17:55:49 +02:00
Daniel Eklöf
e7c01f3e52
changelog: fonts sometimes not being reloaded with the correct scaling factor 2021-05-17 17:55:49 +02:00
Daniel Eklöf
0e7e7b769b
render: simply check for an invalid (not set) scaling factor 2021-05-17 17:55:49 +02:00
Daniel Eklöf
0935428695
term: remove get_font_scale()
get_font_scale() was used to get the new scaling factor when loading
fonts. This was then compared to the last seen font scaling factor. If
there was no difference, the fonts were not reloaded.

The problem was, the initial term->scale was set differently. This
sometimes led to term->scale=2, while get_font_scale() return 1. That
meant, fonts were initially scaled by 2 (when dpi-aware=no). Later,
when mapped on an output (and thus term->scale being set to 1), the
fonts weren’t reloaded with the correct scaling factor since the
cached term->font_scale value was already 1.

Since term->scale always reflects the *new* scaling factor when
term_font_dpi_changed() is called, use that directly, and remove
get_font_scale().

Also rename the following functions:

* font_should_size_by_dpi() -> font_size_by_dpi_for_scale()
* font_size_by_dpi() -> font_sized_by_dpi()
* font_size_by_scale() -> font_sized_by_scale()
2021-05-17 17:55:39 +02:00
Daniel Eklöf
3405a9c81c
Merge branch 'reflow-performance'
Part of #504
2021-05-16 18:48:19 +02:00
Craig Barnes
cf3eeff951 Merge branch 'vt-anywhere-fix2' 2021-05-16 11:50:19 +01:00
Daniel Eklöf
a0ab4f3f1c
Merge branch 'sixel-dont-shrink-below-sra-size' 2021-05-16 11:05:59 +02:00
Daniel Eklöf
e0f1a4ae33
sixel: don’t *ever* shrink image below its SRA size
If the image was accompanied with a “Set Raster Attributes” (SRA)
command, make sure we *never* shrink the image below the size
specified in the SRA.

Images are normally shrunk when their bottom rows are fully
transparent. This enables sixels that aren’t a multiple of 6 to be
emitted, without also emitting an SRA command.

But if there *is* an SRA command, obey it.

Verified against XTerm-367
2021-05-16 11:00:32 +02:00
Craig Barnes
d37b2a7f7b Update term->vt.state for each iteration of vt_from_slave() loop
Otherwise it may be stale when read by the anywhere() function.
2021-05-15 19:20:36 +01:00
Daniel Eklöf
8d1b724056
grid: reflow: qsort_r() is not portable
Replace with qsort() + global variable. Not thread safe!
2021-05-15 13:37:46 +02:00
Daniel Eklöf
aa1f589e3f
grid: include <stdlib.h>, for qsort_r() 2021-05-15 13:32:10 +02:00
Daniel Eklöf
c7e51bdf72
grid: reflow: always run qsort_r(), handle rows == 0 in tp_cmp() instead 2021-05-15 13:00:46 +02:00
Daniel Eklöf
528e91aece
grid: take scrollback start into account when sorting the tracking points array
The row numbers in the tracking points are in absolute
numbers. However, when we walk the old grid, we do so starting in the
beginning of the scrollback history.

We must ensure the tracking points are sorted such that the *first*
one we see is the “oldest” one. I.e. the one furthest back in the
scrollback history.
2021-05-15 12:54:59 +02:00
Daniel Eklöf
60a55d04ac
grid: fix 32-bit compilation 2021-05-15 12:11:58 +02:00
Daniel Eklöf
a5d7f2e592
grid: reflow: tag tracking point if-statements with likely/unlikely 2021-05-15 11:44:13 +02:00
Daniel Eklöf
0d6abf1515
grid: reflow: use a sorted array for tracking points
Instead of iterating a linked list of tracking points, for *each and
every* cell in the old grid, use a sorted array.

This allows us to step through the array of tracking points as we walk
the old grid; each time we match a tracking point, we move to the next
one.

This means we only have to check a single tracking point for each cell.
2021-05-15 11:40:39 +02:00
Daniel Eklöf
d2c0a65b70
render: set tracking point count to 0 if there’s no active selection 2021-05-15 11:39:59 +02:00
Daniel Eklöf
a5ec26ccc9
grid: reflow: no need to check for combining characters
Since we no longer call wcwidth(), we don’t need the base character.
2021-05-15 00:12:51 +02:00
Daniel Eklöf
8e05f42a1c
grid: don’t depend on wcwidth()
Calling wcwidth() on every character in the entire scrollback history
is slow.

We already have the character width encoded in the grid; it’s in the
CELL_SPACERs following a multi-column character.

Thus, when we see a non-SPACER character, that isn’t in the last
column, peek the next character. If it’s a SPACER, get the current
characters width from it.

The only thing we need the width for, is to be able to print padding
SPACERS in the right margin, if the there isn’t enough space on the
current row for the current character.
2021-05-14 16:32:06 +02:00
Daniel Eklöf
d9e1aefb91
term: rename CELL_MULT_COL_SPACER -> CELL_SPACER, and change its definition
Instead of using CELL_SPACER for *all* cells that previously used
CELL_MULT_COL_SPACER, include the remaining number of spacers
following, and including, itself. This is encoded by adding to the
CELL_SPACER value.

So, a double width character will now store the character itself in
the first cell (just like before), and CELL_SPACER+1 in the second
cell.

A three-cell character would store the character itself, then
CELL_SPACER+2, and finally CELL_SPACER+1.

In other words, the last spacer is always CELL_SPACER+1.

CELL_SPACER+0 is used when padding at the right margin. I.e. when
writing e.g. a double width character in the last column, we insert a
CELL_SPACER+0 pad character, and then write the double width character
in the first column on the next row.
2021-05-14 14:41:02 +02:00
Daniel Eklöf
5bec83c406
grid: add compile-time define to enable timing of the reflow operation 2021-05-14 14:30:18 +02:00
Daniel Eklöf
92e517ae34
Merge branch 'xdg-activation'
Closes #487
2021-05-14 14:23:19 +02:00
Daniel Eklöf
8211484185
changeloge: xdg-activation support 2021-05-14 14:22:43 +02:00
Daniel Eklöf
3c898770cb
ci: try switching the gitlab CI from alpine:latest -> alpine:edge 2021-05-14 13:26:13 +02:00
Daniel Eklöf
584d2cacf1
wayland: workaround epoll-shim defining the macro close 2021-05-14 13:26:13 +02:00
Daniel Eklöf
03e1b906ab
meson: add xdg-activation-v1.xml conditionally
Only enable XDG activation when compiling against wayland-protocols
1.21. Older versions don’t have this protocol.

When available, define HAVE_XDG_ACTIVATION.

Make all usages of xdg_activation_v1 and xdg_activation_token_v1
conditional.
2021-05-14 13:26:13 +02:00
Daniel Eklöf
bf44f3f594
pgo: add wayl_win_set_urgent() stub 2021-05-14 13:26:13 +02:00
Daniel Eklöf
f5f1bc8dd9
wayland: set xdg activation token surface to our top-level 2021-05-14 13:26:13 +02:00
Daniel Eklöf
3e92361534
xdg-activation: initial support for setting urgency using XDG activation 2021-05-14 13:26:04 +02:00
Craig Barnes
95bbab8fba Merge branch 'vt-anywhere-cleanup' 2021-05-13 10:08:41 +01:00
Daniel Eklöf
cb62944dce
Merge branch 'install-tweaks' 2021-05-13 11:06:30 +02:00
Daniel Martí
8ae8635add INSTALL: fix an unclosed markdown quote
While skimming this doc, I noticed that "-Dterminfo" wasn't rendering
properly as it was lacking its closing backquote.

While at it, tweak the Arch wiki link, as it redirects to replace
/index.php with /title.
2021-05-13 09:49:38 +01:00
Craig Barnes
e4ff8d83d1 vt: make anywhere() function return term->vt.state by default
Instead of passing a `default_return` parameter, which is always
just the current state anyway.
2021-05-13 07:47:32 +01:00
Craig Barnes
8bb69f22b7 vt: clean up handling of "anywhere" actions 2021-05-13 07:47:26 +01:00
Daniel Eklöf
4ed545f4d8
Merge branch 'no-underlines-below-cell'
Closes #503
2021-05-12 20:10:58 +02:00
Daniel Eklöf
2ac8509c82
render: force underlines to be visible
In some cases, the underline position (typically provided by the font,
mind you), end up below the cell, making it visible.

Note that below the cell here means below the line. I.e. the font
provided underline position is below the font provided line height...

Oh well.

Doing this in foot rather than fcft, since other applications
typically don’t have to clip the rendered text.

Closes #503
2021-05-12 20:10:04 +02:00
Daniel Eklöf
9b5330bf29
Merge branch 'remove-plasma-quirk' 2021-05-12 20:08:56 +02:00
Daniel Eklöf
29776dbd1f
quirk: remove plasma/kwin quirk
Older version of Plasma/KWin had an issue where buffer damage recorded
before the buffer was attached were ignored. This appears to have been
fixed now.
2021-05-12 20:08:40 +02:00
Daniel Eklöf
04215bac6c
Merge branch 'double-buffering'
Closes #478
2021-05-12 20:07:40 +02:00
Daniel Eklöf
07d0acbabf
changelog: improved performance when double buffering 2021-05-12 20:07:18 +02:00
Daniel Eklöf
dc4f60fd4f
render: always do a full repaint if last buffer’s dimension doesn’t match 2021-05-12 20:06:15 +02:00
Daniel Eklöf
51dec651f4
render: add margins to buffer’s dirty region when rendering margins 2021-05-12 20:06:15 +02:00
Daniel Eklöf
945a346596
shm: clear buffer’s dirty region before returning a cached buffer
A non-busy buffer should always have an empty dirty region
2021-05-12 20:06:15 +02:00
Daniel Eklöf
37bbf44f6d
shm: set ‘age’ in newly allocated buffers to something large
This ensures we don’t try to do a partial update of fresh buffer.
2021-05-12 20:06:15 +02:00