1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00
Commit Graph

1100 Commits

Author SHA1 Message Date
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
Ovidiu Ionescu
9c215e15fd
fix: issue 3935 handle F13-F24 (#3937)
* fix: issue 3935 handle F13-F24

* Added F13-F24 in kitty mode

* fix: replace trailing ~ with u in escape sequence

* fix: patch ending char for function keys

---------

Co-authored-by: Ovidiu Ionescu <ovidiu@ionescu.net>
2023-08-06 10:22:14 -07:00
Wez Furlong
06dd8e4a79
macos: populate effective_dpi in wezterm.gui.screens
refs: #4096
2023-08-06 10:11:05 -07:00
Wez Furlong
1bbd56d469
wayland: return effective_dpi in wezterm.gui.screens
Note that this also does not respect dpi_by_screen; this is for
consistency in behavior and reported values.

Once we can produce the correct overridden value in
dispatch_pending_event, we can update these functions to return
the same data.

refs: #4096
2023-08-06 09:31:11 -07:00
Wez Furlong
06046c4319
x11: return effective_dpi in wezterm.gui.screens
refs: #4096
2023-08-06 09:26:06 -07:00
Wez Furlong
2a7167a0ef
fix some warnings 2023-08-06 09:18:40 -07:00
Wez Furlong
6ccbc723ba
wezterm.gui.screens: add optional effective_dpi field
This commit implements it for Windows. The other systems
report None for now.
2023-08-06 09:18:40 -07:00
Wez Furlong
b11691dda7
windows: support dpi_by_screen option
refs: #4096
2023-08-06 08:43:33 -07:00
Wez Furlong
ef94fc8405
wayland: respond to config.dpi changes faster
This is a baby step towards handling dpi_by_screen.
I don't want to do the actualy per-screen stuff here;
it touches stuff around the edges of SCTK and there is a pending,
significant, rewrite of that code needed to upgrade to a more
recent version of SCTK + wayland-protocols, and I don't want to waste
my effort on the intermediate state.
https://github.com/wez/wezterm/issues/3996#issuecomment-1636830740

refs: #4096
2023-08-06 07:52:37 -07:00
Wez Furlong
ede7e846f4
x11: respect config.dpi_by_screen
Maintain a cache of the positions of the various named screens,
and use that to resolve the screen of the current window, and
from there we can resolve the correct dpi_by_screen screen.

Make dpi and dpi_by_screen config changes generate a resize
event with the updated dpi.

refs: #4096
2023-08-05 22:25:06 -07:00
Wez Furlong
f7f253ec28
macos: add config.dpi_by_screen config option
Allows specifying the precise dpi to use on a per-screen basis:

```lua
return {
  dpi_by_screen = {
    ["Built-in Retina Display"] = 144,
  },
}
```

The screen names are the same as those returned from
`wezterm.gui.screens()`.

Changing either `dpi` or `dpi_by_screen` in the config will now cause
the window to be immediately resized/adjusted to the changed dpi
override.

Ultimately, I'd like to deprecate `dpi` in favor of `dpi_by_screen`,
but can't do that until this functionality is ported to windows, x11
and wayland.

refs: #4096
2023-08-05 20:48:59 -07:00
Wez Furlong
33187d0e79
macos: fonts: use full list of user fallback languages
The hope was that this would find more fonts, but it doesn't actually
help for this case.

refs: https://github.com/wez/wezterm/issues/4099
2023-08-05 17:33:59 -07:00
Wez Furlong
d1d4db20be
cargo update
Transitive deps now require rust 1.71, so update for that, as well
as some other minor changes required by transitive deps.
2023-07-30 20:09:15 -07:00
Wez Furlong
cbccbd3478
wayland: speculative fix for reading keymap from a pipe on chromebook
refs: #3958
2023-07-10 20:19:20 -07:00
Wez Furlong
2035ad4de3
x11: remove diagnostic print of kbd layouts
It seems that the library is a bit wonky; see:
https://github.com/wez/wezterm/issues/3882#issuecomment-1628359441
for an example of a segv around this
2023-07-10 07:37:51 -07:00
Wez Furlong
046443c107
windows: fix build
"Something changed" somewhere in the deps that broke type inference for
these cases.  Just use explicit types for the `as` portions.
2023-07-10 07:07:50 -07:00
Jacob Malloy
6154cf21c4 Fixed: Middle mouse drag MacOS
Added event selector to objc class for the otherMouseDragged event.
2023-07-10 06:34:20 -07:00
Wez Furlong
f901dfbf68
deps: tiny-skia -> 0.11 2023-07-09 18:28:48 -07:00
Wez Furlong
f09992f704
x11/wayland: fix ctrl-key for latin layouts
This is fixing a regression introduced by the fix for #2845.
The resolution for this is relatively straightforward, but took a bit
of effort to plumb.

Previously:
* CTRL/ALT/SUPER-modified keys with no explicit expansion would end
  up just taking the US layout version of the key.  That worked well
  for the intended problem with non-latin layouts, but for eg: German
  layouts it caused expansion to totally the wrong thing

Now:
* CTRL/ALT/SUPER-modified keys which effectively expand to non-ascii
  text (eg: cyrillic "Es") now take the equivalent key press from the
  US layout (which would be "c" in the "Es" case).  For European
  layouts this heuristic seems to avoid unexpected effects, but could
  do with some validation from native users.

To support this, the xkb code splits the `Keyboard` struct out from
some of the higher level logic and introduces a `KeyboardWithFallback`
struct that is built out of the user-selected keyboard layout, and
the fallback keyboard.  Now the fallback keyboard is fed the same
key inputs as the selected keyboard to correctly model the key
combinations.

refs: #3610
refs: #3933
2023-07-09 12:28:34 -07:00
Omar Sandoval
7373a4990b Fix copy mode on Wayland
On Wayland, copy mode often doesn't actually update the clipboard.
Specifically, it only works one time after a pointer enter or pointer
button event, then doesn't work again until the next event.

This is because the Wayland protocol serial number in
CopyAndPaste::last_serial is only updated by pointer enter and pointer
button events. So, subsequent copies using only the keyboard reuse the
same serial number and get ignored. last_serial used to be updated for
keyboard events, too, but that was (accidentally?) dropped in commit
0a00ffe98b.

Commit 0a00ffe98b also added another
last_serial to WaylandConnection which is updated for keyboard events
but isn't used anywhere as far as I can tell.

So, to fix this bug, let's get rid of CopyAndPaste::last_serial and
replace it with WaylandConnection::last_serial, which is now updated for
pointer and keyboard events.

closes: #3843
2023-07-03 10:45:47 -07:00
Wez Furlong
95e44f2199
Fix dbus value parsing issue by upgrading zbus/zvariant crate
Error message I've been seeing the past couple of days:

Unable to resolve appearance using xdg-desktop-portal: invalid value:
string "()", expected at least one field signature between `(` and `)`:
invalid value: string "()", expected at least one field signature
between `(` and `)`
2023-05-30 06:27:29 -07:00
Wez Furlong
7e2b7ca84d
deps: update tiny-skia
closes: https://github.com/wez/wezterm/pull/3794
2023-05-28 20:18:00 -07:00
Wez Furlong
4ae176dd8a
try scaling down images that don't fit in the texture atlas
When trying to display a 4k image there is a high chance that
we'll run out of texture space and then render with no images
displayed.

This commit changes the binary yes/no allow-images into a a series
of attempts: display at natural size, scale down by 2, 4, then 8,
then give up on images.

While looking at this, I noticed that we had a TOCTOU in the blob lease
stuff in the case where we might very quickly try the handle the same
image in succession, and end up deleting a file out from under a live
lease.

I've put in place a simple bandaid for that, but it's probably worth
revisiting the concurrency model for that.
2023-05-19 08:57:38 -07:00
Ye Sijun
c154eb2d8a reimpl and remove clipboard_macos
Signed-off-by: Ye Sijun <junnplus@gmail.com>
2023-05-07 11:05:55 -07:00
Wez Furlong
dc2cd706dc
macos: remove about dialog
Replace it with a menu item that shows the version number, and
that you can click to copy the version number.

closes: https://github.com/wez/wezterm/issues/3507
2023-04-24 11:08:18 -07:00
Wez Furlong
26090da81e
deps: tiny-skia -> 0.9 2023-04-24 09:13:44 -07:00
Wez Furlong
77ea124094
eprintln -> log::trace
Avoid unconditionally logging this diagnostic message, so that
we don't fill up wherever stderr is logging to.

refs: #3564
2023-04-20 07:31:47 -07:00
Wez Furlong
e204f8ba49
wayland: set_cursor: use exactly the caller-provided serial
Don't fallback to some other serial.

In a new version of SCTK, it looks like the serial we pass should
be the serial from the time we entered the surface, rather than
the latest serial that we have.

In practice, this commit uses None for the serial which seems to
have better results, but may come back to haunt us until we upgrade
to the latest SCTK.

refs: https://github.com/wez/wezterm/issues/3334#issuecomment-1515141539
2023-04-19 10:55:47 -07:00
Wez Furlong
048e8dd1ba
wayland: fall back to 'default' for pointers that are not found
This allows for potentially listing multiple candidate cursor names,
like we do for x11, but doesn't add any.

Attempt to load default if our desired cursor is not found.

refs: https://github.com/wez/wezterm/issues/3334
2023-04-19 10:29:40 -07:00
Wez Furlong
21e19ca091
x11/wayland: improve non-latin ctrl/alt keypresses
For eg: RU layout, CTRL-S shouldn't result in ы in the context
of a terminal.

The approach taken here is similar to kitty; when the key combination
doesn't produce a definitive composed output, and when any of
ctrl/alt/super are present, we treat the keypress as though it were
the same as the one from the system default keymap.

The result is that ctrl-c now works like ctrl-c and alt-b and alt-f work
like their latin counterparts.

Hopefully there are no downsides to this!

refs: https://github.com/wez/wezterm/issues/2845
refs: https://github.com/kovidgoyal/kitty/issues/606
2023-04-19 09:37:58 -07:00
Wez Furlong
44eccffe0c
macos: fix font size issue when spawning on external monitor
The main part of the problem is that NSWindow::isZoomed lies to us
sometimes.

This is a relatively gross workaround.

Add missing invalidation after setting the content size; that prevents
janky when dragging the window between monitors.
Removed some redundant Dimensions computation from that method; nothing
ever read it.

refs: https://github.com/wez/wezterm/issues/3503
2023-04-18 10:35:58 -07:00
Wez Furlong
163dfd7d9a
windows: refine DwmExtendFrameIntoClientArea call 2023-04-17 06:33:02 -07:00
kingavatar
08e9be0df3
feat: calling extendframe function to get sheet of glass effect 2023-04-17 06:33:02 -07:00
Wez Furlong
c4145a464b
windows: more consistently enable/disable backdrop on older windows
When the user edits their config, this should stand a better chance
of the desired effect being enabled and not requiring a restart.

refs: #3528
2023-04-17 06:33:01 -07:00
kingavatar
eef5ffb0ce
feat: add acrylic accent color as config and other refactors 2023-04-17 06:33:01 -07:00
kingavatar
a0b625985e
feat: add systembackdrop like acrylic and mica for windows os
Added functionality which enables Setting SystemBackdrop for windows os like mica, Acrylic, tabbed.
2023-04-17 06:33:00 -07:00
Wez Furlong
f3ee5e57f0
x11/wayland: route modifier/led status change to window
refs: https://github.com/wez/wezterm/issues/3444
2023-04-16 20:37:45 -07:00
Wez Furlong
075388fbe5
add window:keyboard_modifiers() method 2023-04-16 19:53:32 -07:00
Wez Furlong
3f820b93d9
Fix win32 input mode encoding inconsistencies
This pulls in almost all of the original PR in #2235.
I skipped a dead key case that I recall being tricky:
I didn't want to break the non win32-input mode version
of that.

I'd be happy to have that case re-evaluated in a smaller
PR where we can focus on its details.

Co-authored-by: Dominik Kreutzer <kreudom@gmail.com>
2023-04-16 13:07:18 -07:00
Wez Furlong
6d3dee733f
windows: fix maximize button with OS titlebar
refs: #3499
2023-04-16 11:56:05 -07:00
Wez Furlong
f627d6d704
windows: improve hit test for integrated max button
refs: https://github.com/wez/wezterm/issues/3499

but isn't the cause of it
2023-04-16 11:37:58 -07:00
Wez Furlong
0bb9a2896e
keyboard: populate caps and num lock on windows 2023-04-15 15:22:40 -07:00
Wez Furlong
f5d8e52094
keyboard: fixup build on win32 2023-04-15 15:06:23 -07:00
Wez Furlong
7ff88280f3
keyboard fixup build on x11/wayland 2023-04-15 15:00:03 -07:00
Wez Furlong
3c40846d95
keyboard: move led status to separate enum 2023-04-15 14:52:54 -07:00
Wez Furlong
5311bb657e
macos: populate caps lock state, report num lock presses
macos doesn't have a num lock concept, so there is no num lock state
reported in modifiers. wezterm doesn't emulate that state because it
cannot guarantee to observe all key presses and correctly track it.
2023-04-10 16:38:53 -07:00
Ron Waldon-Howe
0eeca6c2c5
fix(wayland): register frame callback then commit (fixes #3468) (#3485)
fix(wayland): register frame callback then commit (fixes #3468)

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2023-04-10 09:10:38 -07:00
Wez Furlong
f4995511e2
keyboard: improve support for numpad buttons
We were missing encoding of these for the base xterm encoding
(I haven't daily driven a keyboard with a numpad in over 10 years!).

Improve mapping for the kitty protocol.

refs: https://github.com/wez/wezterm/issues/3478
2023-04-09 12:28:30 -07:00
Wez Furlong
b646c36e34
refactor: tidy up some logging 2023-04-09 12:26:32 -07:00
Wez Furlong
2dcf7ad98d
keyboard: plumb more modifier+state information through
This commit teaches the termwiz layer about positional modifiers,
and expands our modifier concept to also pass through led states
such as caps lock and num lock.

Those aren't actually keyboard modifiers, but the state is useful
to recognize.

Adjust the shift key normalization so that we don't uppercase
alpha characters when both SHIFT and CAPS_LOCK are held.
This processing will remove both SHIFT and CAPS_LOCK in that
situation.

Add a method to KeyEvent that will undo the OS keyboard layer
normalization of positional to generic modifier key presses.
eg: the OS may map LeftControl -> Control, but we actually
prefer to have LeftControl so if we can unambiguously reverse
that mapping, we do so.

refs: #3476
refs: #3475
2023-04-09 10:34:53 -07:00
Wez Furlong
69ae847273
windows: fix: mess up full screen mode on config reload
refs: https://github.com/wez/wezterm/issues/3439
2023-04-08 11:24:25 -07:00
Wez Furlong
9e03d24402
windows: fix warning; mut not required here 2023-04-08 11:12:38 -07:00
Wez Furlong
36d5307b80
wayland: fix webgpu invalidation issue
For whatever reason, it appears as though the wayland
frame event stuff is unreliable when used with webgpu,
so we simply avoid using it.

refs: https://github.com/wez/wezterm/issues/3126
2023-04-07 22:15:07 -07:00
Wez Furlong
a5e89cda3d
windows: speculative fix for recursive borrow
refs: https://github.com/wez/wezterm/issues/3425
2023-04-07 09:29:20 -07:00
Jalil David Salamé Messina
b32863cc2f fix(clippy): Implement From instead of Into
Implementing `From` is prefered as this also implements the `Into` trait, may
not be desireable for code size/compilation time reasons.
2023-04-03 08:31:12 -07:00
Wez Furlong
c7ee705eaf
windows: fix INTEGRATED_BUTTONS|RESIZE 2023-04-01 08:32:24 -07:00
Wez Furlong
8a6e207f18
rustfmt 2023-04-01 07:46:31 -07:00
Wez Furlong
b74da54a70
x11: fix INTEGRATED_BUTTONS|RESIZE
Shouldn't show the native titlebar in that case
2023-04-01 07:26:14 -07:00
Wez Furlong
2168709836
minor tidy up of hover handling for maximize button
Remove an unsafe global variable and replace with a member variable
that works similarly to the drag tracking.

Doing this from a mac... may not compile on a windows box!
2023-03-31 23:10:12 -07:00
Wez Furlong
8b03890b8b
macos: correctly synthesize WindowState::MAXIMIZED 2023-03-31 22:06:22 -07:00
Wez Furlong
422ae51577
allow using Gnome and Windows styles on macos.
Rename macos to MacOsNative to make its intended purpose clearer
2023-03-31 20:35:26 -07:00
Wez Furlong
fb4e5b0f7b
macos: fixup window_decorations w/ INTEGRATED_BUTTONS+RESIZE
Our docs strongly suggest that RESIZE be kept in the mask, so let's
ensure that it continues to work.
2023-03-31 20:13:51 -07:00
YuraIz
bcd1b03569
integrated-title-bar: Use snap layouts for any maximize button 2023-03-31 19:55:13 -07:00
YuraIz
eab21a669d
integrated-title-bar: Improve windows support 2023-03-31 19:53:45 -07:00
YuraIz
01aeb506c0
integrated-title-bar: Update config options
and rename the "FANCY" option to "INTEGRATED_BUTTONS"
2023-03-31 19:51:46 -07:00
Yuri Izmer
e354791c34
integrated-title-bar: Add macOS support 2023-03-31 19:45:28 -07:00
YuraIz
fc7a8a8914
integrated-title-bar: Add x11 support 2023-03-31 19:45:28 -07:00
YuraIz
93308317d7
integrated-title-bar: Add windows support 2023-03-31 19:44:19 -07:00
Wez Furlong
d1c2257bd8
macos: fix CTRL key behavior when use_ime=true
refs: https://github.com/wez/wezterm/pull/2435
refs: https://github.com/wez/wezterm/issues/2771
refs: https://github.com/wez/wezterm/issues/2630
2023-03-30 21:49:48 -07:00
Gkirito
63676c30d2
refactor(config & macos/windows): rename window_background_blur to macos_window_background_blur 2023-03-24 19:04:15 -07:00
Gkirito
1b24ff1abf
feat(config & window): use CGSSetWindowBackgroundBlurRadius to set background blur on macos 2023-03-24 19:04:15 -07:00
Wez Furlong
c38d160918
macos: be precised about matching cocoa BOOL
Weirdly, this worked for me on my mac, but not in CI

refs: #3340
2023-03-23 20:12:43 -07:00
Wez Furlong
448a9fe78a
macos: don't treat command line args as .command scripts
Weird behavior from macos; the command line:

`wezterm start vim hello`

would result in macos requesting `vim` and `hello` be opened
as "documents" which would route each of those to the .command
script handling flow and spawn a window for each; running:

`vim ; exit` in one
`hello ; exit` in another

in addition to the normal handling of that command line.

This commit resolves this by igoring document opening
requests until after the application is fully launched.

I tested this by trying to open a .command script with
this new build and verified that that continued to work.

refs: #3340
2023-03-23 19:21:42 -07:00
Noé Froidevaux
073ea55a4c
Fix transparent title bar on macOS with window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW" (#3330)
Fix transparent title bar
2023-03-22 18:03:25 -07:00
Jalil David Salamé Messina
d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Jalil David Salamé Messina
191aacc7d7 fix(clippy): Use faster methods on Iterators
- Use `find` instead of `position(..).next()`
- Use `any` instead of `position(..).next().is_some()/.is_none()`
- Use `first/next` instead of `get(0)/nth(0)`
- Prefer `for` loops over `while let` loops on iterators

May improve performance.
2023-03-19 07:29:23 -07:00
Jalil David Salamé Messina
cb9dc3a800 fix(clippy): Remove unnecessary clone/to_string calls 2023-03-16 07:40:12 -07:00
Jalil David Salamé Messina
c6dc38b7f3 fix(clippy): Derive Default where possible 2023-03-15 10:21:11 -07:00
Wez Furlong
508ea437df
window: negative caching for xdg-portal
When it outright doesn't work, just cache that state rather than
repeatedly querying it.

refs: https://github.com/wez/wezterm/issues/3082
2023-02-09 08:49:35 -07:00
Wez Furlong
fd5c6dceb1
window: use a shorter timeout for xdg portal reads
A user reported this:

08:47:13.372  DEBUG  window::os::x11::connection        > Unable to
   resolve appearance using xdg-desktop-portal: Read:
   org.freedesktop.DBus.Error.TimedOut: Failed to activate service
   'org.freedesktop.portal.Desktop': timed out
   (service_start_timeout=120000ms)

which is an issue with their xdg-portal service.

Rather than have wezterm block for 2 minutes on startup, we give it
1 second, and log the issue as a warning.
2023-02-08 09:19:28 -07:00
Wez Furlong
3eede5c248
macos: make initial position consistent with window:set_position
refs: https://github.com/wez/wezterm/issues/2976
2023-02-07 13:02:59 -07:00
Wez Furlong
d1d48444f9
x11: avoid "Unhandled" log line for focus events
refs: #2959
2023-02-06 08:48:38 -07:00
Wez Furlong
5dff4b1bfb
macos: fixup open_untitled_file handling
This event is not triggered unless invoking the bundle via open,
and we need to gate it until after we've finished launching, otherwise
we will open two windows on startup.

closes: https://github.com/wez/wezterm/issues/3064
refs:  https://github.com/wez/wezterm/issues/3057
2023-02-06 05:37:07 -07:00
Wez Furlong
d2fd2c6b1a
remove some debug prints
These are no longer needed
2023-02-05 18:00:22 -07:00
Wez Furlong
2271c3ae59
macos: spawn new window when clicking on dock icon
If there are no windows, clicking on the dock icon will spawn a new
window.

Requires that `quit_when_all_windows_are_closed=false`

refs:  https://github.com/wez/wezterm/issues/3057
2023-02-05 17:56:01 -07:00
Val Packett
6a47bbaf32 wayland: set scale factor without wegl_surface (for WebGpu)
This fixes wrong scale with the WebGpu backend.
2023-02-05 09:53:18 -08:00
Hong Minhee
7bc15b668f macos: Add "New Window" to the dock menu 2023-02-05 08:26:24 -08:00
Wez Furlong
1fad5b5249
deps: sctk -> 0.16 2023-02-04 07:49:30 -07:00
Wez Furlong
8ffcf546cf
wayland: improve error when no seats have pointers
I don't know why that might be the case, but this error is better
than the unwrap.

refs: https://github.com/wez/wezterm/issues/3050
2023-02-04 07:44:47 -07:00
Michael Bikovitsky
397f1d0dc9 Detect ALT key for mouse events on Windows 2023-02-04 06:37:13 -08:00
Wez Furlong
8cff8fc918
x11: simplify focus event matching
refs: #2959
2023-02-02 08:25:53 -07:00
NBonaparte
3bee573bf8 x11: ignore pointer focus events 2023-02-02 07:24:28 -08:00
Wez Furlong
f4096803e3
window_decorations: add MACOS_FORCE_(EN|DIS)ABLE_SHADOW
Evidence:
* https://github.com/wez/wezterm/issues/310#issuecomment-718288028
* https://github.com/wez/wezterm/issues/2669#issuecomment-1379829866
* https://github.com/wez/wezterm/issues/2669#issuecomment-1408144931

seems to suggest that window shadows hurt performance,
so add a way to disable them independently from window opacity.

You may use:

```
config.window_decorations = "TITLE|RESIZE|MACOS_FORCE_DISABLE_SHADOW"
```

for this.

refs: https://github.com/wez/wezterm/issues/2669
2023-01-31 22:47:59 -07:00
Wez Furlong
f15bb186f4
macos: maybe fix window positioning for multi-monitor systems
refs: https://github.com/wez/wezterm/issues/2958
2023-01-25 18:06:46 -07:00
Wez Furlong
9350795f33
x11: always update selection ownership
refs: https://github.com/wez/wezterm/issues/2926
2023-01-21 18:24:29 -07:00
Wez Furlong
730c41b7e3
cargo fmt 2023-01-19 07:47:37 -07:00
Wez Furlong
5dbdd36a72
macos: implement window:focus()
refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 23:25:19 -07:00
Wez Furlong
6d2b42c95e
windows: implement focus method
refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 23:19:22 -07:00
Wez Furlong
b01aa129f7
add WindowOps::focus, ActivateWindow, window:focus()
Only implemented on X11 so far.
Note that Wayland doesn't support this action at all.

refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 22:58:48 -07:00
Jared Baur
88b49c9da0 wayland: hide mouse cursor when typing 2023-01-18 19:13:44 -08:00
Wez Furlong
14c749e51d
macos: ensure menubar is visible when switching away from a fullscreen window 2023-01-13 21:08:39 -07:00
Wez Furlong
a145a140f1
macos: retain menu menu when retrieving it from NSApp
refs: https://github.com/wez/wezterm/issues/2940
2023-01-12 19:29:40 -07:00
Wez Furlong
5da0ef4c12
macos: fixup application termination
The recently added app delegate was telling cocoa that we'd decide
to quit later in response to termination requests, blocking
shutdown/logout/restart.

This commit introduces a macos native modal alert to let the user
decide whether to quit or not.

While testing this, I noticed that in some cases, our internal choice
to quit had no effect.  Reading the fine print of NSApp::stop, it sounds
like calling it from a modal context will only stop a modal rather then
exit out of NSApp::run, so we explicitly bounce through an event
callback to try to make it exit from the right place.

I'm not 100% convinced by this.  I've left some debug prints in for
now to see if those give some insight in the future.

refs: https://github.com/wez/wezterm/issues/2944
2023-01-12 16:49:19 -07:00
NBonaparte
1999d2f0fc x11: determine active screen by using max intersecting area with active window 2023-01-11 08:07:52 -08:00
NBonaparte
5d5efa04fc x11: use TranslateCoordinates to get the root coordinates of focused window 2023-01-11 08:07:52 -08:00
NBonaparte
f77763275f x11: clean up active screen detection 2023-01-11 08:07:52 -08:00
NBonaparte
e31ff587f9 x11: implement active screen detection 2023-01-11 08:07:52 -08:00
Wez Furlong
890bff7faf
macos: add version info to system name 2023-01-10 18:58:35 -07:00
Wez Furlong
c19b65054f
gui: include x11 window manager in connection name 2023-01-09 16:22:48 -07:00
Wez Furlong
81f1979cd4
gui: describe connection and show it in debug overlay
Also helpful to understand the user's environment in problem reports
2023-01-09 15:59:54 -07:00
Wez Furlong
b1c3103a08
macos: update menubar when the config reloads
This is moderately painful to do, because of some objc/cocoa lifetime
concern that causes a crash when attempting to simply replace the
entire menubar, so we try to find/update items instead.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-24 00:10:04 -07:00
Wez Furlong
85afd9b599
tidy up macos menubar key assignment
This commit safely registers key equivalents with the menubar.  Safe in
this context means "doesn't override a key assignment from a key table".
For example, it would suck to define an application-wide key assignment
for a key combination that has a different assignment in a key table
that may be activated conditionally by some user-defined state/mode.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-23 19:59:35 -07:00
Wez Furlong
37b5dd91a5
move OpenInBrowser -> KeyAssignment
This allows defining those help actions that open URLs in the main
commands list, and not just for the macOS Help menu.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-21 07:04:51 -07:00
Wez Furlong
787f6550b8
macos: link to helpful resources from Help menu 2022-12-21 00:31:58 -07:00
Wez Furlong
b5aea795ca
fixup tests
refs: https://github.com/wez/wezterm/issues/162
refs: https://github.com/wez/wezterm/issues/1485
2022-12-20 20:48:44 -07:00
Wez Furlong
b224aa1b56
macOS: add MenuBar
This took a decent amount of effort to thread through with context;
wrappers around NSMenu and NSMenuItem are added to reduce some of
the objc usability warts, and an additional NSObject wrapper is
added to help copy the KeyAssignment from the existing list
of command palette commands and associate it with the menu item.

When a menu item is selected, macOS will walk through the responder
chain and look for a responder that responds to the selector associated
with the menu item.  In practice that means that our window/view class
will be tried first, and then later, our app delegate will be tried.

This commit implements routing from both of these: the window case
routes to the associated TermWindow and drops into the existing
perform_key_assignment method.

In case there is no window (not currently possible, but will be
in the future), the app delegate also has a placeholder for dispatching
key assignments, although it will only be able to perform a subset
of the possible actions.

A couple of things to note:

* Items aren't smart enough to disable themselves or adjust their
  caption based on the context. To make that work, we either need
  to recreate the entire menubar when any possible context changes
  (doable, but feels heavy), or we need to assign a target to each
  menu item and implement a validation handler on that target.
  That seemed to mess with the responder chain when I briefly
  experimented with it.

* There's some disabled code to add a Services menu. It is disabled
  because when it is enabled, accessing either Services or Help
  from the menu bar sends the process into a busy loop somewhere
  in macOS's internals.  It's unclear what it is unhappy with.

* No keyboard accelerators are associated with the menubar yet.
  That needs some thought, as they would essentially become global
  keyboard shortcuts and take precedence over the shortcuts defined
  for other keys in the config.  This feels like it should be something
  that the user has control over, so there needs to be something to
  allow that before we go ahead and wire those up.

refs: https://github.com/wez/wezterm/issues/162
refs: https://github.com/wez/wezterm/issues/1485
2022-12-20 19:46:08 -07:00
Wez Furlong
30238acb1b
x11: potential fix for hanging IME
refs: https://github.com/H-M-H/xcb-imdkit-rs/issues/5
refs: https://github.com/wez/wezterm/issues/2819
2022-12-19 12:23:04 -07:00
Wez Furlong
28c7c0ba19
macos: allow association with .command file type
Implement an app delegate to receive a callback when the system
requests that we open `.command` files, and then ask the mux
layer to spawn a window for it and execute it via the shell.

Also allow handling `.sh`, `.zsh`, `.bash`, `.fish` and `.tool`,
per kitty.

refs: https://github.com/wez/wezterm/issues/2741
refs: https://github.com/wez/wezterm/issues/2871
2022-12-19 11:06:12 -07:00
Wez Furlong
1f7a34f8b2
fix resizing on windows when wgpu is enabled 2022-11-18 10:03:49 -07:00
Wez Furlong
883e2d11d7
make drawRect work on macos when using webgpu 2022-11-18 10:03:49 -07:00
Wez Furlong
09f1ecbf82
erase generic T from Atlas, Sprite, CachedGlyph etc.
This will make it easier to use the same impl for webgpu and opengl
for a bunch of this stuff.
2022-11-18 10:03:49 -07:00
Wez Furlong
8479be7465
Basic useless wgpu based rendering foundation 2022-11-18 10:03:49 -07:00
Wez Furlong
eaa91e9314
deps: update raw-window-handle 2022-11-18 10:03:49 -07:00
Wez Furlong
387d0ad3e3
rustdoc markdown fences-- 2022-11-15 09:40:10 -07:00
Wez Furlong
9569028d98
xcursor: parse and follow theme inheritance
A couple of users ran into an issue where wezterm couldn't find
their mouse cursor icons.

Looking more deeply into this, we weren't looking at `index.theme`
files and following the inheritance chain from them.

This commit addresses that!

refs: https://github.com/wez/wezterm/issues/2687
refs: https://github.com/wez/wezterm/issues/2743
2022-11-15 09:15:43 -07:00
Wez Furlong
cd386804c4 macos: remove UNHANDLED: IME: do_command_by_selector warnings
We handle this the same whether we know the selector or not these days,
so just remove the warning.
2022-10-22 20:03:15 -07:00
Wez Furlong
473316934b add window-focus-changed event 2022-10-08 09:45:57 -07:00
Wez Furlong
7f8d3a31d7 x11: explicitly enable Dri2
On some systems, the X server will send dri2 events when enabling
opengl. Without telling the rust xcb crate that they might arrive, it
may panic.

refs: https://github.com/rust-x-bindings/rust-xcb/issues/204
refs: https://github.com/wez/wezterm/issues/2559
2022-10-08 08:11:57 -07:00
Wez Furlong
ba57f73bd9 deps: pick up updated rust-xcb
Might help with these:

refs: https://github.com/rust-x-bindings/rust-xcb/issues/195
refs: https://github.com/wez/wezterm/issues/2559
refs: https://github.com/rust-x-bindings/rust-xcb/issues/204
2022-10-04 07:53:46 -07:00
Wez Furlong
694ffdbed2 macos: revise how we prevent routing to the IME
https://github.com/wez/wezterm/pull/2435 proposed including
CTRL-modified keys, but I think that the state of the code now means
that we can simplify that area and adjust it so that we will default to
routing keys to the IME, but excluding them based on the
`send_composed_key_when_(left|right)_alt_is_pressed` configuration.

I've only very lightly tested this, but it seems ok with roman text and
me punching in random pinyin and then using CTRL-H or CTRL-M to delete
or enter.

refs: https://github.com/wez/wezterm/pull/2435
2022-09-21 21:22:38 -07:00
Wez Furlong
006e19813f x11: use _NET_WM_MOVERESIZE to drag by tab bar
refs: https://github.com/wez/wezterm/issues/2530
2022-09-18 17:20:41 -07:00
Wez Furlong
1355a5f83b macos: add logging around querying appearance 2022-09-17 05:57:54 -07:00
Wez Furlong
72c83e0599 ls-fonts: fix ascii rasterization of emoji/bitmap fonts
Need to scale them using the same rules we do when the window
renders them for real.

wezterm  ls-fonts --text "$(printf hi\\U1faf0💩)" --rasterize-ascii
2022-09-06 18:49:20 -07:00
unrelentingtech
682e83433d wayland: only cancel key repeat when the *held* key was released, fixes #2452 2022-09-06 07:31:08 -07:00
Wez Furlong
804fc04630 deps: xkbcommon-rs released 0.5
can stop using my git repo for this
2022-09-02 09:25:20 -07:00
Wez Furlong
b9d0843b71 deps: tiny-skia 0.7 -> 0.8 2022-08-28 20:50:27 -07:00
Wez Furlong
4edc9c5d9f macos: make us run again on Mojave
refs: https://github.com/wez/wezterm/issues/2451
2022-08-23 11:48:59 -07:00
Wez Furlong
7be824db62 deps: update zbus 2022-08-21 09:18:32 -07:00
Wez Furlong
f4b8028e5e macos: fixup CI build
weirdly, BOOL is considered bool when I compile locally,
but in the CI:

```
error[E0308]: mismatched types
   --> window/src/os/macos/connection.rs:170:22
    |
170 |     let max_fps = if has_max_fps {
    |                      ^^^^^^^^^^^ expected `bool`, found `i8`
```

I can't explain the difference in behavior (feels like a compiler
bug?) but let's try comparing explicitly against YES
2022-08-21 08:29:17 -07:00
Wez Furlong
99391e39d2 macos: NSScreen::maximumFramesPerSecond is newish
Gate calling it to avoid a runtime failure on eg: Big Sur.

refs: https://github.com/wez/wezterm/issues/2440
2022-08-21 07:21:12 -07:00
Wez Furlong
b181935303 win32: implement max_fps option 2022-08-20 19:20:41 -07:00
Wez Furlong
dc62aa5198 win32: set ScreenInfo::max_fps 2022-08-20 17:39:51 -07:00
Wez Furlong
cb09e71214 x11: populate ScreenInfo::max_fps from xrandr 2022-08-20 07:07:58 -07:00
Magnus Groß
ba309931a3 Cache xdg-desktop-portal appearance
This slightly improves the startup time of wezterm.

Right now we query the portal appearance value again over dbus every
time that we access it, for example every time that the user calls
wezterm.gui.get_appearance() from the Lua interface.

Queries over dbus are slow, they usually take a few milliseconds to
complete, for example on my system a portal query over dbus takes around
2 milliseconds to complete.

Wezterm also automatically calls the portal during its own internal
x11/wayland connection initialization, thus right now wezterm queries
the appearance portal setting n+1 times on startup, where n is the
number of times that the user calls get_appearance() from the config.

To fix this problem, we simply cache the portal appearance.

Thus this patch decreases the startup time by 2ms for users that
configure wezterm to follow the global system theme and potentially by
more for users that call get_appearance() in inflational amounts.

With the naive implementation wezterm would be subject to the following
race condition:

1. wezterm calls get_appearance() and caches the value
2. System-wide dark mode changes
3. wezterm subscribes to portal notifications

In that scenario wezterm would miss the dark mode switch entirely and
would cache the wrong value until the dark mode switches again after
wezterm subscribed.

To fix this race condition we call read_setting() again **after** we
have subscribed just to be on the safe side.

Note that while this still introduces a second "redundant" dbus query
for the same value, this time it does not actually block start up since
it happens in another thread.

refs: #2258
2022-08-20 06:06:59 -07:00
Wez Furlong
4fead3171e macos: report max_fps in ScreenInfo
Other platforms can be added later
2022-08-19 21:02:51 -07:00
Wez Furlong
8ca3faa6ee macos: implement max_fps
Use the same technique that we use on x11 systems to schedule/throttle
painting frames.

refs: https://github.com/wez/wezterm/discussions/2419
2022-08-19 20:39:39 -07:00
Davide Cavalca
0048209bcf Add missing license files 2022-08-17 07:19:12 -07:00
Wez Furlong
e2bf468393 wayland: disable use of wlr-output-management protocol
refs: #2297
refs: #2293
refs: #2360
2022-08-07 08:13:38 -07:00
Magnus Groß
60b5be2b34 x11/wayland: always try the portal for appearance
Right now the initial x11 appearance retrieval uses the specific
connection interface, which completely circumvents the already existing
more complete implementation in x_and_wayland.rs.
The latter implementation is strictly better, because it first attempts
getting the appearance from the XDG desktop portal and then falls back
to the X11 interface.

Before this patch there was a very weird issue for folks using the OS
system dark mode with the following config snippet:

```
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())
```

The color_scheme on startup would be correct, but there would be a very
weird problem where sometimes wezterm ignores the first time that the
portal notifies about an appearance update.

The source of the bug was an inconsistent retrieval of the appearance
setting:
- The Lua API used the XDG desktop portal
- The internal appearance used the X11 specific connection at startup

For example due to this, the internal appearance variable could have
stored "Dark" from the X11 connection, but the actual appearance from
the XDG desktop portal was "Light".
If then the XDG desktop portal changes to "Dark", the
appearance_changed() method would dismiss the update because
self.appearance was already "Dark".

It is only after that, that the internal inconsistency would have been
solved and following appearance changes would succeed and update the
colorscheme correctly.

To fix this problem, we now use the portal directly in both the x11 and
wayland connections,  which is consistent with the Lua
wezterm.gui.get_appearance() API.

refs: #2258
2022-07-15 15:23:47 -07:00
Wez Furlong
a1c8b4a9b3 x11/wayland: subscribe to xdg desktop portal for settings changes
We use this to detect changes in dark mode

refs: https://github.com/wez/wezterm/issues/2258
2022-07-13 18:56:21 -07:00
Wez Furlong
8ef70d1e31 windows: avoid recursing and borrowing inner twice
Querying the window can call into windowproc so we need to avoid
it when we hold `inner`.  Adjust the flow so that we can get
the info about the window state purely from an HWND.

refs: #2257
2022-07-13 11:37:04 -07:00
Wez Furlong
8dcfbc6718 x11/wayland: use xdg desktop portal settings interface to get dark mode
There are some other settings in there that could also help with
things like the cursor theme on Wayland.

Note that we don't currently subscribe to the settings changed
signal: that can be done in a follow up.

refs: https://github.com/wez/wezterm/issues/2258
refs: https://github.com/wez/wezterm/issues/1742
2022-07-13 08:55:43 -07:00
Wez Furlong
d7fa541745 windows: fixup starting maximized
Since applying the maximized state is async, we hadn't fully applied
it before we got to the startup logic that resizes the window to fit
the initial terminal size.

This adds a final check to see if we are resizable before we try
to apply that size, and skips it.

refs: #284
2022-07-10 07:19:08 -07:00
Wez Furlong
f11b240a1c wayland: double-buffer ime events
refs: #1772
2022-07-10 06:52:21 -07:00
Wez Furlong
607287935f wayland: ime: clear compose state after commit
refs: #1772
2022-07-09 23:12:43 -07:00
Wez Furlong
2196279689 wayland: workaround mutter IME issue
refs: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4776
refs: https://github.com/wez/wezterm/issues/1772
2022-07-09 22:29:25 -07:00
Wez Furlong
7f6ae3c82d wayland: fixup IME preedit
The done event shouldn't clear the state.

refs: #1772
2022-07-09 12:35:01 -07:00
Wez Furlong
9c758dd203 wayland: fix ime position when scaling > 1
refs: #1772
2022-07-09 12:20:22 -07:00
Wez Furlong
e2b748a0d4 wayland: initial support for zwp_text_input_v3 / IME
refs: #1772
2022-07-09 09:44:08 -07:00
Wez Furlong
c906179bb9 wayland: use zwlr_output_manager if available
This seems to have better names and also returns fractional
scaling information.
2022-07-08 13:40:28 -07:00
Wez Furlong
fdb5fc2d66 wayland: implement wezterm.gui.screens()
Hook it up for resolving geometry, but note that wayland doesn't
allow positioning and we don't expose a way to set width/height
based on screen right now.
2022-07-08 09:54:42 -07:00
Wez Furlong
2c093b976d windows: implement window:maximize(), window:restore() 2022-07-07 06:25:43 -07:00
Wez Furlong
9779b29c39 wayland: implement window:maximize() window:restore() 2022-07-07 06:19:08 -07:00
Wez Furlong
871f7a8115 x11: implement maximize and restore 2022-07-06 23:53:19 -07:00
Wez Furlong
8caf0615c5 add plumbing for maximize/restore on x11/wayland
Doesn't do anything yet, but I always forget to add this until
after I've implemented one or the other and then wonder why
nothing happens.

refs: #284
2022-07-06 23:14:37 -07:00
Wez Furlong
8853df02ca lua: add window:maximize() and window:restore() methods
Implemented on macOS only for the moment.

refs: https://github.com/wez/wezterm/issues/284
2022-07-06 23:11:02 -07:00
Wez Furlong
87b963981e win32: fixup initial window pos after screens changes
Ensure that we correctly use CW_USEDEFAULT for the case where
`--position` was not used.
2022-07-06 13:43:46 -07:00
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