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

553 Commits

Author SHA1 Message Date
Wez Furlong
70ab5e7712 implement beeps for Windows
refs: #3
2021-09-26 13:50:57 -07:00
Wez Furlong
aefbab5a9d enable audible bell for X11
refs: #3
2021-09-26 13:36:43 -07:00
Wez Furlong
72cb110b65 add audible_bell config option
This allows using the system beep sound, currently only on macos.

refs: #3
2021-09-26 12:55:19 -07:00
Greg V
275dee4aa3 window: implement increment step resize on Wayland 2021-09-21 08:19:56 -07:00
Greg V
c5da219847 window: do not lose maximized/fullscreen -> default transitions on Wayland
Changing surface configuration flags *to* default would never be applied.
This was uncovered when implementing increment step resize: it would stop
working after *one* maximization.
2021-09-21 08:19:46 -07:00
Wez Furlong
8f0ab02b09 wayland: keymap File no longer needs to be mut 2021-09-19 18:27:57 -07:00
Wez Furlong
5657141dae wayland: Expand use clause 2021-09-19 15:59:29 -07:00
Greg V
b94e78c8ec window: read the xdg keymap fd from 0 on Wayland (fixes #1144)
The wl_keyboard definition does not define that the incoming fd is always at seek position 0.
In fact, the spec says the fd "can be memory-mapped" and that's it.
And e.g. smithay client-toolkit uses mmap, but we don't :/

Use pread() to read from zero.
2021-09-19 15:59:29 -07:00
Wez Furlong
8282faf31f window: allow specifying window resize increments on macos and x11
This commit introduces a mechanism for specifying resize increments
for a window, and then arranges for the termwindow to set those
to match the current font cell metrics.

This should help to avoid cases where there is excess padding pixels
resulting from the window being slightly larger than computed number
of cells and the font metrics.
2021-09-08 22:57:42 -07:00
Greg V
94ede1e8f1 window: implement window movement by dragging on Wayland 2021-09-08 17:45:48 -07:00
Greg V
455ea89fa8 window: unbreak bypass_mouse_reporting_modifiers on Wayland (fixes #1122)
Modifier state was not saved to the `modifiers` field that's read when converting mouse events,
so these events always had no modifiers.
2021-09-08 09:27:23 -07:00
Greg V
5b85e80b75 window: fix synthesized configure event for Wayland DPI scale (fixes #1111) 2021-09-06 19:26:24 -07:00
Wez Furlong
91209af8da window: fix default dpi on X11 and Wayland systems
Similar to da455cafa1, the extra
connection layer wasn't forwarding the call to the actual impl.

closes #947
2021-09-06 10:01:16 -07:00
Wez Furlong
da455cafa1 window: plumb get_appearance on x11/wayland systems
Not sure what happened here: presumably a borked merge or something
similar, but this commit allows `window:get_appearance` to return
the actual appearance value on X11.

Even though this plumbs the call through to Wayland, Wayland doesn't
provide an equivalent concept so still always return Light, as is
mentioned on our docs.

closes: #1098
2021-09-02 09:08:21 -07:00
Wez Furlong
b53a6059de increase max fps to 60 by default, improve coalesce
* Trigger a paint immediately from invalidate if not throttled
* Otherwise defer the other events until we're about to sleep for xcb
  events, which should maximize the coalesce around resize/expose events

refs: #1051
2021-09-02 08:53:03 -07:00
Wez Furlong
367797c1ae x11: coalesce resize and repaint events
The thesis is that some WM's might send a whole bunch of events
that cause us to over draw/over resize.

I'm not convinced that this is a righteous change, but it can't
hurt to try.

refs: #1051
2021-09-02 08:53:03 -07:00
Ziyang Lin
df68147af5 (macOS) respect alt key configs for ime 2021-09-01 22:54:44 +08:00
Shizeeg Unadequatov
61c5063654 X11: Composite isn't required anymore
on X11 bits_per_value() reports 11 when Composite is disabled and 8 otherwize.
2021-08-27 07:49:17 -07:00
Wez Furlong
f09d747f14 window: use released xcb-imdkit crate
refs: #250
2021-08-23 09:09:45 -07:00
Wez Furlong
5629e0c1ca deps: tiny-skia -> 0.6 2021-08-23 07:48:13 -07:00
Wez Furlong
fc5ca5a297 don't vsync on x11, do our own throttling
Some users mentioned that there's a lag after selecting text
on X11.  Tracing through, I saw that the we invalidate the window
quite a lot when dragging the selection, and the buffer swap could
delay for several ms each time while waiting for the vsync.

Rather than blocking the GUI thread and making it bog down, this
commit adopts a technique similar to the recent Wayland frame sync
changes, except that we enforce a minimum of 33ms between frames
in our own scheduler to avoid blocking for several ms at a time.

This seems to do a decent job of balancing responsiveness during
selection with updating the display, and keeps the buffer swap
delay down to microseconds.

We may want to make this delay configurable.
2021-08-19 20:53:21 -07:00
HMH
6404099d25
IME support on X11 (#1043)
* WIP: IME support for X11

* Handle text generated by IME.

* Set IME position according to the cursor position.

* Improve IME position handling.

Geometry as well as window focus changes are now handled.

* Dispatch IME strings like it's done on windows.

* Make sure not to silently drop IME errors.

* Respect `use_ime` configuration.

* Add xcb-util as dependency.

* Only update IME position if necessary.

* Formatting.

* Update xcb-imdkit-rs.

* Set IME position under the start of the cursor.

This seems to be the way it is commonly done among gui frameworks.
(Tested with Firefox for GTK and Konsole for QT).

* Update xcb-imdkit-rs.

* Handle systems only providing libxcb-util0-dev.

* Add libxcb to freebsd dependencies.

Required by xcb-imdkit-rs.

* Update xcb-imdkit-rs.

* Try to use more recent gcc on centos7.

* More recent C++ compiler on centos7 as well.

* Also setup correct env on centos7 for tests.
2021-08-19 20:51:56 -07:00
Wez Furlong
571c137955 gui: gamma fixup
This makes the comparison in https://github.com/wez/wezterm/issues/544
work for me on mac, linux (x11, wayland) and also on Windows but
only using WGL.

It looks like we can use the proper colorspace on all targets
except for ANGLE EGL.  For whatever reason, the combination of
glium and ANGLE EGL on windows over-gamma corrects.

AFAICT, the framebuffer and perhaps the surfaces it creates
don't indicate srgb support, and whatever combination of status
they return tickles glium's srgb stuff the wrong way.

I think the "solution" is just to directly use WGL by default.

EGL was on by default because it tended to be more survivable
when graphics card drivers were updated, but the last couple
of times I updated mine it still killed wezterm anyway.

refs: #544
2021-08-19 09:17:09 -07:00
Wez Furlong
ab21910d80 deps: update bitflags -> 1.3 2021-08-15 18:21:17 -07:00
Wez Furlong
0866e5d213 fonts/shaping: respect the Presentation selection for a cluster
This commit annotates fonts with a boolean that indicates whether
we think it contains glyphs with emoji presentation, and then
passes the cluster.presentation field down to the shaper.

If the presentation doesn't match the current font in the fallback,
then it will be skipped until we exhaust its options.

`wezterm ls-fonts` also shows whether we think a font has emoji
presentation.

refs: #997
2021-08-11 09:11:59 -07:00
Wez Furlong
8d93222000 window: x11: assume default theme if no cursor theme specified
refs: #1007
2021-08-11 08:22:53 -07:00
Wez Furlong
ee71d478c4 window+gui: enable dual source blending
This replaces the slightly gnarly subpixel enabled blending in the
shader with Dual Source Blending, which is a technique where the
fragment shader can specify both the primary color (RGBA) as well
as an additional per-channel mask that can be used to alpha blend
with the destination.

This enables artifact-free alpha blending when used together
with a transparent window background.

refs: https://github.com/wez/wezterm/issues/932
2021-08-10 18:23:18 -07:00
Wez Furlong
2e158f58f3 x11: avoid make_current assertion for wezterm connect unix
The connection UI show/close could cause an assertion/bad alloc
error when it closes.
2021-08-08 12:27:16 -07:00
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