76 Commits

Author SHA1 Message Date
Mitchell Hashimoto
ab948f6f8f macos: reuse original event if translation mods changes nothing
Fixes #766 (again)

This is a repeat fix of 766 after fixing a number of other regressions
from the original fix. See the comment for reasons.
2023-11-14 08:14:24 -08:00
Mitchell Hashimoto
35e78939e5 macos: ignore alt key with other modifiers set
This enables shifted alt-prefixed keys, such as `shift+alt+.` on
US standard becoming `M->`. To do this, we needed to fix a few bugs:

  (1) translation mods should strip alt even if other mods are set
  (2) AppKit translation event needs to construct new characters with
      the translation mods.
  (3) Alt-prefix handling in KeyEncoder needs to allow ASCII utf8
      translations even for macOS.
2023-11-13 19:21:51 -08:00
Mitchell Hashimoto
5001e2c60c macos: filter option in AppKit when option-as-alt set
Fixes #872

In #867 we fixed macos-option-as-alt, but unfortunately AppKit ALSO does
some translation so some behaviors were not working correctly.
Specifically, when you had macos-option-as-alt set, option+e would
properly send `esc+e` to the pty but it would ALSO set the dead key
state for "`" since AppKit was still translating the option key.

This commit introduces a function to strip alt when necessary from the
translation modifiers used at the AppKit layer, preventing this
behavior.
2023-11-13 13:26:37 -08:00
Mitchell Hashimoto
dd1faf5e50 macos: handle preedit in AppKit, enables Korean input 2023-11-10 09:53:56 -08:00
Gregory Anders
582df33083 macos: use Ghostty.AppState as @EnvironmentObject
This is a small cleanup change. This provides the Ghostty.AppState
object to any view that needs it within the TerminalSplit view hierarchy
without needing to explicitly define EnvironmentKeys.
2023-11-05 20:42:59 -06:00
Gregory Anders
3b2799ce97 macos: refactor SplitNode
This commit does two things: adds a weak reference to the parent
container of each SplitNode.Container and SplitNode.Leaf and moves the
"direction" of a split out of the SplitNode enum and into the
SplitNode.Container struct as a field.

Both changes are required for supporting split resizing. A reference to
the parent in each leaf and split container is needed in order to
traverse upwards through the split tree. If the focused split is not
part of a container that is split along the direction that was requested
to be resized, then we instead try and resize the parent. If the parent
is split along the requested direction, then it is resized
appropriately; otherwise, repeat until the root of the tree is reached.

The direction is needed inside the SplitNode.Container object itself so
that the container knows whether or not it is able to resize itself in
the direction requested by the user. Once the split direction was moved
inside of SplitNode.Container, it became redundant to also have it as
part of the SplitNode enum, so this simplifies things.
2023-11-05 20:20:39 -06:00
Mitchell Hashimoto
c6ce9aea4a macos: do not set window initial size if fullscreen
Fixes #798
2023-11-03 09:06:17 -07:00
Mitchell Hashimoto
b40245f01d macos: remove old primary window stuff 2023-10-30 14:36:20 -07:00
Mitchell Hashimoto
cd18f3455b macos: add needsConfirmQuit helper to surface and split structs 2023-10-30 09:06:23 -07:00
Gregory Anders
0f73bf32e6 macos: document SurfaceView.cellSize property 2023-10-27 09:23:17 -05:00
Gregory Anders
2ee80a52df macos: set window resizeIncrements when cell size changes
The resizeIncrements property is only modified when the cell size of the
focused window changes. If two splits have the same cell size then the
property is not modified when focusing between the two splits.
2023-10-26 20:27:58 -05:00
Mitchell Hashimoto
be46bea40f macos: fix warning from xcode 2023-10-26 14:45:55 -07:00
Mitchell Hashimoto
1696cf76b6 macos: free inspector when it is hidden 2023-10-25 09:09:10 -07:00
Mitchell Hashimoto
5e2bed62b3 macos: terminal inspector control 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
92d172377e macos: don't do full surface-style key translation for imgui 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
d50ff6ece7 macos: complete cimgui events 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
2c40183c3c macos: rendering basic imgui 2023-10-24 15:27:14 -07:00
Mitchell Hashimoto
69cc6d11dc macos: MetalView, render an MTKView 2023-10-24 15:27:14 -07:00
Jon Parise
d63c0df582 macos: always apply initial size to new windows
We would previously exit early for non-transparent windows, which
skipped the call to setInitialWindowSize().
2023-10-21 08:21:58 -07:00
Mitchell Hashimoto
6990c1572a macos: insertText should not include null char 2023-10-14 21:06:34 -07:00
Mitchell Hashimoto
f987a36fce macos: escape shell-sensitive characters on filepath drop 2023-10-04 10:49:32 -07:00
Mitchell Hashimoto
2aacf6e130 macos: support dropping file urls onto surfaces 2023-10-04 08:01:13 -07:00
Mitchell Hashimoto
ee832aa361 apprt/embedded: ghostty_surface_text function, remove _char 2023-10-04 07:56:56 -07:00
Mitchell Hashimoto
e471228f6b macos: surfaceview supports dropping file URLs, just logs for now 2023-10-03 22:40:56 -07:00
Mitchell Hashimoto
6249621d71 macos: support drag and drop with no windows 2023-10-03 22:03:04 -07:00
Mitchell Hashimoto
d5299fec25 macos: use SurfaceConfiguration everywhere instead of bare c struct 2023-10-03 22:00:56 -07:00
Mitchell Hashimoto
a1a8aeb104 initial window size needs to take into account window chrome 2023-09-30 21:35:50 -07:00
Mitchell Hashimoto
cc8e1cd936 macos: support initial window size 2023-09-30 20:47:31 -07:00
Mitchell Hashimoto
300ba32ad0 macos: enum does not need to be a string 2023-09-22 15:48:41 -07:00
Mitchell Hashimoto
1eb0dbb548 macos: more robust cursor visibility handling
Fixes #519

The core issue here was that `mouseEntered` was called AFTER
`cursorUpdate` (by Cocoa) so we were messing up our NSCursor state. To
fix this more robustly, all cursor state should ONLY be handled by
cursorUpdate and mouseEntered/Exit goes through that system now.
2023-09-22 15:47:08 -07:00
Mitchell Hashimoto
7f549c5b41 macos: detect mouseEntered/Exit on frame change 2023-09-21 09:42:17 -07:00
Mitchell Hashimoto
d12f07ceda macos: mouse tracking area should always send
Without this, non-first-responder views would not receive mouse
entered/exit events. This would break some of our mouse hiding state.
See comments for more info.
2023-09-21 09:30:42 -07:00
Mitchell Hashimoto
6cee9e57f6 macos: prevent mouseEntered/Exited processing if already in that state
See the comment in the code.

Fixes #494
2023-09-20 08:53:31 -07:00
Mitchell Hashimoto
724900f143 macos: implement setCursorVisibility 2023-09-14 19:37:30 -07:00
Mitchell Hashimoto
cb2931cb27 rename cursor shape to mouse shape for OSC 22 2023-09-14 11:12:17 -07:00
Mitchell Hashimoto
3356146bb4 macos: support cursor style 2023-09-14 10:40:40 -07:00
Mitchell Hashimoto
2b04a7114b macos: use the configured unfocused split opacity 2023-09-10 18:52:40 -07:00
Mitchell Hashimoto
8bec01f237 macos: disable hit testing for unfocused split rectangle 2023-09-10 16:02:09 -07:00
Mitchell Hashimoto
de564dad94 macos: fade unfocused splits
Fixes #353
2023-09-10 09:17:46 -07:00
Mitchell Hashimoto
e5cba11ad0 macos: key events for modifier-only keys 2023-09-09 09:22:15 -07:00
Mitchell Hashimoto
e2282f1f4d macos: zoomed splits put an emoji in the title bar 2023-09-02 16:33:33 -07:00
Mitchell Hashimoto
70bdc21d22 macos: support zoomed splits 2023-09-02 15:51:10 -07:00
Mitchell Hashimoto
1626c8cd3a macos: hacks for split focus to work correctly on macos 12 2023-09-02 09:15:50 -07:00
Mitchell Hashimoto
e0015a0d00 macos: hacks to grab surface focus on macOS 12
See comment in code.
2023-09-01 16:23:30 -07:00
Mitchell Hashimoto
52396304ff macos: begin syncing menuitem key equivalents 2023-08-30 22:45:29 -07:00
Mitchell Hashimoto
c71979804e apprt/embedded: ghostty_surface_binding_action can now run any action 2023-08-30 21:46:38 -07:00
Mitchell Hashimoto
79971c62a6 macos: pass around a base surface_config_s rather than a new tab 2023-08-18 09:09:43 -07:00
Thorsten Ball
d2dae7a696 macOS: inherit font size when creating new tab
This is one part of #281.
2023-08-17 20:56:56 +02:00
Mitchell Hashimoto
721087be76 macos: send the left/right status of modifier keys 2023-08-14 12:40:48 -07:00
Mitchell Hashimoto
d5df8aea9a apprt/embedded: handle repeat events 2023-08-11 12:02:00 -07:00