Commit graph

282 commits

Author SHA1 Message Date
Daniel Eklöf
6bc9fd4ba1
Merge branch 'master' into scroll-damage-performance 2020-03-23 19:30:20 +01:00
Daniel Eklöf
5a972cb98e
delayed rendering: ignore frame callback if delayed rendering is active
Before, we applied delayed rendering (that is, we gave the client a
chance to do more writes before we scheduled a render refresh) only
when the renderer were idle.

However, with e.g. a high keyboard repeat rate, it is very much
possible to start the render loop and then never break out of it while
receiving keyboard input.

This causes screen flickering, as we're no longer even trying to
detect the clients transaction boundaries.

So, let's rewrite how this is done.

First, we give the user the ability to disable delayed rendering
altogether, by setting either the lower or upper timeout to 0.

Second, when delayed rendering is enabled, we ignore the frame
callback. That is, when receiving input, we *always* reschedule the
lower timeout timer, regardless of whether the render is idle or not.

The render's frame callback handler will *not* render the grid if the
delayed render timers are armed.

This means for longer client data bursts, we may now skip frames. That
is, we're trading screen flicker for the occasional frame hickup.

For short client data bursts we should behave roughly as before.

This greatly improves the behavior of fullscreen, or near fullscreen,
updates of large grids (example, scrolling in emacs in fullscreen,
with a vertical buffer split).
2020-03-23 19:21:41 +01:00
Daniel Eklöf
ed987b2de7
render: use shm_scroll() when we believe it will be faster
shm_scroll() is fast when memmove() is slow. That is, when scrolling
a *small* amount of lines, shm_scroll() is fast.

Conversely, when scrolling a *large* number of lines, memmove() is
fast.

For now, assume the two methods perform _roughly_ the same given a
certain number of bytes they have to touch.

This means we should use shm_scroll() when number of scroll lines is
less than half the screen. Otherwise we use memmove.

Since we need to repair the bottom scroll region after a shm_scroll,
those lines are added to the count when determining which method to
use.

TODO:

* Check if it's worth to do shm scrolling when we have a top scroll
  region.
* Do more performance testing with a) various amount of scrolling
  lines, and b) larger bottom scroll regions.
2020-03-22 20:22:17 +01:00
Daniel Eklöf
48091966cb
render: resize: update saved 'normal' cursor if we're in alt screen
When resizing in alt mode, we never updated the saved 'normal'
cursor. This meant that when we exited alt mode, the cursor would be
positioned where it was in the old pre-resize/reflow grid.

Now, we update the saved cursor in the same way we update visible
cursor. The result is that when we exit the alt screen, the cursor
is restored to the same coordinates it would have been updated to had
the resize been done in the 'normal' screen.
2020-03-22 11:14:56 +01:00
Daniel Eklöf
6a35abb6ca
shm: new functions: shm_cookie_*()
These functions return a SHM cookie given a terminal instance.
2020-03-18 16:52:33 +01:00
Daniel Eklöf
a2774878ef
render: don't try to resize if we're shutting down
This fixes an issue where we sometimes (depends on compositor?) tried
to signal a TIOCSWINSZ and failed. This caused us to log a misleading
error message.
2020-03-17 13:27:26 +01:00
Daniel Eklöf
93207bc482
render: render non-block cursors after rendering the glyph + decorations
This fixes an issue where an 'underline' cursor wasn't visible on
underlined text - the cursor was rendered first, and then shadowed by
the text underline.
2020-03-17 11:47:47 +01:00
Daniel Eklöf
d482bf0a30
sixel: improve handling of images when reflowing the grids
Update the sixels' 'row' attribute when re-flowing a grid, to ensure
it is rendered at the correct place.

This should work in most cases, but will break when the cell size has
changed (e.g. font size increase/decrease, or a DPI change).

This patch also moves the sixel image list from the terminal struct
into the grid struct. The sixels are per-grid after all.
2020-03-13 18:47:16 +01:00
Daniel Eklöf
c5a1af4e53
render: never render CSD and/or search box "immediately"
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.
2020-03-06 19:16:54 +01:00
Daniel Eklöf
e5540a0d2e
render: csd: improved look of minimize/maximize/close buttons
* minimize: a downward triangle
* maximize (window): an upward triangle
* maximize (already maximized): a hollow square
* close: a filled square

The glyphs are now rendered using the default background color instead
of hardcoded to black.
2020-03-06 19:15:09 +01:00
Daniel Eklöf
f434933824
render: CSD: use *default* foreground, not current foreground
Applications may temporarily change the foreground color. Don't use
this when rendering the CSD title bar - use the default
foreground (i.e the default default one, or the one configured by the
user in footrc).
2020-03-06 19:13:10 +01:00
Daniel Eklöf
a78cca74a0
render: oops, add missing '}' 2020-03-03 18:29:46 +01:00
Daniel Eklöf
b81b1b6ff7
render: configure a clip region to exclude the grid margins
This ensures content in the last column doesn't flow over into the
margins (where they are typically never erased, unless the window is
resized).
2020-03-03 18:27:59 +01:00
Daniel Eklöf
d76484ae50
wayland: set window geometry to exclude the invisible CSD borders
But it *does* include the title bar. This simplifies the 'adjustment'
needed to be done to the configured window size.

It also fixes a number of issues:

* the compositor will now properly snap the window to screen
  edges (before, there was an empty space between the edge and the
  window - the CSD border).
* This also removes the need for the mutter 'commit' workaround. We
  must be doing something right now.
2020-03-03 18:26:15 +01:00
Daniel Eklöf
044556ef3e
render: csd: render surfaces in reverse order
This ensures the inner most child surfaces are rendered and comitted
before the parent surfaces.
2020-03-03 18:24:51 +01:00
Daniel Eklöf
da91a9de4b
render: csd: assert surfaces exist before trying to use them 2020-03-03 18:24:31 +01:00
Daniel Eklöf
09bb9bef33
render: csd: center 'close' button's cross 2020-03-03 18:24:09 +01:00
Daniel Eklöf
c9659ecd14
render: csd: don't even try to render CSDs when we're in fullscreen mode 2020-03-03 18:23:52 +01:00
Daniel Eklöf
c10f1d5459
render: don't try to render CSDs when the terminal is shutting down 2020-03-03 18:23:37 +01:00
Daniel Eklöf
c90d70b2bf
config: CSD borders are always invisible
That is, remove all configuration options and always draw them fully
transparent.
2020-03-03 18:18:59 +01:00
Daniel Eklöf
cb6616ef8a
render: csd: maximize: change default color to a lighter green 2020-03-02 21:11:17 +01:00
Daniel Eklöf
63a3d6ce03
render: csd: close: change default color to a lighter blue 2020-03-02 21:10:25 +01:00
Daniel Eklöf
b14c217fb6
render: csd: minimize: change default color to a lighter blue 2020-03-02 21:09:21 +01:00
Daniel Eklöf
20eaa15271
render: initial minimize/maximize/close glyphs
These are really ugly, but is meant to get something up there, that
can be polished afterwards.
2020-03-02 21:06:15 +01:00
Daniel Eklöf
9699c9b8bf
csd: initial implementation of minimize/maximize/close buttons 2020-03-02 20:29:28 +01:00
Daniel Eklöf
22ce09eb44
config: make CSD user configurable
The user can now configure the following:

* Whether to prefer CSDs or SSDs. But note that this is only a hint to
  the compositor - it may deny our request. Furthermore, not all
  compositors implement the decoration manager protocol, meaning CSDs
  will be used regardless of the user configuration (GNOME/mutter
  being the most prominent one).
* Title bar size and color, including transparency
* Border size and color, including transparency

Also drop support for rendering the CSDs inside the main surface.
2020-03-02 18:42:49 +01:00
Daniel Eklöf
875b067f13
render: csd: don't try to render a zero-width/height border 2020-03-01 13:17:54 +01:00
Daniel Eklöf
b6f8a2e422
search: enable/disable weston sub-surface desync quirk when rendering search box 2020-03-01 13:06:00 +01:00
Daniel Eklöf
a29427a185
render: search: add todo to only position sub-surface on a window resize 2020-03-01 12:54:50 +01:00
Daniel Eklöf
b8d79c719b
render: search: mark visible portion of sub-surface opaque 2020-03-01 12:54:27 +01:00
Daniel Eklöf
7b1dafae0f
render: search: kwin has problems with a resizing/repositioned sub-surface
So, make it equal to the window size, and make the non-used area fully
transparent.
2020-03-01 12:28:33 +01:00
Daniel Eklöf
f038a27366
render: csd: switch-based CSD positioning 2020-03-01 12:28:01 +01:00
Daniel Eklöf
92d638eb1c
render: csd: split up positioning from rendering 2020-02-29 18:02:38 +01:00
Daniel Eklöf
9264e1e5bd
render: don't update last 'un-maximized' size when in fullscreen 2020-02-29 17:25:08 +01:00
Daniel Eklöf
cbf657e2d2
render: resize: redraw search box, if visible 2020-02-29 11:42:00 +01:00
Daniel Eklöf
f67572208d
render: search: fix off-by-one error in number of visible characters 2020-02-29 11:41:40 +01:00
Daniel Eklöf
601dc02ea1
render: wl_subsurface_set_position() uses un-scaled coordinates
This fixes an issue where the CSDs and the search box was incorrectly
positioned when output's scale != 1.
2020-02-29 11:40:41 +01:00
Daniel Eklöf
e01030f99f
render: csd: bump title bar height from 20 -> 26 2020-02-29 09:39:05 +01:00
Daniel Eklöf
de9fcbc339
render: csd: use a struct for positioning information 2020-02-28 19:00:48 +01:00
Daniel Eklöf
45c1585bfb
render: resize: change 'resize' log from info to debug 2020-02-28 18:51:51 +01:00
Daniel Eklöf
ec2ad7755f
render: CSDs: transparent borders
This gives the illusion that window is border-less, but still gives us
surfaces the user can grab to resize the window.
2020-02-28 18:51:09 +01:00
Daniel Eklöf
e7e553ae5b
render: resize: exclude CSD borders when loading default geometry in maximized mode 2020-02-28 18:50:15 +01:00
Daniel Eklöf
b44bbb5b2b
render: CSDs: don't render borders (only title bar) in maximized mode 2020-02-28 18:49:34 +01:00
Daniel Eklöf
925088a8f2
render: color_hex_to_pixman_with_alpha(): handle alpha == 0 (transparent) 2020-02-28 18:35:21 +01:00
Daniel Eklöf
ddbfb3676c
render: remember, and use, last unmaximized size
When the compositor wants us to decide the size (it sends a configure
event with width/height == 0), then use the last unmaximized size, if
there is one.

If there isn't one, use the size from the user configuration.
2020-02-26 20:59:11 +01:00
Daniel Eklöf
3228758951
render: resize: adjust user configured size for CSDs 2020-02-26 15:27:40 +01:00
Daniel Eklöf
6eece79218
render: csd: fix typo when CSDs are positioned *inside* main surface 2020-02-26 13:22:20 +01:00
Daniel Eklöf
90efe6ec02
render: don't center grid on surface
Up until now, we've centered the grid on the main surface. Meaning, we
calculated the unusable area, added the user configured padding and
then centered the grid.

This may look nice at first, but doesn't anymore when you start
resizing the window. Resizing the window will cause the top+left
margins to change, which makes the text "jump" or "wobble".

So, now we fix the grid in the upper left corner defined by the user
configured padding (plus CSDs if they aren't positioned outside the
main surface).
2020-02-26 12:51:58 +01:00
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