Commit Graph

7238 Commits

Author SHA1 Message Date
Mitchell Hashimoto
5b4baee9fa renderer: don't assume non-zero sized grid (#8246)
Fixes #8243

This adds a check for a zero-sized grid in cursor-related functions.

As an alternate approach, I did look into simply skipping a bunch of
work on zero-sized grids, but that looked like a scarier change to make
now. That may be the better long-term solution but this was an easily
unit testable, focused fix on the crash to start.
2025-08-15 09:07:22 -07:00
Mitchell Hashimoto
9ccc02b131 renderer: don't assume non-zero sized grid
Fixes #8243

This adds a check for a zero-sized grid in cursor-related functions.

As an alternate approach, I did look into simply skipping a bunch of
work on zero-sized grids, but that looked like a scarier change to make
now. That may be the better long-term solution but this was an easily
unit testable, focused fix on the crash to start.
2025-08-15 08:59:24 -07:00
Jeffrey C. Ollie
63869d8e37 ci: switch to debian 13 2025-08-14 22:42:26 -05:00
Mitchell Hashimoto
6b1dd3e441 apprt/gtk-ng: implement maximize and fullscreen
These fell through the cracks.
2025-08-14 15:01:03 -07:00
Mitchell Hashimoto
a148adc5e4 apprt: make gtk-ng the default apprt on Linux 2025-08-14 12:43:15 -07:00
Mitchell Hashimoto
b7913f09ad gtk-ng: add a helper for creating GTK actions (#8228)
- Reduces boilerplate.
- Adds type safety.
- Adds comptime checks for action and group names which
  otherwise could cause panics at runtime.
2025-08-14 12:26:39 -07:00
Mitchell Hashimoto
4740242bb9 fix(renderer/generic): deinit render targets with framestate (#8234)
This was a memory leak under Metal, leaked 1 swapchain worth of targets
every time a surface was closed.

Under OpenGL I think it was all cleaned up when the GL context was
destroyed.
2025-08-14 11:52:48 -07:00
Qwerasd
add7f762a6 fix(renderer/generic): deinit render targets with framestate
This was a memory leak under Metal, leaked 1 swapchain worth of targets
every time a surface was closed.

Under OpenGL I think it was all cleaned up when the GL context was
destroyed.
2025-08-14 11:47:05 -06:00
Jeffrey C. Ollie
d251695fa2 gtk-ng: move actions helper to namespace 2025-08-14 12:23:14 -05:00
Jeffrey C. Ollie
0e3ec24d2c gtk-ng: use action helper in surface 2025-08-14 12:22:42 -05:00
Jeffrey C. Ollie
6b690e6b4e gtk-ng: use action helper in split-tree 2025-08-14 12:22:42 -05:00
Jeffrey C. Ollie
31c71c6c5a gtk-ng: use action helper in tab 2025-08-14 12:22:39 -05:00
Jeffrey C. Ollie
d66212dcce gtk-ng: use action helper in window 2025-08-14 12:21:52 -05:00
Jeffrey C. Ollie
a10b95f052 gtk-ng: use action helper in application 2025-08-14 12:21:51 -05:00
Jeffrey C. Ollie
96e252872f gtk-ng: add a helper for creating GTK actions
- Reduces boilerplate.
- Adds type safety.
- Adds comptime checks for action and group names which
  otherwise could cause panics at runtime.
2025-08-14 12:21:51 -05:00
Mitchell Hashimoto
83d1bdcfcb apprt/gtk-ng: clean up close handling of all types
This cleans up our close handling of all types (surfaces, tabs, windows).
Surfaces no longer emit their scope; their scope is always just the
surface itself. For tab and window scope we use widget actions.

This makes `close_tab` work properly (previously broken).
2025-08-14 10:07:28 -07:00
Mitchell Hashimoto
68f337e398 apprt/gtk-ng: close inspector window when widget loses surface 2025-08-14 09:42:26 -07:00
Mitchell Hashimoto
7548dcfe63 apprt/gtk-ng: clear weakrefs on dispose 2025-08-14 09:31:14 -07:00
Mitchell Hashimoto
6280bd7a42 apprt/gtk-ng: far less control inspector complexity 2025-08-14 08:57:11 -07:00
Mitchell Hashimoto
3fc33089f3 apprt/gtk-ng: clean up a bunch of unused window stuff 2025-08-14 08:37:58 -07:00
Mitchell Hashimoto
48a65b05d0 apprt/gtk-ng: use a weak_ref on surface for inspector 2025-08-14 08:21:19 -07:00
Mitchell Hashimoto
43550c18c0 apprt/gtk-ng: imguiwidget uses signals instead of callbacks 2025-08-14 08:21:19 -07:00
Jeffrey C. Ollie
bd7177a924 gtk-ng: port the terminal inspector
This is a (relatively) straightforward port of the terminal inspector
from the old GTK application runtime. It's split into three widgets. At
the lowest level is a widget designed for showing a generic Dear ImGui
application. Above that is a widget that embeds the ImGui widget and
plumbs it into the core Inspector. At the top is a custom Window widget
that embeds the Inspector widget.

And then there's all the plumbing necessary to hook everything into the
rest of Ghostty.

In theory this design _should_ allow showing the Inspector in a split
or a tab in the future, not just in a separate window. It should also
make it easier to display _other_ Dear ImGui applications if they are
ever needed.
2025-08-14 08:21:19 -07:00
Mitchell Hashimoto
57f1033198 gtk-ng: parametrize the new-split action (#8225)
why four when one do trick
2025-08-14 08:19:18 -07:00
Leah Amelia Chen
0979e6d2e9 gtk-ng: parametrize the new-split action
why four when one do trick
2025-08-14 08:17:01 -07:00
Mitchell Hashimoto
997d38c362 apprt/gtk-ng: set cursor on Surface widget, not GL area
This fixes `mouse-hide-while-typing`. Don't know why this worked before
(I tested it yesterday!) but stopped working today. But this now works,
and conceptually makes some sense.
2025-08-13 15:21:08 -07:00
Leah Amelia Chen
1b1264e592 gtk-ng: only show OSD when mouse event isn't consumed 2025-08-14 04:06:02 +08:00
Leah Amelia Chen
23048dbd33 gtk-ng: add show_on_screen_keyboard binding 2025-08-14 04:06:02 +08:00
Leah Amelia Chen
0d0d3118f4 gtk-ng: show on-screen keyboard on LMB release
This aligns with VTE behavior when the on-screen keyboard is enabled in
GNOME's accessibility settings.

Closes #7987
2025-08-14 03:08:34 +08:00
Mitchell Hashimoto
5e3bd92c57 apprt/gtk-ng: prompt surface title (#8223)
Straightforward port. A hell of a lot cleaner with `-ng`.
2025-08-13 10:53:12 -07:00
Mitchell Hashimoto
8edc041eaf apprt/gtk-ng: prompt surface title 2025-08-13 10:49:16 -07:00
Jeffrey C. Ollie
22fc90fd55 gtk-ng add border to bell features 2025-08-13 12:18:07 -05:00
Mitchell Hashimoto
6de98eda04 apprt/gtk-ng: audio bell
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:51 -07:00
Mitchell Hashimoto
d8a309c734 apprt/gtk-ng: split tree active focus should be last focused fallback
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:49 -07:00
Mitchell Hashimoto
3680c8637e apprt/gtk-ng: tab attention for bell
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:45 -07:00
Mitchell Hashimoto
d37e3828a2 apprt/gtk-ng: win.ring-bell
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:39 -07:00
Mitchell Hashimoto
408ec24165 apprt/gtk-ng: hook up bell into title
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:35 -07:00
Mitchell Hashimoto
40427b06c7 apprt/gtk-ng: surface bell-ringing property
Co-authored-by: Jeffrey C. Ollie <jcollie@dmacc.edu>
2025-08-13 09:22:16 -07:00
Mitchell Hashimoto
798e872f48 apprt/gtk-ng: split zoom title 2025-08-12 15:45:59 -07:00
Mitchell Hashimoto
12bc0d7b10 apprt/gtk-ng: window-subtitle 2025-08-12 15:23:47 -07:00
Mitchell Hashimoto
502040c86a apprt/gtk-ng: tab tooltips match our pwd 2025-08-12 15:02:23 -07:00
Mitchell Hashimoto
aa4cbf444b apprt/gtk-ng: forgot to register a prop 2025-08-12 13:45:33 -07:00
Mitchell Hashimoto
f130a724e5 apprt/gtk-ng: track is-zoomed property on surface tree 2025-08-12 13:39:38 -07:00
Mitchell Hashimoto
fb846b669c split_tree: convert Handle to enum 2025-08-12 13:34:35 -07:00
Mitchell Hashimoto
145d1c1739 split_tree: track zoomed state 2025-08-12 13:08:04 -07:00
Mitchell Hashimoto
7bcb190aa8 apprt/gtk-ng: resize_split action (#8215)
Ports the resize split action (tied to the `resize_split` binding
action).

This also includes fixes for splits that are exactly `0` or `1` ratio
width (full width either direction). This would previously cause
crashes.
2025-08-12 12:27:26 -07:00
Mitchell Hashimoto
93da59682f apprt/gtk-ng: resizeSplit action 2025-08-12 11:04:34 -07:00
Mitchell Hashimoto
4afd3445c4 split_tree: fix bugs for 0/1 sized ratios 2025-08-12 10:46:43 -07:00
Mitchell Hashimoto
2bcc2fa4bd split_tree: resize function 2025-08-11 12:52:16 -07:00
Qwerasd
5bf632e9cc Fix up font raster position + other small fixes (#8206)
I've cleaned up the code we use for scaling and positioning glyphs for
raster, under both CoreText and FreeType. Before we had some
imprecision, and under CoreText we were sometimes stretching glyphs in
unseemly ways. These changes make it so that our constraints can
position and size glyphs *exactly* and we don't have any chopped-off
row/column issues for CoreText. With this, PowerLine Extra symbols now
always align *perfectly* with the cell height:
||Before|After|
|-:|-|-|
|**CoreText**|<img width="105" height="245" alt="image"
src="https://github.com/user-attachments/assets/d3c1b1cb-a798-4e18-a0e0-59551893369c"
/>|<img width="106" height="246" alt="image"
src="https://github.com/user-attachments/assets/dac10c49-9ec1-4f4f-8825-a5e8c2fd3402"
/>|
|**FreeType**|<img width="105" height="245" alt="image"
src="https://github.com/user-attachments/assets/160e1e35-4a3c-42d0-9042-215301e636a1"
/>|<img width="106" height="245" alt="image"
src="https://github.com/user-attachments/assets/89bf1538-7271-4baf-88c0-51ebc4d360df"
/>|

The other changes are mainly just cleanup stuff, though one of the
changes makes it so that we do once again properly apply constraints to
symbols from the dingbats block (it was a regression, noted in #7955,
that we stopped doing that).

### Future work
This has been a problem since we introduced the custom constraints, but
I noticed it while preparing the before/after images: the left-edge PLE
symbols (meant to connect to a full block on the right) expand out to
the *right*, so if they're followed immediately by another character
than they actually get squished and don't match the right-edge symbols:

<img width="75" height="114" alt="image"
src="https://github.com/user-attachments/assets/1420b9a5-9950-4210-9934-8ef7cd7a1e19"
/>

I have a WIP change to move constraint logic to the shapers, and at that
point we can maybe do something to allow the constraint to grow in to
whitespace on the left side instead of on the right side.
2025-08-11 13:44:50 -06:00