159 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9c547dd8cd apprt/gtk: forward window key events to the focused surface 2024-10-07 13:06:35 -07:00
Mitchell Hashimoto
9e435f050e apprt/gtk: setup window key event infrastructure 2024-10-07 13:01:36 -07:00
Mitchell Hashimoto
eab6c0d4af gtk: only set initial window size if its the first terminal in a window
Fixes #2391
2024-10-07 09:46:13 -07:00
Mitchell Hashimoto
c7f83fcef8 gtk: notify core of cursor leave 2024-10-06 18:23:53 -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
4cc4eb5ed0 core: remove more hasdecls 2024-09-26 14:21:06 -07:00
Mitchell Hashimoto
4e2781fdec apprt/gtk 2024-09-26 14:13:18 -07:00
Mitchell Hashimoto
26cba70b69 core: no need for hasTabs apprt function 2024-09-26 08:34:20 -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
9e73d865fb apprt/gtk: small comments 2024-09-13 20:45:39 -07:00
Jeffrey C. Ollie
5f759a19d1 GTK: Fix clicking on desktop notifications
Currently, clicking on a desktop notification will bring Ghostty
to the foreground, but it won't necessarily bring the right window
to the top and it won't switch tabs or change the focus on splits.

With this patch, clicking on a desktop notification will raise the
correct window, change to the correct tab, and focus on the correct
split that send the original desktop notification.
2024-09-13 13:37:38 -07:00
Paul Berg
0c286a049a gtk: add adwaita banner 2024-09-11 15:42:31 +02:00
Paul
0e22695ec4 gtk: use adwaita tab view when possible
add tab bar view
2024-09-11 15:35:22 +02:00
Mitchell Hashimoto
a3aa5463a1 Revert "Merge pull request #2060 from jcollie/gtk-compatibility"
This reverts commit 9ce789cc85d411c59eff2a01c7fe18ce14ccd2b8, reversing
changes made to f1aea10a84176ff4338f7d2f0bf1b9c700b41baa.
2024-09-05 08:45:37 -07:00
Mitchell Hashimoto
2142ba53c4 apprt/gtk: do not remove unfocused widget from overlay
See comment
2024-09-04 14:17:51 -07:00
Jeffrey C. Ollie
bbb204ac85 rename gtkVersionMinimum->gtkVersionAtLeast for consistency 2024-08-31 19:16:43 -07:00
Jeffrey C. Ollie
b6c943386c Conditional compilation against different GTK versions
Adds a comptime function to enable conditional compilation against
different GTK versions that have added new API calls in newer versions
of GTK.

Use this function to get fractional scaling information for GTK
surfaces, which is only available with GTK 4.12+.
2024-08-31 19:15:24 -07:00
Mitchell Hashimoto
512b24818a apprt/gtk: fix int cast 2024-08-26 20:16:23 -07:00
Mitchell Hashimoto
d7e7f55956 apprt/gtk: support last_tab 2024-08-26 20:13:28 -07:00
Mitchell Hashimoto
9409e3072f apprt/gtk: remove usingnamespace 2024-08-16 14:58:04 -07:00
Jeffrey C. Ollie
414fdc0214 gtk: prettify the url overlays 2024-08-13 14:21:28 -05:00
Jeffrey C. Ollie
f4bdf8d3a1 gtk: resize overlay improvements
* runtime changing of `resize-overlay` now works on GTK
* shorten function names in ResizeOverlay
* improve documentation
2024-08-11 12:23:43 -05:00
Mitchell Hashimoto
451cf69398 Merge pull request #2071 from jcollie/resize-overlay
gtk: add resize overlay
2024-08-10 15:07:09 -07:00
Mitchell Hashimoto
1c88377e97 apprt/gtk: small style tweaks for resize overlay 2024-08-10 15:06:44 -07:00
Jeffrey C. Ollie
4dbd2fb639 move resize overlay code to a new file to keep the file size down 2024-08-10 14:59:05 -05:00
Jeffrey C. Ollie
b55b3de05b resize overlay: move all resize overlay code and data into a struct
Keepin´ the code clean by gathering all of the resize overlay
related data and code into a struct.
2024-08-10 14:44:28 -05:00
Jeffrey C. Ollie
8b919df1f5 resize-overlay: change default and delay → duration
Change the default to `after-first` and change `resize-overlay-delay` →
`resize-overlay-duration`.
2024-08-10 13:22:20 -05:00
Jeffrey C. Ollie
301826dfff gtk: add resize overlay
This adds a transient overlay that shows the size of the surface
while you are resizing the window or the surfaces.
2024-08-09 22:58:33 -05:00
Jeffrey C. Ollie
ce5e55d4aa Implement the XTWINOPS (CSI t) control sequences that "make sense".
These sequences were implemented:

CSI 14 t - report the text area size in pixels
CSI 16 t - report the cell size in pixels
CSI 18 t - report the text area size in cells
CSI 21 t - report the window title

These sequences were not implemented because they manuipulate the window
state in ways that we do not want.

CSI 1 t
CSI 2 t
CSI 3 ; x ; y t
CSI 4 ; height ; width ; t
CSI 5 t
CSI 6 t
CSI 7 t
CSI 8 ; height ; width ; t
CSI 9 ; 0 t
CSI 9 ; 1 t
CSI 9 ; 2 t
CSI 9 ; 3 t
CSI 10 ; 0 t
CSI 10 ; 1 t
CSI 10 ; 2 t
CSI 24 t

These sequences were not implemented because they do not make sense in
a Wayland context:

CSI 11 t
CSI 13 t
CSI 14 ; 2 t

These sequences were not implemented because they provide information
about the screen that is unnecessary.

CSI 15 t
CSI 19 t

These sequences were not implemeted because Ghostty does not maintain an
icon title for windows.

CSI 20 t
CSI 22 ; 0 t
CSI 22 ; 1 t
CSI 23 ; 0 t
CSI 23 ; 1 t

These sequences were not implemented because of the additional
complexity of maintaining a stack of window titles.

CSI 22 ; 2 t
CSI 23 ; 2 t
2024-08-07 00:12:20 -05:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
e25997ad58 apprt/gtk: ignore mouse movement if no actual movement occurs
Fixes #2022

See comment
2024-08-01 06:25:10 -07:00
karei
5eb7925446 apprt/gtk: don't dim surface when opening context menu 2024-07-22 21:13:07 +03:00
Mitchell Hashimoto
53e942abae apprt/gtk: some stylistic changes 2024-07-22 10:29:59 -07:00
Mitchell Hashimoto
cc3b040571 apprt/gtk: get rid of forcing context menu for now
We have escapes (shift) so lets see how that goes and compare to some
other GTK apps first.
2024-07-22 10:21:18 -07:00
karei
6e5bc62726 apprt/gtk: disable copy in context menu while without selection
Left a FIXME where the "Copy" button action is disabled.

Though very hackish this was the best way I found to do this currently.
Disable sensitivity on the button didn't do anything and trying to
remove the button altogether like on macOS, causes the menu to become
really buggy. Either by the context menu turning into a scrollable list
or by it becoming really janky and showing the user pre-update UI.
2024-07-21 11:10:26 +03:00
karei
57db35036e apprt/gtk: implement context menu
Implements context menu for GTK with:
- copy
- paste
- split right
- split down
- terminal inspector
2024-07-21 11:10:21 +03:00
Chris Marchesi
d0446a8444 apprt/gtk: set mouse shape on GL area widget instead of overlay
In b7699b9a, mouse shape functionality was moved from the GL area widget
to the overlay that was newly created for the URL target information
that was included as part of #1928. This seems to have the side effect
of causing the pointer shape to revert to the default shape (here, the
basic arrow pointer) when dragging the mouse during selections.

This moves it back to the GL area, which seems to correct this. It
doesn't seem to need to be added to both - everything seems to function
correctly when a link is moused over, and then selection is made down to
the overlay area (not that this scenario is very likely, though).
2024-07-18 08:56:24 -07:00
Mitchell Hashimoto
2d7baaa7d7 apprt/gtk: toggle_window_decorations keybinding
Fixes #1943
2024-07-15 21:23:52 -07:00
Tim Culverhouse
76df732169 gtk: add unfocused_widget when split created from menu
When a split is created from a menu action, the focus is lost before the
split is made which prevents the surface from having the
unfocused_widget. Move the logic to add the unfocused_widget to the
overlay to an exported function which is called when the split is
created.
2024-07-11 10:29:40 -05:00
Tim Culverhouse
11c2ae1007 gtk: use GtkDrawingArea to dim unfocused split
Refactor the GTK unfocused split code to use a GtkDrawingArea widget to
dim the unfocused split. The GtkDrawingArea is added to the overlay and
a CSS style is used to give it a background color and opacity. This
aligns with the macOS design of drawing on top of the surface. In GTK,
we don't need to actually draw a rectangle because we can apply CSS
directly to the widget.
2024-07-11 08:28:47 -05:00
Tim Culverhouse
6c40cd963d gtk: implement unfocused-split opacity and fill
For a long time, us GTK users have been subject to lesser UX by not
knowing which split was focused. Improve the GTK UX by implementing both
unfocused-split-opacity and unfocused-split-fill. This is implemented by
setting the background-color of the notebook stack, and conditionally
applying a new css class "unfocused-split" to the unfocused split.
2024-07-10 12:56:09 -05:00
Mitchell Hashimoto
53fbed492b apprt/gtk: ellipsize URLs in middle to show end 2024-07-09 09:26:07 -07:00
Mitchell Hashimoto
f1561a4cae apprt/gtk: committed the forever status bar again 2024-07-07 12:25:08 -07:00
Mitchell Hashimoto
b7699b9af9 apprt/gtk: add all event handlers to the overlay so both receive 2024-07-07 12:17:40 -07:00
Mitchell Hashimoto
45d0653f46 apprt/gtk: add deinit for url widget 2024-07-07 09:48:39 -07:00
Mitchell Hashimoto
10a3214cb4 apprt/gtk: forgot to remove debug code to hide overlay 2024-07-07 09:39:41 -07:00
Mitchell Hashimoto
f9e5d9c10b apprt/gtk: move url hover bar when its under the mouse 2024-07-07 09:37:43 -07:00
Mitchell Hashimoto
ecdb0a74b0 apprt/gtk: style the overlay 2024-07-06 15:09:59 -07:00
Mitchell Hashimoto
8858c2ba4e apprt/gtk: convert surface to overlay so we can support the url overlay 2024-07-06 15:01:18 -07:00
Mitchell Hashimoto
36648ae397 apprt: stubs for mouseOverLink 2024-07-06 10:29:23 -07:00