Commit Graph
1062 Commits
Author SHA1 Message Date
Chris Pick cfb1e9190f Prevent infinite loop in macOS' "Service" menu validation
The `WezTermAppDelegate` class was setting `NSWindow` as its parent.

This caused an infinite loop any time macOS's "Service" menu was
expanded becuase it would pass [`validRequestorForSendType:returnType:`]
(https://developer.apple.com/documentation/appkit/nsresponder/1524638-validrequestor)
messages along the full responder chain to [check for objects that are
eligible for services offered by other applications]
(https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-148895).

The [responder chain]
(https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW9)
would walk up to the `WezTermAppDelegate` which, since it was an
`NSWindow`, would walk back to `NSApp` which would walk to its delegate
(`WezTermAppDelegate`) and so on forever.


Change `WezTermAppDelegate`s parent class `NSObject` to prevent this
loop.

Fixes: https://github.com/wezterm/wezterm/issues/6738
Fixes: https://github.com/wezterm/wezterm/issues/6833
2025-07-23 08:15:24 +01:00
Chris Pick 85c587f9f3 Remove deprecated NSWindowFullScreenButton
Fixes #7080 to prevent null pointer dereference (and crash in debug
mode) on macOS.

`NSWindowFullScreenButton`
[is deprecated](https://developer.apple.com/documentation/appkit/nswindow/buttontype/fullscreenbutton?changes=__6_5&language=objc).
Removing it prevents a null pointer from being dereferenced and doesn't
otherwise impact behavior.

Confirmed that `window_decorations = "RESIZE"` sill works
[with rounded corners](https://github.com/wezterm/wezterm/issues/1034).
2025-07-13 13:51:09 +01:00
Wez Furlong 54675c9c35 window: fix use of deprecated objc2_core_graphics::CGColorCreateSRGB 2025-07-01 07:47:23 +01:00
Wez Furlong f54dd1b028 macos: don't try swrast fallback for mesa
We're not using; we only use either Metal via WebGpu (and thus
don't ever get into the egl code), or Egl via the native opengl
implementation.

So we can bail out of the loop with the swrast fallback like
we do on windows.

closes: https://github.com/wezterm/wezterm/issues/6819
2025-05-17 09:36:33 -07:00
parthandWez Furlong 4d6b83585f feat: Added support for window blur on KDE Wayland (#6905)
* added config flag for kde blur

* added deps for wayland-protocol-plasma

* added kde background blur

* keeping inner functions together

* updated docs with kde_blur

* added kde_blur ss to docs

* removed unneeded dep

* removed redundant default value for bool

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* updated default for kde_blur in config

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* Update docs/config/lua/config/kde_window_background_blur.md

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* Update blur logic in os/wayland/window.rs

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* simplified blur_manager creation in wayland/state.rs

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* removed unnecessary panic paths

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* removed unnecessary panic path

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

* put the right screenshot for kde_blur

* fixed build issues

* reverted window/src/os/windows/window.rs

* fixed formatting

* Update window/src/os/windows/window.rs

---------

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2025-05-04 06:29:27 -07:00
Jay Madden c0b29fef24 feat(macos): add support for titlebar background matching theme background on macos
closes: #6558
2025-03-08 17:13:37 -07:00
Ryan Zimmermanandvolskaya c6b67877b6 Add option to extend the osx non-native fullscreen behind the notch to the top of the screen (#5759)
* Adding an option (disabled by default) to disable the notch avoidance so you can use the full screen if your terminal config already handles the notch.

Co-authored-by: volskaya <38878482+volskaya@users.noreply.github.com>
2025-02-22 08:17:33 -07:00
dani162 23d643bab4 use surface height/width for client side decoration frame resizes 2025-02-09 15:58:48 -07:00
Wez Furlong 011ea313b6 rustfmt
refs: https://github.com/wezterm/wezterm/pull/6587
2025-02-08 19:22:10 -07:00
amadeusandWez Furlong fcae187b29 feat(macOS): add support to disable rounded corners on macOS (#6587)
* feat(macOS): add support to disable rounded corners on macOS

* Update wezterm-input-types/src/lib.rs

---------

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2025-02-08 19:21:44 -07:00
Bowei Zhang ca671d649b fix: don't clear ime_last_event when a key is UP 2025-02-08 14:19:32 -07:00
MaeIsBad d1684d38e8 Fix crash on hidpi with wayland (#6508) 2025-02-08 13:33:12 -07:00
Aliaksandr Truš 80b9ffd14c fix(wayland): fix issue with tiled and maximized window
Potential fix for #6262
2025-02-08 13:26:35 -07:00
Jared Baur 444ed2309a wayland: prevent setting cursor when window is not focused 2025-02-08 13:22:54 -07:00
Wez Furlong b6ec0b03d6 macos: suppress warnings from legacy objc crate
This is a PITA. The objc crate does some stuff that spews warnings
everywhere that the sel! and msg_send! macros are used.

That crate is not currently maintained

There is a fork of the crate which resolves the spew, but we also
use the cocoa crate which pulls in the original crate

The new fork is not compatible with cargo workspace patching.

There is an alternative objc2 crate with a nicer, more type-safe
API, but the API changes to migrate are pretty huge: I just lost
a couple of hours on this and still hadn't gotten past the migrating
the NSMenu stuff over.

So, the approach here is to simply ignore the warnings in the modules
that use the objc crate.

This will need to be fixed by someone someday, but that day is not
today.

refs: https://github.com/SSheldon/rust-objc/issues/125
2025-02-07 22:23:22 -07:00
Bowei Zhang 7145a8ffaf chore: resolve nit from linter 2025-02-07 19:07:08 -07:00
Wez Furlong 11c4b11669 s,wez/wezterm,wezterm/wezterm,
I moved the repo to an org of its own. Update various things
to reference the new location.
2025-02-07 13:08:01 -07:00
occupyhabit 72e723187c chore: remove redundant words in comment
Signed-off-by: occupyhabit <wangmengjiao@outlook.com>
2024-12-04 07:49:30 -07:00
Cosimo Matteini a7ff718c7c wayland: reimplement maximize and restore
It was removed with wayland reimplementation in #4777
2024-11-28 10:58:03 -07:00
Wez Furlong da0a738169 rustfmt 2024-09-22 09:11:22 -07:00
Wez Furlong d7938cb6b2 wayland: handle left/right tiling too
refs: https://github.com/wez/wezterm/pull/5897
2024-09-22 09:10:15 -07:00
Aliaksandr Truš c75d300f6f feat: implement toggle_fullscreen and hide for Wayland
closes https://github.com/wez/wezterm/pull/5897
2024-09-22 09:04:43 -07:00
Aliaksandr Truš 16a8bcdd89 fix(wayland): match inner window and window frame sizes 2024-09-22 08:06:10 -07:00
Wez Furlong 09ac8c5377 wgpu -> 22.1
Tested on X11 and Wayland via weston and seems to work

closes: https://github.com/wez/wezterm/pull/5814
2024-09-15 05:56:56 -07:00
Gracjan GóreckiandWez Furlong 137a97bf65 #5518: handling panic in copy_and_paste.rs line 105 (#6004)
* #5518: handling panic in copy_and_paste.rs line 105

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2024-09-14 10:48:35 -07:00
Sean Estabrooks 9668fa9481 Don't exit-program on X11 selection-event protocol errors
There are situations where transient xcb errors can be generated
  in regard to copy/paste selection.  One example was reported
  in connection with "wl-clip-persist" in issue #6128.  And another
  in issue #5482.

  But there's no reason for us to terminate in response, so catch
  and report any selection-related errors, as per code review in
  PR  #6135
2024-09-14 09:21:01 -07:00
Rian McGuire 024a8eebb5 Handle non-sRGB displays on macOS 2024-09-14 08:18:50 -07:00
Sean Estabrooks 030bc46e30 Avoid potential panic, when starting in Wayland.
As per the documentation for the OutputState info method:

/// This may be none if the output has been destroyed or the
/// compositor has not sent information about the output yet.

Unwrapping its return has lead to crashes at startup, which to
the user can appear as WezTerm refusing to start.
2024-09-14 06:55:27 -07:00
blukai a0a415d1cb improve x11 startup times
related issue: wez#5802

requesting `GetScreenResourcesCurrent` instead of `GetScreenResources`
brings startup times down from 1.5 seconds to 30 microseconds on my
machine (measured with dumb printlns).

according to some findings `GetScreenResourcesCurrent` may return
nothing, so i kept `GetScreenResources` there as a fallback, just in
case, although I'm not 100% sure that it's necessary. see:
- https://github.com/qt/qtbase/blob/c234700c836777d08db6229fdc997cc7c99e45fb/src/plugins/platforms/xcb/qxcbscreen.cpp#L963
- https://github.com/qt/qtbase/blob/c234700c836777d08db6229fdc997cc7c99e45fb/src/plugins/platforms/xcb/qxcbconnection_screens.cpp#L390

also worth to note that i3 does not rely on
`xcb_randr_get_screen_resources`, but only on
`xcb_randr_get_screen_resources_current`, see:
- https://github.com/search?q=repo%3Ai3%2Fi3%20get_screen_resources&type=code
2024-08-11 11:28:35 -07:00
Thayne McCombs ccb7270dd7 Upgrade smithay-client-toolkit to 0.19
closes: https://github.com/wez/wezterm/pull/5781
2024-07-13 10:49:45 -07:00
Michael Baird af4f5edb50 Fix notch avoidance padding in full screen mode
Fixes https://github.com/wez/wezterm/issues/3807

The values returned by [`safeAreaInsets`][0] need to be multipled by the
scale factor of the display (in case of the MacBook Pro 14-inch, 2021, a
value of 2.0).

There's a code comment referencing [#1737 (comment)][1], where an extra
`2` was added to this number, but something must have changed since then
because I cannot see a need for this now.

[0]: https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets
[1]: https://github.com/wez/wezterm/issues/1737#issuecomment-1085923867
2024-06-07 17:40:11 -07:00
Wez Furlong f1a0842608 windows: fix warning 2024-05-13 19:07:55 -07:00
Wez Furlong a597803c13 windows: fixup for newer libloading 2024-05-13 15:54:14 -07:00
Wez Furlong 421ce4f0e1 deps: update zbus 2024-05-13 09:56:11 -07:00
Wez Furlong c6ffe92853 deps: remove a duplicate version of libloading 2024-05-13 09:45:45 -07:00
Wez Furlong 6c890c3995 update metrics to latest version (0.22) 2024-05-13 09:41:12 -07:00
Jeffrey Knockel 79ce027d38 x11: fix exposures on child window
We should watch the child window for exposure events, not the parent
window (the parent window is just a background color and we never paint
to it).

This was a regression from commit 809bcc55.

Fixes #5405.
2024-05-10 13:39:48 -07:00
Daniel Berlin 5b0b657b30 Update wayland keymap handling for protocol 7+.
Newer wayland protocol expects us to mmap the keymap file
descriptor (and do so with certain mmap flags).

The current code tries to handle both normal files and pipes,
but neither will work in some cases.

This updates the code to use xkbcommon's new_from_fd,
which is what the toolkit uses, and mmap's the file.

This fixes #5393, which was caused by hanging when
trying to read the file as if it was a pipe.
2024-05-10 05:49:09 -07:00
Jeffrey Knockel 814857cd69 x11: fix positioning with --position arg
The child window should always have position 0,0.

This was a regression from commit 809bcc55.

Fixes #5395.
2024-05-09 16:48:06 -07:00
Thayne McCombs 0b50725f67 Handle missing data device manager more gracefully 2024-05-06 14:52:55 -07:00
Wez Furlong 265b85be1d update image to 0.25
This improves how non-conforming jpegs are decoded and displayed.

refs: https://github.com/wez/wezterm/issues/5365
2024-05-05 16:14:46 -07:00
Jeffrey Knockel 809bcc55a5 x11: fix window contents jumping on async resize
We can't hope to keep the renderer's idea of the window size consistent
with the actual window size when the user can asynchronously change its
size at any moment. Therefore, we create a child window which we render
to and which we synchronously resize in response to async resizes. Since
by default the contents of X11 windows are undefined on resize, we take
the additional steps of setting our windows' X11 background color and
bit gravity as appropriate.
2024-05-05 14:06:46 -07:00
Martin Nowak d70624b169 fix #4985 - reimplement get_appearance for wayland
- was dropped with wayland reimplementation (#4777, 3eaba4e3d6)
- get appearance from xdg desktop portal
- advise all windows of appearance changes to reload config
2024-05-05 13:50:45 -07:00
Kushagra Gupta d9455a45fe fixed the issue #5348 and a typo
Fixed the issue #5348 for windows by setting margins check for window decoration instead and using value 0 margin for only the TITLE style
2024-05-05 13:09:14 -07:00
Wez Furlong 1598579551 x11: refactor x11 dnd a little
Reduce some nesting and make it a little easier to follow.

refs: https://github.com/wez/wezterm/pull/5316
2024-05-05 13:02:40 -07:00
Stefan Siegel 3d511bbd67 Accept drag and drop of URLs from browsers and plain text on X11
For filenames and urls an additional space is inserted after the last
item to enable adding more files and urls with another drag-and-drop
operation without the need to manually enter the space in between.
2024-05-05 12:48:09 -07:00
Stefan Siegel b888c547db Implement drag and drop for X11
This is the last platform to resolve #640
2024-05-05 12:48:06 -07:00
Wez Furlong d8154bc450 avoid unwrap when detaching seat
refs: https://github.com/wez/wezterm/pull/5276
2024-05-04 16:17:31 -07:00
V 48fa4ca497 Fix crash when setting cursor on non-existent pointer 2024-05-04 16:09:38 -07:00
V 369fcb9928 Fix crash when switching TTYs 2024-05-04 16:09:38 -07:00