aboutsummaryrefslogtreecommitdiff
path: root/input.c (follow)
Commit message (Collapse)AuthorAgeLines
...
* kitty: implement “report associated text”Daniel Eklöf2021-12-08-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | In this mode, key events that generate text now add a third CSI parameter, indicating the actual codepoint. Remember that we always use the *unshifted* key in the CSI escapes. With this mode, those CSI escapes now also included the text codepoint. I.e. what would have been emitted, had we not generated a CSI escape. As far as I can tell, this mode has no effect unless “report all keys as escape sequences” is enabled (reason being, without that, there aren’t any text events that generate CSIs - they’re always emitted as-is). Note that Kitty itself seems to be somewhat buggy in this mode. At least on Wayland, with my Swedish layout. For example ‘a’ and ‘A’ does generate the expected CSIs, but ‘å’ and ‘Å’ appears to be treated as non-text input. Furthermore, Kitty optimizes away the modifier parameter, if no modifiers are pressed (e.g. CSI 97;;97u), while we always emit the modifier (CSI 97;1;97u). Related to #319
* input: kitty: add support for “report all keys as escape codes”Daniel Eklöf2021-12-06-25/+55
|
* input: kitty: merge handling of plain-text and composed charactersDaniel Eklöf2021-12-04-88/+87
| | | | | | | | | | | | | | | | | | | | | | | | All plain-text and composed characters are now printed as-is, in a single place. Also fix handling of “generic” keys when emitted as escapes; don’t use the raw XKB symbol as key in the escape, convert it to a unicode code point first. For many symbols, these are the same. But not all. For now, we fallback to using the symbol as is if XKB fails to convert it to a codepoint. Not sure if we should simply drop the key press instead. Composed characters also need special treatment; we can’t use the symbol as is, since it typically refers to the last key pressed (i.e. not the composed character). And, that key is also (usually) a special “dead” key, which cannot be converted to a unicode codepoint. So, what we do is convert the generated utf8 string, and (try to) convert it to a wchar. If it succeeds, use that. If not, fallback to using the XKB symbol (as above).
* input: reset compose state on key *releases*, not pressesDaniel Eklöf2021-12-04-1/+1
|
* input: kitty: treat repeating == pressed when report-events is offDaniel Eklöf2021-12-04-1/+1
|
* input: kitty: add support for the “report event” mode (0b10)Daniel Eklöf2021-12-04-13/+38
|
* input: don’t ignore key release eventsDaniel Eklöf2021-12-04-43/+62
| | | | | | | | | | | | | Before this, key release events stopped the repeat timer, and then returned. Now, we run through the entire function. Most things are still only done on key press events. But, the goal here is to get to the keyboard protocol functions (and the kitty protocol in particular), and call them on release events too. This is in preparation for the kitty protocol mode 0b10, report event types.
* config, input: allow configuring select-override modifiersfeeptr@codeberg.org2021-12-02-6/+8
|
* input: always update the xcursor shape in pointer enter/motion eventsDaniel Eklöf2021-12-01-15/+10
| | | | | | | | | | | | | | | | Now that term_xcursor_update_for_seat() takes the current surface into account (i.e. doesn’t assume the cursor is over the main grid), there’s no longer any need to call render_xcursor_set() directly. Thus, we can simply call term_xcursor_update_for_seat() on **all** pointer enter and motion events. As long as we take care to update the internal state to reflect the, possibly new, current surface before doing so. Also make sure to **always** reset the seat’s “current” xcursor pointer on pointer leave events. This is done without actually sending anything to the compositor, but is necessary to ensure that we *do* send a request to update the xcursor on the next pointer enter event.
* input: fix debug log format specifier; ‘count’ is a size_tDaniel Eklöf2021-12-01-1/+1
|
* input: make csd_data variable ‘const’Daniel Eklöf2021-11-30-2/+1
|
* Merge branch 'window-menu'Daniel Eklöf2021-11-30-6/+20
|\
| * input: Add support for xdg_toplevl.show_window_menu()Jonas Ådahl2021-11-29-0/+10
| | | | | | | | | | This makes, if the compositor supports it, the window menu appear when right clicking on the title bar.
| * input: Update mouse x/y coordinates on wl_pointer_enterJonas Ådahl2021-11-29-5/+9
| | | | | | | | | | | | | | Otherwise if you don't receive motion event before e.g. button pressed, the coordinates will be incorrect. This happens when e.g. you get alt-tabbed so that the mouse cursor ends up on top of the terminal window, but the mouse never actually moved.
| * terminal: Make seat xcursor update focus awareJonas Ådahl2021-11-29-1/+1
| | | | | | | | | | | | | | When term_xcursor_update_for_seat() was called on e.g. keyboard focus loss, it'd update the curret xcursor to 'text' even if it was e.g. on top of the window title, or resize areas. This makes the function a bit more focus aware, and will not be so eager to set the text xcursor.
* | input: regression: reset view (and cancel selection) on “handled” inputDaniel Eklöf2021-11-29-16/+18
| | | | | | | | | | | | This fixes a regression, where the view (and selection) was only reset if the keyboard input resulted in plain text. That is, key presses like enter, arrows etc did not.
* | input: regression: special keys don’t reset view and cancel selectionDaniel Eklöf2021-11-28-2/+4
| | | | | | | | | | This fixes an issue where e.g. holding down ctrl would cancel the selection, thus making it impossible to copy text to the clipboard.
* | input: kitty: use `XKB_CONSUMED_MODE_GTK` when retrieving consumed modsDaniel Eklöf2021-11-28-1/+2
| |
* | input: get_current_modifiers(): use xkb_state_key_get_consumed_mods2()Daniel Eklöf2021-11-28-2/+4
| | | | | | | | Explicitly request consumed modifiers using the `XKB` mode.
* | input: legacy: use ALEN(mod_param_map)Daniel Eklöf2021-11-28-1/+1
| |
* | input: grammar: “an UTF-8” -> “a UTF-8”Daniel Eklöf2021-11-28-4/+4
| |
* | input: legacy: reduce size of reply bufferDaniel Eklöf2021-11-28-1/+1
| | | | | | | | | | Its maximum size is known; the only two variables are two integers. We know the maximum length of an integer converted to a string.
* | input: only report modifiers when “Report all keys as escape codes” is enabledDaniel Eklöf2021-11-28-60/+16
| |
* | input: kitty: add shift/alt/ctrl/super/hyper/meta keysDaniel Eklöf2021-11-28-0/+48
| |
* | input: kitty: add ‘media’ keysDaniel Eklöf2021-11-28-0/+14
| |
* | input: kitty: map ISO_Left_Tab to TabDaniel Eklöf2021-11-28-0/+1
| |
* | input: rename ‘meta’ to ‘super’Daniel Eklöf2021-11-28-11/+11
| |
* | input: kitty: only emit CSIs for Caps- and Num-Lock when they aren’t modifiersDaniel Eklöf2021-11-28-2/+14
| |
* | input: handle “invalid” XKB modifiersDaniel Eklöf2021-11-28-30/+56
| | | | | | | | | | A modifier may not exist in a specific layout. This is indicated by XKB returning XKB_MOD_INVALID from xkb_keymap_mod_get_index().
* | input: kitty: disable CSI for Caps- and Num-LockDaniel Eklöf2021-11-28-2/+2
| | | | | | | | | | | | | | | | Not sure why these keys have CSIs in the kitty spec; they don’t emit anything. Could it be that they are used if the keys are *not* modifiers in the current layout?
* | input: kitty: printables are emitted as text, even if Caps- or Num-Lock is in effectDaniel Eklöf2021-11-28-4/+15
| | | | | | | | | | | | | | | | | | | | Not sure if this is the best/correct way to do it. But kitty seems to ignore at least Num-Lock for printables, while it _does_ affect other keys. For example, Return, which usually emits ‘\r’, are affected by Num-Lock and emit ‘CSI 13;129u’. Note that as soon as some other modifier is in effect, the Num-Lock modifier *is* encoded in the CSI, also for printables.
* | input: get_current_modifiers() no longer strips insignificant modsDaniel Eklöf2021-11-28-34/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Our internal binding handling cares about a different set of modifiers, compared to the kitty keyboard protocol. To handle this, get_current_modifiers() has been modified, to no longer strip the “unsignificant” modifiers. This is now up to the caller to do. To help, we keep two masks (for significant modifiers) in the seat struct; one for our internal binding handling (and the legacy keyboard protocol), and one for the kitty keyboard protocol. These two masks are updated when the seat’s keymap is updated/changed.
* | input: kitty: use base symbol instead of lowering the symbolDaniel Eklöf2021-11-28-21/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When emitting an escape sequence for a printable character, with modifiers (e.g. ctrl+a), use the key’s base symbol instead of “lowering” it. This means we now handle e.g. ctrl+2 and ctrl+shift+2, with Swedish layout. There’s a twist however. We *only* use the base symbol if the modifiers that is used to “generate” the symbol are “significant”. Significant modifiers are, in this context, modifiers we can encode in the kitty escape sequences. In the Swedish layout, pressing AltGr+2 results in ‘@’. AltGr cannot be encoded in the kitty protocol. If we were to use the base symbol, AltGr+Alt+2 would result in exactly the same escape sequence as Alt+2.
* | input: wip: add support for kitty kbd protocol “Disambiguate escape codes”Daniel Eklöf2021-11-28-21/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most things appear to work as in kitty. There’s one known difference: tri-state keys don’t generate the same unshifted symbol while holding Shift (but e.g. Ctrl+a and Ctrl+Shift+a *does* generate the same base symbol). For example, the Swedish keyboard layout has double quote, ‘2’ and ‘@’ on the same key. ‘2’ is the base (unshifted) symbol. Double quote is Shift+2. ‘@’ is AltGr+2. Kitty generates the same base symbol for ‘2’ and double quote (the base symbol is, as expected, ‘2’). But, for ‘@’ kitty generates the base symbol ‘@’. Currently, foot generates the base symbol by calling xkb_keysym_to_lower(). I _think_ what we need to do is “consume” the shift modifier, and then re-retrieve the symbol (given the current xkb state and key pressed).
* | input: enable repeat while COMPOSINGDaniel Eklöf2021-11-28-4/+2
| |
* | input: refactor: new function: legacy_kbd_protocol()Daniel Eklöf2021-11-28-105/+107
| | | | | | | | | | | | | | | | | | | | | | | | This breaks out all handling of key escapes to-be-sent to the client, to a separate function, legacy_kbd_protocol(). That is, the key press/release handler first handles key generic handling, such as starting and stopping the repeat timer. Then it checks for foot keyboard bindings. If not bindings match, we need to pass the keyboard event to the client. This code has now been separated out into a new function.
* | input: finalize mouse selection on a pointer-leave event on the GRID surfaceDaniel Eklöf2021-11-25-1/+4
|/ | | | | | | | | If a mouse selection was ongoing, and the user switched workspace (probably using the keyboard...), and then back, the selection was still treated as ongoing, while all other mouse state has been reset. This meant the user had to tap at least once to stop the selection.
* input: add support for modifyOtherKeys=2Daniel Eklöf2021-11-13-5/+39
| | | | | | | | | | | | | | | | Similar to modifyOtherKeys=1 (foot’s default, and only, mode), except that: * All modifiers (and not just Ctrl) generate \E[27;m;n~ escapes * Regular keys (with modifiers) also generate \E[27;m;n~ escapes (for example, C-h no longer generates ^H, but \E[27;5;104~) For our keymap based lookups, this is handled by adding MOD_MODIFY_OTHER_KEYS_STATE<N> variants. For “generic” keys, we simply adjust the conditions for when to emit a \E[27;m;n~ escape - the only requirement is that at least one modifier is active.
* input: don’t apply [scrollback].multiplier when alt screen is in useDaniel Eklöf2021-11-13-4/+11
| | | | Closes #787
* input: clean up mouse scroll handlingDaniel Eklöf2021-10-27-8/+21
| | | | | | | | | | * Allow scrolling on the normal (non-alt) screen, when application is grabbing the mouse (when user presses Shift). * Use term_mouse_grabbed() instead of explicitly checking for MOUSE_NONE tracking. * Remove mouse tracking check from cmd_scrollback_{up,down}. Caller is expected to have done the check. * Don’t scroll down on mouse wheel tilt events.
* config: add [key-bindings].noop actionDaniel Eklöf2021-10-27-0/+3
| | | | | | | Key combinations assigned to this action will not be sent to the application. Closes #765
* input: update serial on each key press/release and mouse buttonDaniel Eklöf2021-10-20-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The serial is used when copying/pasting data from the clipboard. Up until now, we’ve used the serial from the keyboard/mouse enter events. This works in most cases, but breaks in the following example: $ wl-copy WLCOPY /* Ctrl+Shift+v works fine (pastes "WLCOPY") */ $ printf "\033]52;c;eHl6\a" /* Ctrl+Shift+v pastes "WLCOPY" instead of "xyz" */ Shifting focus away and then back to the foot window, and re-executing the printf works, suggesting the “enter” serial is no longer valid after another process(?) has copied something to the clipboard. Updating the serial on key press/release (and the corresponding mouse serial on mouse button events) seems to fix this. I’ve also tested that “normal” copy/paste operations, within the same foot instance, and between foot and other applications, are still working. In at least river (wlroots based), and GNOME/mutter. Closes #753
* input: filter out non-significant modifiers when matching mouse bindingsDaniel Eklöf2021-10-06-15/+28
| | | | Closes #736
* input: check for ‘effective’ modifiers, not ‘depressed’Daniel Eklöf2021-10-02-6/+6
| | | | | | | When reading XKB modifier state, use XKB_STATE_MODS_EFFECTIVE, not XKB_STATE_MODS_DEPRESSED. This fixes handling of ‘sticky’ modifier keys.
* input: workaround GNOME issue with pointer button eventsDaniel Eklöf2021-09-12-45/+57
| | | | | | | | | | | | | | | | | Under certain circumstances, GNOME will send multiple pointer button press events, without any release or leave events in between. This trips up our button tracking. Workaround, by replacing the existing state for the pressed button with the new state. Previously, debug builds would assert (and thus crash), while release builds would have multiple states for the same button, causing (probably) issues like the title bar not being usable (as in, cannot be dragged, buttons not working etc). Hopefully closes #709
* input: implement support for mouse wheel left/rightDaniel Eklöf2021-08-07-19/+24
| | | | | | | | | | | | | We now emit button 6/7 events (when the client application grabs the mouse). This buttons map to mouse wheel horizontal scroll events. Or, left/right tilting, if you like. Wayland report these as ‘axis’ events (just like regular scroll wheel events), and thus we need to translate those scroll events to button events. libinput does not define any mouse buttons for wheel tilts, so we add our own defitions. These are added last in the BTN_* range, just before the BTN_JOYSTICK events.
* input: codespell: follwing -> followingDaniel Eklöf2021-08-06-1/+1
|
* input: workaround GNOME messing up pointer leave/enter after moving windowDaniel Eklöf2021-08-06-1/+47
| | | | | | | | | | GNOME doesn’t send pointer enter after finishing a window move. In subsequent move operations, it is also possible to make it skip sending pointer leave when starting the move operations. This caused foot to assert in debug builds, and add the same button multiple times to the list of buttons currently being pressed.
* term: consolidate shutdown related state into an anonymous structDaniel Eklöf2021-07-31-1/+1
|
* config: remove replaced/removed key bindings, instead of marking as ‘unused’Daniel Eklöf2021-06-30-6/+0
| | | | | | | | | | | | Instead of keeping removed/replaced key bindings in the key binding array (marked as ‘unused’), remove them, by compacting the array. The invariant is thus that there should be *no* entries in the key binding list with the `BIND_ACTION_NONE` for action. Add code to debug builds that verifies this, plus a unit test. Closes #614
* input: ignore ‘unused’ URL key bindings when mapping bindings to current keymapDaniel Eklöf2021-06-28-2/+0
| | | | | This is a temporary fix for #614. Long term fix is to remove the ‘replaced’ bindings from the array at config time.
* config: add new function config_clone()Daniel Eklöf2021-06-23-3/+4
|
* config: don’t use tllist where it isn’t necessaryDaniel Eklöf2021-06-18-10/+30
| | | | | | | | | | | | | | | | tllists are great when dealing with dynamically changing lists. They are also very easy to use when building lists/arrays where the final size is unknown. However, this ease of use comes at a price: code size. tll-macros expand to a lot of code. Since things in the config are static, once the config has been loaded, using tllists for configuration data structures doesn’t make much sense. This patch replaces nearly all tllists used by the configuration, with dynamically allocated arrays.
* input: pass through scrollback-* key bindings when alt screen is activwDaniel Eklöf2021-06-04-12/+33
| | | | | | | | | Since the alt screen have no scrollback, all scrollback-* actions are effectively no-ops when the alt screen is active. Make them available to the client application instead. Closes #573
* macros: add UNITTEST macro and use to replace test_keymap_lookup()Craig Barnes2021-05-26-4/+1
|
* input: regression test for escape sequence generated for ctrl+shift+tabDaniel Eklöf2021-05-26-0/+15
|
* input: keymap_lookup: remove unused argument ‘seat’Daniel Eklöf2021-05-26-3/+2
|
* revert: input: do not include consumed modifiers in the set sent to the clientDaniel Eklöf2021-03-29-5/+5
| | | | | | | | | | | | | | | | There were two issues with it: * Not all applications decode the sequence into a set of modifiers + key, but use a fixed sequence -> combo mapping, that we broke. * There were unforeseen issues with e.g. F1-12, where the modifier were removed from combos like Ctrl+F12, or Alt+F12. The reason is simple; XKB tells us that Ctrl, or Alt, is a consumed modifier. Now, _why_ it thinks that is a different story. This reverts 6cd72bdee6c2b11f7cab15df9afb0ed92a7f8ba0 Closes #425
* input: must have all required modifiers to un-shift a symbolDaniel Eklöf2021-03-21-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When detecting, and repairing, “broken” key bindings (where the key binding itself explicitly lists a modifier that is consumed by the final symbol - e.g “Shift+W”), don’t just look for an intersection between the set of modifiers needed to produce the final symbol, and the modifiers listed in the key combo. Instead, check if the key combo has *all* the required modifiers. Example: Shift+AltGr+w produces Page_Down. I.e. Page_Down is the _shifted_ symbol, ‘w’ is the un-shifted symbol, and Shift+AltGr are the modifiers required to shift ‘w’ to Page_Down. If we have the key combo Shift+Page_Down, foot would, correctly, determine that Page_Down is a shifted symbol. It would find the Shift+AltGr modifier set, and since the intersection of “Shift+AltGr” and “Shift” (from our key combo) is non-empty, foot would (incorrectly) determine that we can, and should, replace Page_Down with its un-shifted symbol ‘w’. This is completely wrong, since Shift+w does _not_ produce Page_Down. Closes #407
* keymap: handle shift+tab combos correctly, after consuming modifiersDaniel Eklöf2021-03-08-2/+2
| | | | | | | | | | | | | | | | | | | | | Shift+Tab is an odd bird in XKB; it produces a shifted variant of tab, ISO_Left_Tab, with Shift being a consumed modifier. From a terminal perspective, Tab and ISO_Left_Tab are the same key, with Shift+Tab generating ‘CSI Z’, and all other combos generating a ‘CSI 27;mods;9~’ escape. Before, when we didn’t filter out consumed modifiers, we could simply re-use the keymap for Tab when translating ISO_Left_Tab. This is no longer possible, since shift has been filtered out. As a result, Shift+Tab no longer generated ‘CSI Z’, but ‘\t’. I.e as if shift wasn’t being pressed. This patch adds a separate keymap table for ISO_Left_Tab. It’s MOD_ANY entry corresponds to Shift+Tab, and emits ‘CSI Z’. All its other entries *exclude* shift (since it has been consumed), *but*, the encoded modifier (in the escape sequences) *include* shift.
* input: do not include consumed modifiers in the set sent to the clientDaniel Eklöf2021-03-08-5/+5
| | | | | | | When sending a key escape sequence to the client application, do not include consumed modifiers. Fixes part of #376
* input: repair key combos containing both explicit modifier and shifted symbolDaniel Eklöf2021-03-04-5/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a user-provided key combo contains both an explicit modifier, and the shifted symbol it produces, replace the symbol with its un-shifted version. Example: Control+Shift+U contains both ‘Shift’, and ‘U’, where ‘Shift’ is the modifier that shifts ‘u’ to ‘U’. Such modifiers are “consumed”, i.e. filtered out, when matching key combos. As such, Control+Shift+U will never trigger since we’ll never be able to match the consumed modifier ‘Shift’. The above combo can be written in two ways: - Control+U - Control+Shift+u To be able to detect that Control+Shift+U is an invalid combination, we need to check all *shifted* symbols for all key *codes*. Once we’ve detected a shifted symbol (and where it differs from the un-shifted symbol), we loop all modifier sets that produce the shift level where our shifted symbol is. For each such set, check if it intersects with the user-provided key combo’s modifier set. If there is an intersection, it means the user provided a key combo containing a modifier and symbol, such that the modifier is consumed when the symbol is produced. In this case, we replace the symbol with its un-shifted version.
* input: rewrite of how we match foot’s own key bindingsDaniel Eklöf2021-03-04-14/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bindings are matched in one out of three ways: * By translated (by XKB) symbols * By untranslated symbols * By raw key codes A translated symbol is affected by pressed modifiers, some of which can be “consumed”. Consumed modifiers to not partake in the comparison with the binding’s modifiers. In this mode, ctrl+shift+2 maps to ctrl+@ on a US layout. Untranslated symbols, or un-shifted symbols refer to the “base” symbol of the pressed key, i.e. it’s unaffected by modifiers. In this mode, consumed modifiers *do* partake in the comparison with the binding’s modifiers, and ctrl+shift+2 maps to ctrl+shift+2 on a US layout. More examples: ctrl+shift+u maps to ctrl+U in the translated lookup, while ctrl+shift+u maps to ctrl+shift+u in the untranslated lookup. Finally, we also match raw key codes. This allows our bindings to work using the same physical keys when the user switches between latin and non-latin layouts. This means key bindings in foot.ini *must* not include both +shift+ and a *shifted* key. I.e. ctrl+shift+U is not a valid combo as it cannot be triggered. Unfortunately, this was how you were supposed to write bindings up until now... so, we try to detect such bindings, log a deprecation warning and then “fix” the binding for the user. When specifying bindings in foot.ini, both ctrl+U and ctrl+shift+u are valid, and will work. The latter is preferred though, since we cannot detect the raw key code for the former variant. Personally, I also prefer the latter one because it is more explicit; it’s more obvious which keys are involved. However, in some cases it makes more sense to use the other variant. Typically for non-letter combos.
* input: ask XKB for consumed modifiers, but don’t actually use them just yetDaniel Eklöf2021-03-04-10/+11
|
* input: mutter has been seen sending NULL surfaces in pointer enterDaniel Eklöf2021-03-04-0/+5
|
* input: exit URLs mode on mouse button eventsDaniel Eklöf2021-03-04-0/+1
| | | | This makes URLs mode behave like scrollback search mode.
* url-mode: use ‘jump-label-letters’ as the alphabet for key sequencesDaniel Eklöf2021-02-13-1/+1
| | | | | | | Instead of hard coding the alphabet to “sadfjklewcmpgh”, use the letters from ‘jump-label-letters’. Closes #355
* Convert all but 2 remaining uses of xassert(false) to BUG("...")Craig Barnes2021-02-10-2/+2
|
* Convert some more uses of xassert(false) to BUG("...")Craig Barnes2021-02-09-2/+2
|
* Convert some uses of xassert(false) to BUG("some error message")Craig Barnes2021-02-09-1/+1
|
* key-bindings: refactor: use a single type for all key bindingsDaniel Eklöf2021-02-08-49/+16
| | | | | | | | | | | | | | | | Up until now, the various key binding modes (“normal”, “search” and “url”) have used their own struct definitions for their key bindings. The only reason for this was to have a properly typed “action” (using the appropriate “action” enum). This caused lots of duplicated code. This patch refactors this to use a single struct definition for the “unparsed” key bindings handled by the configuration, and another single definition for “parsed” bindings used while handling input. This allows us to implement configuration parsing, keymap translation and so on using one set of functions, regardless of key binding mode.
* url-mode: urls_collect(): URL list pointer as an argumentDaniel Eklöf2021-02-07-3/+3
|
* url-mode: underline URLs using the color from colors.urlsDaniel Eklöf2021-02-07-0/+1
| | | | | | | | | | | | | | | | | | | | | | This is implemented by allocating one of the (few!) remaining bits in the cells’ attribute struct to indicate the cell should be “URL highlighted”. render_cell() looks at this bit and draws an underline using the color from colors.urls (defaults to regular3 - i.e. yellow). A new function, url_tag_cells(), iterates the currently detected URLs and sets the new ‘url’ attribute flag on the affected cells. Note: this is done in a separate function to keep urls_collect() free from as many dependencies as possible. urls_reset() is updated to *clear* the ‘url’ flag (and thus implicitly also results in a grid refresh, _if_ there were any URLs). We now exit URL mode on *any* client application input. This needs to be so since we can’t know if the URLs we previously detected are still valid.
* input: mouse events on jump label surfaces do nothingDaniel Eklöf2021-02-07-0/+4
|
* config: add show-urls-copy actionDaniel Eklöf2021-02-07-2/+8
| | | | | | This works just like show-urls-launch, except that instead of opening the URL (typically using xdg-open), it is placed in the clipboard when activated.
* config: rename ‘show-urls’ to ‘show-urls-launch’Daniel Eklöf2021-02-07-1/+1
|
* urls: initial support for detecting URLs and rendering jump-labelsDaniel Eklöf2021-02-07-2/+11
| | | | The jump labels work, but is currently hardcoded to use xdg-open
* config: add infrastructure to handle URL mode specific key bindingsDaniel Eklöf2021-02-07-0/+28
| | | | | | * Add “show-urls” action to regular key bindings * Add url-bindings section to foot.ini * Add “cancel” action to URL mode key bindings
* input: don’t execute mouse bindings when the application is grabbing the mouseDaniel Eklöf2021-02-02-94/+74
| | | | | | | | | | | | | | | | | | | When the application is grabbing the mouse, we require ‘shift’ to be pressed to be able to use foot’s mouse bindings. Otherwise the mouse event is sent to the application. This wasn’t being enforced consistently; each and every mouse **only** action was checking the mouse grab state, but e.g. *primary paste* (which can be used as both a key binding and a mouse binding) was not. The fix is actually quite simple: don’t even try to execute *any* mouse bindings when the application is grabbing the mouse (unless shift is pressed). This fixes an issue where e.g. middle mouse button events (using the default mouse bindings) were never seen by any mouse grabbing client applications.
* debug: rename assert() to xassert(), to avoid clashing with <assert.h>Craig Barnes2021-01-16-28/+28
|
* input: don’t enable keyboard repeat timer when repeat rate is zeroDaniel Eklöf2021-01-16-0/+3
| | | | | | | | | | wayland-client-protocol.h: Negative values for either rate or delay are illegal. A rate of zero will disable any repeating (regardless of the value of delay). This fixes a division-by-zero crash.
* Add xsnprintf() and remove some unnecessary strlen(3) callsCraig Barnes2021-01-14-2/+3
|
* config: add ‘select-extend-character-wise’ bind actionDaniel Eklöf2021-01-14-1/+11
| | | | | | | This forces the (new) selection mode to be character-wise when extending a word- or line-wise selection. Default key binding is ctrl+RMB.
* selection: combine enum selection_kind with selection_semanticDaniel Eklöf2021-01-06-10/+6
|
* selection: use selection_start() to initialize word/row-based selectionDaniel Eklöf2021-01-04-7/+10
| | | | | | This removes the selection_mark_word() and selection_mark_row() functions. To start a word/row-based selection, use selection_start() with SELECTION_SEMANTIC_{WORD,ROW}
* selection: wip: update selection word-wise when initial selection was by wordDaniel Eklöf2021-01-04-2/+4
|
* input: don’t try to close an invalid FDDaniel Eklöf2021-01-04-3/+4
|
* input: don’t assert when receiving a button release without a press eventDaniel Eklöf2021-01-04-1/+20
|
* input: remove non-existing state from debug logDaniel Eklöf2020-12-23-1/+1
|
* input: make sure ‘surf_kind’ is not uninitializedDaniel Eklöf2020-12-12-1/+1
|
* input: rework mouse button/motion handlingDaniel Eklöf2020-12-12-91/+120
| | | | | | | | | | | | | | | | | | | Store a list of currently pressed buttons, and which surface they belong to (i.e. which surface that received the press). Then, in motion events (with a button pressed, aka drag operations), send the event to the “original” surface (that received the press). Also send release events to the originating surface. This means a surface receiving a press will always receive a corresponding release. And no one will receive a release event without a corresponding press event. Motion events with a button pressed will *always* use the *first* button that was pressed. I.e. if you press a button, start dragging, and then press another button, we keep generating motion events for the *first* button.
* input: report mouse drag events also when the pointer is outside the gridDaniel Eklöf2020-12-11-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As long as the mouse button was *pressed* while the pointer was inside the grid, we want to keep reporting motion events until the button is released. Even when the pointer moves outside the grid (but in this case, the reported coordinates are bounded by the grid size). This patch also tries to improve multi-button handling (i.e. multiple buttons pressed at the same time), and the events we report to the client for these, in the following ways: * Motion events now report the *initial* button. That is, if you start a drag operation with the LEFT button, then press RIGHT (before releasing LEFT), keep reporting LEFT in the motion events. * Mouse release events are reported for *any* button, as long as the pointer is *inside* the grid, *or*, the button released was the button used to start a drag operation. The last point is important; if we have reported a button press followed by motion events (i.e. a drag operation), we need to report the button release, *even* if the pointer is outside the grid. Note that the client may receive unbalanced button press/release events in the following ways if the user pressed one, and then a second button *inside* the grid, then releases the *first* button (possibly outside the grid), and finally releases the *second* button *outside* the grid. In this case, both buttons will report press events. The first button will report a release event since it is the initial button in the drag operation. However, we don’t track the fact that the second button is being pressed, and thus if it is released outside the grid, it wont generate a release event.
* Merge branch 'remove-deprecated-things'Daniel Eklöf2020-12-09-2/+0
|\
| * config: remove support for scrollback-up and scrollback-downDaniel Eklöf2020-12-08-2/+0
| |
* | ime: render pre-edit textDaniel Eklöf2020-12-07-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done by allocating cells for the pre-edit text when receiving the text-input::done() call, and populating them by converting the utf-8 formatted pre-edit text to wchars. We also convert the pre-edit cursor position to cell positions (it can cover multiple cells). When rendering, we simply render the pre-edit cells on-top off the regular grid. While doing so, we also mark the underlying, “real”, cells as dirty, to ensure they are re-rendered when the pre-edit text is modified or removed.
* | ime: wip: commit all changes in ‘done()’Daniel Eklöf2020-12-07-1/+3
|/
* Merge branch 'modify-escape-key'Daniel Eklöf2020-12-01-1/+7
|\ | | | | | | Closes #225
| * csi: add new private mode that makes the Escape key emit "\E[27;1;27~"Craig Barnes2020-11-29-1/+7
| | | | | | | | | | | | | | | | | | | | This mode can be set by client programs with the DECSET, DECRST, XTSAVE and XTRESTORE sequences by using 27127 as the parameter. The sequence "\E[27;1;27~" is encoded in the same way as is done by xterm's "modifyOtherKeys" mode. Even though xterm itself never emits such a sequence for the Escape key, many programs already have support for parsing this style of key sequence.
* | input: relax requirements for overriding keypad application modeDaniel Eklöf2020-12-01-7/+1
| | | | | | | | | | | | Don’t require NumLock to be locked. Foot has no idea _which_ modifier the user has mapped NumLock to, meaning we really cannot require it to be locked.
* | input: improved debug logging of pressed keysDaniel Eklöf2020-11-30-10/+9
|/