1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 06:03:39 +03:00
Commit Graph

762 Commits

Author SHA1 Message Date
Wez Furlong
2b3e5119a4 lua: screens: fixup x11 build 2022-07-06 13:30:40 -07:00
Wez Furlong
99f6fbda15 lua: implement wezterm.window.screens() for macos 2022-07-06 13:27:03 -07:00
Wez Furlong
0e36358acc fix up x11 build for screens changes on win32 2022-07-06 13:00:57 -07:00
Wez Furlong
43c7664438 screens: improve naming on Windows, move resolve_geom to Connection
On Windows, GDI returns unintuitive names like "\\.\DISPLAY6" that
may not start numbered at either 0 or 1.

This commit grubs through the various APIs so that we can produce more
meaningful names like "DISPLAY6: Gigabyte M32u on NVIDIA 2080 TI"
instead.

This commit also makes the lua wezterm.window.screens() function
consistent with the internal resolve_geom functions that each different
implementation had, so that we can eliminate those functions in
favor of this new one on the ConnectionOps trait.

Still need to do macOS and verify that this commit doesn't break X11.
2022-07-06 12:54:18 -07:00
Wez Furlong
cdeabd6a21 lua: implement wezterm.window.screens() on Windows 2022-07-06 08:58:07 -07:00
Wez Furlong
9301d1900d rustfmt 2022-07-06 08:39:14 -07:00
Wez Furlong
a6cf13e1e2 lua: add wezterm.window.screens()
Currently implemented on X11 only, this function returns information
about the geometry of the screen(s).

This is taken from the same source of information we use for the
`--position` CLI argument to `wezterm start`.

```
> wezterm.window.screens()
{
    "by_name": {
        "DisplayPort-1": {
            "height": 2160,
            "name": "DisplayPort-1",
            "width": 3840,
            "x": 0,
            "y": 0,
        },
    },
    "main": {
        "height": 2160,
        "name": "DisplayPort-1",
        "width": 3840,
        "x": 0,
        "y": 0,
    },
    "origin_x": 0,
    "origin_y": 0,
    "virtual_height": 2160,
    "virtual_width": 3840,
}
```
2022-07-06 08:35:05 -07:00
Funami580
df1b832fce wayland: add global active_surface_id to fix pasting 2022-07-05 17:35:43 -07:00
Wez Furlong
67b96b9b5c speculative fix for https://github.com/wez/wezterm/issues/2204
An alternative to a special case for just one of mappings that
we handle specially below
2022-07-04 21:12:25 -07:00
Wez Furlong
3dbd866b06 deps: tiny-skia -> 0.7
closes: #2219
2022-07-04 06:30:34 -07:00
Wez Furlong
e6efec8298 x11: remove accidentally added debug statements 2022-06-29 07:23:26 -07:00
Wez Furlong
b5518d5cd9 x11: avoid protocol error around DestroyWindow request
This is a bit of an unsatisfactory commit... the bulk of it is
augmenting our calls into XCB to ensure that we check the status of each
request; the idea was that doing so would highlight the source of the
bad drawable error that is being surfaced in #2198, but after doing
that, it still doesn't highlight the offending call.

My conclusion is that either something in MESA/EGL or the IME is
generating calls that we cannot see into and that one of those is
referencing the window id that we just destroyed.

The resolution then is a bit gross: instead of destroying the window
when we need to close it, we first unmap it to remove it from the
screen, then after 2 seconds we destroy it.

refs: https://github.com/wez/wezterm/issues/2198
2022-06-28 08:30:52 -07:00
Wez Furlong
b5f015c9bb macos: really really fix ctrl-shift-tab
refs: #1902
2022-06-24 10:57:36 -07:00
Wez Furlong
14282f99bc x11: flush prior to mapping window
Speculative change to see if that helps with this dwm related issue:
https://github.com/wez/wezterm/issues/2155

refs: https://github.com/wez/wezterm/issues/2155
2022-06-22 07:55:21 -07:00
Wez Furlong
1b2efe8c70 x11: fix copy and paste between wezterm windows race
This commit adds more trace logging around selection
related events.

That tracing uncovered a situation, when multiple wezterm windows within
the same process were involved, where one window didn't receive a
selection-clear event notification.

Since Window::get_clipboard trusted our local understand of the
clipboard contents, it would return those until the selection was
changed in that window.

This commit changes that code to always ask the X server for the
selection. It makes pasting slightly slower, but should always produce
consistent results.

refs: https://github.com/wez/wezterm/issues/2110
2022-06-21 07:32:53 -07:00
Funami580
b29089ebdc support drag and drop files for wayland 2022-06-20 13:25:32 -07:00
Wez Furlong
3d9898eb54 windows: properly fix shifted dead keys
Don't break AltGr based dead keys with the shift fix from
8e16756474

refs: https://github.com/wez/wezterm/issues/2102
refs: https://github.com/wez/wezterm/issues/473
2022-06-18 11:01:23 -07:00
Wez Furlong
e0616e5eb3 fix AltGr-7 reporting for win32 input mode
We need to carry the RIGHT_ALT modifier flag through to the win32
input mode encoder so that it is correctly handled by both win32
and wsl apps.

Take care to avoid RIGHT_ALT being encoded as ALT for the
non-win32-input-mode case.

refs: https://github.com/wez/wezterm/issues/2127
refs: https://github.com/wez/wezterm/issues/2098
2022-06-18 10:48:07 -07:00
Wez Furlong
8e16756474 windows: fix shifted dead keys
deadkeys that are triggered through shift (eg: backtick on a German
layout) weren't working because we were trying to lookup in our maps
using `SHIFT | LEFT_SHIFT` when the map data was keyed only by `SHIFT`.

This commit removes the positional modifier flags from the modifier
keys and restores the correct behavior.

refs: https://github.com/wez/wezterm/issues/2102
2022-06-18 10:26:48 -07:00
Wez Furlong
32fe7106a9 remove x11_focus_change_repaint_delay_ms code
We found the real root of the problem in so we shouldn't need this any
longer

refs: https://github.com/wez/wezterm/issues/1992
refs: https://github.com/wez/wezterm/issues/1628
refs: https://github.com/wez/wezterm/issues/2063
2022-06-18 07:39:56 -07:00
Wez Furlong
1485cf344c x11: make another run at weird resize related issue w/ nvidia
This does two things:

* Sets the event queue owner explicitly to xcb
* Adopts a dri2 resize related workaround from the rust-xcb opengl
  example

I think the latter is probably a NOP, but the former sounds like
something important.

refs: #1992
2022-06-17 21:23:18 -07:00
Wez Furlong
adf9679461 macos: use shift-tab hack with ctrl-shift-tab as well
refs: #1902
2022-06-15 22:23:15 -07:00
Wez Furlong
297377ae9a rename focus_change_repaint_delay -> x11_focus_change_repaint_delay_ms
and add changelog!

refs: #2111
2022-06-15 20:50:33 -07:00
Patrick Jones
4f015e66bc x11: query focus after repaint delay
The focus events used to trigger a query of geometry are inaccurate, so the window's focus state should also be queried.

refs: #2063
refs: #1992
2022-06-15 20:42:26 -07:00
Patrick Jones
3f01c04911 x11: allow configuration of repaint delay
Adds a configuration option, `focus_change_repaint_delay` to allow customisation of the delay added in 9b6329b454.

The default delay remains 100ms, and can be disabled by setting it to `0`, if the workaround is not required on the user's system.

refs: #2063
refs: #1992
2022-06-15 20:42:26 -07:00
Wez Furlong
26c43f784d macos: allow for keyboard translation data to be null
refs: https://github.com/wez/wezterm/issues/2119
2022-06-15 20:25:16 -07:00
Wez Furlong
ff593d1d6a appease dependabot security alerts
This doesn't change anything real, it just hints to dependabot
that we're using 1.1.1 and later, which we were anyway.
2022-06-15 07:38:39 -07:00
Wez Furlong
f601c775e6 x11: Xkb is already in the mandatory list
so remove it from the optional extensions list
2022-06-08 08:43:32 -07:00
Wez Furlong
d85b7bf3b9 win32: add extended/enhanced key concept for win32 input mode
refs: https://github.com/wez/wezterm/issues/2009
refs: https://github.com/microsoft/terminal/issues/13134#issuecomment-1148000328
2022-06-08 07:41:19 -07:00
Wez Furlong
9b6329b454 x11: more hacks to deal with missing CONFIGURE_NOTIFY
This one triggers a short timer when a focus event is received;
when that timer fires, we invalidate the geometry and repaint.

refs: #2063
refs: #1992
2022-06-04 06:29:33 -07:00
Wez Furlong
da59a22297 x11: subscribe to Present extension configure notify events
The hope here is that the nvidia-specific resize issue might have
a workaround if it is emitting some other events that we were
previously not listening for.

This commit optionally enables the Present extension and listens
for its version of CONFIGURE_NOTIFY, routing it through the same
logic as the base CONFIGURE_NOTIFY event.

On my AMD hardware under Gnome, I see something like:

```
18:04:26.476  TRACE  window::os::x11::window > Present::ConfigureNotify: width 1168 -> 1180, height 858 -> 873, dpi 124.7998046875 -> 124.7998046875
18:04:26.478  TRACE  window::os::x11::window > Ignoring X::ConfigureNotify (1180x873 dpi=124.7998046875) because width,height,dpi are unchanged
```

with the Present event firing before the X event.

Let's see how this goes.

refs: #2063
refs: #1992
2022-06-03 18:08:51 -07:00
Wez Furlong
81bac8b3f2 x11: trace expose events. invalidate geometry in some cases
Main idea here is to add expose events to the trace so that we
can get a sense of whether those are emitted when a WM isn't delivering
CONFIGURE_NOTIFY consistently.

If the exposed area is bigger than what we think the window is,
then we mark geometry as unsure.

I'm considering always marking as unsure for an expose event,
or at least, adding a config option to enable that, as a way
to workaround this situation.

refs: https://github.com/wez/wezterm/issues/2063
refs: https://github.com/wez/wezterm/issues/1992
2022-06-02 09:52:36 -07:00
Wez Furlong
c3b1aa72d3 x11: use focus change as a signal that the size may have changed
From the logs shared in https://github.com/wez/wezterm/issues/2063#issuecomment-1144957250
it looks like focus change events can correlate with the WM tiling
windows, even though the WM doesn't send a CONFIGURE_NOTIFY event.

So let's set a flag to query the geometry when the focus changes

refs: https://github.com/wez/wezterm/issues/2063
refs: https://github.com/wez/wezterm/issues/1992
2022-06-02 08:00:55 -07:00
Wez Furlong
a648d6d8d2 windows: reduce EGL->WGL fallback warning to trace 2022-06-01 05:57:59 -07:00
Wez Furlong
03e07ece56 x11: try harder to detect missing resize/focus events
This commit:

* Logs atom names in property change events (makes it easier to
  understand user's logs)
* Sets flags in cases where property changes might imply that a
  configure or focus event should have or should be sent
* Adjusts the "unsure about state" logic so that it doesn't just
  trigger on the initial paint, but also on those flags being set

refs: https://github.com/wez/wezterm/issues/1992
2022-05-27 08:56:29 -07:00
Wez Furlong
8f222d9559 wayland: make scaling workaround accomodate wlroots
Rather than detaching the buffer, replace it with an appropriately
sized little one.

refs: #1727
2022-05-27 07:07:44 -07:00
Wez Furlong
e83f2c95f4 Allow tracking left/right control and shift modifiers
I think this might only be a thing on Windows.

This commit speculatively (I'm on a mac at the moment!) allows tracking
the left/right control/shift modifier flags and passing that through
to the win32 input mode logic.

refs: https://github.com/wez/wezterm/issues/2009
2022-05-25 18:47:47 -07:00
kumattau
89d78ac410 Fix IME candidate window position on macOS 2022-05-24 09:37:49 -07:00
kumattau
342fa3f55b Add support of IME preedit rendered by system on X11 2022-05-22 06:02:51 -07:00
kumattau
c890c238c1 Add support of IME preedit rendered by system on Windows 2022-05-22 06:02:51 -07:00
Wez Furlong
f72207e7f0 wayland: fix weirdness with recent mutter and display scaling
Mutter recently started to enforce a protocol error that enforces
the ordering of buffer updates and that is flushing out some
bugs in various places; here's a related issue that I stumbled
into when I set my scaling to 300% and got stuck:

https://gitlab.gnome.org/GNOME/mutter/-/issues/2083

What that means to us is that we have to be careful when updating
the buffer scaling properties on our EGL surface.

We don't actually own the underlying buffer or the underlying
buffer commits, so we have to be a little indirect: what
we do here is detach the EGL managed buffer when we notice
that scaling has changed, and that appears to satisfy the
compositor.

refs: https://github.com/wez/wezterm/issues/1727
2022-05-20 08:54:07 -07:00
Wez Furlong
1e61d1ea8b wayland: avoid noisy panic-within-panic on shutdown
Ensure that we eagerly clear the window map to avoid
drop-during-global-dtor related panic which confuses
the root cause of wayland protocol errors.
2022-05-20 07:54:00 -07:00
Funami580
cbd13c5e2a wayland: clipboard: fix pasting if active surface id was not set
refs: #1385
2022-05-16 14:18:28 -07:00
kumattau
bf0f502823 Fix compile error by using i686-pc-windows-msvc 2022-05-16 14:17:38 -07:00
kumattau
ab8ea8b559 Fix X11 IME candidate window position 2022-05-12 09:01:04 -07:00
kumattau
ae4e3a65a2 Fix Windows IME candidate window position 2022-05-12 09:01:04 -07:00
Wez Furlong
cd623dffa8 fix xcb raising a fatal error when closing a window
The rust xcb bindings seem to have gotten more strict in 1.x;
previously we might generate two DestroyWindow calls for the same
window when closing one and things were fine, but now the second
call generates a protocol error which has the effect of terminating
the program.

This commit ensures that we only generate a single DestroyWindow
call by zeroing out the saved window_id after we emit it.

refs: #1974
2022-05-11 06:52:52 -07:00
Wez Furlong
e5a483ff8b window: point to re-integrated xkbcommon
refs: https://github.com/rust-x-bindings/xkbcommon-rs/pull/30
2022-05-09 17:24:20 -07:00
datasone
74e1cdcb40
Add support for drag and drop files in Windows (#1953)
* Add support for drag and drop files in Windows

* Add two drag and drop filename quoting patterns (mainly) for Windows, change doc examples.

* Code style cleanup

* Improve Windows quoting pattern and rename DoubleQuoteAlways to WindowsAlwaysQuoted

* Improve special char finding for DroppedFileQuoting::Windows and fix doc.
2022-05-09 07:38:52 -07:00
Wez Furlong
6484b3adc0 switch macos clipboard crate
This cleans up the `cargo audit` output on linux because the `clipboard`
crate (which hasn't been updated in 3 years) depends on xcb=0.8.2
which is flagged by cargo audit.

We don't use `clipboard` on any platform except macos

This commit switches to the `clipboard_macos` crate; that appears to
use a copy and paste of the macos specific code from the `clipboard`
crate, so this shouldn't have any change in functionality.

refs: https://github.com/wez/wezterm/issues/1952
2022-05-08 21:11:39 -07:00