1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-28 07:55:03 +03:00
Commit Graph

978 Commits

Author SHA1 Message Date
Jeffrey Knockel
0462f318d7 Set base_width/height in set_resize_increments
On X11, this information is set as part of the hints given to the window
manager. When resizing the terminal, many X11 window managers will now
correctly report the current cell size of the terminal (e.g., 80x24) as
an overlay when resizing the window.
2024-01-24 22:04:16 -07:00
Jeffrey Knockel
f204f0f1a9 Refactor set_resize_increment() args into struct 2024-01-24 22:04:16 -07:00
Wez Furlong
46732d049a
x11: speculatively allow pasting latin-1 data
refs: https://github.com/wez/wezterm/issues/4402
2024-01-24 16:31:56 -07:00
fortuneteller2k
328b1f3b15 macos/clipboard: use try_quote instead of quote 2024-01-24 11:57:03 -07:00
Wez Furlong
223ba32de2
x11: fix handling of high-speed key events
test scenario is:

```
bash -c "sleep 5; for((i=0;i<30;i++)); do xdotool keydown --delay 0 Shift_L keydown --delay 0 9 keyup --delay 0 Shift_L keyup --delay 0 9; done"
```

That should cause a series of `(` characters to be emitted, but prior to
this commit is was usually mostly `9`'s.

What's changing here is:
* We copy the pertinent fields from the last xcb StateNotify event.
  That ostensibly has the current modifier and layout state, but
  because it comes from the X server, it doesn't factor in knowledge
  from the IME.
* When processing an XCB key event, compute the current modifier
  mask and override the XKB state with it.
* Now XKB will produce correct information about the key syms
* Restore the modifier state from the saved StateNotify information.

refs: https://github.com/wez/wezterm/pull/4151
refs: https://github.com/wez/wezterm/issues/4615
refs: https://github.com/fcitx/fcitx5/issues/893
refs: https://github.com/ibus/ibus/issues/2600
refs: https://github.com/wez/wezterm/issues/3840
2024-01-24 08:04:39 -07:00
Wez Furlong
079e87d62e
fixup issue with compose key
this partially reverts eb3a78b0cb and
should hopefully resolve the underlying problem, which is that
the composition cursor is stuck at an empty string when using
a compose key on its own.

refs: https://github.com/wez/wezterm/issues/4841
2024-01-24 06:58:07 -07:00
Wez Furlong
9bae5b4158
switch wholesale to my fork xcb-imdkit, as it is not actively maintained
My branch includes my own fixes, as well as this PR:

refs: https://github.com/H-M-H/xcb-imdkit-rs/pull/3

which should enable this PR that's been blocked on it for a while:
refs: https://github.com/wez/wezterm/pull/2056
2024-01-23 17:50:04 -07:00
Wez Furlong
f6aba4b0d6
deps: update zbus 2024-01-23 17:14:47 -07:00
Wez Furlong
201fc1bf8e
deps: update xcb 2024-01-23 17:12:16 -07:00
Wez Furlong
33647b029c
deps: update x11 2024-01-23 17:04:26 -07:00
Wez Furlong
a263fd38f1
deps: update xkbcommon 2024-01-23 17:02:32 -07:00
Wez Furlong
eb3a78b0cb
x11: synthesize clearing dead key state when forgotten by system
It's not clear exactly how this triggers, but in setups where
a compose key has been configured (against the default for the
configured keyboard layout), it seems as though certain events
that indicate when composition is complete are not delivered,
leaving the compose cursor in an inconsistent state.

This commit attempts to detect that composing->!composing
state transition and bubble it up; when we return Nothing
and had previously had a composition string we're return
a bool to cause the caller to emit an event that clears
the composition state.

I'm not totally sure this is 100% right, but I think
it may help with the case we're discussing in
https://github.com/wez/wezterm/issues/4841
2024-01-23 15:02:50 -07:00
Wez Furlong
045e92be1b
x11: always trust key event modifiers over xkd modifiers
in discussion: https://github.com/ibus/ibus/issues/2600#issuecomment-1904322441
the summary is that the StateNotify event which is used to update
the xkd modifier state is sourced directly from the X server and
doesn't account for any state maintained by the IME.

The key press and release events do include the correct state,
so we should always prefer to use the modifiers from those events
on X11.

Under wayland, we continue to use the kbd state.

refs: https://github.com/ibus/ibus/issues/2600
refs: https://github.com/wez/wezterm/pull/4151
2024-01-23 14:26:53 -07:00
Wez Furlong
c0b61d1c6d
Revert "x11: add experimental x11_use_passive_key_updates config option"
This reverts commit c7c0cabbb7.
2024-01-23 14:09:44 -07:00
Wez Furlong
c7c0cabbb7
x11: add experimental x11_use_passive_key_updates config option
In discussion about the ongoing weirdness with modifier processing,
it sounds like we could/should be using `update_key` rather than
`update_mask` under X11.  (Wayland: has to use `update_mask`,
per the docs:
https://docs.rs/xkbcommon/latest/xkbcommon/xkb/struct.State.html#method.update_key)

I quickly tried out a proof of concept with this and it
doesn't seem to hurt, but since I'm unsure if there are other
nuances to consider, I've put this behind a config option.

`x11_use_passive_key_updates` defaults to true which results
in the use of `update_mask` on X11.

Setting it to false will switch to using `update_key` instead,
and may improve handling of xkb states.

refs: https://github.com/wez/wezterm/issues/4841
refs: https://github.com/ibus/ibus/issues/2600
refs: https://github.com/wez/wezterm/pull/4151
2024-01-23 12:19:40 -07:00
Wez Furlong
02bdd7ed56
rustfmt 2024-01-23 10:29:46 -07:00
Wez Furlong
851997cce4
x11: synthesize clearing dead key status when composing via IME
We have two different ways to compose:

* Via xkbd
* Via IME messages

In the latter case, we receive notifications from the IME about
the composed text, but are apparently not guaranteed to receive
them about the composition status overall.

This commit will synthesize clearing the composition status
when we receive the instruction to emit composed text.

The hope is that this will clear the compose cursor state
that appears to get stuck for some users of ibus + Gnome 45.

refs: https://github.com/wez/wezterm/issues/4841
2024-01-23 10:25:52 -07:00
Wez Furlong
72fae51b00
x11/wayland: avoid including keysym name in compose cursor
refs: https://github.com/wez/wezterm/issues/4511
2024-01-21 15:49:03 -07:00
rawnly
5dcf67dbec chore: moved comment 2024-01-21 14:06:01 -07:00
Federico
82d05aa71a Update window/src/os/macos/window.rs
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2024-01-21 14:06:01 -07:00
rawnly
6dbea8ff5e chore: run fmt 2024-01-21 14:06:01 -07:00
rawnly
32a090e353 macos: code cleanup 2024-01-21 14:06:01 -07:00
rawnly
163606afec fix: moved window level state update 2024-01-21 14:06:01 -07:00
rawnly
209d039c5d fix: refactor window level + Toggle options 2024-01-21 14:06:01 -07:00
rawnly
9901866962 macos: floating window logic cleanup 2024-01-21 14:06:01 -07:00
rawnly
2e66a4b0df macos: save window level on window_state 2024-01-21 14:06:01 -07:00
Federico Vitale
a1f0dca655 macos: cleanup 2024-01-21 14:06:01 -07:00
Federico Vitale
86e42e1c58 macos: refactor set_window_level 2024-01-21 14:06:01 -07:00
Federico Vitale
0080fec63d macos: remove level() function in window 2024-01-21 14:06:01 -07:00
rawnly
d9387ed6e2 fmt: run fmt
Signed-off-by: rawnly <rawnly@users.noreply.github.com>
2024-01-21 14:06:01 -07:00
rawnly
18cb7e9765 macos: updated WindowLevel enum
removed wrong values and implemented `From<T>` trait

Signed-off-by: rawnly <rawnly@users.noreply.github.com>
2024-01-21 14:06:01 -07:00
rawnly
ae67f85ea3 macos: added platform checks for ToggleFloatingWindow
Signed-off-by: rawnly <rawnly@users.noreply.github.com>
2024-01-21 14:06:01 -07:00
rawnly
8906d03851 macos: added floating window 2024-01-21 14:06:01 -07:00
Wez Furlong
c4970b7fc8
xkbd: don't merge in modifiers, use only when missing
I think it will be safer to only take the flags from
the event in the case that the state reports zero
modifiers.

refs: https://github.com/wez/wezterm/issues/4776
closes: https://github.com/wez/wezterm/pull/4781
2024-01-21 13:11:36 -07:00
Jeffrey Knockel
1d4a407df9 x11: fix resize increments
Set atom with property (type) WM_NORMAL_HINTS (WM_SIZE_HINTS) instead of
WM_SIZE_HINTS (CARDINAL).
2024-01-21 10:10:59 -07:00
Wez Furlong
bf07f6de0f
Revert "deps: update to wgpu 0.19"
This reverts commit b4c5dc746d.
This reverts commit 3214610f16.
This reverts commit 3ec1cfba73.
This reverts commit 47590bbedc.
This reverts commit ea88dca296.
This reverts commit c269230b74.
This reverts commit 1484e2a673.
This reverts commit 6fd45c1223.
This reverts commit 9acc2ae6c5.

refs: https://github.com/wez/wezterm/issues/4825
refs: https://github.com/wez/wezterm/issues/4826
2024-01-21 09:51:58 -07:00
Wez Furlong
3214610f16
windows: final stretch 2024-01-20 20:51:27 -07:00
Wez Furlong
3ec1cfba73
windows: and maybe this fixes the build now! 2024-01-20 16:06:19 -07:00
Wez Furlong
47590bbedc
windows: and another try! 2024-01-20 15:54:25 -07:00
Wez Furlong
ea88dca296
windows: another run at fixing up the build 2024-01-20 15:37:38 -07:00
Wez Furlong
c269230b74
macos: another run at fixing up the build 2024-01-20 15:36:47 -07:00
Wez Furlong
1484e2a673
macos: another wgpu related fixup 2024-01-20 12:58:59 -07:00
Wez Furlong
6fd45c1223
maybe fixup build for wgpu 0.19 on macos and windows 2024-01-20 12:55:33 -07:00
Wez Furlong
9acc2ae6c5
deps: update to wgpu 0.19 2024-01-20 12:09:52 -07:00
Wez Furlong
c607c6a59c
allow rgba for all window_frame colors
refs: https://github.com/wez/wezterm/issues/3580
2024-01-20 10:06:02 -07:00
Benoit de Chezelles
0466898af7
x11: Use modifiers from X event if non were detected by XKB
This is a working tentative at fixing text expansion/injection done by
Espanso by default, where XKB doesn't seem to detect the pressed
modifiers `Ctrl+Shift` before pressing `v`.

refs: #3840
2024-01-11 06:44:57 -07:00
Quan Tong
f2a9c06247 honor the window_close_confirmation config option when quitting 2023-12-02 08:38:42 -07:00
ud2
4551903f5b macos: fix leak of Window and View objects 2023-10-29 18:39:30 -07:00
Haochen Tong
44c914c230 wayland: update SCTK to fix startup on newer compositors 2023-09-20 11:22:04 -07:00
Wez Furlong
0456719980
windows: fix build
Weirdly, the rust compiler is suddenly complaining about this,
when this file hasn't changed.

```
error[E0283]: type annotations needed
    --> window\src\os\windows\window.rs:2398:26
     |
2398 |         if vk <= u8::MAX.into() {
     |               --         ^^^^
     |               |
     |               type must be known at this point
     |
     = note: cannot satisfy `u32: PartialOrd<_>`
help: try using a fully qualified path to specify the expected types
     |
2398 |         if vk <= <u8 as Into<T>>::into(u8::MAX) {
     |                  ++++++++++++++++++++++       ~

error[E0283]: type annotations needed
    --> window\src\os\windows\window.rs:2415:32
     |
2415 |         if leader.1 <= u8::MAX.into() && key.1 <= u8::MAX.into() {
     |                     --         ^^^^
     |                     |
     |                     type must be known at this point
     |
     = note: cannot satisfy `u32: PartialOrd<_>`
help: try using a fully qualified path to specify the expected types
     |
2415 |         if leader.1 <= <u8 as Into<T>>::into(u8::MAX) && key.1 <= u8::MAX.into() {
     |                        ++++++++++++++++++++++       ~

```
2023-08-21 06:00:51 -07:00