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

525 Commits

Author SHA1 Message Date
Wez Furlong
45576eeeab wayland: make use of the frame callback
This commit ties our invalidation requests together with the surface
frame callback request so that we can throttle our frame rate if
we're busy, but still remain largely idle if we're not changing
any content.

refs: https://github.com/wez/wezterm/issues/884
2021-08-07 09:30:36 -07:00
Wez Furlong
609f9358eb wayland: use non-blocking eglSwapInterval
https://emersion.fr/blog/2018/wayland-rendering-loop/ suggests that
it is best practice to do this so that the compositor doesn't
cause an application to block forever if the window is moved to
an off-screen state.

That article also suggests using the frame callback to schedule
paints; this commit has that code included, but I've left it
disabled because it causes us to repaint at the monitor refresh
rate which is often more frequently than we would anyway;
in our problem scenario we're painting once per second and we
just want to make sure that that doesn't block.

So hopefully this makes the sway/scratchpad experience better!

refs: https://github.com/wez/wezterm/issues/884
2021-08-07 08:31:15 -07:00
Wez Furlong
e9ad43765c fix build on macos 2021-08-06 21:44:45 -07:00
Wez Furlong
79165617b1 window: add WindowState concept
WindowState is a bitfield that can represent maximized, full screen
and hidden window states.

WindowState is passed along with resize events, improving on the
prior basic is_full_screen boolean by representing the other states.

Notably, WindowState::MAXIMIZED is used to represent a state where
the window's size is constrained by some window environment function;
it could be due to the window being maximized in either or both the
vertical or horizontal directions, or by the window being in a tiled
state on any edge.

When the window is MAXIMIZED, wezterm will behave as though
`adjust_window_size_when_changing_font_size = false` because it knows
that it cannot adjust the window size in that state.

This potentially helps with #695, depending on whether the window
manager propagates this state information to wezterm.  Gnome/mutter
does a good job at this with both X11 and Wayland, but I couldn't get
sway to report these states and I don't know of any other tiling wm
that I can easily install and use on fedora, so there's a question
mark around that.
2021-08-06 18:56:37 -07:00
Wez Furlong
86bf251f3f add some more metrics around get_lines_with_hyperlinks_applied + others 2021-08-01 14:50:50 -07:00
Wez Furlong
ecc63e2e5d wayland: improve mouse cursor resolution and diagnostics
Switch to using `xterm` rather than `text` for the name of the
xterm style I-beam mouse cursor, as that appears to be more
compatible across themes; the gnome theme aliases text -> xterm
via a symlink.

Improve error diagnostics in the case that no cursor is found.

refs: https://github.com/wez/wezterm/issues/532
2021-08-01 13:47:24 -07:00
Wez Furlong
267885ce0b workaround a guillotiere issue
We don't need to free any allocations, so we can use the simple
allocator instead and avoid the issue.

refs: https://github.com/nical/guillotiere/issues/25
2021-08-01 00:12:19 -07:00
Wez Furlong
c867b4e079 window: fix warning when buildings tests on !macos 2021-07-29 19:44:34 -07:00
Wez Furlong
b13ca6fac4 window: x11: no need to complain loudly if no xsettings 2021-07-24 08:34:36 -07:00
Wez Furlong
07dfccaddd window: x11: avoid extraneous title updates
Avoid setting the title again if it matches the last thing we set;
this in turn avoids receiving a property update from the window
manager to tell us that we set the title.

refs: #964 (but isn't the root cause)
2021-07-21 08:58:35 -07:00
Wez Furlong
5904140abf improve error handling around xsettings reading 2021-07-18 22:13:18 -07:00
Wez Furlong
a2e882a7cb deps: cargo update, and a couple of dependabot suggestions 2021-07-18 19:10:46 -07:00
Wez Furlong
f050659543 window: implement get_appearance and AppearanceChanged on Windows
refs: #806
2021-07-18 14:17:05 -07:00
Wez Furlong
a697b30223 window: add xsettings support on X11 systems
This allows reading xsettings which contain information about
both the active theme as well as the DPI.

refs: #947
2021-07-18 12:54:52 -07:00
Wez Furlong
1f5b900f3d plumb appearance change event -> reload on macos
This commit causes a window-config-reloaded event to trigger
when the appearance (dark/light mode) is changed on macos.

It also arranges to propagate the window level config to newly
spawned panes and tabs, created both via the gui and via the
CLI/mux interface.

refs: https://github.com/wez/wezterm/issues/894
refs: https://github.com/wez/wezterm/issues/806
2021-07-18 00:01:53 -07:00
Wez Furlong
daaa3299d6 window: introduce interface for determining if dark mode is active
This is a baby step: it introduces the Appearance concept
and provides an accessor at the Connection level.

Only macos implements this at this time, and nothing else
makes use of it.

refs: https://github.com/wez/wezterm/issues/894
refs: https://github.com/wez/wezterm/issues/806
2021-07-17 23:08:08 -07:00
Rashil Gandhi
1d800c956b Listen for settings change event 2021-07-17 11:26:16 -07:00
Rashil Gandhi
4ad9f10f9f Remove hardcoded logic for titlebar color 2021-07-17 11:26:16 -07:00
Wez Furlong
ce1a05d9bd window: add some trace logging
refs: #949
2021-07-17 08:37:04 -07:00
Wez Furlong
5c4fb92b87 fixup wgpu example 2021-07-11 12:46:23 -07:00
Wez Furlong
77c5acaaf5 fixup tests on macos 2021-07-10 19:01:20 -07:00
Wez Furlong
37ec16329e fixup tests + wayland bits 2021-07-10 18:07:16 -07:00
Wez Furlong
cc2b9507f8 fixup build on windows 2021-07-10 17:52:14 -07:00
Wez Furlong
6aa575d838 fixup build on macos 2021-07-10 17:42:05 -07:00
Wez Furlong
db6da81272 window: move away from async event queue
I added this originally thinking that it would make it easier to resolve
https://github.com/wez/wezterm/issues/695 and to integrate wgpu support,
but it's the cause of https://github.com/wez/wezterm/issues/922 so let's
take it out and more directly connect the window events to those in the
terminal.

This commit likely breaks mac and windows; pushing it so that I can
check it out and verify on those systems.
2021-07-10 17:30:19 -07:00
Wez Furlong
ad19b4f57b window: de-Future most of the WindowOps methods 2021-07-10 17:30:19 -07:00
Wez Furlong
cd1f7b1784 x/wayland: remove Mod3 -> SUPER mapping
I'm not sure where this came from in its originating commit
(05a60e6e8b), but it is inconsistent with
the reverse mapping function added in that same commit:
05a60e6e8b/window/src/os/x11/xkeysyms.rs (L3)

It is causing problems in https://github.com/wez/wezterm/issues/933
and is rarely used by default, so it seems safe to just remove
this mapping.
2021-07-10 08:04:28 -07:00
Wez Furlong
fc4c165ca3 window: update wgpu -> 0.9
This is still used only in an example
2021-07-09 20:37:34 -07:00
Wez Furlong
8ecfdb618f wayland: disambiguate Event type 2021-06-27 16:23:03 -07:00
Wez Furlong
46476f2eec wayland: remove unused code
This stuff was added because the underlying types lacked Debug
and Send. They've since added those impls and we don't need this
layer.
2021-06-27 16:01:26 -07:00
Wez Furlong
37a57e8a41 wayland: refine event loop 2021-06-27 15:13:41 -07:00
Wez Furlong
0a00ffe98b wayland: fix key repeat
The main culprit was the calloop feature that is used by default
in the underlying SCTK crate.

This commit:

* Routes keyboard processing via the same keyboard mapping code
  that we use for X11
* Implements key repeats directly, and with awareness of elapsed
  time in case the repeat rate is quicker than the event dispatching
  quantum
* Disables the calloop feature of SCTK and let us do our own polling
  of the wayland connection.

Critically, key repeat is sticky and unpredictable while calloop is
enabled.

closes: #669
2021-06-27 14:29:03 -07:00
Wez Furlong
c514254138 wayland: use proportional font for title bar
allow specifying the font in the config file
2021-06-27 13:04:20 -07:00
Wez Furlong
ca8209b230 wayland: move frame color config to the config file
This simplifies it a bit and exposes the config via the config file;
the following options are possible, each one specifies a color

```lua
return {
  window_frame = {
    inactive_titlebar_bg = "",
    active_titlebar_bg = "",
    inactive_titlebar_fg = "",
    active_titlebar_fg = "",
    inactive_titlebar_border_bottom = "",
    active_titlebar_border_bottom = "",
    button_fg = "",
    button_bg = "",
    button_hover_fg = "",
    button_hover_bg = "",
  }
}
```

refs: https://github.com/wez/wezterm/issues/761
2021-06-27 12:33:56 -07:00
Wez Furlong
7f04c4601a window: fixup tests for font config changes 2021-06-26 22:58:42 -07:00
Wez Furlong
282c148bf6 wayland: render title with our font layer when doing CSD
This isn't perfect by any means:

* Should allow configuring a sans-serif font
* Emoji need to be scaled

but it allows us to upgrade SCTK without loosing the titlebar
or any control over client side decorations.
2021-06-26 22:58:42 -07:00
Wez Furlong
4f9532f9d8 window: plumb font config to underlying window impl 2021-06-26 22:58:42 -07:00
Wez Furlong
e69869efa7 refactor deps so that window can depend on wezterm-font
I want to use this to render the font in the title bar
2021-06-26 22:58:42 -07:00
Wez Furlong
d04486f30a wayland: replace andrew with tiny_skia
This has the consequence of removing the title bar text when
client side decorations are in use.
2021-06-26 22:58:42 -07:00
Wez Furlong
d1177a29c2 wayland: update to SCTK 0.14 2021-06-26 22:58:42 -07:00
Wez Furlong
355b2f5b5a wayland: import ConceptFrame impl from SCTK
This has been removed in a later version, so pull it in ahead
of updating that dependency to verify that it builds.
2021-06-26 22:58:42 -07:00
Wez Furlong
8ab025b7fc Allow building without wayland support
You can run `cargo build --release --no-default-features` to build
without wayland support.

This is useful for systems that do not have wayland (eg: the `slint`
distro).
2021-06-26 22:58:42 -07:00
Wez Furlong
2fc143e6dd click to focus window now focuses the pane under the mouse cursor
refs: https://github.com/wez/wezterm/issues/881
2021-06-26 15:24:17 -07:00
Wez Furlong
4c0d789ac3 zeno -> tiny_skia
Mostly so that we can turn off anti-aliasing for smaller sizes,
but it also happens to be more complete anyway.
2021-06-25 22:55:42 -07:00
Wez Furlong
a514adfec0 windows: avoid ctrl normalization in the common case
in https://github.com/wez/wezterm/issues/767 CTRL-Tab was getting
incorrectly normalized to CTRL-i; that normalization is valid (Tab is
actually equivalent to CTRL-i as far as unix terminals are concerned)
but unwanted at this layer.

I suspect that this change will come back to haunt me in the future,
as keyboard input is a bit of a zoo.
2021-05-29 10:23:41 -07:00
Wez Furlong
030e517b43 deps: metrics 0.15 -> 0.16, cargo update 2021-05-24 07:57:03 -07:00
Wez Furlong
18ae2ccc8e window: log/retry self-pipe-writes
At the bottom of https://github.com/wez/wezterm/issues/815 is some
discussion about an apparent hang.

Let's make the self pipe writing a bit more robust and log to see
if that might be related.
2021-05-23 19:07:48 -07:00
Wez Furlong
f78190ec9c filedescriptor: remove anyhow from public interface
Use thiserror instead
2021-05-23 14:24:01 -07:00
Wez Furlong
a59e9b1706 update metrics 0.14 -> 0.15
closes: https://github.com/wez/wezterm/pull/778
2021-05-11 19:20:24 -07:00
Wez Furlong
5f5a48c830 tidy up log levels for wgpu 2021-05-09 10:59:48 -07:00