1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

267 Commits

Author SHA1 Message Date
Wez Furlong
e70a58e7f3 cargo update 2020-06-13 10:21:49 -07:00
Wez Furlong
9395fd3465 window: remove unused feature from cargo.toml 2020-06-12 18:14:15 -07:00
Wez Furlong
542fede5a5 window: update smithay-client-toolkit 2020-06-06 11:58:38 -07:00
Wez Furlong
9ff9bf15fd window: allow for stronger separation between raw and composed keys
The goal at the window layer is to preserve enough useful information
for other layers.  In this specific circumstance on macos we'd like
to be able know both that eg: ALT-1 was pressed and that ALT-1 composes
to a different unmodified sequence and then allow the user's key
binding assignment to potentially match on both.

We sort of allowed for this, but didn't separate out the modifier keys.
This commit adds a `raw_modifiers` concept to the underlying event
struct so that we can carry both the raw key and modifier information
as well as the composed key and modifier information.

In the scenario above, we want the raw key/modifier tuple to be ALT-1
but the composed key/modifier to be eg: unmodified `¡` in my english
keymap.

refs: https://github.com/wez/wezterm/issues/158
2020-05-28 19:35:50 -07:00
Wez Furlong
ed1450326d window: Windows: dos->unix line endings when fetching clipboard 2020-05-22 18:22:33 -07:00
Wez Furlong
a9d1429888 window: allow specifying the clipboard context when getting clipboard
refs: https://github.com/wez/wezterm/issues/183
2020-05-21 08:46:16 -07:00
Wez Furlong
7ddff705a4 window: Windows: improve AltGr handling
Adds some detection to see if the active keyboard layout has
AltGr, and if so, adjust our key mapping logic to accomodate it.

With this change, when using an ENG layout, I can use either left
or right alt-b/alt-f to move through words in wsl.  When I switch
to DEU my left alt is still alt and my right alt causes the
Windows On-Screen keyboard to act as though AltGr is pressed.

I can then use the On-Screen keyboard to press the `<` key which
is to the left of the `Z` key on a German layout and have it produce
the `|` character.

refs: https://github.com/wez/wezterm/issues/185
2020-05-20 20:35:04 -07:00
Wez Furlong
a92b33c727 Revert "window: default to reading the PRIMARY selection under X11"
This reverts commit 5ebdcc3642.

It turns out not to be desirable, so lets back it out and think up
a different way to satisfy this.
2020-05-16 15:55:20 -07:00
Wez Furlong
5ebdcc3642 window: default to reading the PRIMARY selection under X11
We switched to using clipboard because of problems under XWayland.
These days we have much better native Wayland support and folks
should use that.

Test plan:

In one window:

```
echo "clipboard" | xclip -i -selection clipboard; echo "primary" | xclip -i -selection primary;
```

then start `wezterm` and press shfit-insert.

Prior to this change we'd always print `clipboard`.
After this change we'll print `primary`.

However, if you run:

```
WEZTERM_X11_PREFER_CLIPBOARD_OVER_PRIMARY=1 wezterm
```

then we'll use the old `clipboard` behavior.
2020-05-16 11:53:42 -07:00
Wez Furlong
538ce5e110 window: fix shift-tab processing on X11
This was being silently swallowed.  For some reason shift-tab generates
ISO Left Tab rather than regular Tab and we weren't mapping that.
2020-05-16 08:35:25 -07:00
Wez Furlong
d3cb27129c upgrade to latest smithay client toolkit
This version greatly improves the client side decoration handling
under Wayland and allows rendering the window title in the titlebar
(shocker!).
2020-05-03 10:31:30 -07:00
Wez Furlong
14c73f7122 window: linux: set window icon
Teach the window layer about window icons and implement the
plumbing for this on X11.

For Wayland there is no direct way to specify the icon; instead
the application ID is used to locate an appropriate .desktop filename.
We set the app id from the classname but that didn't match the installed
name for our desktop file which is namespaced under my domain, so change
the window class to match that and enable the window icon on Wayland.

refs: https://github.com/wez/wezterm/issues/172#issuecomment-619938047
2020-05-02 12:07:34 -07:00
Wez Furlong
8511bda6cf window: Adjust some debug logging
https://github.com/wez/wezterm/issues/172#issuecomment-619935565
interpreted these as errors but they're really just informational
messages.
2020-05-02 09:32:08 -07:00
Wez Furlong
73c0c02ffb window: x11: adjust log level for a debug print 2020-03-08 08:40:46 -07:00
Wez Furlong
8cd029ae63 wayland: remove a debug print 2020-02-26 23:21:59 -08:00
Wez Furlong
7e714a5ca1 x11: avoid changing the mouse cursor glyph on each move
@kalgynirae showed me weirdly laggy behavior when moving the mouse
in front of his x11 window.  My suspicion was that this is somehow
related to updating the mouse cursor glyph, and looking at this code
there were two things that might influence this:

* We weren't saving the newly applied cursor value, so we'd create
  a new cursor every time the mouse moved (doh!)
* We'd create a new cursor id each time it changed, and then destroy it
  (which isn't that bad, but if it contributes to lag, maybe it is?)

This commit addresses both of these by making a little cache map
from cursor type to cursor id.

I can't observe a difference on my system, so I wonder if this might
also be partially related to graphics drivers and hardware/software
cursors?
2020-02-21 09:10:13 -08:00
Wez Furlong
bc6cf6eed6 fix typo in some debug 2020-02-16 09:32:22 -08:00
Wez Furlong
754f8166b5 Add HideApplication and QuitApplication key assignments
```
[[keys]]
key = "q"
mods = "CMD"
action = "QuitApplication"
```

refs: https://github.com/wez/wezterm/issues/150
2020-02-14 08:49:15 -08:00
Wez Furlong
da6783bbd0 macos: implement Hide function
Hiding a window is implemented as miniaturizing the window, which
is typically shown with an animation of the window moving into the
dock.

This is not the same as the application-wide hide function in macOS;
that function hides the entire app with no animation.  We don't use
that here because our Hide function is defined as a window operation
and not an application operation.

refs: https://github.com/wez/wezterm/issues/150
2020-02-12 22:04:10 -08:00
Wez Furlong
02ace26e0a macos: Fix an issue with chorded keys in norwegian keymap
fixes: https://github.com/wez/wezterm/issues/151
2020-02-12 18:36:05 -08:00
Wez Furlong
c778307b0e macos: fix light background/border
The opengl based render first clears the window to the background
color and then renders the cells over the top.

on macOS I noticed a weird lighter strip to the bottom and right of
the window and ran it down to the initial clear: our colors are SRGB
rather than plain RGB and the discrepancy from rendering SRGB as RGB
results in the color being made a brighter shade.  This was less
noticeable for black backgrounds.
2020-01-26 19:04:34 -08:00
Wez Furlong
85c70aebb7 macos: improve support for dvorak
Remove a normalizing function that made assumptions based on the
keycaps that did not hold up when selecting Dvorak as an input
source.  For example "CTRL-C" where `C` is the key with the C keycap
would send `CTRL-C` even when Dvorak was selected; it should send CTRL-J
in that layout.

I think with the other normalization that happens in the termwindow
layer we don't need this function any more.
2020-01-26 18:13:16 -08:00
Wez Furlong
f3e42c3d2a point to local filedescriptor crate 2020-01-26 09:15:24 -08:00
Wez Furlong
e67022344f remove a debug print 2020-01-25 23:20:01 -08:00
Jun Wu
511fc55b10 Respect wheel scrolling speed settings on Windows
The default values are 3 lines. With this change, scrolling speed now seems
similar to other programs like cmd.exe. Before this change it feels too slow.
2020-01-20 15:18:33 -08:00
Jun Wu
ff6ff649af Make mouse wheel scroll smooth on Windows
I noticed my trackpoint or touchpad reports a lot of < 120 (WHEEL_DELTA) events.
They shouldn't be ignored.

Also https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel says:

> The wheel rotation will be a multiple of WHEEL_DELTA, which is set at 120.
> This is the threshold for action to be taken, and one such action (for
> example, scrolling one increment) should occur for each delta.
>
> The delta was set to 120 to allow Microsoft or other vendors to build
> finer-resolution wheels (a freely-rotating wheel with no notches) to send
> more messages per rotation, but with a smaller value in each message. To use
> this feature, you can either add the incoming delta values until WHEEL_DELTA
> is reached (so for a delta-rotation you get the same response), or scroll
> partial lines in response to the more frequent messages. You can also choose
> your scroll granularity and accumulate deltas until it is reached.
2020-01-20 15:17:44 -08:00
Wez Furlong
dc0573457c windows: fix compilation for 32-bit target
The CI shouldn't be trying to build this, but this is what was blocking
its builds on windows.
2020-01-17 10:12:25 -08:00
Wez Furlong
2eed9d67f4 fixup windows build 2020-01-17 09:23:30 -08:00
Wez Furlong
55e1cceb87 remove more Executors 2020-01-16 23:27:54 -08:00
Wez Furlong
75eb16bec4 move spawn_task into a new promise::spawn module 2020-01-16 03:50:48 -08:00
Wez Furlong
ac3ccab1c5 window: adopt async_task for spawn_task 2020-01-16 01:31:28 -08:00
Wez Furlong
256b4e6da8 fix pollable_channel to be non-blocking on Windows
Upgrade filedescriptor to 0.7 to use the portable helper for
setting non-blocking mode, and enable non-blocking mode on Windows.
2020-01-15 21:30:14 -08:00
Wez Furlong
ad2f724416 bump some versions 2020-01-09 22:39:34 -08:00
Wez Furlong
9670fc3fdf macos: fix minimum scroll wheel tick
macos generates fractional distance values for the mouse wheel,
with one tick starting at 0.1.  We were truncating this to a 0 row
move, which meant that you'd need to build up some acceleration to
move the rows when all you really wanted was a single tick.

This commit changes things so that we round up to at least 1.0 in this
situation.
2020-01-06 10:44:43 -08:00
Wez Furlong
180a991760 macos: add use_ime option to disable the IME
The IME stuff on macos tends to swallow repeats for some keys.
Ugh.  So this commit adds an option to disable the use of the IME.

Switching away from it effectively inverts the meanging of backspace
and delete (because our method is no longer called by the IME), so
we need to check for that and remap it.  Ugh.

Ugh.
2020-01-05 22:54:59 -08:00
Wez Furlong
59de97034a belt and suspenders to clip the copy region
a debug assertion triggers for me on macos because we were trying
to copy out of bounds.  This makes the copy routine safe again.
2020-01-05 17:58:14 -08:00
Wez Furlong
bda0a3b5fe windows: remove DoubleClick from input enums
double clicks weren't registering correctly with the new selection
logic.  Tell windows that we're doing all our own click counting
and simplify the logic.
2020-01-05 16:16:06 -08:00
Wez Furlong
048495b651 Fix x11 compilation due to bad semver bump in xcb-util
Force using xcb-util 0.2.1 precisely because 0.2.2 pulls in a
conflicting major version of xcb (0.8 -> 0.9).

It's a non-trivial upgrade: the types around xkb are different
and features need to be specified in the manifest to enable compilation
of the things that we depend upon.

In addition, xkbdcommon, on which we depend, requires xcb 0.8 and
results in pulling in two conflicting versions of the crates.

It's a bit of a painful situation and will require some effort to
figure out how to upgrade the xcb dependency, when we're ready for that.

refs: https://github.com/meh/rust-xcb-util/issues/12
2020-01-05 15:51:48 -08:00
Wez Furlong
400c8aa66d remove explicit dirty manipulation from Renderable
This commit leaves mux domains broken for the moment,
but also simplifes the implementation of the renderable interface.
2020-01-05 14:37:17 -08:00
Wez Furlong
d8701dc771 instrument executor spawn delay 2020-01-05 14:37:17 -08:00
Wez Furlong
e424a4ce6c x11: improve default wheel distance per tick
On x11 we'd get just a single line per scroll wheel tick.
Contrast with Wayland where we get multiple.

This config change makes us feel more snappy by default on X11.

I'd like to make this configurable using the live configuration
infra, but we don't currently have a way for this crate to see
that config, so this just changes the default to be "better".

refs: https://github.com/wez/wezterm/issues/92
2020-01-02 11:32:26 -08:00
Wez Furlong
b5e410e843 wayland: normalize clipboard to unix line endings on copy 2020-01-02 11:08:16 -08:00
Wez Furlong
0db15ecaf4 wayland: fix spurious resize event on focus change
The resize event would be fine except that it happens to trigger
the scroll position to reset to the bottom.
2020-01-02 11:03:12 -08:00
Wez Furlong
4b4683b1af fix focus messages on Windows
Use SETFOCUS/KILLFOCUS rather than ENABLE.

Closes: https://github.com/wez/wezterm/issues/93
2019-12-31 17:28:51 -08:00
Wez Furlong
b4b24aacca suppress warning 2019-12-30 11:11:41 -08:00
Wez Furlong
3f2e29b024 macos: fix keyboard repeat issue with backspace
wtf?  Not sure why this only impacted backspace
2019-12-30 11:09:19 -08:00
Wez Furlong
d58f1ff5dc Implement focus_change for macos
Refs: https://github.com/wez/wezterm/issues/93
2019-12-30 10:32:12 -08:00
Wez Furlong
a396a64550 Revert "wayland: implement focus_change callback"
This reverts commit bfa8d0c207,
which proved not to be needed because it was already covered
by the `KeyboardEvent::Enter` and `KeyboardEvent::Leave` handling.
2019-12-30 08:35:52 -08:00
Wez Furlong
bfa8d0c207 wayland: implement focus_change callback
Refs: https://github.com/wez/wezterm/issues/93
2019-12-29 17:17:46 -08:00
Jeremy Fitzhardinge
fce215f10f Enable focus for Windows.
Untested; passes a `cargo check`, but I'm not sure whether I've got the right
event for focus.
2019-12-29 16:58:15 -08:00