542 Commits

Author SHA1 Message Date
Tristan Partin
0adbe097ed fix: remove deprecated to-pixdata gresource preprocessor
It was deprecated in gdk-pixbuf 2.32.

Link: https://docs.gtk.org/gio/struct.Resource.html
2024-03-28 21:15:09 -05:00
Mitchell Hashimoto
77c8a5998f apprt/gtk: handle gtk realize error more gracefully
Fixes #1606

This improves our logging when this occurs and prevents a crash.
The program will just run indefinitely with no windows (you can try to
create another but it will probably fail) but the logs are much more
helpful now.
2024-03-28 15:11:45 -07:00
Mitchell Hashimoto
054aeebf17 Merge pull request #1506 from jcollie/gtk-resources
GTK: Add compiled-in GTK resources and use them for icons.
2024-03-28 14:48:40 -07:00
Mitchell Hashimoto
b6f5970264 minor style changes 2024-03-28 14:45:44 -07:00
Mitchell Hashimoto
9aadf59ab1 macos,libghostty: font size is a u8 2024-03-27 20:53:03 -07:00
Jeffrey C. Ollie
9f0468f950 generate gresource xml and dependencies at comptime rather than hardcoding 2024-03-27 16:47:27 -05:00
Jeffrey C. Ollie
f943a4cf87 GTK: Add compiled-in GTK resources and use them for icons.
Use glib-compile-resources to compile CSS style sheets and icons into
the Ghostty GTK binary. Makes for simpler access to icons and sets
things up for customizing the look of Ghostty with CSS in the future.
The CSS style sheets are blank for now so there will be no visual
changes.
2024-03-27 16:47:26 -05:00
Igor Anić
137359bcb5 gtk: use symbolic icon for tab close
On my system (xorg Ubuntu 24.04, Adwaita:dark theme) tab close icon was
red while in all other applications was more discrete. With adding
`-symbolic` to the icon name now looks like all other application.
2024-03-27 20:04:17 +01:00
Mitchell Hashimoto
b68e1c6a5d Merge pull request #1555 from BvngeeCord/gtk-tabs-location
add 'gtk-tabs-location'
2024-03-25 21:37:50 -07:00
Kyungrok Chung
612d98d8f8 apprt/gtk: commit buffer before preeditchanged resets
When gtkInputPreeditChanged is called after gtkInputCommit, character
that should be committed is cleared. Check if there's buffered character
and send the characters directly when preedit changed.

Fix #1563
2024-03-18 21:17:40 +09:00
Jack N
fab3490d6e add gtk-tabs-location 2024-02-25 22:56:33 -08:00
Mitchell Hashimoto
be0595d71d apprt/embedded: add occlusion state callback 2024-02-12 13:48:09 -08:00
Mitchell Hashimoto
f414787779 move SplitDirection to apprt 2024-02-04 20:42:42 -08:00
Mitchell Hashimoto
d315223423 apprt/gtk: small stylistic edits 2024-02-02 20:00:10 -08:00
Jeffrey C. Ollie
0938835f87 Implement mode 2031 and DSR 996 for GTK 2024-02-02 21:10:58 -06:00
Mitchell Hashimoto
258d51395c apprt/embedded: add API for reporting color scheme 2024-02-02 13:02:16 -08:00
Mitchell Hashimoto
ae8f5f3ceb core: colorSchemeCallback on surface, can report 2024-02-02 12:51:20 -08:00
Mitchell Hashimoto
e5400bad06 config: add window-theme = auto for automatic choosing based on bg color 2024-02-01 20:49:28 -08:00
Mitchell Hashimoto
5c0e63458f apprt/embedded: do not allow NaN or small content scales
Fixes #1408
2024-01-29 08:35:23 -08:00
Mitchell Hashimoto
0726a8d1fa apprt/embedded: ctrl-only should use binding-mods only
This allows it to ignore control side differences.
2024-01-27 11:15:54 -08:00
Mitchell Hashimoto
d177b20bab macos: do not trust AppKit's text translation with ctrl only
Normally, when `ctrl+<character>` is pressed, such as `ctrl+z` or
`ctrl+c`, macOS (AppKit) doesn't do any key translation because that
doesn't map to any printable text on its own. Ghostty does the
translation to correctly determine the character is "z" or "c" or
whatever.

For some reason when the keyboard layout is "Dvorak - QWERTY Cmd"
specifically (_not_ plain "Dvorak") on a US layout keyboard, AppKit
decides that "ctrl+z" ("/" on a qwerty keyboard) translates to "/"...
I can't find any explanation for this.

To workaround this, this commit makes it so that if the following
conditions are true, then we IGNORE AppKit's text translation and
manually do it using UCKeyTranslate:

  (1) We're on macOS specifically (not iOS, etc.)
  (2) We have a key event with ONLY control pressed

This fixes `ctrl+z` on this unique Dvorak keyboard layout.
2024-01-27 08:13:53 -08:00
Mitchell Hashimoto
bf4211e060 input: handle more ctrl+<key> sequences, namely ctrl+_
Previously, we encoded `ctrl+_` in the CSIu format[1]. This breaks most
notably emacs which expects the legacy ambiguous encoding.

This commit utilizes the generator from Kitty to generate our control
key mappings. We also switch from keycode mapping to key contents
mapping which appears to be the correct behavior also compared to other
terminals.

In the course of doing this, I also found one bug with our fixterms
implementation. Fixterms states: "The Shift key should not be considered
as a modifier for Unicode characters, because it is most likely used to
obtain the character in the first place (e.g. the shift key is often
required to obtain the ! symbol)." We were not applying that logic and
now do.

[1]: https://www.leonerd.org.uk/hacks/fixterms/
2024-01-25 15:25:23 -08:00
Mitchell Hashimoto
4dbd10c913 apprt/embedded: support asking for selection text, existence 2024-01-21 17:22:44 -08:00
Mitchell Hashimoto
26e6e8cec8 apprt/embedded: add iOS platform with uivew 2024-01-18 15:03:03 -08:00
Krzysztof Wolicki
316cb5314c cimgui metal impl available only when target is Darwin 2024-01-18 21:43:57 +01:00
Mitchell Hashimoto
01afa293c8 apprt/embedded: fix initialization on macOS 2024-01-18 08:55:03 -08:00
Mitchell Hashimoto
df09c21103 apprt/embedded: compile for Linux 2024-01-18 08:44:56 -08:00
Thorsten Ball
551d19205b gtk: respect minimum split size when using resize keys
This is the GTK equivalent of #1304.
2024-01-18 06:38:08 +01:00
Mitchell Hashimoto
93c87f21ff apprt/embedded: set wait-after-command when command is set 2024-01-17 08:43:04 -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
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
0277a0fb4c renderer/metal: detect frame commit failures and notify surface 2024-01-16 10:51:36 -08:00
Mitchell Hashimoto
34d5cbda13 apprt/gtk: xft-dpi can be fractional, do not expect exact division
This was reported on Discord. A Chromebook reported an `Xft.dpi` of
`96.1025390625` which resulted in a `gtk-xft-dpi` of 98409. This caused
`divExact` to crash in runtime safety modes.
2024-01-15 20:49:12 -08:00
Paul Berg
2b52c5ed88 gtk: update tab title even when the tab is unfocused
This change updates the tab title if the tab is unfocused. Tab title
updates only occur when the update surface is the focused child of the
tab.
2024-01-15 11:53:30 +01:00
Mitchell Hashimoto
87f5d6f6a8 apprt/embedded: do not depend on macOS APIs on non-macOS 2024-01-14 14:31:14 -08:00
Mitchell Hashimoto
adb7958f61 remove tracy usage from all files 2024-01-13 15:06:08 -08:00
Mitchell Hashimoto
81b9a6b623 config: rename window-append-new-tab to window-new-tab-position 2024-01-12 09:50:47 -08:00
Thorsten Ball
2aa1874f94 gtk: append new tabs at the end if config is set
This adds a new config option: `window-append-new-tabs` (please: if you
have a better name, let me know). If this is set to true, then new GTK
tabs aren't added after the current tab, but after at the end.
2024-01-12 17:35:15 +01:00
Gregory Anders
d059c57440 gtk: use modifier state from GTK key event on X11
On X11 gdk_device_get_modifier_state does not correctly return the
modifier state, while the modifier state passed to the key callback
does. On Wayland, the situation is exactly reversed.

Therefore on X11 we use the mods provided by the key callback and on
Wayland we continue to get the modifier state from the device.

`App.modifier_state_from_xkb` is removed since we can lift the
conditional out of the function call (we would need to make a second,
redundant check for the presence of `x11_xkb` otherwise).
2024-01-10 16:26:53 -06:00
Gregory Anders
36a5965eea x11: fix modifier mask for Super key
Mod4 is "Super" in X11, verified via the `xmodmap` command:

    xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock        Caps_Lock (0x42)
    control     Control_L (0x25),  Caps_Lock (0x42),  Control_R (0x69)
    mod1        Alt_L (0x85),  Alt_R (0x86),  Alt_L (0xcc),  Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3        ISO_Level5_Shift (0xcb)
    mod4        Super_L (0x40),  Super_R (0x6c),  Super_L (0xce),  Hyper_L (0xcf)
    mod5        ISO_Level3_Shift (0x5c)
2024-01-10 10:15:39 -06:00
Mitchell Hashimoto
b62c78b61d apprt/gtk: stylistic changes 2024-01-07 12:25:56 -08:00
Riccardo Binetti
ad503b8c4f linux: consider Xft.dpi to scale the content
Many applications use Xft.dpi to scale their contents (e.g. Chromium,
kitty, alacritty...). This value also gets set by DE setting managers
and can be manually set in ~/.Xresources if using, e.g., i3.

This should make HiDPI on Linux more consistent even when not using
GTK-specific methods (e.g. GDK_SCALE=2).

Note that we still consider GTK scaling, so it's possible to use the two
independently.

Closes #1243
2024-01-07 17:16:16 +01:00
Riccardo Binetti
fe0842c2d0 linux: add a function to check if we're running on X11 2024-01-07 16:54:01 +01:00
Jeffrey C. Ollie
698954031a Add 'Open Config' menu to the GTK runtime and synchronize config-related keybindings across platforms. 2024-01-04 23:30:22 -06:00
Mitchell Hashimoto
732063375a apprt/gtk: stylistic changes 2024-01-01 08:34:19 -08:00
Chris Marchesi
d235554606 apprt/gtk: Move Xkb state to App, remove un-needed fields, style changes 2023-12-31 12:10:25 -08:00
Mitchell Hashimoto
a3ce446fee apprt/gtk: use some comptime to load X11 functions 2023-12-31 08:00:43 -08:00
Mitchell Hashimoto
3b7e83150f apprt/gtk: stylistic changes 2023-12-31 07:50:36 -08:00
Chris Marchesi
fc4fdbb643 apprt/gtk: ensure modifier state matches current keypress under X11
This fixes an issue in that when running under X11, when a modifier key
is pressed, the modifier state will "lag" behind what should be current.
This is due to how X11 sends modifiers in events, i.e. it sends the
state from right before the key press, and does not include the effects
of the key press itself.

This is corrected by checking the X event queue directly for a pending
XkbStateNotify event (we mask this on modifiers), and setting the
modifiers off of that if we find one. If not, we fall back to the GDK
call.
2023-12-30 22:58:33 -08:00