Commit graph

2517 commits

Author SHA1 Message Date
Daniel Eklöf
d29c4aed8a
input: mouse motion: don't update selection while scrollback searching
When we are doing a scrollback search, the selection *is* ongoing. We
still don't want to update the selection when the mouse moves.
2020-08-14 07:38:56 +02:00
Daniel Eklöf
bb9228dd21
input: bindings: calculate 'cursor_is_on_grid' once only 2020-08-14 07:38:56 +02:00
Daniel Eklöf
2764a8394a
footrc: fix combo for select-begin-block
Typo: should be a '+', not a '='.
2020-08-14 07:38:56 +02:00
Daniel Eklöf
364412bfaa
input: mouse-bindings: ignore Shift
Shift is used to enable selection when the client application is
grabbing the mouse.

As such, mouse bindings *never* have Shift as a modifier, but should
still trigger when Shift is being pressed.
2020-08-14 07:38:56 +02:00
Daniel Eklöf
517d13fbce
config: don't allow Shift in mouse bindings
Shift is a special modifier that is used to enable selection when the
client application is grabbing the mouse.
2020-08-14 07:38:56 +02:00
Daniel Eklöf
28410f1b99
input: mouse-bindings: check selection is enabled/possible and that pointer is on grid
We shouldn't start or modify a selection if selection isn't
possible (i.e. client application is grabbing the mouse, and user
isn't holding Shift).

We also shouldn't start or modify a selection if the pointer is
outside the grid (updating an ongoing selection on motion events is an
exception to this).
2020-08-14 07:38:56 +02:00
Daniel Eklöf
24ee6d836b
doc: footrc: mouse-bindings: clean up description 2020-08-14 07:38:56 +02:00
Daniel Eklöf
8f99a032c9
changelog: new mouse actions 2020-08-14 07:38:56 +02:00
Daniel Eklöf
4d2bc54fa2
config: mouse bindings: add select-begin-block and select-row 2020-08-14 07:38:56 +02:00
Daniel Eklöf
f14b49068a
selection: extend: set ongoing to true 2020-08-14 07:38:56 +02:00
Daniel Eklöf
9517c6443c
selection: finalize: clear ongoing selection
Check for ongoing selection, and *clear* it before bailing out due to
the selection not having an end-point.

This fixes an issue where a selection was kept as ongoing, even though
the button had been released. Typically triggered by clicking without
moving the mouse; this started a new selection, then (tried to)
finalize it, but failed since the selection didn't have an end-point.
2020-08-14 07:38:55 +02:00
Daniel Eklöf
cddeaa2c1c
selection: update: don't update if there's no ongoing selection 2020-08-14 07:38:55 +02:00
Daniel Eklöf
9352befd13
doc: footrc: document the new mouse actions 2020-08-14 07:38:55 +02:00
Daniel Eklöf
20f0334e13
config: add mouse specific bind actions
This extends the "normal" bind action enum with mouse specific
actions.

When parsing key bindings, we only check up to the last valid keyboard
binding, while mouse bindings support *both* key actions and mouse
actions.

The new actions are:

* select-begin: starts an interactive selection
* select-extend: interactively extend an existing selection
* select-word: select word under cursor
* select-word-whitespace: select word under cursor, where the only
  word separating characters are whitespace characters.

The old hard-coded selection "bindings" have been converted to instead
use these actions, via default bindings added to the configuration.
2020-08-14 07:38:55 +02:00
Daniel Eklöf
1dd142aeab
changelog: click count in mouse bindings 2020-08-14 07:38:55 +02:00
Daniel Eklöf
8ed3f66ad9
changelog: modifier support in mouse bindings 2020-08-14 07:38:55 +02:00
Daniel Eklöf
d940815f6d
Merge branch 'click-count-in-mouse-bindings' into master
Closes #78
2020-08-14 07:38:05 +02:00
Daniel Eklöf
f647816ff7
changelog: click count in mouse bindings 2020-08-14 07:36:53 +02:00
Daniel Eklöf
c6ad765f91
doc: footrc: document click count in mouse bindings 2020-08-14 07:36:53 +02:00
Daniel Eklöf
d74e583089
config: mouse bindings: add support for click count
Specified by appending "-X", where X is a number.
2020-08-14 07:36:53 +02:00
Daniel Eklöf
593cad3680
config: wrap LOG_AND_NOTIFY_*() in do {} while (0)
This allows us to use these macros in if-statement without braces.
2020-08-14 07:36:53 +02:00
Daniel Eklöf
9b65531d6a
Merge branch 'modifiers-in-mouse-bindings' into master 2020-08-14 07:36:34 +02:00
Daniel Eklöf
44557dc7cf
input: don't crash on mouse motion events on the render timer surface 2020-08-14 07:35:01 +02:00
Daniel Eklöf
b783e4c6ea
doc: footrc: document modifiers in mouse bindings 2020-08-13 18:47:20 +02:00
Daniel Eklöf
704d182c88
changelog: modifier support in mouse bindings 2020-08-13 18:47:20 +02:00
Daniel Eklöf
b97ef5819f
config: key/mouse bindings: refactor: less parsing in keyboard_enter()
This simplifies the handling of mouse and keyboard bindings.

Before, the bindings where parsed *both* when loading the
configuration, and then on every keyboard enter event. This was done
since keys require a keymap to be decoded. Something we don't have at
configuration time. The idea was that at config time, we used a
default keymap just to verify the key combo strings were valid.

The following has changed:

* The bindings in the config struct is now *one* key combo per
  entry. Previously, it was one *action* per entry, and each entry
  had one or more key combos.

  Doing it this way makes it easier when converting the binding in the
  keyboard enter event (which previously had to expand the combos
  anyway).

* The bindings in the config struct no longer contains any unparsed
  strings.

  A key binding contains a decoded 'modifier' struct (which specifies
  whether e.g. ctrl, or shift, or ctrl+shift must be pressed for the
  binding to be used).

  It also contains a decoded XKB keysym.

* A mouse binding in the config struct is similar to a key binding,
  except it contains the button, and click count instead of the XKB
  key sym.

* The modifiers in the user-specified key combo is decoded at config
  time, by using the pre-defined XKB constants
  XKB_MOD_NAME_<modifier>.

  The result is stored in a 'modifiers' struct, which is just a
  collection of booleans; one for each supported modifier.

  The supported modifiers are: shift, ctrl, alt and meta/super.

* The key sym is decoded at config time using
  xkb_keysym_from_name(). This call does *not* depend on a keymap.

* The mouse button is decoded at config time using a hardcoded mapping
  table (just like before).

* The click count is currently hard-coded to 1.

* In the keyboard enter event, all we need to do is pre-compute the
  xkb_mod_mask_t variable for each key/mouse binding, and find all the
  *key codes* that map to the (already decoded) symbol.

  For mouse bindings, the modifiers are the *only* reason we convert
  the mouse bindings at all.

  In fact, on button events, we check if the seat has a keyboard. If
  not, we use the mouse bindings from the configuration directly, and
  simply filter out those with a non-empty set of modifiers.
2020-08-13 18:47:19 +02:00
Daniel Eklöf
375dcf0810
input: pointer-leave: don't reset mouse properties with memset()
Using memset() also clears the mouse bindings. This is both incorrect,
and leaked memory.
2020-08-13 18:47:19 +02:00
Daniel Eklöf
49eea3893e
wayland: global-remove: return after finding a matching seat 2020-08-13 18:47:19 +02:00
Daniel Eklöf
6b18bd998a
wayland: global-remove: fix call to pointer_listener.leave()
Don't call it when we have keyboard focus, call it when we have mouse
focus.
2020-08-13 18:47:19 +02:00
Daniel Eklöf
544c1b1976
config: wip: add support for modifiers in mouse bindings
Mouse bindings can now include modifiers. They are specified in pretty
much the same way as in keyboard bindings:

  Control+BTN_LEFT
2020-08-13 18:47:19 +02:00
Daniel Eklöf
823a7c0318
render: oops... swprintf() needs to number of *chars*, not *bytes* 2020-08-13 18:46:57 +02:00
Daniel Eklöf
6e0171ee44
render: fix printf-errors in 32-bit builds 2020-08-13 18:40:10 +02:00
Daniel Eklöf
17070a0d54
config: add tweak.render-timer option
This can be set to 'none' (the default), 'osd', 'log' or 'both'.

When 'osd' is enabled, we'll render the frame rendering time to a
sub-surface after each frame.

When 'log' is enabled, the frame rendering time is logged on stderr.
2020-08-13 18:35:17 +02:00
Daniel Eklöf
c7126c4076
doc: footclient.1: move DESCRIPTION up before OPTIONS 2020-08-13 18:34:44 +02:00
Daniel Eklöf
6c78919d4b
doc: foot.1: move DESCRIPTION up before OPTIONS 2020-08-13 18:34:24 +02:00
Daniel Eklöf
1decd8e9de
selection: improve handling of multi-column characters
* Don't assume multi-column characters are exactly *two* columns
* Check for CELL_MULT_COL_SPACER values instead of using wcwidth()
2020-08-13 18:33:22 +02:00
Daniel Eklöf
3816a3b460
selection: handle multi-column characters when reversing selection direction 2020-08-13 18:32:56 +02:00
Daniel Eklöf
a4b18ba832
changelog: cancelling -> canceling 2020-08-13 06:33:10 +02:00
Daniel Eklöf
fc154fcf3a
Merge branch 'selection-inversion' into master 2020-08-13 06:23:49 +02:00
Daniel Eklöf
52abf85266
Merge branch 'custom-selection-colors' into master 2020-08-13 06:22:45 +02:00
Daniel Eklöf
8808dd28f2
selection: adjust start point when the selection changes direction
Without this, the initial cell will always be selected, regardless of
how the selection is moved to the left or right.

With this patch, the initial cell will only be selected while the
selection is being made in the original direction. Changing direction
of the selection moves the start point to next/previous character.
2020-08-12 19:42:21 +02:00
Daniel Eklöf
5e36ebdef8
config: make selection foreground/background colors configurable
The default is still to inverse the regular foreground/background
colors.

If the user sets *both* of the new options, selection-foreground and
selection-background, those colors will *always* be used for selected
cells, instead of inverting the regular foreground/background colors.
2020-08-12 19:41:50 +02:00
Daniel Eklöf
156cce6ef6
doc: foot.1: don't talk about using '--' on the command line
This used to be necessary, but isn't anymore.
2020-08-12 19:40:50 +02:00
Daniel Eklöf
8626b4bc1a
search: don't update/refresh match when modifier keys are pressed 2020-08-12 19:40:50 +02:00
Daniel Eklöf
b01431e38f
search: fix viewport not moving if we tried to move it past the scrollback start
If the match was somewhere near the scrollback beginning, and if the
entire scrollback hadn't yet been filled, we ended up trying to move
the viewport past the beginning of the scrollback, which we then
adjusted in the wrong direction, causing the viewport to not move at
all.

Besides being a bad user experience, since the new match wasn't
visible, foot would also crash if you manually scrolled up to the
match.
2020-08-12 19:40:40 +02:00
Daniel Eklöf
ef9bac5965
Revert "ci: sr.ht: just testing..."
This reverts commit b7b7b56b3d.
2020-08-11 17:33:19 +02:00
Daniel Eklöf
b7b7b56b3d
ci: sr.ht: just testing... 2020-08-11 17:32:34 +02:00
Daniel Eklöf
187fe3a586
render: fix compilation errors in 32-bit builds
timeval.tv_usec is an 'unsigned long long' on 32-bit
2020-08-11 17:29:56 +02:00
Daniel Eklöf
12e3a7e2a2
ci: gitlab: let's see if we can do 32-bit builds 2020-08-11 17:27:48 +02:00
Daniel Eklöf
6f5f7f1411
main: include our own bitness when logging the architecture 2020-08-11 17:23:10 +02:00