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

467 Commits

Author SHA1 Message Date
Wez Furlong
325e755216 window: don't propagate errors from close notif channel
When a window is being destroyed we expect the receiver end
to be disconnected, so we don't want to break out of the
message loop if a couple of residual windows fail to notify.
2021-05-08 10:20:26 -07:00
Wez Furlong
453cfc1813 avoid a panic during shutdown 2021-05-08 09:36:20 -07:00
Wez Furlong
e81fb6e721 make alpha work on macos 2021-05-08 09:36:20 -07:00
Wez Furlong
0503abc63a fixup build on windows, make transparent 2021-05-08 09:36:20 -07:00
Wez Furlong
655eef271f fixup build on macos 2021-05-08 09:36:20 -07:00
Wez Furlong
058c3f612f add wgpu example 2021-05-08 09:36:19 -07:00
Wez Furlong
f4939c510b impl raw window handle on Window 2021-05-08 09:36:19 -07:00
Wez Furlong
c4e1f2434a add raw-window-handle impls 2021-05-08 09:36:19 -07:00
Wez Furlong
3d760653b4 window: macos: disable window restoration 2021-05-08 09:36:19 -07:00
Wez Furlong
a44607fb3f with_window inner from FnMut -> FnOnce
Not sure why it was FnMut, but this tidies up an awkward
option/take/unwrap thing in notify().
2021-05-08 09:36:19 -07:00
Wez Furlong
fb72338689 window: macos set gl layer placement to top-left 2021-05-08 09:36:19 -07:00
Wez Furlong
89dfeb69d6 tweak message pumping around paint on win32
It's not perfect; the revised code won't repaint immediate during
resize which can make the window a little "wobbly" during resize.
2021-05-08 09:36:19 -07:00
Wez Furlong
630d9d215b fixup build on windows
and correct the notify same thread optimization on unix
2021-05-08 09:36:19 -07:00
Wez Furlong
0f384b5c06 make window.notify more efficient on unix
avoid going through an extra queue if we already are in the right place
2021-05-08 09:36:19 -07:00
Wez Furlong
9fd04f6024 fixup linux build 2021-05-08 09:36:19 -07:00
Wez Furlong
5d037eae52 adjust gui layer for window changes 2021-05-08 09:36:19 -07:00
Wez Furlong
4d73448387 window: fixup build for macos 2021-05-08 09:36:19 -07:00
Wez Furlong
fe836da980 window: fixup build on windows 2021-05-08 09:36:19 -07:00
Wez Furlong
d56bfd0b7f window: separate gui window state from app state
Removes the callbacks type and replaces event dispatch with
an async capable channel.

This makes it a bit simpler to model some of the window internals,
and to prepare for a wgpu enabled future.

This changes have been tested only on linux so far.
2021-05-08 09:36:19 -07:00
Chris
2add312c5c
Allow VoidSymbol keycode to be seen by wezterm (#759)
* allow voidsymbol for key code

* update docs, cleanup

* cleanup and fmt of files

* remove unnecessary inputs
2021-05-07 07:54:24 -07:00
Wez Furlong
e400f2f524 fixup build on windows
refs: https://github.com/wez/wezterm/issues/695
2021-05-03 21:40:20 -07:00
Wez Furlong
b2b0b8b011 fixup build on linux
refs: https://github.com/wez/wezterm/issues/695
2021-05-03 21:09:08 -07:00
Wez Furlong
0df755b8f0 window: set_inner_size now returns Future<Dimensions>
This should help us reason about whether a resize respected
our request.

This may break linux and windows builds, will fixup once
this is pushed.

refs: https://github.com/wez/wezterm/issues/695
2021-05-03 20:49:22 -07:00
Wez Furlong
772991a1f0 window: remove WindowOpsMut trait
It doesn't serve any purpose and makes it awkward to make
a change in a later commit.

refs: https://github.com/wez/wezterm/issues/695
2021-05-03 20:26:33 -07:00
Wez Furlong
e4d45de9ec cargo fmt 2021-05-02 12:59:31 -07:00
Wez Furlong
6a5582f45a fixup tests for new_window async change 2021-05-02 12:43:00 -07:00
Wez Furlong
6919630810 refactor: new_window is now async
This doesn't really change anything, but it makes it a little
simpler to integrate wgpu in a later commit.
2021-05-02 12:05:28 -07:00
Wez Furlong
45262c3091 macos: fix numpad enter key reporting
refs: https://github.com/wez/wezterm/issues/739
2021-04-27 07:39:10 -07:00
Wez Furlong
ff7f097fb9 macos: fix "reflected" mouse x coordinate values
We were getting abs() of the backing-rect-adjusted value, so we need to
restore the sign to avoid what should be logically cell position "-1"
being treated as cell position "1" and so on.

With this change, the logic in the gui layer successfully clamps the x
coordinate to zero when trying to drag left off the window.
2021-04-23 18:31:44 -07:00
Wez Furlong
aea4fd5020 macos: ensure window is always miniaturizable
We need to keep the miniaturizable flag in even when there is no
titlebar, otherwise the miniaturize action has no effect.
2021-04-15 18:12:14 -07:00
Wez Furlong
2bb0e4e797 macos: use alternative cursor hiding technique
NSCursor hide/unhide must be perfectly balanced otherwise
the cursor can vanish unexpectedly when the mouse leaves
the window, and not come back.

So, let's use NSCursor:setHiddenUntilMouseMoves instead; it's
not 100% fulfilling the promise of the API, but it's close enough
and should avoid the permanent invisibility issue.

refs: https://github.com/wez/wezterm/issues/618
2021-04-10 14:30:06 -07:00
Wez Furlong
1415d16c9f window: x11: explicitly set titles in utf8
closes: https://github.com/wez/wezterm/issues/673
2021-04-10 07:44:51 -07:00
Wez Furlong
16e7457049 x11: notice dynamic changes to Xft.dpi
This commit allows the x11 window implementation to detect changes
in the DPI that occur after a window is created.

These can occur when changing desktop resolution or when changing
the accessibility option for "Large Text" in gnome.

In order to avoid continually polling for the value on every resize,
we look for the `_GTK_EDGE_CONSTRAINTS` atom in our property change
notifications.  This seems to be sent at least as often as the
dpi/scaling changes.

It's also worth noting that some dpi changes don't generate resize
events, so we can't just read the dpi value on every resize, because
we'd miss some of those changes.

Part of this commit changes the font scaling logic: previously
we'd keep a notion of "dpi scale" to apply.  That dates from an
earlier time in wezterm where we didn't think that we knew an
actual dpi value.

The way that worked was that we'd compare our current guestimate
of the DPI against what we though the baseline OS dpi should be to
produce a scaling factor.

On X11 that dpi value is global and we'd effectively always produce
a revised scaling factor of 1 after we'd set up the initial window.

This commit changes that logic to just pass down the actual DPI value
to the font code.  That DPI value already accounts for HiDPI scaling
so this is hopefully a NOP change for the other systems.

refs: https://github.com/wez/wezterm/issues/667
2021-04-09 09:23:25 -07:00
Wez Furlong
7a17ae833f macos: add logging around NSOpenGLPixelFormat
This just makes it easier to see when this is slowing things down.

refs: https://github.com/wez/wezterm/issues/452
2021-04-03 20:08:57 -07:00
Wez Furlong
1658627e2c macos: the event loop would keep running until mouse moved after quit
On macos, once all panes were closed, the GUI would request that the app
stop, but it wouldn't actually exit until a UI event occurred.

This was mostly noticeable when running debug builds from another
terminal.

Calling NSApp::abortModal is sufficient to knock us out of that state.
2021-04-03 14:57:20 -07:00
Wez Furlong
7deb215303 macos: recognize CTRL-Tab
macOS only sends key up events for this, so we remap them to
key down events.

closes: https://github.com/wez/wezterm/issues/630
2021-04-03 11:29:03 -07:00
Wez Furlong
fe48951e7a macos: fixup SUPER+SHIFT+[ key decoding
One of the default key assignments was registered as `SUPER+SHIFT+{`
which worked on macOS, but on Linux, would never match because the
keypress over there was (correctly) reporting as `SUPER+{`.

I originally thought that the user reported issue was a linux
normalization problem, but in looking deeper, the issue is really
that macos is doing something funky!

On macos we collect the interpreted key event as a string, and also
the interpretation of that event without any modifiers applied.

For letters this means that eg: `ALT-l` reports as `¬` for the
processed string and `l` for the unmodified string.  That's good!

However, for punctuation we get a backwards result: SUPER+SHIFT+[
produces `[` for the processed text and `{` for the unmodified
text!

This commit tries to detect this, using a heuristic that is
potentially bad on non-US layouts: if both the processed and
unmodified strings are punctuation then we bias to the unmodified
version.

With that change, that key press is correctly reported as `SUPER+{`,
and we can fix the key assignment registration to reflect that.

I quickly checked the behavior of pressing that same physical key
combination with a DEU layout active, and it appears that the unmodified
stuff is also flipped there; we get a lower-case version of something
that I think should be uppercase.  This commit doesn't change that
behavior:

```
key_event KeyEvent { key: Char('ü'), modifiers: NONE,
        raw_key: Some(Char('Ü')),
        raw_modifiers: SHIFT | SUPER,
        raw_code: Some(33),
        repeat_count: 1, key_is_down: true }
```

refs: https://github.com/wez/wezterm/issues/601
2021-04-03 06:32:13 -07:00
Wez Furlong
d7b78b4163 x11: handle setting cursor to None (= hide)
refs: https://github.com/wez/wezterm/issues/618
2021-04-03 05:43:01 -07:00
Wez Furlong
298e0b8d76 hide mouse cursor each time we send key input to a pane
Mouse movement will show the cursor again.

macOS: fix hiding the cursor

refs: https://github.com/wez/wezterm/issues/618
2021-04-02 22:34:58 -07:00
Gus Wynn
b057e1f671 switch to just button 2 2021-04-01 08:38:50 -07:00
Gus Wynn
76041265d6 other_mouse_down as well 2021-04-01 08:38:50 -07:00
Gus Wynn
e84811085e filter mouse buttons 2021-04-01 08:38:50 -07:00
Gus Wynn
0bae61d580 Capture middle mouse events on macos 2021-04-01 08:38:50 -07:00
Wez Furlong
b4876da2aa fix windows build 2021-03-23 22:41:04 -07:00
Wez Furlong
51e22d4c90 remove ConfigBridge, Windows edition 2021-03-23 22:17:44 -07:00
Wez Furlong
e294123215 window: remove ConfigBridge on x11/wayland 2021-03-23 22:11:41 -07:00
Wez Furlong
b876fbabd6 remove the config bridge and have window -> config directly 2021-03-23 21:56:57 -07:00
Wez Furlong
a7c9d9123b window: fix compilation warning when wayland feature disabled 2021-03-21 20:20:24 -07:00
Wez Furlong
a0d39989df simplify Color data type
There's something fishy with colorspaces and blending.
This commit removes the `window::Color` type and replaces
it and the confusing array of color types exposed by the
`palette` crate with a pair of much simpler types:

`LinearRgb` - a tuple of f32 linear color components
`SrgbaPixel` - the u32 sRGBA pixel representation

This doesn't change anything about rendering, it just
makes it a bit simpler and makes the SrgbaPixel -> LinearRgb
conversion happen slightly earlier which shaves off some
ad-hoc conversions.

Refs: https://github.com/wez/wezterm/issues/544
2021-03-21 16:54:22 -07:00
Wez Furlong
4767fcc28c windows: some minor performance improvements
* Make window invalidation more efficient by avoiding spawning a call
  that spawns a call to invalidate the window.  Just directly mark as
  invalidated.

* Suppress default background erase

* hoist the bg_color calc for quads that don't have Cells outside of
  its loop.

refs: https://github.com/wez/wezterm/issues/546
2021-03-21 10:06:43 -07:00