110 Commits

Author SHA1 Message Date
Mitchell Hashimoto
d5a23e78fe macos: some disabled swiftui code that makes link tooltips show 2024-07-06 10:01:35 -07:00
Qwerasd
5df0935f82 update font_size to f32 in libghostty 2024-05-09 00:03:40 -04:00
Mitchell Hashimoto
9aadf59ab1 macos,libghostty: font size is a u8 2024-03-27 20:53:03 -07:00
Mitchell Hashimoto
118b51157a macos: more robust surface focus state detection
Fixes #1500

This overhauls how we do focus management for surfaces to make it more
robust. This DID somehow all work before but was always brittle and was
a sketchy play with SwiftUI/AppKit behavior across macOS versions.

The new approach uses our window controller and terminal delegate
system to disseminate focus information whenever any surface changes
focus. This ensures that only ONE surface ever has focus in libghostty
because the controller ensures it is widely distributed.
2024-02-11 09:19:13 -08:00
Mitchell Hashimoto
487c22011c macos: make SurfaceView cross-platform! 2024-01-18 19:28:36 -08:00
Mitchell Hashimoto
01afa293c8 apprt/embedded: fix initialization on macOS 2024-01-18 08:55:03 -08:00
Mitchell Hashimoto
2568b4979b macos: allow first click when non-focused to shift focus
This allows for example clicking on a split when focused on a different
app and having focus immediately jump to that split. Before this, you'd
have to click to focus the window, then second click to focus on the
split.
2024-01-17 20:30:34 -08:00
Mitchell Hashimoto
ed3f1df5f0 Merge pull request #1316 from qwerasd205/macos-file-handler
Added macOS file open handler
2024-01-16 18:56:34 -08:00
Mitchell Hashimoto
1005116f03 macos: detect error during surface initialization and render 2024-01-16 18:50:47 -08:00
Qwerasd
51f53aa9bf Added macOS file open handler 2024-01-16 16:26:21 -05:00
Mitchell Hashimoto
376345dcae macos: detect renderer health failures and show error view 2024-01-16 11:27:18 -08:00
Mitchell Hashimoto
875a774d4b macos: remove AppState and unify onto Ghostty.App cross-platform 2024-01-14 19:35:57 -08:00
Mitchell Hashimoto
eba3d5414d macos: Ghostty.Config to store all config-related operations 2024-01-14 15:53:33 -08:00
Mitchell Hashimoto
afb1fea48b macos: add Edit => Select All menu item
Fixes #1268
2024-01-09 20:54:23 -08:00
Mitchell Hashimoto
9bf13c6236 macos: set initial window size in controller window init
Fixes #1227
Fixes #1206

This moves the logic that respects `window-width` and `window-height` to
the controller window initialization. This is where it should've been
all the time but we previously didn't use a controller architecture so
we did our best to use heuristics in the view to do this.

This location now ensures that this only happens on window
initialization and only if we have one surface.
2024-01-05 09:42:50 -08:00
Mitchell Hashimoto
5e0e0b2bd4 macos: wait for window to become visible to set blur
Fixes #1181
2023-12-29 21:58:30 -08:00
Mitchell Hashimoto
40e882ff48 macos: invalid restorable state when surface is closed
Fixes #1177
2023-12-28 19:39:47 -08:00
Mitchell Hashimoto
181cfa1350 macos: notifications use surface UUID for lookups
Fixes #1162
2023-12-27 08:49:12 -08:00
Mitchell Hashimoto
98041940f0 macos: restore focused split on app restore 2023-12-26 14:45:27 -08:00
Mitchell Hashimoto
a321ef515d macos: assign unique UUID per surface, store in app state 2023-12-26 14:24:05 -08:00
Mitchell Hashimoto
a8568306c9 macos: store pwd with save/restore state 2023-12-23 17:06:34 -08:00
Chris Marchesi
e1320be757 macos: handle middle click
This adds middle-click support to MacOS.

Very simple update, since everything else is in place to handle mouse
clicks in the embedded runtime already, we just needed to add the event
handlers in the UI.
2023-12-22 00:05:28 -08:00
Mitchell Hashimoto
9642dd3275 macos: proper event when sided mod released with other side pressed
Related to https://github.com/mitchellh/ghostty/issues/1082

This fixes two separate issues to follow along with the new spec changes
Kovid pushed to Kitty:

  1. When two modifiers are pressed and one is released, this shows up
     as a proper release event with the correct side. Previously, the
     correct side was shown but as a press event.

  2. When two modifiers are pressed and one is released, the Kitty event
     should not have that specific modifier set. For example, pressing
     left ctrl, then right ctrl, then releasing right ctrl should encode
     as "right ctrl released" but with NO modifiers still present.
2023-12-13 21:50:00 -08:00
Mitchell Hashimoto
9f7e53620b Merge pull request #1070 from mattrobenolt/overlay-color
Configurable unfocused dimming color
2023-12-13 19:10:22 -08:00
Mitchell Hashimoto
220da88a9a config: make unfocused-split-fill default to bg 2023-12-13 19:06:25 -08:00
Mitchell Hashimoto
fefd4ca04d macos: style changes, make equivalent not an optional 2023-12-13 13:49:39 -08:00
Gregory Anders
163ee1d75a macos: special case handling of some control keys
Some control key combinations must be handled specially by Ghostty to
prevent undesirable behavior at the OS level. For now, this includes
only Ctrl-/, which makes a "beep" sound when processed by AppKit. It is
unclear why this beep occurs and no answer was found after extensive
searching.

This solution is inspired by iTerm2, which also handles certain control
key combinations (including C-/) manually before passing them on to
Cocoa/AppKit.
2023-12-13 14:46:34 -06:00
Matt Robenolt
ae6645586e unpack rgb correctly 2023-12-12 21:56:35 -08:00
Matt Robenolt
1b039b35ac typos 2023-12-12 17:22:37 -08:00
Matt Robenolt
91937c4ada Apply feedback 2023-12-12 17:14:47 -08:00
Matt Robenolt
8e607f372b Configurable unfocused dimming color 2023-12-12 16:34:41 -08:00
Mitchell Hashimoto
ec989d6b46 macos: newTab needs to call Controller.showWindow 2023-12-08 08:46:05 -08:00
Mitchell Hashimoto
7ea0dfdd5d macos: if a preedit state is cleared, don't send key event
Fixes #992
2023-12-06 09:04:59 -08:00
Gregory Anders
86b7442f3c macos: implement desktop notifications 2023-11-15 11:21:30 -06:00
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