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

476 Commits

Author SHA1 Message Date
Wez Furlong
a2110fed6f gui: add mouse event logging
refs: #1140
2021-09-14 08:43:55 -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
ce5615082c gui: cancel mouse click streak when the cursor has moved to a different cell (fixes #910)
Fast-clicking users generally expect to be able to rapidly do regular selections
or otherwise cancel double/triple/quad clicks, so significant mouse movement should end the streak.

Allowing tiny pixel movements to account for touchpads is necessary.
Fortunately, the position here is already in character grid cells, which provides enough margin for this.
Other code editors like gedit also seem to do this based on the character grid.
2021-09-08 17:38:59 -07:00
Spyros Roum
bfaf46a196 Also accept shift + y/n when asking for confirmation to close panes 2021-09-08 09:33:08 -07:00
Wez Furlong
aa61a6b065 gui: force cursor to be visible in copy mode
It appears as though kakoune hides the terminal cursor and renders
its own version of the cursor.

The hidden state was being picked up by the copymode overlay,
making it awkward to use.

This commit forces the cursor to be visible (and a block) when
copy mode is active.

closes: #1113
2021-09-06 19:51:20 -07:00
Wez Furlong
41866a0b5b gui: capture new terminal size even if we haven't setup opengl
I think this is a hangover from the older logic to figure out
the initial sizing, and I suspect that it is what is causing
refs: 1074

So this is a speculative change to see if it helps!
2021-09-06 10:19:06 -07:00
Wez Furlong
93e18b2a01 deps: colorgrad -> 0.5 2021-09-05 23:27:01 -07:00
Wez Furlong
545a8fc8a7 deps: ordered-float -> 2.8 2021-09-05 23:25:37 -07:00
Wez Furlong
fea3a527dd Fixed invisible I-beam/underline cursor w/force_reverse_video_cursor
closes: https://github.com/wez/wezterm/issues/1076
2021-09-04 14:24:58 -07:00
Wez Furlong
4c8ccf8efc Add Multiple key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-04 13:01:34 -07:00
Wez Furlong
bc4ed3735d Add SendKey key assignment
refs: https://github.com/wez/wezterm/pull/1091
2021-09-03 12:07:17 -07:00
Wez Furlong
97831848cb gui: also log current size during a resize event
refs: #947
2021-09-02 09:18:32 -07:00
Wez Furlong
d38ba13211 render: 3 layers with dual source blending only for the glyph layer
This splits rendering into 3 passes:

* background pass for z-index < 0.  This is for solid background colors,
  background images, and image attachments with z-index < 0.
  Rendered with regular alpha blending.
* glyph pass: for glyphs at z-index==0. This is rendered with dual
  source blending enabled to facilitate subpixel aa appearance.
* top layer pass for z-index >= 0 graphics.  This is rendered with
  regular alpha blending.

This avoids weird effects, like images with alpha shining through
the back of the window when the window itself isn't transparent.

refs: #544
2021-08-24 08:53:33 -07:00
Wez Furlong
5629e0c1ca deps: tiny-skia -> 0.6 2021-08-23 07:48:13 -07:00
Wez Furlong
98206f0bf8 gui: take another pass at alpha/gamma stuff
The prior commit wasn't right, this looks better!

refs: #1049
2021-08-19 19:11:59 -07:00
Wez Furlong
66ff7740c4 gui: tweak alpha/color mask to avoid incorrect transparency
transparent images weren't always blending correctly, and were
instead shining through.

This might also have affected cursors.

It may also be a factor in a couple of recent reports of excessive
boldness which looked like funky over-alpha multiplication.

Let's see what people say about this.
2021-08-19 10:07:06 -07:00
Wez Furlong
c6e1889b04 remove unused alt alpha blending config
This doesn't make sense in a dual source blending world
2021-08-19 09:41:48 -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
2013718336 gui: avoid divide by zero for glyphs that report num_cells=0
refs: https://github.com/wez/wezterm/issues/1042
2021-08-18 08:33:53 -07:00
Wez Furlong
769f632a26 gui: avoid making a transparent hole under the cursor 2021-08-16 08:32:49 -07:00
Wez Furlong
3e80854bc7 gui: apply hsv transform to background colors
refs: #1025
2021-08-16 08:07:22 -07:00
Wez Furlong
ab21910d80 deps: update bitflags -> 1.3 2021-08-15 18:21:17 -07:00
Wez Furlong
e1ee1ddd97 gui: disable zone fetch in the renderer
We need a more scalable alternative to this before we can use
it in the renderer.
2021-08-15 15:58:51 -07:00
Wez Furlong
67e4516c03 gui: fix seqno for semantic zone cache 2021-08-15 13:42:09 -07:00
Wez Furlong
a7b20443ba gui: add more generic dragging concept, fixup scrollbar math
Add a more general dragging thingy and use that to know when we
are dragging splits or the scroll thumb.

Fixup scrollbar math, which didn't account for whether the tabbar
was shown and which might cause the scroll thumb to jump around
on first drag (resolves #568)
2021-08-15 13:41:38 -07:00
Wez Furlong
befdc7ac3a Fixed: text_background_opacity was not respected 2021-08-15 08:33:09 -07:00
Wez Furlong
ab8c8dc6c9 gui: add UIItem concept
The idea here is to make it a bit easier to do hit detection for UI
elements; today we've been duplicating position math between the render
and the mouse movement handlers, with both pieces of code knowing the
location of the UI element.

UIItem allows the render phase to record the position, which allows
the mouse phase to be a more independent lookup against the registered
elements.

This makes it easier to add more UI elements in the future.
2021-08-15 07:46:06 -07:00
Wez Furlong
0bbb8cc37c gui: add semantic zone cache 2021-08-14 21:43:53 -07:00
Wez Furlong
eabb84b974 gui: fix: respect dynamic color scheme backgrounds
Ensure that we respect the dynamic color scheme that is configured
in a given pane.
2021-08-14 12:12:27 -07:00
Wez Furlong
0a5a4cb642 cleanup: remove bg color from vertex
Now that we have dual-source blending, this is unused
2021-08-14 11:02:56 -07:00
Wez Furlong
615b5b3966 gui: support radial gradients 2021-08-13 17:38:33 -07:00
Wez Furlong
d9e0340a94 gui: add some randomness to gradients to avoid banding 2021-08-13 13:35:55 -07:00
Wez Furlong
746951416b gui: tidy up gradient calculation 2021-08-13 12:14:14 -07:00
Wez Furlong
d59898987a gui: fix lost sync with the cell position in the renderer
If a cell contained a ligature, the math used to track where the
next quad was going to be placed could lose consistency with
the cluster/shaping information and result in offset glyphs.

This was most noticeable to me in tab titles in the tab bar;
my shell dotfiles append `-- something` to the title when a
command is launched, and the `--` is a ligature in my font.

I think I've also seen this mess up positioning in the notcurses
demo as well.

The solution is to take the cluster initial cell index rather
than trying to reverse engineer it from incomplete info.
2021-08-13 09:34:36 -07:00
Wez Furlong
cbfb6d59c5 added new window_background_gradient config option 2021-08-12 23:08:38 -07:00
Wez Furlong
6f78ee4f14 deps: update unicode-segmentation to 1.8 2021-08-11 23:06: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
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
89f9512cc1 gui: use solid color block for background color quads
like 2facc465ef but for
cells with a background color
2021-08-09 08:48:20 -07:00
Wez Furlong
2facc465ef gui: avoid sampling solid background color
eg: white could have a greyish border from where the texture sampling
was picking up the transparent padding in the texture atlas.
2021-08-09 08:19:27 -07:00
Wez Furlong
827adf3a95 gui: try to gracefully handle both resize and scaling changes
refs: #695
2021-08-08 14:43:41 -07:00
Wez Furlong
eae327efcc model: replace LineBits::DIRTY with a sequence number
Terminal now maintains a sequence number that increments
for each Action that is applied to it.

Changes to lines are tagged with the current sequence number.

This makes it a bit easier to reason about when an individual
line has changed relative to some point in "time"; the consumer
of the terminal can sample the current sequence number and then
can later determine which lines have changed since that point
in time.

refs: https://github.com/wez/wezterm/issues/867
2021-08-08 12:45:08 -07:00
Wez Furlong
9617c742cf gui: try harder to deal with tiling wm resizing + dpi changes
refs: #695
2021-08-07 22:32:52 -07:00
Wez Furlong
5a9bd14d89 gui: fix newlines in copied text
Use the newer logical line method in pane rather than going
via the hyperlink function, so that we can better reason
about physical vs. logical line breaks, and get the results
very slightly faster too.

refs: #874
2021-08-07 19:16:29 -07:00
Wez Furlong
6d9957e6e3 term, gui: allow tracking multiple buttons
We were previously only remembering the most recently pressed
button, but that's a lossy thing to do.

This commit remembers the button presses so that we can correctly
report all press/release events.

refs: #973
2021-08-07 18:37:38 -07:00
Wez Furlong
1344b243d8 gui: allow dispatching resize events during creation
I think this is the heart of the initial size issues:
during creation, if the dpi or size is different, we generate
a resize event, but because it is dispatched before we've
assigned self.window, we weren't able to resize the window
to fit.

This commit passes the Window object down to the resize
handler so that it can do that; the diff is conceptually
small but there is corresponding fanout around ensuring
that the Window is passed down through all the resize
related codepaths that need it.

refs: #1002
refs: #695
2021-08-07 10:07:32 -07:00
Wez Furlong
e143db2b7f gui: tidy up initial resize/scale adjustment
It seems like this is making things worse on X11/Wayland.
Let's try simply skipping it--that seems fine on X11/Wayland,
but needs to be verified on macOS and Windows.

refs: #1002
refs: #695
2021-08-07 09:45:33 -07:00
Wez Furlong
308f3a8d74 window: avoid resizing on startup if the size doesn't appear different
The intent is to avoid weirdness with Wayland where we need to wait for
a configure event before we try to set the window size programmatically.

refs: #1002
2021-08-06 19:37:08 -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