63 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f722e30bf5
macos: terminal controller reacts to surface config changes 2024-11-21 12:46:46 -08:00
Mitchell Hashimoto
954c4d7b56
macos: swap out pointerVisible with NSCursor.setHiddenUntilMouseMoves
Fixes #2695

We had various issues with the pointerVisible property on macOS,
including the pointer not being hidden when it should be. Our only use
case today is mouse hide while typing so
NSCursor.setHiddenUntilMouseMoves is a better fit!
2024-11-15 19:05:51 -08:00
Mitchell Hashimoto
4d9143f634
macos: use the pwd apprt action to set the proxy icon URL 2024-11-13 13:11:32 -08:00
Mitchell Hashimoto
f6ea15dd21
macos: allow additional modifiers through for ctrl+enter
The bug: ctrl+shift+enter on macOS 15 shows a context menu and doesn't
encode to the terminal.

This avoids a system-wide keybind that shows a context menu in macOS
15+. In general Ghostty doesn't try to override system-wide keybinds
but this one is particularly annoying and not useful to terminal users.

We've discussed making this logic configurable for all system level
keybinds but for now this is a quick fix specifically for
ctrl+shift+enter.
2024-11-11 10:13:31 -08:00
Qwerasd
de16541bca macOS: fix quicklook position
Account for padding and properly calculate text baseline, since that is
the position that the NSView `showDefinition` method ultimately needs.
2024-10-15 15:40:15 -04:00
Mitchell Hashimoto
eec77e271c
macos: change our minimum version to macOS 13
macOS 12 is officially EOL by Apple and the project only supports
officially supported versions of macOS. Once publicly released, users on
older macOS versions will have to use older released builds.
2024-10-09 14:41:57 -07:00
Mitchell Hashimoto
8994a8c627
macos: implement key sequence UI 2024-10-08 21:58:53 -07:00
Mitchell Hashimoto
ed2cd6d436
macos: remove the ability to bind fn/globe
This was recently introduced a few days ago. Unfortunately, this doesn't
work as expected. The "function" modifier is not actually the fn key
but used by macOS to represent a variety of "functional" key presses.
This breaks other bindings such as #2411.

I can't find a source on the internet that reliably tells me how we
can detect fn key presses, but I do find a number of sources that tell
us we can't.
2024-10-07 14:36:12 -10:00
Mitchell Hashimoto
fe3f8439a7
macos: send mouse cursor position events for right mouse dragged
Fixes #2407
2024-10-07 10:50:04 -10:00
Mitchell Hashimoto
227eda1d09
macos: notify core of mouse exit 2024-10-06 15:20:17 -10:00
Mitchell Hashimoto
6fdfa9d491
Make the function/globe key available as a modifier on macOS 2024-10-05 09:39:55 -10:00
Mitchell Hashimoto
1ae9322959
macos: non-native fs keeps track of screen number for change screen comp
Fixes #2370

Comparing NSScreens directly was fragile. It appears that AppKit/Cocoa
can return different instances of NSScreen for the same screen for
unknown reasons between calls to windowDidChangeScreen. I don't fully
understand why this happens.

In any case, our comparison was not safe. Instad, we now keep track of
of the CGDirectDisplayID for each screen and compare those instead.
2024-10-05 06:21:30 -10:00
Mitchell Hashimoto
4ae20212bf
libghostty: unified action dispatch
First, this commit modifies libghostty to use a single unified action
dispatch system based on a tagged union versus the one-off callback
system that was previously in place. This change simplifies the code on
both the core and consumer sides of the library. Importantly, as we
introduce new actions, we can now maintain ABI compatibility so long as
our union size does not change (something I don't promise yet).

Second, this moves a lot more of the functions call on a surface into
the action system. This affects all apprts and continues the previous
work of introducing a more unified API for optional surface features.
2024-09-26 22:00:11 -07:00
Qwerasd
92d310a660 macOS: prevent ctrl-return key equivalent
macOS 15 adds this as a default key equivalent to show the context menu,
this is annoying, so we capture the event and tell macOS we handled it.
2024-09-23 16:55:11 -06:00
Mitchell Hashimoto
c63af5efaa
macos: cannot call mouseEntered/Exited with blank NSEvent
Fixes #2283

macOS <= 14 crash with an invalid NSEvent error. macOS 15 seems to just
ignore the blank event. We just got lucky with this. Since we don't
override mouseEntered/Exited anymore we can remove this completely.

The regression was from: e89a4f74089b66c00043096589dc75fff5ab6674
2024-09-22 10:17:45 -07:00
Mitchell Hashimoto
261ce00552
apprt/macos,gtk: unfocused splits now highlight hovered links
Fixes #1547

The core change to make this work is to make the cursor position
callback support taking updated modifiers. On both macOS and GTK, cursor
position events also provide the pressed modifiers so we can pass those
in.
2024-09-21 15:16:14 -07:00
Mitchell Hashimoto
0e1258b7fe
macos: pointer style uses macOS 15 helpers 2024-09-20 22:02:21 -07:00
Mitchell Hashimoto
e89a4f7408
macos: use macOS 15 pointerVisibility to show/hide cursor 2024-09-20 22:02:20 -07:00
Mitchell Hashimoto
1ed1c73c1a
macos: enable secure input on password input 2024-09-19 16:38:32 -07:00
Mitchell Hashimoto
498804b571
macos: right-click actions on surface should target surface under click
Fixes #2263
2024-09-18 13:43:57 -07:00
Mitchell Hashimoto
90d24f9e82
macos: get updated surface size metrics immediately on resize
Fixes #2149

Previously, the way we were getting the updated surface size would use
outdated (previous) values because the resize event was not processed by
the surface before the SwiftUI view processed the resize overlay. And
since the property we used wasn't `@Published`, we didn't get notified
when we got that updated value.
2024-08-29 14:56:30 -07:00
pnodet
7ff9af1520
style(macos): cleanup trailing spaces 2024-08-21 21:53:09 +02:00
Mitchell Hashimoto
2e0e8897e7
macos: avoid showing overlay if gained focus recently 2024-08-11 11:07:07 -07:00
Mitchell Hashimoto
9cf247bb3e
macos: implement resize overlay
Implements the resize overlay configurations completely.
2024-08-10 20:17:33 -07:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
9785130c03
macos: add "Reset Terminal" context menu option 2024-08-01 14:58:03 -07:00
Gregory Anders
c9c7b3803e macos: add split menu items to context menu 2024-07-10 08:47:04 -05:00
Mitchell Hashimoto
cb790b8e39
macos: show URL on OSC8 hover 2024-07-06 10:25:12 -07:00
Mitchell Hashimoto
7fbc73ad37
macos: implement ctrl+command+d for quicklook under cursor 2024-07-01 10:08:38 -07:00
Mitchell Hashimoto
57d71450ab
ctrl+click is handled as right-click (with various details)
If mouse capturing is enabled, we encode ctrl+click as ctrl+left-click
and DO NOT handle it as right click.
2024-06-30 19:44:51 -07:00
Mitchell Hashimoto
f0737356cb
macos: i don't like windowing in the context menu 2024-06-30 15:19:59 -07:00
Mitchell Hashimoto
174d83bfd3
macos: add windowing commands to context menu 2024-06-30 15:18:33 -07:00
Mitchell Hashimoto
a771d65735
macos: start context-menu 2024-06-30 10:15:36 -07:00
Mitchell Hashimoto
03f37087a5
mouse button callbacks returns bool for consumption 2024-06-30 09:42:15 -07:00
Mitchell Hashimoto
46a0cbf9d7
macos: remove log statement 2024-06-30 09:18:13 -07:00
Mitchell Hashimoto
afc172728f
macos: offset quicklook box a bit to look better (imo) 2024-06-29 11:31:12 -05:00
Mitchell Hashimoto
26735f0e05
apprt: convert selection info to a single struct and C API 2024-06-29 11:23:14 -05:00
Mitchell Hashimoto
80700d524d
macos: add API to get selection top-left for quicklook 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
4c3fbffa4b
macos: return valid selection range 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
d5f27245d4
macos: hacky API to get a CTFont for QuickLook 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
280b8efacc
macos: I don't need any custom quicklook stuff 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
99faeab649
macos: release pressure on mouseUp 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
6faeb9ba40
core: mouse pressure state and callbacks 2024-06-29 10:42:45 -05:00
Mitchell Hashimoto
c165cef0a6
macos: initialize some pressure click boilerplate 2024-06-29 10:42:44 -05:00
Mitchell Hashimoto
50019bc766
minor comment changes 2024-06-18 17:09:29 -04:00
Cameron Dart
92e16ccbf7 no early return 2024-06-10 18:23:06 -07:00
Cameron Dart
29fb70197c macos: surface focus follow mouse 2024-06-10 16:07:33 -07:00
Mitchell Hashimoto
25484d2ccc
macos: set background opacity/blur on window controller not surface 2024-06-07 12:31:45 -07:00
Mitchell Hashimoto
d2adf0501c
macos: ime coordinate needs to be converted from view to window coords
Fixes #1756

We previously converted from view to screen coordinates but if the view
doesn't take up the full window then the view coordinates are wrong. We
need to convert to window coordinates in the middle.
2024-05-10 20:45:51 -07:00
Mitchell Hashimoto
ca9689be46
renderer/metal: API to handle macOS display ID changing 2024-05-04 19:40:58 -07:00