Commit graph

234 commits

Author SHA1 Message Date
Daniel Eklöf
1e1b204377
csd: don't draw CSDs in fullscreen mode 2020-02-26 12:39:17 +01:00
Daniel Eklöf
f960e7aff7
render: resize: ignore unconfigured windows 2020-02-26 12:21:03 +01:00
Daniel Eklöf
2f587f6f3d
csd: position CSD sub-surfaces *outside* the main window
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.
2020-02-26 12:17:58 +01:00
Daniel Eklöf
cc3dad9599
render: search: take CSD into account 2020-02-25 20:30:45 +01:00
Daniel Eklöf
ef53729242
render: resize with with/height == 0 resizes to user configured dimensions 2020-02-25 20:29:44 +01:00
Daniel Eklöf
595b32ddf9
render: render_resize_*() returns a boolean indicating whether size changed. 2020-02-25 19:51:03 +01:00
Daniel Eklöf
7db9221aa9
render: render_resize(): don't allow too small window sizes 2020-02-25 19:10:48 +01:00
Daniel Eklöf
d3c7d25dae
render: call render_csd() from render_resize(), not render_grid()
The CSDs doesn't need to be re-drawn each time we redraw the grid,
only when the window is resized.
2020-02-25 19:09:49 +01:00
Daniel Eklöf
70ce7245c6
render: export render_csd() 2020-02-25 19:09:29 +01:00
Daniel Eklöf
d15eb936ef
render: make CSD border and title size globally accessible 2020-02-25 19:08:14 +01:00
Daniel Eklöf
0b265cc9a5
render: csd: sort geometry entries 2020-02-24 22:40:02 +01:00
Daniel Eklöf
2798807853
render: csd: render all borders and the title bar
* Still no content in the title bar
* Colors are temporary
* No resize/drag yet
2020-02-24 22:06:20 +01:00
Daniel Eklöf
01a11457a5
Merge branch 'master' into csd 2020-02-24 18:47:08 +01:00
Daniel Eklöf
d804bc8579
term: resize: pre-calculate right/bottom margins 2020-02-24 18:38:11 +01:00
Daniel Eklöf
8368e8184f
csd: wip: something to get started... 2020-02-23 14:17:48 +01:00
Daniel Eklöf
85684bc0c7
render: sixel: don't render sixels on the 'other' grid 2020-02-23 00:41:28 +01:00
Daniel Eklöf
63140a68f5
sixel: calculate image height in (cell) rows 2020-02-22 00:05:25 +01:00
Daniel Eklöf
564e8909f4
render: break out sixel rendering code 2020-02-21 23:48:45 +01:00
Daniel Eklöf
f0fc82f098
sixel: wip: maintain a list of finished, and "active" sixel images
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.
2020-02-21 23:40:35 +01:00
Daniel Eklöf
9e3bfb1eab
sixel: initial support
This implements basic parsing of sixel data. Lots of limitations and
temporary solutions as this is still work-in-progress:

* Maximum image size hardcoded to 800x800
* No HLS color format support
* Image is always rendered at 0x0 in the terminal
2020-02-21 21:53:23 +01:00
Daniel Eklöf
38a682f0d0
render/grid: move grid reflow code to grid.c 2020-02-15 22:19:08 +01:00
Daniel Eklöf
b036a66c42
render: resize: take padding from configuration into account 2020-02-15 19:01:26 +01:00
Daniel Eklöf
f07a124c11
render: reflow: set 'linebreak' flag before inserting new line 2020-02-15 18:59:21 +01:00
Daniel Eklöf
3019d59369
render: reflow: remove 'linebreak' flag from recycled rows 2020-02-15 18:58:57 +01:00
Daniel Eklöf
56c2dd4199
render: reflow: no need to mark new rows as dirty 2020-02-15 18:58:36 +01:00
Daniel Eklöf
ab43a6fd37
render: resize: cancel selection before reflowing text
The old selection will no longer be valid once we resize the grids.
2020-02-15 18:57:52 +01:00
Daniel Eklöf
9e6404be11
render: reflow: bug: fix off-by-one
The 'last-row' variable points to the last row the cursor is *on*,
thus it's not a counter, and we need to add one when calculating the
new grid offsets, or we get an off-by-one error.

With this, there's no longer any need to scroll the reflowed text.
2020-02-15 18:56:16 +01:00
Daniel Eklöf
ce8005545d
term: convert cell 'linefeed' attribute to a row 'linebreak' property
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.
2020-02-14 22:39:26 +01:00
Daniel Eklöf
60056fdd61
render: resize: don't reflow text if grid layout hasn't changed
A window resize doesn't necessarily mean the grid layout changes. When
it doesn't, don't reflow text.

This fixes a slowness issue on Sway, when swapping positions of two
~equally sized windows.
2020-02-14 19:03:33 +01:00
Daniel Eklöf
ec63a24c80
render: reflow: erase row when wrapping around the scrollback 2020-02-14 19:03:13 +01:00
Daniel Eklöf
cb015d5eec
render: reflow: mark all "new" rows as dirty 2020-02-14 19:02:36 +01:00
Daniel Eklöf
4b328ead5e
render: resize: do linefeed *after* updating cursor position 2020-02-12 20:39:43 +01:00
Daniel Eklöf
a96a6c2c58
render: resize; heuristics to prevent prompt from being printed on a newline 2020-02-12 20:26:14 +01:00
Daniel Eklöf
ea52d3e570
render: resize: temporarily disable row adjustment
This was intended to prevent a new prompt from being printed on a
newline. However, it breaks normal output under certain conditions,
that have yet to be determined exactly what they are.
2020-02-12 20:16:42 +01:00
Daniel Eklöf
c28c0ab9c2
render: resize: only stay on current row if col is within grid width 2020-02-12 19:49:39 +01:00
Daniel Eklöf
bcd28bcd14
render: spelling 2020-02-12 18:06:15 +01:00
Daniel Eklöf
e56523f326
render: resize: calculated cursor row *should* never be beyond the screen bottom 2020-02-10 22:40:16 +01:00
Daniel Eklöf
88e2ab21b3
render: reflow: clear new line if already allocated 2020-02-10 22:38:30 +01:00
Daniel Eklöf
3ad2ee7681
render: resize: fix cursor positioning at grid wrap around
When current view is at a grid wrap around (last emitted row index is
< grid offset), the cursor row ended up being negative which we then
mapped to the top line.

This is wrong. When we're at a wrap around, re-adjust cursor by adding
the grid's row count.
2020-02-10 22:36:39 +01:00
Daniel Eklöf
8d262e71c1
render: reflow: initial line is always unallocated 2020-02-10 22:36:17 +01:00
Daniel Eklöf
4a169f5643
vt: tag cells that were form-feed:ed, to allow correct text reflow
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.
2020-02-10 21:54:37 +01:00
Daniel Eklöf
80e8f91270
render: reflow: no need to clear cells
We set initialize=true when allocating a new row. This initializes the
cell to 0, with clean=1.
2020-02-10 20:46:02 +01:00
Daniel Eklöf
61b43620fc
render: initial support for text reflow
The algorithm is as follows:

Start at the beginning of the scrollback. That is, at the oldest
emitted lines. This is done by taking the current offset, and adding
the number of (old) screen rows, and then iterating until we find the
first allocated line.

Next, we iterate the entire old grid. At the beginning, we allocate a
line for the new grid, and setup a global pointer for that line, and
the current cell index.

For each line in the old grid, iterate its cells. Copy the the cells
over to the new line. Whenever the new line reaches its maximum number
of columns, we line break it by increasing the current row index and
allocating a new row (if necessary - we may be overwriting old
scrollback if the new grid is smaller than the old grid).

Whenever we reach the end of a line of the old grid, we insert a line
break in the new grid's line too **if** the last cell in the old line
was empty. If it was **not** empty, we **don't** line break the new
line.

Furthermore, empty cells in general need special consideration. A line
ending with a string of empty cells doesn't have to be copied the new
line. And more importantly, should **not** increase the new line's
cell index (which may cause line breaks, which is incorrect).

However, if a string of empty cells is followed by non empty cells, we
need to copy all the preceding empty cells to the line too.

When the entire scrollback history has been reflowed, we need to
figure out the new grid's offset.

This is done by trying to put the **last** emitted line at the bottom
of the screen. I.e. the new offset is typically "last_line_idx -
term->rows". However, we need to handle empty lines. So, after
subtracting the number of screen rows, we _increase_ the offset until
we see a non-empty line. This ensures we handle grid's that doesn't
fill an entire screen.

Finally, we need to re-position the cursor. This is done by trying to
place the cursor **at** (_not_ after) the last emitted line. We keep
the current cursor column as is (but possibly truncated, if the grid's
width decreased).
2020-02-10 20:35:24 +01:00
Daniel Eklöf
fd5782d6e6
render: resize: reset scroll damage
We've resized, and reset the render's 'last-buf' pointer; any scroll
damage we have is **not** valid anymore.
2020-02-08 18:22:14 +01:00
Daniel Eklöf
9e2ca2b1a3
render: add render_resize_force()
This forces a full resize operation, even though actual window
size (or scale) hasn't changed.
2020-02-08 14:08:16 +01:00
Daniel Eklöf
d6ea676ef2
presentation: store input timestamp in a per-commit context
This should reduce the risk of mixing up an input timestamp with the
corresponding rendered frame.
2020-01-21 18:51:04 +01:00
Daniel Eklöf
2c8b31204f
render: fallback to background color if cursor text color is not set 2020-01-20 18:36:44 +01:00
Daniel Eklöf
767a0ec232
fcft: update to 1.0.0
Allow/disallow subpixel antialiasing in font_glyph_for_wc(), not using
font_enable_subpixel_antialias().
2020-01-19 12:44:21 +01:00
Daniel Eklöf
727be358df
render: resize: TIOCSWINSZ: don't include padding in ws_{x,y}pixel 2020-01-12 14:42:49 +01:00
Daniel Eklöf
1623fc0c0a
term: shorten application_synchronized_updates -> app_sync_updates 2020-01-12 12:55:19 +01:00