aboutsummaryrefslogtreecommitdiff
path: root/render.c (follow)
Commit message (Collapse)AuthorAgeLines
* unicode-combining: store seen combining chains "globally" in the term structDaniel Eklöf2020-05-03-17/+28
| | | | | | | | | | | | | | | | | | | | 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.
* render: don't re-instantiate the foreground pixman sourceDaniel Eklöf2020-05-02-6/+5
|
* unicode-combine: remove utf8proc dependencyDaniel Eklöf2020-05-02-1/+1
| | | | | | | | | | | | 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.
* render: de-indent #if statementDaniel Eklöf2020-05-01-1/+1
|
* unicode-combining: completely remove unicode combining characters when feature is disabledDaniel Eklöf2020-05-01-0/+2
|
* render: render combining charactersDaniel Eklöf2020-05-01-10/+33
| | | | | | | | | | | | | | | | | 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.
* util.h: new header file defining commonly used macrosDaniel Eklöf2020-05-01-4/+1
|
* csd: buttons: use default color table as default colorsDaniel Eklöf2020-04-29-3/+3
| | | | | If the user hasn't configured any CSD button colors, use the color scheme's default colors for blue/green/red.
* damage: remove 'scroll' sub structDaniel Eklöf2020-04-26-25/+25
| | | | There is no other types of damage but scroll damage.
* render: make 'glyph' assignment more readableDaniel Eklöf2020-04-26-3/+4
|
* fcft: fcft_glyph_for_wc() has been renamed to fcft_glyph_rasterize()Daniel Eklöf2020-04-24-2/+4
|
* fcft: adjust to fcft-2.0 API changesDaniel Eklöf2020-04-21-10/+10
| | | | | | | * font_*() -> fcft_*() * struct font -> struct fcft_font * struct glyph -> struct fcft_glyph * enum subpixel_order -> enum fcft_subpixel
* render: use output's subpixel mode when rasterizing glyphsDaniel Eklöf2020-04-20-1/+1
|
* render: search: improve handling of very long search stringsDaniel Eklöf2020-04-19-4/+10
|
* csi: implement CSI Ps ; Ps ; Ps t reporting escape sequencesDaniel Eklöf2020-04-18-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* render: resize: no need to truncate selection anymore - it's being translatedDaniel Eklöf2020-04-17-7/+1
|
* render: resize: need to translate selection coordinatesDaniel Eklöf2020-04-17-2/+15
| | | | | | | | | | | | | 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.
* render: resize: no need to clear the selection - just truncate if necessaryDaniel Eklöf2020-04-17-2/+6
|
* grid: reflow: caller may now pass a list of coordinates that should be translatedDaniel Eklöf2020-04-17-2/+2
|
* grid: grid_reflow() now translates cursor coordinatesDaniel Eklöf2020-04-16-34/+2
|
* grid: move 'cursor' state from terminal to gridDaniel Eklöf2020-04-16-11/+11
| | | | | This way, the 'normal' and 'alt' grids have their own cursor state, and we don't need to switch between them.
* misc: replace all explicit zero-initializers with empty initializersDaniel Eklöf2020-04-13-3/+3
|
* render: don't dim so much when in search modeDaniel Eklöf2020-04-10-3/+3
|
* render: strip 'pixman' from color function namesDaniel Eklöf2020-04-09-10/+10
|
* render: remove unused functionsDaniel Eklöf2020-04-09-18/+0
|
* shm: scroll: keep shm pool around, and fix its size at max allowedDaniel Eklöf2020-03-25-11/+13
| | | | | | | | | | | | | | | | | 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.
* render: pace title updatesDaniel Eklöf2020-03-25-14/+30
| | | | Synchronize window title updates with window rendering.
* render: explain _why_ we set a clip regionDaniel Eklöf2020-03-24-0/+1
|
* render: bug: clear clip region before tinting the windowDaniel Eklöf2020-03-24-0/+1
|
* render: attach buffer just before commitDaniel Eklöf2020-03-24-1/+3
|
* render: clear scroll damage list when we force-refresh the entire windowDaniel Eklöf2020-03-24-0/+1
|
* Merge branch 'master' into scroll-damage-performanceDaniel Eklöf2020-03-24-22/+17
|\
| * render: fdm refresh handler: don't clear pending flagsDaniel Eklöf2020-03-24-22/+17
| | | | | | | | | | The pending flags may already be set (from a previous call to the FDM hook). In this case, they should not be cleared.
* | shm: shm_scroll(): initial implementation of reverse scrollingDaniel Eklöf2020-03-23-19/+50
| | | | | | | | | | | | | | | | | | 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).
* | shm: scroll: move top/bottom region handling from renderer into shmDaniel Eklöf2020-03-23-52/+11
| | | | | | | | | | This allows us to restore the regions without copying the contents to temporary memory.
* | render: scroll: use shm scrolling even though we have a top regionDaniel Eklöf2020-03-23-3/+20
| |
* | render: scroll: take margins into account when restoring bottom scroll regionDaniel Eklöf2020-03-23-5/+5
| |
* | render: scroll: move comment to where it belongsDaniel Eklöf2020-03-23-12/+10
| |
* | render: margins: caller explicitly asks for top/bottom marginsDaniel Eklöf2020-03-23-7/+10
| |
* | render: margins: regression: fix incorrect marginsDaniel Eklöf2020-03-23-6/+17
| |
* | Merge branch 'master' into scroll-damage-performanceDaniel Eklöf2020-03-23-1/+4
|\|
| * delayed rendering: ignore frame callback if delayed rendering is activeDaniel Eklöf2020-03-23-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | render: use shm_scroll() when we believe it will be fasterDaniel Eklöf2020-03-22-54/+186
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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.
* render: resize: update saved 'normal' cursor if we're in alt screenDaniel Eklöf2020-03-22-0/+13
| | | | | | | | | | | 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.
* shm: new functions: shm_cookie_*()Daniel Eklöf2020-03-18-4/+0
| | | | These functions return a SHM cookie given a terminal instance.
* render: don't try to resize if we're shutting downDaniel Eklöf2020-03-17-0/+3
| | | | | | 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.
* render: render non-block cursors after rendering the glyph + decorationsDaniel Eklöf2020-03-17-4/+8
| | | | | | 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.
* sixel: improve handling of images when reflowing the gridsDaniel Eklöf2020-03-13-4/+1
| | | | | | | | | | | 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.
* render: never render CSD and/or search box "immediately"Daniel Eklöf2020-03-06-51/+94
| | | | | | | | | | 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.
* render: csd: improved look of minimize/maximize/close buttonsDaniel Eklöf2020-03-06-20/+117
| | | | | | | | | | * 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.
* render: CSD: use *default* foreground, not current foregroundDaniel Eklöf2020-03-06-1/+1
| | | | | | | 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).
* render: oops, add missing '}'Daniel Eklöf2020-03-03-1/+1
|
* render: configure a clip region to exclude the grid marginsDaniel Eklöf2020-03-03-0/+5
| | | | | | 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).
* wayland: set window geometry to exclude the invisible CSD bordersDaniel Eklöf2020-03-03-10/+20
| | | | | | | | | | | | | 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.
* render: csd: render surfaces in reverse orderDaniel Eklöf2020-03-03-2/+2
| | | | | This ensures the inner most child surfaces are rendered and comitted before the parent surfaces.
* render: csd: assert surfaces exist before trying to use themDaniel Eklöf2020-03-03-0/+3
|
* render: csd: center 'close' button's crossDaniel Eklöf2020-03-03-2/+2
|
* render: csd: don't even try to render CSDs when we're in fullscreen modeDaniel Eklöf2020-03-03-0/+3
|
* render: don't try to render CSDs when the terminal is shutting downDaniel Eklöf2020-03-03-1/+9
|
* config: CSD borders are always invisibleDaniel Eklöf2020-03-03-11/+1
| | | | | That is, remove all configuration options and always draw them fully transparent.
* render: csd: maximize: change default color to a lighter greenDaniel Eklöf2020-03-02-1/+1
|
* render: csd: close: change default color to a lighter blueDaniel Eklöf2020-03-02-1/+1
|
* render: csd: minimize: change default color to a lighter blueDaniel Eklöf2020-03-02-1/+1
|
* render: initial minimize/maximize/close glyphsDaniel Eklöf2020-03-02-5/+75
| | | | | These are really ugly, but is meant to get something up there, that can be polished afterwards.
* csd: initial implementation of minimize/maximize/close buttonsDaniel Eklöf2020-03-02-1/+78
|
* config: make CSD user configurableDaniel Eklöf2020-03-02-62/+38
| | | | | | | | | | | | | | 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.
* render: csd: don't try to render a zero-width/height borderDaniel Eklöf2020-03-01-0/+5
|
* search: enable/disable weston sub-surface desync quirk when rendering search boxDaniel Eklöf2020-03-01-0/+4
|
* render: search: add todo to only position sub-surface on a window resizeDaniel Eklöf2020-03-01-0/+1
|
* render: search: mark visible portion of sub-surface opaqueDaniel Eklöf2020-03-01-0/+7
|
* render: search: kwin has problems with a resizing/repositioned sub-surfaceDaniel Eklöf2020-03-01-9/+15
| | | | | So, make it equal to the window size, and make the non-used area fully transparent.
* render: csd: switch-based CSD positioningDaniel Eklöf2020-03-01-29/+35
|
* render: csd: split up positioning from renderingDaniel Eklöf2020-02-29-73/+122
|
* render: don't update last 'un-maximized' size when in fullscreenDaniel Eklöf2020-02-29-1/+1
|
* render: resize: redraw search box, if visibleDaniel Eklöf2020-02-29-1/+7
|
* render: search: fix off-by-one error in number of visible charactersDaniel Eklöf2020-02-29-2/+2
|
* render: wl_subsurface_set_position() uses un-scaled coordinatesDaniel Eklöf2020-02-29-3/+3
| | | | | This fixes an issue where the CSDs and the search box was incorrectly positioned when output's scale != 1.
* render: csd: bump title bar height from 20 -> 26Daniel Eklöf2020-02-29-1/+1
|
* render: csd: use a struct for positioning informationDaniel Eklöf2020-02-28-5/+10
|
* render: resize: change 'resize' log from info to debugDaniel Eklöf2020-02-28-4/+4
|
* render: CSDs: transparent bordersDaniel Eklöf2020-02-28-3/+6
| | | | | This gives the illusion that window is border-less, but still gives us surfaces the user can grab to resize the window.
* render: resize: exclude CSD borders when loading default geometry in maximized modeDaniel Eklöf2020-02-28-6/+17
|
* render: CSDs: don't render borders (only title bar) in maximized modeDaniel Eklöf2020-02-28-1/+13
|
* render: color_hex_to_pixman_with_alpha(): handle alpha == 0 (transparent)Daniel Eklöf2020-02-28-0/+3
|
* render: remember, and use, last unmaximized sizeDaniel Eklöf2020-02-26-10/+26
| | | | | | | | 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.
* render: resize: adjust user configured size for CSDsDaniel Eklöf2020-02-26-0/+5
|
* render: csd: fix typo when CSDs are positioned *inside* main surfaceDaniel Eklöf2020-02-26-1/+1
|
* render: don't center grid on surfaceDaniel Eklöf2020-02-26-2/+2
| | | | | | | | | | | | | | 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).
* csd: don't draw CSDs in fullscreen modeDaniel Eklöf2020-02-26-0/+3
|
* render: resize: ignore unconfigured windowsDaniel Eklöf2020-02-26-0/+3
|
* csd: position CSD sub-surfaces *outside* the main windowDaniel Eklöf2020-02-26-44/+69
| | | | | | | | | | | | | | | 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.
* render: search: take CSD into accountDaniel Eklöf2020-02-25-5/+9
|
* render: resize with with/height == 0 resizes to user configured dimensionsDaniel Eklöf2020-02-25-6/+6
|
* render: render_resize_*() returns a boolean indicating whether size changed.Daniel Eklöf2020-02-25-7/+9
|
* render: render_resize(): don't allow too small window sizesDaniel Eklöf2020-02-25-8/+31
|
* render: call render_csd() from render_resize(), not render_grid()Daniel Eklöf2020-02-25-3/+1
| | | | | The CSDs doesn't need to be re-drawn each time we redraw the grid, only when the window is resized.
* render: export render_csd()Daniel Eklöf2020-02-25-18/+33
|
* render: make CSD border and title size globally accessibleDaniel Eklöf2020-02-25-0/+3
|
* render: csd: sort geometry entriesDaniel Eklöf2020-02-24-5/+5
|
* render: csd: render all borders and the title barDaniel Eklöf2020-02-24-3/+7
| | | | | | * Still no content in the title bar * Colors are temporary * No resize/drag yet