83 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9d6b9d78d8 macos: set NSAppearance on windowDidLoad
Fixes #3072

Previously, when `window-theme = auto`, the appearance was delayed
enough on the DispatchQueue that the window was already visible. This
would result in the window appearing with the wrong appearance before
switching to the correct one.

For annoying reasons, we can't set the NSApplication.shared.appearance
in `applicationDidFinishLaunching` because it results in a deadlock with
AppKit.

This commit moves to set the `NSWindow.appearance` in `windowDidLoad`
(and any config sync) to ensure that the appearance is set before the
window is visible.

This is probably the right solution anyways because this allows windows
with different background colors to each have their own distinct
appearance.
2024-12-22 19:33:01 -08:00
Mitchell Hashimoto
abf713feec macos: support the macos-icon configurations 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
29929a473d config: macos-icon configurations 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
c4bec781b0 macos: colorized Ghostty icon begins! 2024-12-21 19:31:30 -08:00
Mitchell Hashimoto
63f77f0c9f macos: fix unwanted resize in non native fullscreen (#2901)
Fixes #2516 

Those changes mean that when we have one ghostty window in non-native
fullscreen and another ghostty window not in fullscreen switching to not
fullscreen window won't cause appearing menu bar and dock. I think it
looks good:
![Screenshot 2024-12-07 at 19 18
33](https://github.com/user-attachments/assets/125eb18f-3b2f-469a-a5ba-0469dd12462a)

If we implement detection and make menu bar and dock appear for not
fullscreen window in this case it will cause the fullscreen window to
change its size and will look bad.

Non-native fullscreen works bad with multiple screens in either way.
E.g. switching to a non-native fullscreen window would cause menubar
disappering on another screen or switching to not fullscreen window
would show menu bar over fullscreen window on another screen. I think
nobody would want non-native fullscreen with multiple screens.
2024-12-11 08:52:25 -08:00
Dmitry Zhlobo
49f105cd27 macos: make non-native fullscreen windows not resizeable 2024-12-08 16:34:44 -08:00
Dmitry Zhlobo
080afce649 found a better explanation for the reason to hide dock before menu 2024-12-08 13:09:37 +01:00
Dmitry Zhlobo
0d0aeccf0f fix unwanted resize of non-native fullscreen window
Removing autoHideDock and autoHideMenuBar options cause window to
resize.

Fix #2516
2024-12-08 13:09:37 +01:00
Mitchell Hashimoto
f384fd038b macos: trigger fullscreenDidChange on any fullscreen event
Fixes #2840
Related to #2842

This builds on #2842 by missing a key situation: when native fullscreen
is toggled using the menu bar items it doesn't go through our
`FullscreenStyle` machinery so we don't trigger fullscreen change
events.

This commit makes it so that our FullscreenStyle always listens for
native fullscreen change (even in non-native modes) to fire a fullscreen
did change event. This way we can always rely on the event to be fired
when fullscreen changes no matter what.
2024-12-01 11:37:04 -08:00
Mitchell Hashimoto
ddde68d1f4 macos: add NSAppearance.isDark 2024-11-22 10:31:31 -08:00
Mitchell Hashimoto
a733ea381b macos: OSColor.hexString must be able to compile with UIKit 2024-11-21 14:50:03 -08:00
Mitchell Hashimoto
1aa77837eb macos: use correct title background if top surface 2024-11-21 14:20:31 -08:00
Mitchell Hashimoto
70acb0d76e macos: clamp window size to screen size on screen parameter changes
Fixes #2462

This sets up a listener for screen parameter changes. This only triggers
when a screen is added, removed, or a parameter such as its resolution
changes. This doesn't trigger when a window is simply moved from one
screen to another.

On parameter change, we ensure that the window is within the bounds of
the screen. As an exception, if the window was previously already
outside the bounds of the screen, we don't move it back in.
2024-10-19 10:13:16 -07: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
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
22b9f24978 macos: clarify comments, clean up notifications for fullscreen 2024-09-30 20:10:23 -07:00
Mitchell Hashimoto
639434df33 macos: exit native fullscreen if we try to enter non-native 2024-09-30 15:01:44 -07:00
Mitchell Hashimoto
93f0b9dce9 macos: only exit on screen change if the screen really changed 2024-09-30 14:48:05 -07:00
Mitchell Hashimoto
ef5b835dc4 macos: only hide dock on the screen with the dock 2024-09-30 14:25:33 -07:00
Mitchell Hashimoto
408c33e174 macos: handle non-native fullscreen changing screens 2024-09-30 14:14:01 -07:00
Mitchell Hashimoto
35462331ae macos: non-native fs sets frame async to account for style changes
Fixes #1996
2024-09-30 10:44:26 -07:00
Mitchell Hashimoto
718fa6042c macos: new fullscreen implementation 2024-09-30 09:42:46 -07:00
Mitchell Hashimoto
332e1a1494 macos: new FullscreenMode/Style architecture for fullscreen impls 2024-09-29 21:31:58 -07: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
Mitchell Hashimoto
d090384600 macos: fix non-AppKit builds 2024-09-21 10:22:14 -07:00
Mitchell Hashimoto
f9bd009ce5 macos: unhide cursor on clipboard confirmation 2024-09-21 09:59:40 -07:00
Mitchell Hashimoto
c01bdc6d7c macos: use pointerStyle for SplitView Divider 2024-09-20 22:02:21 -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
c6bbdfb7bf macos: remove EventSinkHostingView
This was breaking various other features:

  - Popovers stopped working
  - Split divider drag gestures stopped working

For now we document the top part of the window is draggable... we
can look into removing that limitation later.
2024-09-20 22:01:01 -07:00
Mitchell Hashimoto
2c44e20860 macos: EventSinkHostingView must not override mouse events
This breaks split resizing. Removing this doesn't seem to have negative
effects for hidden titlebars (which it was originally made for).
2024-09-20 21:40:30 -07:00
Mitchell Hashimoto
44e39326b3 Merge pull request #2276 from qwerasd205/macos-titlebar-hidden
macOS: add `macos-titlebar-style = hidden`
2024-09-20 20:50:27 -07:00
Mitchell Hashimoto
578aaa1ba6 macos: DraggableWindowView helper (unused currently) 2024-09-20 20:45:27 -07:00
Qwerasd
16919488da macOS: add macos-titlebar-style = hidden
Hides titlebar without removing the other typical window frame elements
2024-09-20 16:11:51 -06:00
Mitchell Hashimoto
df24d8e1a6 macos: show clickable mouse pointer when hovering over secure input
This only works on macOS 15 because it uses the new `pointerStyle` API.
I don't have the interest to backport this to older macOS versions but
I'm happy to accept a PR if someone else wants to do it.
2024-09-20 09:56:44 -07:00
Mitchell Hashimoto
c3d6356a87 macos: show secure input overlay when it is enabled 2024-09-19 16:24:42 -07:00
pnodet
7ff9af1520 style(macos): cleanup trailing spaces 2024-08-21 21:53:09 +02:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
1d70e822c5 macos: disable macOS-only API on iOS 2024-06-30 19:03:06 -07:00
Mitchell Hashimoto
6c01d20eb7 macos: add string extension 2024-06-30 14:58:28 -07:00
Pete Schaffner
f086bff651 Make things work with really dark backgrounds
This fixes issue #1549
2024-04-02 22:28:34 +02:00
Mitchell Hashimoto
0c4800b015 macos: usingColorSpace is only available with AppKit 2024-03-26 11:39:03 -07:00
Mitchell Hashimoto
f7129880f5 macos: only set titlebar color with enough luminance to avoid #1549 2024-03-26 11:13:39 -07:00
Qwerasd
bd03b19679 style 2024-03-08 13:24:01 -05:00
Qwerasd
d1ac0aff39 feat(macOS): Paste copied files as absolute paths.
Previously files would be pasted as only the filename. This commit
introduces an extension to NSPasteboard which provides a method to
consistently get the string contents of a pasteboard so that the
behavior can stay the same anywhere where we need to do that.
2024-03-07 20:53:48 -05:00
Pete Schaffner
3b6bac0121 Make special blending mode class more generic
This allows us to specify what kind of context we'd like our vibrant
layer to exist in (light or dark).
2024-02-11 00:53:18 +01:00
Pete Schaffner
95c8541efd Color the new tab button image appropriately 2024-02-08 17:46:16 +01:00
Pete Schaffner
8831c601a4 Use draw rect to do the "plus darker" blending
This is a lot simpler and doesn't require adding Obj-C into the mix.
2024-02-08 16:38:07 +01:00
Pete Schaffner
40cfa1abd4 Add CALayer subclass for use in titlebar tabs
It uses a private compositing filter to match what the sytem does to
color unselected tabs in the window's tab bar (specifically with a
light appearance).
2024-02-08 10:10:40 +01:00
Pete Schaffner
93fb852d9b Add comments/docs and make method name clearer 2024-02-07 21:44:44 +01:00