Commit graph

62 commits

Author SHA1 Message Date
Daniel Eklöf
34eac2dbe3
keyboard repeat: pass current input serial to keyboard_key()
This fixes an assertion when holding in ctrl+shift+c (copy to
clipboard); subsequent "presses" would set the clipboard serial to 0,
which we would then assert on in the next iteration when we tried to
cancel the previous copy.
2019-11-22 21:55:46 +01:00
Daniel Eklöf
8c945c9832
input: may get keyboard_exit() event with no focused terminal
This happens on Sway when exiting a screen locker. Or at least that's
when we see the problem; it's unclear if the event occurs when
starting the screen locker, or when exiting it. Or maybe its both.

Anyway, don't try to unfocus a NULL-terminal.
2019-11-21 18:17:02 +01:00
Daniel Eklöf
1bc9835246
Revert "input: remove unneeded(?) term_reset_view() calls"
This reverts commit 739c5cf7f0.

The original commit stated:

  Not sure why these were added here; they don't appear to be
  needed (we're writing to the client - it's up to the client to echo
  stuff, in which case we redraw as usual).

But, client output doesn't cause a scrollback/view reset.
2019-11-20 10:41:40 +01:00
Daniel Eklöf
739c5cf7f0
input: remove unneeded(?) term_reset_view() calls
Not sure why these were added here; they don't appear to be
needed (we're writing to the client - it's up to the client to echo
stuff, in which case we redraw as usual).
2019-11-04 14:10:37 +01:00
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave() 2019-11-03 00:52:24 +01:00
Daniel Eklöf
957fb25559
wayland: move reload_cursor_theme() and update_cursor_surface() to wayland 2019-10-27 19:36:45 +01:00
Daniel Eklöf
8c534d0520
input: input_repeat() takes a 'struct wayland' pointer 2019-10-27 18:44:58 +01:00
Daniel Eklöf
9f0b1f94c2
wayland: change all wayland callbacks to take a wayland pointer
Instead of passing the terminal to the wayland callbacks, pass a
'struct wayland' pointer.
2019-10-27 18:43:07 +01:00
Daniel Eklöf
c9455d5f21
kbd: move into wayland 2019-10-27 17:10:32 +01:00
Daniel Eklöf
f862f173f5
input: scale coordinates in wl_pointer_enter() 2019-09-26 18:41:26 +02:00
Daniel Eklöf
2d6369482e
main: initialize scale to '1'
This ensures we always have a valid (but possibly incorrect) scaling
value. This allows us to simplify code that uses the scale - it
doesn't have to verify the scale if valid.

Furthermore, since render_resize() is the function that actually
updates term->scale, make sure to call it *before* updating the
cursor (otherwise, the cursor will use the old scaling value).
2019-09-26 18:39:49 +02:00
Daniel Eklöf
37d941f57a
input: take scale into account when converting mouse coords to row/col 2019-08-30 21:31:14 +02:00
Daniel Eklöf
05888b4706
input: bug: account for margins when converting mouse coords to row/col 2019-08-30 21:30:27 +02:00
Daniel Eklöf
551d51bf9d
input: call term_reset_view() instead of duplicating code 2019-08-28 17:28:26 +02:00
Daniel Eklöf
3f767be500
input: cancel search on mouse button events 2019-08-27 19:48:29 +02:00
Daniel Eklöf
61cabdac13
search: wip: re-direct input while searching, and build a search buffer
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.
2019-08-27 17:23:28 +02:00
Daniel Eklöf
71c6f11e86
input: back out accidental commit of debug code 2019-08-19 21:18:43 +02:00
Daniel Eklöf
4168f91d40
csi: implement CSI ? 1007 h/l - alternateScroll
When enabled, mouse scrolls in the alternate screen are converted to
up/down key presses.
2019-08-19 21:16:47 +02:00
Daniel Eklöf
6f1cf8af34
input: remove debug output 2019-08-15 20:09:24 +02:00
Daniel Eklöf
44112e5591
input: handle meta modifier when modifying "other" keys
When handling keys without a specific map defined (i.e. keys
corresponding roughly to xterm's "otherKeys"), recognize the meta
modifier and report the correct modifier code.
2019-08-15 19:38:50 +02:00
Daniel Eklöf
9ca01436ee
input: track meta modifier 2019-08-15 19:38:28 +02:00
Daniel Eklöf
4b06360681
input: free previous XKB state when we get a new one 2019-08-12 21:33:24 +02:00
Daniel Eklöf
70b6d9d7d2
input: don't paste from primary if client is mouse tracking 2019-08-09 21:26:34 +02:00
Daniel Eklöf
481a1cd678
selection/input: triple click selects an entire row 2019-08-06 19:32:06 +02:00
Daniel Eklöf
a82f12dd2b
input: use a timer fd to handle keyboard key repeat
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'.
2019-08-05 19:33:01 +02:00
Daniel Eklöf
c62ce72778
selection: mark-word using spaces only as word separator
When the user double-clicks with ctrl pressed, we now select the word
under the cursor using spaces only as word separator.
2019-08-05 19:02:27 +02:00
Daniel Eklöf
4d7993b36f
cell: pack more efficiently and store glyph as a wchar
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.
2019-08-02 18:19:07 +02:00
Daniel Eklöf
263d3bb2ba
input: fix 'comparison ... is always true' warning (clang) 2019-07-30 20:27:19 +02:00
Daniel Eklöf
f5e9b7b048
input: use keyboard enter serial only for selection serial 2019-07-30 19:29:04 +02:00
Daniel Eklöf
3e06dca12d
input: generate escape sequences for "other" keys
This corresponds to xterm's modifyOtherKeys option, though the code
needs more testing and cleanup.
2019-07-26 18:49:09 +02:00
Daniel Eklöf
e88cf4c8c8
mouse: use discrete axis event if available
This improves the scroll experience with certain devices
2019-07-26 18:48:59 +02:00
Daniel Eklöf
32f397d9b0
input: store last seen wayland input serial
We need this for clipboard data
2019-07-19 11:11:48 +02:00
Daniel Eklöf
8bd969262b
selection: implement double-click-to-select-word 2019-07-17 21:30:57 +02:00
Daniel Eklöf
7f6a4f4b6b
csi: implement FocusIn/Out events 2019-07-16 10:34:08 +02:00
Daniel Eklöf
7379198f4a
Use vt_to_slave() instead of calling write(term->ptmx, ...) everywhere 2019-07-15 15:42:21 +02:00
Daniel Eklöf
0393521d79
input: cancel selection on any mouse *except* BTN_LEFT 2019-07-11 18:17:40 +02:00
Daniel Eklöf
66e067082b
selection: implement copy *to* primary 2019-07-11 17:38:03 +02:00
Daniel Eklöf
e56066feef
selection: add selection_from_primary() API (stub for now) 2019-07-11 17:38:03 +02:00
Daniel Eklöf
482c8f76a9
selection: add support for pasting from clipboard 2019-07-11 17:38:02 +02:00
Daniel Eklöf
b50ec1a850
selection: initial copy-to-clipboard functionality 2019-07-11 17:38:02 +02:00
Daniel Eklöf
0facfa4da7
input: call selection_finalize() when BTN_LEFT is released 2019-07-11 17:38:02 +02:00
Daniel Eklöf
c43b49dab6
input: ignore mouse motion outside our window 2019-07-11 17:38:02 +02:00
Daniel Eklöf
bcf763d417
selection: add a selection API 2019-07-11 17:38:01 +02:00
Daniel Eklöf
1c861e5d69
selection: only left button can be used for selection 2019-07-11 17:38:01 +02:00
Daniel Eklöf
632790d5d8
selection: selections can be made, and are rendered
* Start selection on mouse button down
* Update selection on motion
* Button release cancels selection if there were no motion after start
* Renderer detects cells inside the selection and inverts their colors
2019-07-11 17:38:01 +02:00
Daniel Eklöf
7594edb89b
input: generate BTN_BACK/BTN_FORWARD mouse down events when scrolling 2019-07-10 14:17:44 +02:00
Daniel Eklöf
b058e6384a
scrollback: initial support for mouse scrolling 2019-07-10 09:15:37 +02:00
Daniel Eklöf
bcd111d203
wip: initial scroll back support
Can scroll up and down, and stops when the beginning/end of history is
reached.

However, it probably breaks when the entire scrollback buffer has been
filled - we need to detect when the view has wrapped around to the
current terminal offset.

The detection of when we've reached the bottom of the history is also
flawed, and only works when we overshoot the bottom with at least a
page.

Resizing the windows while in a view most likely doesn't work.

The view will not detect a wrapped around scrollback buffer. I.e. if
the user has scrolled back, and is stationary at a view, but there is
still output being produced. Then eventually the scrollback buffer
will wrap around. In this case, the correct thing to do is make the
view start following the beginning of the history. Right now it
doesn't, meaning once the scrollback buffer wraps around, you'll start
seeing command output...
2019-07-09 16:26:36 +02:00
Daniel Eklöf
cb8c2cdb35
input: split up keymap
This makes the top level table smaller, and faster to search
through. Eventually, we could do something fancy, like b-search the
top level table.
2019-07-09 15:05:07 +02:00
Daniel Eklöf
3dbef02dac
input: implement keypad application mode
This commit also replaces the previous (temporary) key map with a much
more complete one.
2019-07-09 14:27:26 +02:00