aboutsummaryrefslogtreecommitdiff
path: root/terminal.h (follow)
Commit message (Collapse)AuthorAgeLines
...
* 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
|
* search: wip: initial search matchingDaniel Eklöf2019-08-27-0/+5
| | | | | | | | * match search buffer against scrollback content * adjust view to ensure matched content is visible * create selection on a successful match * finalize selection when user presses enter (to "commit" the search) * ctrl+r searches for the next match. Needs more work though.
* search: wip: re-direct input while searching, and build a search bufferDaniel Eklöf2019-08-27-0/+8
| | | | | | | | | | | This adds a new state, 'is_searching'. While active, input is re-directed, and stored in a search buffer. In the future, we'll use this buffer and search for its content in the scrollback buffer, and move the view and create a selection on matches. When rendering in 'is_searching', everything is dimmed. In the future, we'll render the current search buffer on-top of the dimmed "regular" terminal output.
* render: center grid in windowDaniel Eklöf2019-08-27-0/+2
| | | | | Instead of placing the upper left corner of the grid at 0,0 in the window, center it.
* term: rename colors256 -> tableDaniel Eklöf2019-08-21-2/+2
|
* term: use colors256 array for *all* colorsDaniel Eklöf2019-08-21-4/+0
| | | | | | That is, remove the 'regular' and 'bright' color arrays. This is possible since the 256-color array is defined such that the first 16 colors map to the regular and bright colors.
* csi: move 256-color table into the terminal structDaniel Eklöf2019-08-21-0/+2
|
* render: reload cursor theme when scale (may) have changedDaniel Eklöf2019-08-21-0/+2
|
* csi: implement CSI ? 1007 h/l - alternateScrollDaniel Eklöf2019-08-19-0/+1
| | | | | When enabled, mouse scrolls in the alternate screen are converted to up/down key presses.
* Remove all references to cairo; we now use pixman onlyDaniel Eklöf2019-08-16-1/+0
|
* input: track meta modifierDaniel Eklöf2019-08-15-0/+2
|
* Add background alpha supportDaniel Eklöf2019-08-15-0/+1
|
* output: track output we're mapped on, and use maximum scaleDaniel Eklöf2019-08-12-1/+2
| | | | | | Our surface may be on multiple outputs at the same time. In this case, we use the largest scale factor, and let the compositor down scale on the "other" output(s).
* output: resize on scale changesDaniel Eklöf2019-08-12-0/+1
|
* output: initial support for output scalingDaniel Eklöf2019-08-12-0/+20
| | | | | | * Not updated run-time; only scale at start up used * Multiple monitors (outputs) not supported, as we can't track which output we're on (yet).
* selection/input: triple click selects an entire rowDaniel Eklöf2019-08-06-0/+1
|
* input: use a timer fd to handle keyboard key repeatDaniel Eklöf2019-08-05-6/+1
| | | | | | | | | | | Instead of running a repeater thread that writes the key to repeat over a pipe, use a simple timer fd. No more locking or condition signalling. No need to track start/stop/exist states. We simply set up the initial timeout value to be the 'delay', and the interval to be the repeat 'rate'.
* cell: pack more efficiently and store glyph as a wcharDaniel Eklöf2019-08-02-16/+23
| | | | | | | | | | | The 'attributes' struct is now 8 bytes and naturally packed (used to be 9 bytes, artificially packed). 'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes, artificially packed). Furthermore, the glyph is stored as a wchar instead of a char*. This makes it easier (faster) to do glyph lookup when rendering.
* term: implement resetDaniel Eklöf2019-08-01-0/+2
|
* conf: make number of scrollback lines configurableDaniel Eklöf2019-08-01-0/+1
|