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

72 Commits

Author SHA1 Message Date
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
Jeffrey Knockel
a0974a2537 Implement SetInnerSizeCompleted events
These are used to signal, after a set_inner_size() call, at what point
we can expect any and all of its related Resized events to have already
been dispatched.  SetInnerSizeCompleted events are currently used to fix
a race condition in rescaling the terminal in which the number of cells
of the terminal (e.g., 80x24) can change when quickly rescaling the
terminal.
2024-02-04 09:40:54 -07:00
Wez Furlong
075388fbe5
add window:keyboard_modifiers() method 2023-04-16 19:53:32 -07:00
Wez Furlong
37b5dd91a5
move OpenInBrowser -> KeyAssignment
This allows defining those help actions that open URLs in the main
commands list, and not just for the macOS Help menu.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-21 07:04:51 -07:00
Wez Furlong
787f6550b8
macos: link to helpful resources from Help menu 2022-12-21 00:31:58 -07:00
Wez Furlong
b5aea795ca
fixup tests
refs: https://github.com/wez/wezterm/issues/162
refs: https://github.com/wez/wezterm/issues/1485
2022-12-20 20:48:44 -07:00
Ye Sijun
8f6facd584 support drag and drop files for macos
Signed-off-by: Ye Sijun <junnplus@gmail.com>
2022-04-25 09:49:32 -07:00
Wez Furlong
2faa6822f9 fix mac, windows builds
refs: https://github.com/wez/wezterm/issues/1794
2022-04-02 07:58:27 -07:00
David Rios
aaad2be606
Detect mouse leaving the window (#1679)
* Detect mouse leaving the window

* Implement leave

* Use new API

* Fix mouse leave

* Fix mouse leave on Wayland

* Mouse leave on X11

* Detect mouse leaving window on macOS

* Fix example

refs:  #1434
2022-03-11 08:26:09 -08:00
Wez Furlong
2616efa72e window: fix test build 2022-01-03 09:13:38 -07:00
Wez Furlong
8d9ae31ff0 window: fix example build 2022-01-02 17:17:47 -07:00
Wez Furlong
1a342adfc1 window: fix test build. remove dead code 2022-01-02 15:37:34 -07:00
Wez Furlong
f9ce727281 remove wgpu from window test deps
We don't use this and all it really does it make `cargo test`
take longer
2021-11-23 05:39:07 -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
c867b4e079 window: fix warning when buildings tests on !macos 2021-07-29 19:44:34 -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
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
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
7f04c4601a window: fixup tests for font config changes 2021-06-26 22:58:42 -07:00
Wez Furlong
5f5a48c830 tidy up log levels for wgpu 2021-05-09 10:59:48 -07:00
Wez Furlong
7cfbd133ac fixup warning in wgpu example 2021-05-09 08:20:03 -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
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
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
ba5d50ba9e add window-resized event
This is to support <https://github.com/wez/wezterm/issues/291>.

The window resized event happens asynchronously wrt. processing
a window resize, triggering at the end of the normal window
resize handling.

This commit introduces the notion of whether we are in full screen
mode or not in the underlying event callback, which is useful to
gate the desired feature, which is: when in full screen mode,
increase the padding for the window to center its content.

While poking around at this, I noticed that we weren't passing
the per-window config down to the code that computes the quad
locations for the window.

This commit also changes the font size increase/decrease behavior
so that in full screen mode it doesn't try to resize the window.

```lua
local wezterm = require 'wezterm';

wezterm.on("window-resized", function(window, pane)
  local window_dims = window:get_dimensions();
  local pane_dims = pane:get_dimensions();
  local overrides = window:get_config_overrides() or {}

  if not window_dims.is_full_screen then
    if not overrides.window_padding then
      -- not changing anything
      return;
    end
    overrides.window_padding = nil;
  else
    -- Use only the middle 33%
    local third = math.floor(window_dims.pixel_width / 3)
    local new_padding = {
      left = third,
      right = third,
      top = 0,
      bottom = 0
    };
    if overrides.window_padding and new_padding.left == overrides.window_padding.left then
      -- padding is same, avoid triggering further changes
      return
    end
    overrides.window_padding = new_padding

  end
  window:set_config_overrides(overrides)
end);

return {
}
```
2021-03-07 11:54:15 -08:00
Wez Furlong
cfed798e79 window: allow window layer to hold per-window config
This is to allow for eg: hotkey to change window decorations
(https://wezfurlong.org/wezterm/config/lua/window/set_config_overrides.html)

So far only macos actually keeps a per-window config.
Hopefully this still compiles for windows and x11.
2021-03-04 23:05:44 -08:00
Wez Furlong
cf6914c5d8 window: remove non-opengl paint, rename paint_opengl -> paint 2020-12-29 13:25:35 -08:00
Wez Furlong
972c07a692 window: update examples for opengl-only-ness 2020-12-29 13:15:16 -08:00
Wez Furlong
cf418c34e3 window: consolidate opengl_initialize with created callback
Since we now always init opengl and fail to create a window if that
fails, may as well combine these two callbacks.
2020-12-29 12:44:39 -08:00
Wez Furlong
ec7d511750 window: implicitly enable_opengl at new_window creation 2020-12-29 12:31:25 -08:00
Wez Furlong
4c22de9f6d window: make opengl always required 2020-12-29 12:13:23 -08:00
Wez Furlong
5eb4d32004 upgrade misc deps, notably, async-task 2020-10-05 00:06:01 -07:00
Wez Furlong
6744a0235d window: fixup tests for opengl init changes 2020-06-15 12:33:30 -07:00
Wez Furlong
c778307b0e macos: fix light background/border
The opengl based render first clears the window to the background
color and then renders the cells over the top.

on macOS I noticed a weird lighter strip to the bottom and right of
the window and ran it down to the initial clear: our colors are SRGB
rather than plain RGB and the discrepancy from rendering SRGB as RGB
results in the color being made a brighter shade.  This was less
noticeable for black backgrounds.
2020-01-26 19:04:34 -08:00
Wez Furlong
75eb16bec4 move spawn_task into a new promise::spawn module 2020-01-16 03:50:48 -08:00
Wez Furlong
9a2c7a1485 failure -> anyhow + thiserror 2019-12-14 21:43:05 -08:00
Wez Furlong
29a6c62b6c window: wayland: fix routing of keyboard events
The seat is a global thing, so we need to track the active
surface and route events to the appropriate window.
2019-11-30 10:00:34 -08:00
Wez Furlong
2475969eca window: enable egl support for wayland 2019-11-29 18:05:09 -08:00
Wez Furlong
c63766ffe2 window: wayland: input mostly working, and hidpi output
Some key mappings are not done yet (arrows!) and need to make
opengl work, but this can run a basic wezterm with the software
renderer under wayland.
2019-11-27 22:00:44 -08:00
Wez Furlong
10a0006eaf window: fix build for examples post mouse coords changes 2019-11-23 16:46:46 -08:00
Wez Furlong
14fbf43485 promise: more properly implement Future::poll
The future won't ever complete if you don't connect the waker
from the context!

Prove this out by making the windowops functions async and
verifying them in the async example
2019-11-23 08:16:12 -08:00
Wez Furlong
152874dd23 window: fixup the async example for stable async 2019-11-23 08:16:12 -08:00
Wez Furlong
41e392fc79 we can now init opengl but not render it 2019-10-10 08:15:00 -07:00