aboutsummaryrefslogtreecommitdiff
path: root/terminal.h (follow)
Commit message (Collapse)AuthorAgeLines
* render: never render CSD and/or search box "immediately"Daniel Eklöf2020-03-06-2/+14
| | | | | | | | | | 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.
* csd: initial implementation of minimize/maximize/close buttonsDaniel Eklöf2020-03-02-0/+3
|
* render: remember, and use, last unmaximized sizeDaniel Eklöf2020-02-26-0/+2
| | | | | | | | 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.
* term: add term_surface_kind(), and track currently active surfaceDaniel Eklöf2020-02-24-0/+15
| | | | | | This is needed to handle pointer motion and button events correctly, since mouse actions in e.g. CSD surfaces are very different from mouse actions in the main window.
* term: resize: pre-calculate right/bottom marginsDaniel Eklöf2020-02-24-2/+6
|
* sixel: track which grid image was created onDaniel Eklöf2020-02-22-0/+1
|
* sixel: application configurable image max width/heightDaniel Eklöf2020-02-22-1/+3
|
* sixel: application configurable palette size (color count)Daniel Eklöf2020-02-22-0/+3
| | | | | This implements the CSI escapes for retrieving and (re)setting the palette size.
* sixel: clean up state machineDaniel Eklöf2020-02-22-3/+8
| | | | | Use proper state names, and implement the state machine using switch statements.
* sixel: use a struct coord for current sixel positionDaniel Eklöf2020-02-22-11/+11
|
* sixel: rename state SIXEL_SIXEL -> SIXEL_GROUNDDaniel Eklöf2020-02-22-1/+1
|
* sixel: resize image buffer dynamicallyDaniel Eklöf2020-02-22-1/+6
|
* sixel: calculate image height in (cell) rowsDaniel Eklöf2020-02-21-0/+1
|
* sixel: wip: maintain a list of finished, and "active" sixel imagesDaniel Eklöf2020-02-21-2/+10
| | | | | | | | | | | | | | | | | | | 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/+17
| | | | | | | | | 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
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-2/+2
|
* term: implement term_font_dpi_changed()Daniel Eklöf2020-02-15-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function reloads the font *if* the DPI has changed. To handle user run-time adjusted font sizes, we record the number of adjustments made. Then, when re-loading the font, we first load the font as specified in the configuration. Then, we re-apply the size adjustment using font_size_adjust(). Note that this means we end up loading the fonts twice; first using the default size (but with adjusted DPI), and then again with the adjusted size. This can probably be improved upon. The existing font code has been refactored to avoid code duplication. For example, term_init() now calls term_font_dpi_changed() to load the initial fonts, instead of directly instantiating them. Finally, the way we calculate the DPI to use has changed: instead of using the highest DPI of all available outputs, we use the highest DPI of the output's we're actually mapped on. If we're not mapped at all, we use the globally highest DPI. Doing it this way means we usually only have to load the fonts once. Otherwise, we'd end up using the default DPI of 96 when the terminal is first instantiated (since it's not mapped at that time). On a single monitor system, we'll use the globally highest DPI at first, before being mapped. Then when we get mapped, we re-load the fonts using the highest mapped DPI. But since they'll be the same, we can skip actually reloading the fonts.
* term: convert cell 'linefeed' attribute to a row 'linebreak' propertyDaniel Eklöf2020-02-14-2/+2
| | | | | | | | | | | | | | | | 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.
* vt: tag cells that were form-feed:ed, to allow correct text reflowDaniel Eklöf2020-02-10-1/+3
| | | | | | | | | 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.
* term: add term_font_size_reset()Daniel Eklöf2020-02-08-0/+1
|
* term: add term_font_size_{increase,decrease}()Daniel Eklöf2020-02-08-6/+10
|
* Implement --holdDaniel Eklöf2020-02-03-0/+1
| | | | When specified, we don't exit when the slave/client process exits.
* vt: use 8-bit indices for parameters and sub parametersDaniel Eklöf2020-02-01-4/+4
| | | | | We only support 16 (sub) parameters and thus there's no need for 64-bit index variables.
* presentation: store input timestamp in a per-commit contextDaniel Eklöf2020-01-21-1/+0
| | | | | This should reduce the risk of mixing up an input timestamp with the corresponding rendered frame.
* input: implement metaSendsEscape and eightBitMetaDaniel Eklöf2020-01-20-0/+5
|
* csi: implement REP - CSI Ps bDaniel Eklöf2020-01-20-0/+1
|
* term: factor out character printing to new function term_print()Daniel Eklöf2020-01-20-0/+2
|
* term: shorten application_synchronized_updates -> app_sync_updatesDaniel Eklöf2020-01-12-3/+3
|
* term/render: move {enable,disable}_application_synchronized_updates()Daniel Eklöf2020-01-12-0/+3
| | | | From render -> terminal
* render: add a timeout for application synchronized updatesDaniel Eklöf2020-01-12-1/+5
| | | | | This ensures we can recover from a crashing (or bad behaving) application that sends a BSU but then never sends an ESU.
* term: rename refresh_prohibited -> application_synchronized_updatesDaniel Eklöf2020-01-12-1/+1
|
* render: add render_{enable,disable}_refresh()Daniel Eklöf2020-01-12-0/+1
| | | | | | | Calling render_disable_refresh() causes update requests to that terminal to be ignored. Calling render_enable_refresh() re-enables updates.
* dcs: initial handling of DCS in generalDaniel Eklöf2020-01-12-0/+6
| | | | | | | | | | | | | | | | | | | | | | Add data structure to term->vt. This structure tracks the free-form data that is passed-through, and the handler to call at the end. Intermediates and parameters are collected by the normal VT parser. Then, when we enter the passthrough state, we call dcs_hook(). This function checks the intermediate(s) and parameters, and selects the appropriate unhook handler (and optionally does some execution already). In passthrough mode, we simply append strings to an internal buffer. This might have to be changed in the future, if we need to support a DCS that needs to execute as we go. In unhook (i.e. when the DCS is terminated), we execute the unhook handler. As a proof-of-concept, handlers for BSU/ESU (Begin/End Synchronized Update) has been added (but are left unimplemented).
* selection: update: don't dirty cells that don't change stateDaniel Eklöf2020-01-06-2/+2
| | | | | | | | | | | | | | | | 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-1/+1
|
* render: ensure cursor is always visible in the search boxDaniel Eklöf2020-01-05-0/+2
| | | | | | | | | | | | | | | | | | 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.
* term: more comments in the 'render' sub-structDaniel Eklöf2020-01-04-3/+4
|
* render: trigger terminal refreshes in an FDM hookDaniel Eklöf2020-01-04-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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: selection_cancel() now sets 'kind' to SELECTION_NONEDaniel Eklöf2020-01-04-1/+1
|
* selection: store cell 'selected' state in the cells' attributesDaniel Eklöf2020-01-04-1/+2
| | | | | | | | | 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.
* selection: track selection type; normal or block selectionDaniel Eklöf2020-01-03-0/+3
|
* term: background alpha is not a floating point numberDaniel Eklöf2020-01-03-1/+1
|
* term: add term_visual_focus_{in,out}Daniel Eklöf2020-01-02-0/+2
| | | | | | | These functions should be called when the terminal gets or loses visual focus. Note that this isn't necessarily the same as having keyboard focus.
* term: rename term_focus_{in,out} -> term_kbd_focus_{in,out}Daniel Eklöf2020-01-02-2/+2
|
* term: add visually focused attribute to terminal structDaniel Eklöf2020-01-02-0/+1
|
* wayland: optionally use the presentation time protocol to measure input lagDaniel Eklöf2019-12-31-0/+4
| | | | | | | | | | | | | | | | | | | This adds a flag, -p,--presentation-timings, that enables input lag measuring using the presentation time Wayland protocol. When enabled, we store a timestamp when we *send* a key to the slave. Then, when we commit a frame for rendering to the compositor, we request presentation feedback. We also store a timestamp for when the frame was committed. The 'presented' callback then looks at the input and commit timestamps, and compares it with the presented timestamp. The delay is logged at INFO when the delay was less than one frame interval, at WARN when it was one frame interval, and at ERR when it was two or more frame intervals. We also update statistic counters that we log when foot is shut down.
* term: term_init: add 'cwd' argumentDaniel Eklöf2019-12-21-1/+2
| | | | | | | | | | This is used when spawning the slave, to set its current working directory just before we exec() the client. In a regular foot instance, we set the cwd from getcwd(). In a foot server instance, each connecting client sends its cwd to the server, and we use that.
* term: wip: track current working directoryDaniel Eklöf2019-12-21-0/+1
| | | | | | | This sets the initial current working directory, as it is when the terminal is instantiated. We chdir() to it just before spawning a new terminal.
* term: term_spawn_new(): new function, spawns a new foot/footclient processDaniel Eklöf2019-12-21-1/+4
| | | | Bind ctrl+shift+return to it
* render: get rid of 'all-clean' detectionDaniel Eklöf2019-12-17-0/+1
| | | | | | | | | | | | | | | | | Instead of trying to figure out if we had to render something (i.e. something in the grid was dirty), and using that to determine whether to post a callback or not, we now let render_refresh() set a flag indication we need to render another frame. This simplifies render_grid(), which now _always_ renders, and pushes it to the compositor. The callback handler checks the pending flag and simply doesn't call render_grid() when there's no more pending state to render. This ends up reducing the number of wakeups when e.g. having a blinking cursor.
* render: move blink timer handling to term.cDaniel Eklöf2019-12-17-1/+2
|
* term: cursor blink: cursor refresh now dirties the cursor cellDaniel Eklöf2019-12-16-0/+2
| | | | | | | | Normally we don't dirty the cell on cursor movement. But, since a blinking cursor isn't a cursor that has moved, our normal cursor rendering wont work. Dirty the cursor cell to force a redraw of it.
* term: implement cursor blinkingDaniel Eklöf2019-12-15-1/+7
| | | | | | | | | | | | | | Blinking can be enabled either by setting the cursor style with CSI Ps SP q and selecting a blinking style. Or, with 'CSI ? 12 h' Note that both affect the same internal state. I.e. you can disable blinking with CSI ? 12l after having selected a blinking cursor style. This is consistent with XTerm behavior.
* fcft: include <fcft/fcft.h>, and use fcft/stride.h instead of local copyDaniel Eklöf2019-12-01-1/+1
|
* fcft: use fcft instead of local copy of font.c/font.hDaniel Eklöf2019-12-01-2/+3
|
* term: mouse reporting functions no longer take modifier stateDaniel Eklöf2019-11-30-6/+3
| | | | | | | | | | | | | | | | The mouse reporting functions are called from input when we receive Wayland mouse events. We used to pass the current keyboard modifier (shift, alt, ctrl, etc) to the terminal functions. This however is wrong, since we may receive Wayland mouse events without having keyboard focus. When we don't have keyboard focus, the modifier state doesn't apply to us. Remove the modifier arguments from the terminal mouse reporting functions. These functions now read this state directly instead, but only when the terminal instance in question has keyboard focus.
* term: add term_mouse_grabbed()Daniel Eklöf2019-11-30-0/+1
| | | | | | When this returns true, it means we have keyboard focus and are grabbing the mouse (for e.g. selections), regardless of whether the client has enabled mouse tracking or not.
* term: xcursor: use 'hand2' instead of 'left_ptr' when mouse trackingDaniel Eklöf2019-11-29-2/+2
| | | | | Mouse tracking always reports clicks, so using a cursor that suggests you can click makes sense I think.
* terminal: use the 'text' xcursor pointer whenever selection is possibleDaniel Eklöf2019-11-28-0/+2
|
* font: move metrics from terminal struct to font structDaniel Eklöf2019-11-26-6/+0
|
* term: try to improve on a performance regressionDaniel Eklöf2019-11-17-1/+1
| | | | | | | | When support was added for DECOM (absolute/relative row addressing), a small but noticeable (~3.5%) performance regression was introduced. Try to improve the situation by simplifying the relative-to-absolute conversion; only the row needs to be transformed.
* Revert "term: new function: term_autowrap()"Daniel Eklöf2019-11-17-1/+0
| | | | This reverts commit 686405b7031736445eeb35206e4a797a8dd78d91.
* term: new function: term_autowrap()Daniel Eklöf2019-11-17-0/+1
| | | | | | | Adds a linebreak (+ scroll if necessary) if we're in a deferred wrap and auto-margins are enabled. Return true when we wrapped, false otherwise.
* term: save/restore charsets on save/restore cursor+attributesDaniel Eklöf2019-11-17-0/+1
|
* term: convert anonymous 'charsets' struct to a named structDaniel Eklöf2019-11-17-4/+6
|
* term: move charset variables into an anonymous structDaniel Eklöf2019-11-17-2/+5
|
* term: move lcf flag into 'cursor' structDaniel Eklöf2019-11-17-1/+1
|
* term: add struct cursorDaniel Eklöf2019-11-17-3/+7
|
* term: rename: print_needs_wrap -> lcf (Last Column Flag)Daniel Eklöf2019-11-17-1/+1
|
* term: add tab-stop list to terminal structDaniel Eklöf2019-11-16-0/+2
| | | | This list is intended to store tab stop columns
* csi: implement DECOM - switch cursor origin between absolute and relativeDaniel Eklöf2019-11-05-1/+5
| | | | | | | | | | | The default is absolute mode, where 0,0 is the upper left corner of the screen. In relative mode, the origin is relative the top scroll margin. Internally, we always track the current cursor position in absolute mode. Every time we the client *sets* or *queries* the cursor position in relative mode, we translate it to absolute.
* term: asynchronous writes to slaveDaniel Eklöf2019-11-03-0/+8
| | | | | | | | | | Make ptmx non-blocking. Then, when writing data to the slave would have blocked, use the FDM to asynchronously write the remaining data. This is done by enabling EPOLLOUT on ptmx, and enqueueing all outgoing data. The FDM handler will go through the enqueued data, and once all of it has been written, we turn off EPOLLOUT again (thus switching back to synchronous writes)
* Rename: vt_to_slave() -> term_to_slave()Daniel Eklöf2019-11-02-0/+1
|
* Revert "render: last_buf may point to a free:d buffer"Daniel Eklöf2019-11-02-5/+1
| | | | This reverts commit 4d3251a93b4ba309d573aca6ff397df44c4ff760.
* render: last_buf may point to a free:d bufferDaniel Eklöf2019-11-01-1/+5
| | | | So, store last buf's width/height separately
* term_init(): initialize slave TERM from term_init() argumentDaniel Eklöf2019-11-01-1/+1
|
* terminal: call user-defined callback when destroying terminalDaniel Eklöf2019-11-01-1/+7
| | | | main uses this to get the exit code of the terminal.
* term: add term_shutdown()Daniel Eklöf2019-10-30-0/+1
| | | | | | | | | | | | | | | | This function unmaps the terminal window, removes itself from the wayland list of terminals and then finally destroys itself. We ensure we don't get any callbacks/events referring to a free:d terminal struct, we close all terminal related FDs and unmap the wayland window. Then, to be really really sure there aren't any (by the FDM) queued up events, we delay the self-destruction to the next FDM poll iteration, by opening an event FD and adding it to the FDM. The callback for the event FD removes the FD from the FDM again, and closes it. And then proceeds to destroy the terminal.
* Merge branch 'fdm'Daniel Eklöf2019-10-30-131/+21
|\
| * terminal: implement term_init() and term_destroy()Daniel Eklöf2019-10-28-0/+10
| |
| * wayland: implement wayl_init()Daniel Eklöf2019-10-27-1/+1
| | | | | | | | Wayland instantiation is now done by the wayland backend, not in main.
| * term: wayland struct is now not a part of the terminal structDaniel Eklöf2019-10-27-1/+1
| | | | | | | | | | | | We do however need access to it, so provide a pointer. The difference is that now we can have a *single* wayland instance, but multiple terminal instances.
| * wayland: change all wayland callbacks to take a wayland pointerDaniel Eklöf2019-10-27-14/+0
| | | | | | | | | | Instead of passing the terminal to the wayland callbacks, pass a 'struct wayland' pointer.
| * kbd: move into waylandDaniel Eklöf2019-10-27-2/+0
| |
| * kbd: break out XKB kbd struct to a separate fileDaniel Eklöf2019-10-27-32/+1
| |
| * wayland: move clipboard/primary structs into the wayland structDaniel Eklöf2019-10-27-16/+0
| | | | | | | | These are application global and very wayland specific
| * wayland: implement wayl_win_destroy()Daniel Eklöf2019-10-27-1/+0
| |
| * wayland: move wayland struct definitions to a separate fileDaniel Eklöf2019-10-27-68/+1
| |
| * term: convert anonymous 'window' struct to named 'wl_window' structDaniel Eklöf2019-10-27-15/+17
| |
| * term: move per-window wayland objects from wayland struct to terminal structDaniel Eklöf2019-10-27-14/+16
| | | | | | | | | | | | | | | | Short term, we want to break out the wayland backend from the terminal struct. Long term, we might want to support multiple windows. One step towards both the above is separating global wayland objects from per-window objects.
| * fdm: use the FDM's poll loopDaniel Eklöf2019-10-27-0/+7
| |
* | scrollback: regression: fix rendering of scrollback diffs less than a screenDaniel Eklöf2019-10-29-1/+3
|/ | | | | | | | | | | | | | When doing "small" scrolls (typically done via mouse wheel or similar), we render the scrolling by emitting a "scroll damage". A recent commit changed how scroll damage is rendered; only when the view is at the bottom ("following" the screen output) do we render the damage. To fix this, add a new type of scroll damage, SCROLL_DAMAGE_IN_VIEW and SCROLL_DAMAGE_REVERSE_IN_VIEW. These signal to the renderer that it should always render the damage.
* font: font_from_name() returns an allocated font structDaniel Eklöf2019-10-16-1/+1
|
* main: track output refresh rateDaniel Eklöf2019-09-20-0/+1
|
* search: make search-direction configurableDaniel Eklöf2019-08-30-0/+1
|
* main: request server-side decorationsDaniel Eklöf2019-08-30-0/+3
|
* term: add a 'cursor' (position) to the search stateDaniel Eklöf2019-08-29-0/+1
|
* search: move wayland surface variables into the term structDaniel Eklöf2019-08-29-2/+14
|
* search: use a sub-surface to render the search bufferDaniel Eklöf2019-08-29-0/+1
|
* term: add term_reset_view() - make view follow end-of-output againDaniel Eklöf2019-08-28-0/+2
|