Commit graph

335 commits

Author SHA1 Message Date
Daniel Eklöf
be2490022d
multi-seat: enable xcursor theme support again 2020-07-08 18:08:39 +02:00
Daniel Eklöf
c470825067
wip: multi-seat support
Compiles and runs, but mouse, clipboard and other things have been
disabled.
2020-07-08 16:45:26 +02:00
Daniel Eklöf
c7b2dcc0f4
render: sixel: regression: need to take current offset into account when early-quitting sixel rendering
The sixel images are sorted, that's true. But in order for our row
numer comparisons to actually work, we need to rebase all numbers
against the current scrollback offset (or, the scrollback *end*, to be
precise).
2020-06-28 14:19:43 +02:00
Daniel Eklöf
5158be86d2
render: sixels: break out of loop when we're sure there aren't any more visible images
The sixel list is sorted, with the most recent images *first* in the
list (and thus the "oldest" images are at the back).

This means we can break out of the loop when we see a sixel
that *ends before* the current view starts.

As a minor optimization, we also recognize sixels that *start after*
the current view ends. We can't break out of the loop, but we can skip
trying to render them (they wouldn't have been rendered, but more work
would have been done in render_sixel() to reach this conclusion).
2020-06-28 10:45:30 +02:00
Daniel Eklöf
0969b2ebd7
render: sixel: use pixman_image_composite32() 2020-06-06 14:22:54 +02:00
Daniel Eklöf
fd99b28beb
render: cell: reset clip region also when we're NOT rendering a glyph 2020-06-06 14:22:25 +02:00
Daniel Eklöf
d8a83b500f
render: regression: don't let cell background overflow into the margins
This used to work before because we had a "global" clip region on the
text area, excluding the margins.

When we introduced per-cell clipping, this global clip region was
removed, and the background drawing code could now overflow into the
margins.

This fixes it by setting the cell clip region not just when rendering
a glyph, but before we render the cell background.
2020-06-05 08:10:38 +02:00
Daniel Eklöf
8b320ed296
render: re-write cell clipping to use pixman destination clipping
Our home rolled clip-to-cell code was, obviously, not correct.

The original problem was that we couldn't use pixman clipping since we
have multiple threads writing to the same pixman image, and thus there
would be races between the threads setting clipping.

The fix is actually simple - just instantiate one pixman
image (referencing the same backing image data) for each rendering
thread.
2020-06-04 15:39:19 +02:00
Daniel Eklöf
bddd3fa384
render: do not allow glyphs to overflow into surrounding cells
This would be done cleaner by using destination clipping in pixman,
but since we have multiple threads rendering cells simultaneously,
that is not possible.

We also cannot use source clipping since we need to offset the
destination x,y coordinates with the glyph offsets.

So, roll our own clipping by not allowing the x,y offsets to go
outside the cell boundaries, and adjusting the glyph offset
accordingly.

Closes #21
2020-06-03 17:32:57 +02:00
Daniel Eklöf
8f37c839f3
render: draw hollow block cursor on top of the character, not the opposite 2020-06-02 18:22:55 +02:00
Daniel Eklöf
8fd7c837f7
render: resize: don't try to signal TIOCSWINSZ on a closed ptmx FD 2020-05-27 18:23:35 +02:00
Daniel Eklöf
1a8ccb0ffa
selection/render: sync cells' 'selected' bit before rendering
For performance reasons, we track whether a cell is selected or not
using a bit in a cell's attributes.

This makes it easy for the renderer to determine if the cells should
be rendered as selected or not - it just have to look at the
'selected' bit instead of doing a complex range check against the
current selection.

This works nicely in most cases. But, if the cell is updated, the
'selected' bit is cleared. This results in the renderer rendering the
cell normally, i.e. _not_ selected.

Checking for this, and re-setting the 'selected' bit when the cell is
updated (printed to) is way too expensive as it is in the hot path.

Instead, sync the 'selected' bits just before rendering. This isn't so
bad as it may sound; if there is no selection this is a no-op. Even if
there is a selection, only those cells whose 'selected' bit have been
cleared are dirtied (and thus re-rendered) - these cells would have
been re-rendered anyway.
2020-05-16 21:36:08 +02:00
Daniel Eklöf
b647aa447b
render: only apply transparency to the default background color 2020-05-16 16:26:52 +02:00
Daniel Eklöf
62e0774319
unicode-combining: store seen combining chains "globally" in the term struct
Instead of storing combining data per cell, realize that most
combinations are re-occurring and that there's lots of available space
left in the unicode range, and store seen base+combining combinations
chains in a per-terminal array.

When we encounter a combining character, we first try to pre-compose,
like before. If that fails, we then search for the current
base+combining combo in the list of previously seen combinations. If
not found there either, we allocate a new combo and add it to the
list. Regardless, the result is an index into this array. We store
this index, offsetted by COMB_CHARS_LO=0x40000000ul in the cell.

When rendering, we need to check if the cell character is a plain
character, or if it's a composed character (identified by checking if
the cell character is >= COMB_CHARS_LO).

Then we render the grapheme pretty much like before.
2020-05-03 11:03:22 +02:00
Daniel Eklöf
ef637fb5e8
render: don't re-instantiate the foreground pixman source 2020-05-02 22:14:48 +02:00
Daniel Eklöf
d945b68b73
unicode-combine: remove utf8proc dependency
We only used utf8proc to try to pre-compose a glyph from a base and
combining character.

We can do this ourselves by using a pre-compiled table of valid
pre-compositions. This table isn't _that_ big, and binary searching it
is fast.

That is, for a very small amount of code, and not too much extra RO
data, we can get rid of the utf8proc dependency.
2020-05-02 17:29:00 +02:00
Daniel Eklöf
3b29aa95c9
render: de-indent #if statement 2020-05-01 21:51:40 +02:00
Daniel Eklöf
3474624c2c
unicode-combining: completely remove unicode combining characters when feature is disabled 2020-05-01 12:05:38 +02:00
Daniel Eklöf
76567e9ef0
render: render combining characters
This is basically just a loop that renders additional glyphs on top
off the base glyph.

Since we now need access to the row struct, for the combining
characters, the function prototype for 'render_cell()' has changed.

When rendering the combining characters we also need to deal with
broken fonts; some fonts use positive offsets (as if the combining
character was a regular character), while others use a negative
offset (to be used as if you had already advanced the pen position).

We handle both - a positive offset is rendered just like a regular
glyph. When we see a negative offset we simply add the width of a cell
first.
2020-05-01 11:56:13 +02:00
Daniel Eklöf
69c3e74498
util.h: new header file defining commonly used macros 2020-05-01 11:46:24 +02:00
Daniel Eklöf
74d30dc410
csd: buttons: use default color table as default colors
If the user hasn't configured any CSD button colors, use the color
scheme's default colors for blue/green/red.
2020-04-29 20:06:16 +02:00
Daniel Eklöf
e9ed3025a8
damage: remove 'scroll' sub struct
There is no other types of damage but scroll damage.
2020-04-26 12:47:19 +02:00
Daniel Eklöf
ce280537de
render: make 'glyph' assignment more readable 2020-04-26 12:39:42 +02:00
Daniel Eklöf
f736d467d9
fcft: fcft_glyph_for_wc() has been renamed to fcft_glyph_rasterize() 2020-04-24 10:53:34 +02:00
Daniel Eklöf
7194f65ae9
fcft: adjust to fcft-2.0 API changes
* font_*() -> fcft_*()
* struct font -> struct fcft_font
* struct glyph -> struct fcft_glyph
* enum subpixel_order -> enum fcft_subpixel
2020-04-21 19:29:36 +02:00
Daniel Eklöf
6f83ef81e5
render: use output's subpixel mode when rasterizing glyphs 2020-04-20 18:38:55 +02:00
Daniel Eklöf
b7593897b7
render: search: improve handling of very long search strings 2020-04-19 14:50:48 +02:00
Daniel Eklöf
fa8b0cbd80
csi: implement CSI Ps ; Ps ; Ps t reporting escape sequences
A lot of the escape sequences on the "CSI Ps ; Ps ; Ps t" form are
expected to return a reply. Thus, not having these implemented means
we will hang if the client sends these escapes.

Not all of these escapes can be meaningfully implemented on Wayland,
and thus this implementation is best effort.

We now support the following escapes:

* 11t   - report if window is iconified (always replies "no")
* 13t   - report window position (always replies 0,0)
* 13;2t - report text area position (replies with margins, since we
          cannot get the window's position)
* 14t   - report text area size, in pixels
* 14;2t - report window size, in pixels
* 15t   - report screen size, in pixels
* 16t   - report cell size, in pixels
* 18t   - report text area size, in cells
* 19t   - report screen size, in cells
2020-04-18 11:51:53 +02:00
Daniel Eklöf
761bf426dc
render: resize: no need to truncate selection anymore - it's being translated 2020-04-17 22:30:56 +02:00
Daniel Eklöf
7eb990c8b1
render: resize: need to translate selection coordinates
While it *looked* like the selection was working before, it really
wasn't.

When rendering, we're looking at the cells' attributes to determine
whether they have been selected or not.

When copying text however, we use the terminal's 'selection' state,
which consists of 'start' and 'end' coordinates.

These need to be translated when reflowing text.
2020-04-17 22:20:27 +02:00
Daniel Eklöf
5509fe514a
render: resize: no need to clear the selection - just truncate if necessary 2020-04-17 21:11:30 +02:00
Daniel Eklöf
ef52ed8a10
grid: reflow: caller may now pass a list of coordinates that should be translated 2020-04-17 21:04:32 +02:00
Daniel Eklöf
5546b40369
grid: grid_reflow() now translates cursor coordinates 2020-04-16 19:38:30 +02:00
Daniel Eklöf
89559d5466
grid: move 'cursor' state from terminal to grid
This way, the 'normal' and 'alt' grids have their own cursor state,
and we don't need to switch between them.
2020-04-16 18:51:14 +02:00
Daniel Eklöf
c96a0b3b3c
misc: replace all explicit zero-initializers with empty initializers 2020-04-13 12:03:11 +02:00
Daniel Eklöf
03bdb40bd9
render: don't dim so much when in search mode 2020-04-10 17:51:33 +02:00
Daniel Eklöf
23b2eed409
render: strip 'pixman' from color function names 2020-04-09 13:41:16 +02:00
Daniel Eklöf
29d4722de5
render: remove unused functions 2020-04-09 13:35:35 +02:00
Daniel Eklöf
03319560f5
shm: scroll: keep shm pool around, and fix its size at max allowed
This lessens the burden on (primarily) the compositor, since we no
longer tear down and re-create the SHM pool when scrolling.

The SHM pool is setup once, and its size is fixed at the maximum
allowed (512MB for now, 2GB would be possible).

This also allows us to mmap() the memfd once. The exposed raw pointer
is simply an offset from the memfd mmapping.

Note that this means e.g. rouge rendering code will be able to write
outside the buffer.

Finally, only do this if the caller explicitly wants to enable
scrolling. The memfd of other buffers are sized to the requested size.
2020-03-25 18:26:58 +01:00
Daniel Eklöf
9bbbd26c7a
render: pace title updates
Synchronize window title updates with window rendering.
2020-03-25 18:23:55 +01:00
Daniel Eklöf
b46ad6a50a
render: explain _why_ we set a clip region 2020-03-24 21:04:30 +01:00
Daniel Eklöf
dc393bd5d7
render: bug: clear clip region before tinting the window 2020-03-24 17:45:45 +01:00
Daniel Eklöf
b08238a1a1
render: attach buffer just before commit 2020-03-24 17:45:38 +01:00
Daniel Eklöf
9a3e97afa7
render: clear scroll damage list when we force-refresh the entire window 2020-03-24 17:45:16 +01:00
Daniel Eklöf
3a04061847
Merge branch 'master' into scroll-damage-performance 2020-03-24 17:44:05 +01:00
Daniel Eklöf
be8b6e8c75
render: fdm refresh handler: don't clear pending flags
The pending flags may already be set (from a previous call to the FDM
hook). In this case, they should not be cleared.
2020-03-24 17:42:29 +01:00
Daniel Eklöf
759fd572e9
shm: shm_scroll(): initial implementation of reverse scrolling
Implemented by truncating the file size and moving the offset
backwards. This means we can only reverse scroll when we've previously
scrolled forward.

TODO: figure out if we can somehow do fast reverse scrolling even
though offset is 0 (or well, less than required for scrolling).
2020-03-23 21:14:51 +01:00
Daniel Eklöf
0de3701984
shm: scroll: move top/bottom region handling from renderer into shm
This allows us to restore the regions without copying the contents to
temporary memory.
2020-03-23 20:45:27 +01:00
Daniel Eklöf
00129b1935
render: scroll: use shm scrolling even though we have a top region 2020-03-23 20:16:19 +01:00
Daniel Eklöf
75180cea37
render: scroll: take margins into account when restoring bottom scroll region 2020-03-23 20:15:53 +01:00