aboutsummaryrefslogtreecommitdiff
path: root/render.c (follow)
Commit message (Collapse)AuthorAgeLines
* 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
* Merge branch 'master' into csdDaniel Eklöf2020-02-24-40/+41
|\
| * term: resize: pre-calculate right/bottom marginsDaniel Eklöf2020-02-24-40/+41
| |
* | csd: wip: something to get started...Daniel Eklöf2020-02-23-2/+48
|/
* render: sixel: don't render sixels on the 'other' gridDaniel Eklöf2020-02-22-0/+3
|
* sixel: calculate image height in (cell) rowsDaniel Eklöf2020-02-21-21/+22
|
* render: break out sixel rendering codeDaniel Eklöf2020-02-21-61/+73
|
* sixel: wip: maintain a list of finished, and "active" sixel imagesDaniel Eklöf2020-02-21-12/+53
| | | | | | | | | | | | | | | | | | | 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.
* sixel: initial supportDaniel Eklöf2020-02-21-0/+21
| | | | | | | | | 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
* render/grid: move grid reflow code to grid.cDaniel Eklöf2020-02-15-183/+10
|
* render: resize: take padding from configuration into accountDaniel Eklöf2020-02-15-2/+16
|
* render: reflow: set 'linebreak' flag before inserting new lineDaniel Eklöf2020-02-15-9/+14
|
* render: reflow: remove 'linebreak' flag from recycled rowsDaniel Eklöf2020-02-15-4/+6
|
* render: reflow: no need to mark new rows as dirtyDaniel Eklöf2020-02-15-4/+3
|
* render: resize: cancel selection before reflowing textDaniel Eklöf2020-02-15-0/+2
| | | | The old selection will no longer be valid once we resize the grids.
* render: reflow: bug: fix off-by-oneDaniel Eklöf2020-02-15-6/+7
| | | | | | | | 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.
* term: convert cell 'linefeed' attribute to a row 'linebreak' propertyDaniel Eklöf2020-02-14-34/+24
| | | | | | | | | | | | | | | | 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.
* render: resize: don't reflow text if grid layout hasn't changedDaniel Eklöf2020-02-14-0/+7
| | | | | | | | 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.
* render: reflow: erase row when wrapping around the scrollbackDaniel Eklöf2020-02-14-1/+2
|
* render: reflow: mark all "new" rows as dirtyDaniel Eklöf2020-02-14-2/+4
|
* render: resize: do linefeed *after* updating cursor positionDaniel Eklöf2020-02-12-2/+6
|
* render: resize; heuristics to prevent prompt from being printed on a newlineDaniel Eklöf2020-02-12-5/+5
|
* render: resize: temporarily disable row adjustmentDaniel Eklöf2020-02-12-0/+3
| | | | | | 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.
* render: resize: only stay on current row if col is within grid widthDaniel Eklöf2020-02-12-1/+3
|
* render: spellingDaniel Eklöf2020-02-12-1/+1
|
* render: resize: calculated cursor row *should* never be beyond the screen bottomDaniel Eklöf2020-02-10-1/+2
|
* render: reflow: clear new line if already allocatedDaniel Eklöf2020-02-10-1/+2
|
* render: resize: fix cursor positioning at grid wrap aroundDaniel Eklöf2020-02-10-2/+6
| | | | | | | | | 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.
* render: reflow: initial line is always unallocatedDaniel Eklöf2020-02-10-5/+5
|
* vt: tag cells that were form-feed:ed, to allow correct text reflowDaniel Eklöf2020-02-10-1/+4
| | | | | | | | | 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.
* render: reflow: no need to clear cellsDaniel Eklöf2020-02-10-2/+1
| | | | | We set initialize=true when allocating a new row. This initializes the cell to 0, with clean=1.
* render: initial support for text reflowDaniel Eklöf2020-02-10-36/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* render: resize: reset scroll damageDaniel Eklöf2020-02-08-1/+2
| | | | | We've resized, and reset the render's 'last-buf' pointer; any scroll damage we have is **not** valid anymore.
* render: add render_resize_force()Daniel Eklöf2020-02-08-5/+18
| | | | | This forces a full resize operation, even though actual window size (or scale) hasn't changed.
* presentation: store input timestamp in a per-commit contextDaniel Eklöf2020-01-21-32/+39
| | | | | This should reduce the risk of mixing up an input timestamp with the corresponding rendered frame.
* render: fallback to background color if cursor text color is not setDaniel Eklöf2020-01-20-3/+3
|
* fcft: update to 1.0.0Daniel Eklöf2020-01-19-2/+3
| | | | | Allow/disallow subpixel antialiasing in font_glyph_for_wc(), not using font_enable_subpixel_antialias().
* render: resize: TIOCSWINSZ: don't include padding in ws_{x,y}pixelDaniel Eklöf2020-01-12-2/+2
|
* term: shorten application_synchronized_updates -> app_sync_updatesDaniel Eklöf2020-01-12-2/+2
|
* term/render: move {enable,disable}_application_synchronized_updates()Daniel Eklöf2020-01-12-31/+1
| | | | From render -> terminal
* render: add a timeout for application synchronized updatesDaniel Eklöf2020-01-12-5/+17
| | | | | This ensures we can recover from a crashing (or bad behaving) application that sends a BSU but then never sends an ESU.
* render: rename render_{enable,disable}_refresh()Daniel Eklöf2020-01-12-3/+3
|
* term: rename refresh_prohibited -> application_synchronized_updatesDaniel Eklöf2020-01-12-5/+5
|
* render: add render_{enable,disable}_refresh()Daniel Eklöf2020-01-12-0/+24
| | | | | | | Calling render_disable_refresh() causes update requests to that terminal to be ignored. Calling render_enable_refresh() re-enables updates.
* render: don't bother trying to lookup glyph for empty cellsDaniel Eklöf2020-01-12-1/+2
| | | | | Depending on the font, it may not have an entry for code point '0', which will cause us to try to load fallback fonts.
* selection: update: don't dirty cells that don't change stateDaniel Eklöf2020-01-06-1/+1
| | | | | | | | | | | | | | | | Previously when updating a selection, we would unmark *all* cells in the old selection, and then mark all cells in the new selection. This caused *all* cells to be dirtied and thus re-rendered. Avoid this, by adding a temporary state to the cells' selected state. Before unmarking the old selection, pre-mark the new selection using a temporary state. When unmarking the old selection, ignore cells in this temporary state. When marking the new selection, ignore cells in this temporary state (except clearing the temporary state).
* search: rename render.search_offset -> render.search_glyph_offsetDaniel Eklöf2020-01-05-6/+6
|
* render: ensure cursor is always visible in the search boxDaniel Eklöf2020-01-05-6/+26
| | | | | | | | | | | | | | | | | | Maintain a view 'offset' (which glyph from the search string to start rendering at). This defines the start of the viewable area. The end is the offset + the search box size (which is limited to the window size). Adjust this offset whenever the cursor moves outside the viewable area. For now, this is always done in the same way: set the offset to the cursor position. This means that when we're entering text at the end of the search criteria (i.e. the normal case; we're simply typing), and the search box reaches the window size, the cursor will jump to the start of the search box, which will be empty. This could be confusing, but let's go with for now.
* render: xcursor: remove render_xcursor_refresh()Daniel Eklöf2020-01-04-18/+17
|
* renderer: destroy: actually free the renderer instance (doh!)Daniel Eklöf2020-01-04-0/+2
|
* wayland: use a low priority FDM hook to flush the wayland socketDaniel Eklöf2020-01-04-2/+0
| | | | | | | | This way, we don't have to manually insert flushes in code paths that may execute outside of a wl_display_dispatch_pending(). (Those that execute inside a wl_display_dispatch_pending() are subject to the flush performed at the end of the normal wayland FDM handler).
* fdm: add hook prioritiesDaniel Eklöf2020-01-04-2/+5
| | | | | | | | | | There are now three hook priorities: low, normal, high. High priority hooks are executed *first*. Normal next, and last the low priority hooks. The renderer's terminal refresh hook now runs as a normal priority hook.
* render: throttle xcursor updatesDaniel Eklöf2020-01-04-20/+125
| | | | | | | | | | | | | | | | | | | | | | | With a bad behaving client (e.g. 'less' with mouse support enabled), we can end up with a *lot* of xcursor updates (so much, that we flooded the wayland socket before we implemented a blocking wayl_flush()). Since there's little point in updating the cursor more than once per frame interval, use frame callbacks to throttle the updates. This works more or lesslike normal terminal refreshes: render_xcursor_set() stores the last terminal (window) that had (and updated) the cursor. The renderer's FDM hook checks if we have such a pending terminal set, and if so, tries to refresh the cursor. This is done by first checking if we're already waiting for a callback from a previous cursor update, and if so we do nothing; the callback will update the cursor for the next frame. If we're *not* already waiting for a callback, we update the cursor immediately.
* wayland: wl_display_flush() never blocksDaniel Eklöf2020-01-04-1/+1
| | | | | | | | | | | | | | | | | | | Since it doesn't block, we need to detect EAGAIN failures and ensure we actually flush everything. If we don't, we sooner or later end up in a wayland client library call that aborts due to the socket buffer being full. Ideally, we'd simply enable POLLOUT in the FDM. However, we cannot write *anything* to the wayland socket until we've actually managed to send everything. This means enabling POLLOUT in the FDM wont work since we may (*will*) end up trying to write more data to it before we've flushed it. So, add a wrapper function, wayl_flush(), that acts as a blocking variant of wl_display_flush(), by detecting EAGAIN failiures and calling poll() itself, on the wayland socket only, until all data has been sent.
* render: remove debug loggingDaniel Eklöf2020-01-04-5/+2
|
* render: attrs_to_font() is not used outside of render.cDaniel Eklöf2020-01-04-1/+1
|
* render: trigger terminal refreshes in an FDM hookDaniel Eklöf2020-01-04-6/+56
| | | | | | | | | | | | | | | | | | | | | | In some cases, we end up calling render_refresh() multiple times in the same FDM iteration. This means will render the first update immediately, and then set the 'pending' flag, causing the updated content to be rendered in the next frame. This can cause flicker, or flashes, since we're presenting one or more intermediate frames until the final content is shown. Not to mention that it is inefficient to render multiple frames like this. Fix by: * render_refresh() only sets a flag in the terminal * install an FDM hook; this hook loops all terminals and executes what render_refresh() _used_ to do (that is, render immediately if we're not waiting for a frame callback, otherwise set 'pending' flag). for all terminals that have the 'refresh_needed' flag set.
* selection: store cell 'selected' state in the cells' attributesDaniel Eklöf2020-01-04-53/+8
| | | | | | | | | Instead of having the renderer calculate, for each cell, whether that cell is currently selected or not, make selection_update() mark/unmark the selected cells. The renderer now only has to look at the cells' 'selected' attribute. This makes the renderer both smaller and faster.
* render: coord_is_selected: handle block selectionsDaniel Eklöf2020-01-03-8/+22
|
* render: refresh: ensure window has been configuredDaniel Eklöf2020-01-03-0/+2
|
* render: remove 'refresh' from render_resize()Daniel Eklöf2020-01-03-3/+2
|
* render: render_resize(): don't do anything if width or height is 0Daniel Eklöf2020-01-03-0/+3
|
* render: resize() now only calls refresh() if asked toDaniel Eklöf2020-01-03-2/+3
|
* Merge branch 'master' into visual-focusDaniel Eklöf2020-01-03-1/+1
|\
| * render: use a unique buffer cookie for the 'search' surfaceDaniel Eklöf2020-01-03-1/+1
| | | | | | | | | | | | | | | | This fixes an issue where rendering the 'search' box caused the last normal buffer from being purged. This meant the terminal had a pointer to a now freed buffer, which we de-referenced and occasionally memcpy:ied from.