531 Commits

Author SHA1 Message Date
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
Mitchell Hashimoto
e43919cb9e apprt/gtk: stylistic changes to adwaita init 2023-12-29 09:10:49 -08:00
Tristan Partin
41aa9ac2ff Use adw_application_new() instead of adw_init()
This will enable further libadwaita improvements in the future, but will
have no effect today.
2023-12-28 21:50:56 -06:00
Mitchell Hashimoto
0a1dfae2ef input: kitty keyboard modifier event changes from Kitty 0.32
> When the key event is related to an actual modifier key, the corresponding
> modifier's bit must be set to the modifier state including the effect for the
> current event. For example, when pressing the :kbd:`LEFT_CONTROL` key, the
> ``ctrl`` bit must be set and when releasing it, it must be reset. When both
> left and right control keys are pressed and one is released, the release event
> must have the ``ctrl`` bit set. See :iss:`6913` for discussion of this design.
2023-12-24 08:21:31 -08:00
Mitchell Hashimoto
243379c50f apprt/embedded: ghostty_surface_pwd 2023-12-23 16:59:09 -08:00
Mitchell Hashimoto
1f50406967 apprt/gtk: correct icon path now that our resources dir is in a subdir
From #1132, our resources dir is now someting like `/usr/share/ghostty`,
but GTK icons always go into `/usr/share/icons`. This does a basename on
the resources dir to set the correct directory.
2023-12-22 17:03:34 -08:00
Mitchell Hashimoto
0c80f85d78 apprt/gtk: only reset IME state if key consuming while IME composing
Fixes #1047

This resets the IME state only if we were previously in a composing
state. I did not realize that IME state also included non-composing
state that we want to preserve, such as the next quotation direction
in the case of chinese. i.e. `“` vs `”`.

I'm not fully sure that this is the right logic, but previous pre-edit
states such as in Japanese appear to still work and this fixes Chinese
quotation marks.
2023-12-19 22:10:00 -08:00
Mitchell Hashimoto
b711ac8a42 apprt/glfw: implement openconfig 2023-12-18 08:20:29 -08:00
Mitchell Hashimoto
2c311ab369 apprt/gtk: hook up open config 2023-12-18 08:04:24 -08:00
Mitchell Hashimoto
7600c761ef fix callback struct ordering, use internal_os.open 2023-12-18 08:00:40 -08:00
Borja Clemente
646e3c365c Add settings shortcut on MacOS
- Settings shortcut opens the config file in the default editor.

Signed-off-by: Borja Clemente <borja.clemente@gmail.com>
2023-12-17 16:19:22 +01:00
Brian Cain
ed3e436e47 apprt: Fix key callback input key assignments
Prior to this commit, two and three were not properly assigned. This
commit updates that to assign two to two, and three to three.
2023-12-15 11:23:52 -08:00