aboutsummaryrefslogtreecommitdiff
path: root/render.c (follow)
Commit message (Collapse)AuthorAgeLines
...
* render: render the render timer *before* committing the main surfaceDaniel Eklöf2020-08-14-17/+17
|
* render: render-timer: position sub-surface similar to the scrollback indicatorDaniel Eklöf2020-08-14-0/+5
|
* render: oops... swprintf() needs to number of *chars*, not *bytes*Daniel Eklöf2020-08-13-1/+1
|
* render: fix printf-errors in 32-bit buildsDaniel Eklöf2020-08-13-2/+3
|
* config: add tweak.render-timer optionDaniel Eklöf2020-08-13-53/+96
| | | | | | | | | This can be set to 'none' (the default), 'osd', 'log' or 'both'. When 'osd' is enabled, we'll render the frame rendering time to a sub-surface after each frame. When 'log' is enabled, the frame rendering time is logged on stderr.
* config: make selection foreground/background colors configurableDaniel Eklöf2020-08-12-8/+12
| | | | | | | | | The default is still to inverse the regular foreground/background colors. If the user sets *both* of the new options, selection-foreground and selection-background, those colors will *always* be used for selected cells, instead of inverting the regular foreground/background colors.
* render: fix compilation errors in 32-bit buildsDaniel Eklöf2020-08-11-6/+9
| | | | timeval.tv_usec is an 'unsigned long long' on 32-bit
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-3/+9
|
* config: add 'hide-when-typing'Daniel Eklöf2020-07-31-0/+9
| | | | | | When enabled, the mouse cursor is hidden when the user types in the terminal. It is un-hidden when the user moves the mouse, or when the window loses keyboard focus.
* render: make compiler happy; make sure 'cell_count' has been initializedDaniel Eklöf2020-07-29-1/+1
| | | | | | | | | Compiler, in release builds, complains about 'cell_count' "may be used uninitialized". This isn't true, as it is initialized in every possible switch case below. But, make the compiler happy and zero-initialize it before the switch statement.
* config: add free-form text variant to 'scrollback-indicator-format'Daniel Eklöf2020-07-28-3/+9
| | | | And make the empty string the new default.
* config: rename scrollback-indicator-style to scrollback-indicator-positionDaniel Eklöf2020-07-27-5/+5
|
* render: scrollback indicator: apply weston sub-surface quirkDaniel Eklöf2020-07-27-0/+2
|
* render: scrollback indicator: render relative indicator "smoothly"Daniel Eklöf2020-07-27-7/+7
| | | | That is, don't require it to be placed on a grid row.
* render: scrollback indicator: add top marginDaniel Eklöf2020-07-26-4/+4
|
* config: scrollback-indicator-format: percent -> percentageDaniel Eklöf2020-07-26-1/+1
|
* render: scrollback indicator: use black on bright blueDaniel Eklöf2020-07-26-2/+2
|
* render: scrollback indicator: implement 'relative' and 'line' variantsDaniel Eklöf2020-07-26-9/+41
| | | | | We now implement all combinations of 'scrollback-indicator-style' and 'scrollback-indicator-format'.
* render: scrollback indicator: wip: implement 'fixed:percent' indicatorDaniel Eklöf2020-07-26-10/+100
| | | | | | | | | | | | | When scrollback indicator has been enabled, and the viewport isn't at the bottom, we now render a *static* indicator with the position in percent. We use the color scheme's blue color as background, and it's white color as foreground. This is subject to change... Should maybe be configurable as well. The Wayland surface + sub-surface are instantiated on-demand, and automatically destroyed when no longer used.
* render: search: fix subpixel argument to fcft_glyph_rasterize()Daniel Eklöf2020-07-26-1/+1
|
* config: rename scrollback-indicator to scrollback-indicator-styleDaniel Eklöf2020-07-25-1/+1
| | | | | | | | And turn it from a boolean to an enum. It can be set to: * `none` - disables the indicator * `static` - always rendered near the top of the window * `moving` - position reflects the scrollback position
* config: rename show-scrollback-position to scrollback-indicatorDaniel Eklöf2020-07-24-1/+1
|
* config: add 'show-scrollback-position' option to footrcDaniel Eklöf2020-07-24-2/+0
|
* render: add code that calculates current position in scrollbackDaniel Eklöf2020-07-24-0/+46
|
* render: bump maximum window title length from 100 to 2048 (bytes)Daniel Eklöf2020-07-22-2/+1
| | | | Apparently, the max is ~8K, but lets stay on the safe side.
* term: don't re-render last cursor cell if cursor was hiddenDaniel Eklöf2020-07-15-1/+2
|
* term: print: write special value CELL_MULT_COL_SPACER to extra cellsDaniel Eklöf2020-07-14-1/+1
| | | | | | When printing a multi-column character, write CELL_MULT_COL_SPACER instead of '0' to both padding cells (when character doesn't fit at the end of the line), and to the cells following the actual character.
* term: rename COMB_CHARS_LO,HI -> CELL_COMB_CHARS_LO,HIDaniel Eklöf2020-07-14-3/+3
|
* render: render_margin: don't damage margins when rendering scroll damageDaniel Eklöf2020-07-13-12/+10
| | | | | | | | | | | | | | | | | | | When applying scroll damage, we may have to re-render the margins. This is because when we SHM-scroll, we actually move the entire surface, and thus we end up overwriting the top margin area with old window content, and scroll in uninitialized memory in the bottom margin. But, we don't have to tell the compositor about this - the last frame always contains correct margins; i.e. there's no change between the last frame and current frame being rendered. TODO: we _could_ micro-optimize and only damage the margins after a surface resize. We do it slightly more often now, when dealing with state changes in screen flash or scrollback searching. But I don't think it's worth the effort.
* render: doh! flush the last surface damage *outside* of the rendering loopDaniel Eklöf2020-07-13-8/+8
|
* render: render_margin: add 'damage_{top,bottom,left,right}' argumentsDaniel Eklöf2020-07-13-20/+24
|
* render: render_margin(): remove top/bottom argumentsDaniel Eklöf2020-07-13-24/+20
| | | | All calls to render_margin() set top=true and bottom=true anyway.
* render: merge wl surface damage for consecutive dirty rowsDaniel Eklöf2020-07-13-38/+55
|
* render: keep lock while pushing dirty rows to worker queueDaniel Eklöf2020-07-13-9/+3
| | | | | | | | | | | | | | | | Instead of locking the queue for each dirty row we append, and signaling a condition variable, just keep the lock while going through the visible rows. Release the lock once done. Since we take the lock *before* posting the 'start' semaphore, all workers will be waiting for the lock to be released. Then, one at a time they'll get the lock and pick a row to render. The queue will never get empty - when all rows have been rendered, each worker will pick a 'frame done' "job" from the queue, and break the rendering loop.
* render: don't render cursor when it has been explicitly hiddenDaniel Eklöf2020-07-12-2/+2
|
* render: remove most of the special handling of cursor renderingDaniel Eklöf2020-07-12-80/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had to explicitly render the old cursor cell *before* applying scrolling damage. We then rendered all the dirty rows, *without* rendering the cursor - even if the cursor cell was among the dirty rows. Finally, when everything else was done, we explicitly rendered the cursor cell. This meant a lot of code, and unnecessary render_cell() calls, along with unnecessary wl_surface_damage_buffer() calls. This was a necessary in the early design of foot, but not anymore. We can simply mark both the old cursor cell, and the current one, as dirty and let the normal rendering framework render it. All we need to do is pass the cursor column to render_row(), so that it can pass has_cursor=true in the appropriate call to render_cell(). We pass -1 here for all rows, except the cursor's row, where we pass the actual cursor column. With this, there's no need to calculate whether the cursor is visible or not; just mark it's cell as dirty, and if that row is visible, the normal rendering will take care of it. This also simplifies the state needed to be saved between two frames; we only need a row pointer, and the cursor column index. Part of https://codeberg.org/dnkl/foot/issues/35
* render: use kbd-focus instead of visual focus for hollow block cursorDaniel Eklöf2020-07-11-5/+5
| | | | | | When determining whether we should render a hollow block cursor, i.e. to signal that we're unfocused, base the decision on the terminals current keyboard focus, not visual focus.
* wayland: read XCURSOR_{THEME,SIZE} in reload_xcursor themeDaniel Eklöf2020-07-10-2/+1
|
* multi-seat: improve handling of multiple (mouse) pointersDaniel Eklöf2020-07-09-17/+17
| | | | | | | | * xcursor always set for all pointers * xcursor sometimes not updated when it should be * mouse grabbed state wasn't per seat, but global (i.e. "does at least one seat enable mouse grabbing") * selection enabled state wasn't per seat
* multi-seat: enable xcursor theme support againDaniel Eklöf2020-07-08-50/+40
|
* wip: multi-seat supportDaniel Eklöf2020-07-08-3/+12
| | | | | Compiles and runs, but mouse, clipboard and other things have been disabled.
* render: sixel: regression: need to take current offset into account when early-quitting sixel ↵Daniel Eklöf2020-06-28-8/+18
| | | | | | | | | 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).
* render: sixels: break out of loop when we're sure there aren't any more visible imagesDaniel Eklöf2020-06-28-1/+25
| | | | | | | | | | | | | 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).
* render: sixel: use pixman_image_composite32()Daniel Eklöf2020-06-06-1/+1
|
* render: cell: reset clip region also when we're NOT rendering a glyphDaniel Eklöf2020-06-06-1/+1
|
* render: regression: don't let cell background overflow into the marginsDaniel Eklöf2020-06-05-6/+8
| | | | | | | | | | | | 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.
* render: re-write cell clipping to use pixman destination clippingDaniel Eklöf2020-06-04-47/+36
| | | | | | | | | | | | 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.
* render: do not allow glyphs to overflow into surrounding cellsDaniel Eklöf2020-06-03-37/+40
| | | | | | | | | | | | | | | 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
* render: draw hollow block cursor on top of the character, not the oppositeDaniel Eklöf2020-06-02-2/+2
|
* render: resize: don't try to signal TIOCSWINSZ on a closed ptmx FDDaniel Eklöf2020-05-27-1/+1
|
* selection/render: sync cells' 'selected' bit before renderingDaniel Eklöf2020-05-16-0/+19
| | | | | | | | | | | | | | | | | | | | | | | 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.
* render: only apply transparency to the default background colorDaniel Eklöf2020-05-16-2/+4
|
* 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.