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

688 Commits

Author SHA1 Message Date
Wez Furlong
a4b68247bb window: fix CTRL-[ on macos
This is another key combination that doesn't generate a key-down
event.

refs: https://github.com/wez/wezterm/issues/1877
2022-04-15 20:51:01 -07:00
Wez Furlong
fdb3471017 xkeyboard: resolve ambiguous CTRL-i / CTRL-Tab
We want to avoid normalizing control key presses; there were
two places where it was happening; one in our own code and
the other was in the xkeyboard mapping stuff itself.

refs: https://github.com/wez/wezterm/issues/1851
2022-04-15 07:27:01 -07:00
Wez Furlong
e680cc848a macos: workaround weird CMD-. behavior
There are certain key combinations that macOS prefers to handle
without giving the application much opportunity to process them.

CTRL-ESC and CMD-. both cause doCommandBySelector(cancel:) to be
called.  The former we had already special cased but since we
can't disambiguate the two things, we need a better way.

performKeyEquivalent: is a method we can implement to have an
opportunity to "do something" and prevent the default macOS behavior.

So we implement that. What's interesting is that saying that we handled
CMD-. results in no further processing at all by macOS, whereas saying
that we handled CTRL-ESC results in macOS doing the normal key event
dispatch.  So we need to route that event for ourselves in that one
case.

Doesn't feel great!

refs: https://github.com/wez/wezterm/issues/1867
2022-04-12 17:41:37 -07:00
Wez Furlong
bbb842c3e9 macos: suppress IME UNHANDLED warning for shift up/down 2022-04-09 22:19:22 -07:00
Wez Furlong
738e180295 x11/wayland: add tracing to xcursor loading code
Makes it easier to understand what is happening when debugging xcursor
issues:

```
WEZTERM_LOG=window::os::x11::cursor=trace,info wezterm
```
2022-04-09 06:48:29 -07:00
David Rios
44a26c78f2 wayland: improve touchpad scroll precision
- Save the remainder of the scroll delta to be used on the next event
when it doesn't meet the activation threshold

refs: https://github.com/wez/wezterm/issues/1827
2022-04-08 07:50:47 -07:00
Wez Furlong
b35e3b2aad deps: remove pretty_env_loggger
Go directly to the underlying env_logger crate, as pretty_env_logger
hasn't been updated in some time, and I'd like to be able to redirect
the log output to a file more directly, and that feature is in a newer
version of the env logger than pretty_env_logger was pulling in.
2022-04-07 08:24:07 -07:00
Wez Furlong
0cfdf0999c macos: send_composed_key_when_X_alt_is_pressed now ignores other mods
For reasons that I cannot remember, I made
`send_composed_key_when_left_alt_is_pressed` and
`send_composed_key_when_right_alt_is_pressed` only take effect if only
the ALT modifiers were pressed.  If SHIFT or CTRL were pressed, then
the purpose of `send_composed_key_when_left_alt_is_pressed` was
bypassed.

This commit scopes this back to the alt mods - other kinds of mods
don't affect this functionality any more.

refs: https://github.com/wez/wezterm/issues/1826
2022-04-06 18:26:16 -07:00
Wez Furlong
6c5e54c47e deps: unpin glium from git, use latest release
We were pinned on the revision where I had added dual source blending,
because I wanted that feature ahead of the crate being published.

Since then a couple of releases have been made so we can unpin.

On Windows 11, we had a report of glium complaining about the opengl
version. I can't find that error message string in the current version
of the code so it's possible that that situation has been resolved.

refs: https://github.com/wez/wezterm/issues/1813
2022-04-04 06:54:49 -07:00
Wez Furlong
0284bcdd3d x11: set position only if explicitly requested
refs: #1794
2022-04-03 18:00:27 -07:00
Wez Furlong
603f6d69ce try harder to set the x,y position on x11
refs: #1794
2022-04-03 17:01:03 -07:00
Wez Furlong
7526b0567c x11: add KP_End keysym mapping
refs: #1804
2022-04-03 07:36:48 -07:00
Wez Furlong
02d5d9425d x11: improve trace logging for keyboard handling
refs: #1804
2022-04-03 06:32:42 -07:00
Wez Furlong
e95707fe70 flesh out % based and named display for positioning on X11
refs: #1794
2022-04-02 22:45:13 -07:00
Wez Furlong
13bfa27d2e flesh out % based and named display for positioning on macOS
refs: #1794
2022-04-02 15:40:09 -07:00
Wez Furlong
9a324385eb flesh out % based and named display for positioning on Windows
refs: #1794
2022-04-02 11:11:28 -07:00
Wez Furlong
02aae83794 fix windows build
refs: #1794
2022-04-02 09:46:36 -07:00
Wez Furlong
52edc8bb11 window: speculative code to enable initial position on windows
need to move this to my windows machine to try it

refs: #1794
2022-04-02 09:40:41 -07:00
Wez Furlong
8ac793a619 add --position CLI option for requesting initial window position
refs: #1794
2022-04-02 09:32:21 -07:00
Wez Furlong
2faa6822f9 fix mac, windows builds
refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:58:27 -07:00
Wez Furlong
89b653acb8 x11: respect requested x/y geometry if provided
refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:47:03 -07:00
Wez Furlong
69288aee4c window: Add RequestedWindowGeometry type
This is mostly a refactoring: pulling out the discrete width/height from
the `new_window` method and preparing to pass down x/y coords as well.

The types are expressed as Dimension so that screen relative sizes could
be expressed in the future... once we know how to obtain that
information on each platform.

refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:25:59 -07:00
Wez Furlong
67218d3a85 fix formatting 2022-04-01 08:15:32 -07:00
Wez Furlong
8ba0ef2375 macos: notch avoidance tweak
https://github.com/wez/wezterm/issues/1737#issuecomment-1085923867
2022-04-01 08:14:11 -07:00
David Rios
821b6f67bb Improve touchpad precision on Wayland 2022-03-31 07:15:45 -07:00
Wez Furlong
ff88fec880 window: add Debug trait to os parameters types 2022-03-30 07:02:47 -07:00
David Rios
45072fa475 Overhaul scroll thumb calculation
- Simplify scroll thumb calculations
- Correct thumb position when dragging with mouse
- Support border OS parameters
- Use usize for OS borders, to explicitly only accept positive integers
- Get correct tab height when using fancy tab bar
- Correctly draw depending on tab bar position
- Adjust minimum thumb size to be 1/2 of a cell height, so it has consistent size across platforms and screen densities

Fixes #1525
2022-03-29 08:55:25 -07:00
Wez Furlong
045698e6ca x11: query focus prior to painting if we don't know focus state
We don't assume that we start up focused, and some WM don't tell
us our focus state, so prior to painting, if we don't know the
focus state, explicitly query it and synthesize a focus change event.

refs: https://github.com/wez/wezterm/issues/1757
2022-03-27 07:10:47 -07:00
Wez Furlong
4cd893335b fix build for intel mac 2022-03-26 23:14:15 -07:00
Wez Furlong
4e343eb1e5 macos: try to avoid the notch
Flesh out the get_os_parameters impl for macOS.  When running on a
system that provides `NSScreen::safeAreaInsets`, use that to determine
the border required to avoid the "notch" on certain models of mac.

In the GUI layer: when the os parameters include a border, adjust
the render position to account for it.

This is a bit of a speculative change, as I don't have a mac with
a notch.

refs: https://github.com/wez/wezterm/issues/1737
2022-03-26 22:47:42 -07:00
Wez Furlong
a61d3a1b99 macos: clear scroll remainder when changing scroll direction 2022-03-26 20:46:28 -07:00
David Rios
491fe14ca9 Fix touchpad on windows 2022-03-26 17:45:40 -07:00
David Rios
fca3559a0f
Implement native window dragging on Windows (#1771)
Implement native window dragging on Windows
2022-03-26 17:28:43 -07:00
Wez Furlong
91a0903246 windows: simplify logfont assignment/fetch 2022-03-26 07:52:25 -07:00
David Rios
109330fefa Get window state on resize, fixes #1502 2022-03-26 07:27:54 -07:00
David Rios
5c5f2dbca5 Cache title_font 2022-03-26 07:27:54 -07:00
David Rios
eaaf98ad2f Uncomment title font 2022-03-26 07:27:54 -07:00
David Rios
c55d44aa72 Use anyhow ensure
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2022-03-26 07:27:54 -07:00
David Rios
da74100d5e Use equality to check focus
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2022-03-26 07:27:54 -07:00
David Rios
b3f1ef7577 Remove unused function 2022-03-26 07:27:54 -07:00
David Rios
a95b081620 Improve the responsiveness of the drawn border 2022-03-26 07:27:54 -07:00
David Rios
b036bb3b05 Improve RESIZE window_decoration on Windows 2022-03-26 07:27:54 -07:00
Wez Furlong
623f617951 x11: window icon had red/blue channels swapped
closes: #1754
closes: #1755
2022-03-23 07:01:26 -07:00
Wez Furlong
5c8ff787c6 x11: query geometry if we're painting and never had CONFIGURE_NOTIFY
If the WM has never confirmed our size and we're about to paint,
explicitly query it and generate a resize event so that we stand
a better chance of showing the right stuff.

refs: https://github.com/wez/wezterm/issues/1710
2022-03-22 09:50:52 -07:00
Wez Furlong
57c66053d2 x11: more logging around configure notify events
refs: #1710
2022-03-22 09:30:50 -07:00
Wez Furlong
9936b8a5ab add xcursor_theme and xcursor_size config options
refs: #1742
2022-03-22 08:23:17 -07:00
Wez Furlong
bd9088372a wayland: speculative handling of pointer when seat changes
It compiles and launches under weston, so that's promising.
I can't test the suspend/resume case on the hardware I have available.

refs: #1497
2022-03-19 05:47:04 -07:00
Adam Harvey
0c7e735a86 window: correctly handle keyboard input after seat updates
When the user switches to another virtual console and then back into a
Wayland session, a number of seat updates are received by the listener
installed by `Environment::listen_for_seats()`. These updates
essentially flip the keyboard and pointer flags off and then back on in
the seat data, which indicates that new handlers need to be assigned to
the keyboard and pointer objects.

However, because one update is received for _each_ flag being toggled,
this means that the listener is fired twice with `has_keyboard` set to
true, which means that two keyboard handlers end up being installed.
Users then experience each keypress being delivered twice to the
terminal.

This commit adds a map to track the keyboard object that has been
assigned on each seat, thereby preventing duplicate assignments and (by
extension) duplicate keypresses being registered. This logic is
essentially the same as what's used in the `kbd_input` example in SCTK,
which doesn't have this issue.

Something similar is required for pointer handling, which also breaks
after switching to another virtual console and back into Wayland, but I
was scared off by the TODO in the `listen_for_seats` callback and didn't
investigate this further.
2022-03-19 05:11:04 -07:00
Wez Furlong
0b7cb6550b macos: more urgh with alt+shift key combinations
refs: https://github.com/wez/wezterm/issues/760
refs: https://github.com/wez/wezterm/issues/1706
2022-03-18 13:32:43 -07:00
Wez Furlong
8c3d2f6eb6 windows: make repeated dead key handling consistent with other apps
On Windows in FRA layout, `^^SPACE` results in `^^SPACE`, whereas
on Linux it results in `^SPACE`.  We were doing the latter instead
of the former.

Let's just be consistent with other windows apps.

closes: #1729
closes: #1730
2022-03-18 10:42:14 -07:00