79 Commits

Author SHA1 Message Date
Thorsten Ball
47b0592c73 gtk: use f64 everywhere instead of i16/f16/c_int 2023-12-13 05:38:34 +01:00
Thorsten Ball
e67fa7abe0 gtk: implement equalize_splits
This adds support for the equalize_splits feature that's already
implemented for macOS.

It's essentially a port of the Swift implementation, using the same
weights-mechanism to equalize split sizes.
2023-12-12 19:30:29 +01:00
Mitchell Hashimoto
08f2e91ff5 apprt/gtk: use map_keycode to get the proper unshifted key for a layout
Fixes #1014

There were a couple overlapping issues here:

  1. To determine the "unshifted" key, we were using `keyval_to_lower`.
     This only works if the key is uppercase and not all layouts are
     uppercase for the unshifted value.

  2. If we couldn't case the unicode value of a key or unshifted key to
     ASCII, we'd say the key was the same as the physical key. This is
     incorrect because the physical key is always the layout of the
     physical keyboard so for example with the Turkish layout on a US
     keyboard, you'd get US letters when a key may only correspond to
     non-US letters.

To fix the first issue, we are using map_keycode to map the hardware
keycode to all possible keyvals from it. We then use the currently
active layout to find the unshifted value.

To fix the scond issue, we no longer fallback to the physical key if
there was IM text or non-ASCII unicode values for the key.

I tested Turkish with #1014 and I tested Dvorak to make sure those
basics still work.
2023-12-08 20:41:09 -08:00
Mitchell Hashimoto
9de5d991a2 core: detect inputs that result in surface close and avoid segfault
Fixes #965

When processing keybindings that closed the surface (`close_surface`,
`close_window`), the surface and associated runtime structures would be
freed so we could segfault.

This PR introduces a new enum result for input events (only key for now)
that returns whether an event resulted in a close. In this case, callers
can properly return immediately and avoid writing to deallocated memory.
2023-12-07 10:24:39 -08:00
Mitchell Hashimoto
3c4bd47de3 apprt/gtk: stylistic changes 2023-12-06 20:53:32 -08:00
Thorsten Ball
40e239bf7a gtk: add support for resizing splits via keybinds
This adds support for resizing splits via keybinds to the GTK runtime.

Code is straightforward. I couldn't see a way to do it without keeping
track of the orientation of the splits, but I think that's fine.
2023-12-06 06:25:34 +01:00
Mitchell Hashimoto
d311fb93ed apprt/gtk: gotoSplit gets proper previous/next direction 2023-12-01 13:21:31 -08:00
Mitchell Hashimoto
f811ac6b18 apprt/gtk: gotoSplit, has some bugs 2023-12-01 09:58:57 -08:00
Mitchell Hashimoto
dc2cee1c78 apprt/gtk: rename parentSurface 2023-12-01 09:15:30 -08:00
Mitchell Hashimoto
967e091e2c apprt/gtk: just heap allocate the title text 2023-12-01 09:14:08 -08:00
Mitchell Hashimoto
14ef6fb2f9 apprt/gtk: add comments, rename some funcs 2023-12-01 09:07:37 -08:00
Mitchell Hashimoto
89f4cf11c7 apprt/gtk: rename parent2 to parent 2023-11-30 21:46:43 -08:00
Thorsten Ball
7e9dce054f gtk: remove unneeded method setContainer on Surface
We don't need to update the titles, etc. since that's done by
`grabFocus` and that then makes the method not that useful. Removing for
now.
2023-11-30 21:44:52 -08:00
Thorsten Ball
3fef4fce56 gtk: move surface destroy through deref 2023-11-30 21:44:52 -08:00
Thorsten Ball
236e57a1f4 gtk: restore focus-grabbing after closing one side in split 2023-11-30 21:44:52 -08:00
Thorsten Ball
a18fb4a661 gtk: fix closing of windows that contains splits 2023-11-30 21:44:52 -08:00
Thorsten Ball
0065bae0d4 gtk: get closing of tabs working again (closing windows still broken) 2023-11-30 21:44:52 -08:00
Thorsten Ball
8cf9d97ac3 gtk: fix replacing of splits, remove dead code 2023-11-30 21:44:52 -08:00
Thorsten Ball
ecbe910714 gtk: fix closing of surfaces by releasing the ref to gl_area 2023-11-30 21:44:52 -08:00
Mitchell Hashimoto
ec2aa8e322 apprt/gtk: maintain container pointers 2023-11-30 21:44:52 -08:00
Mitchell Hashimoto
06b40a8b89 apprt/gtk: closing tabs works again 2023-11-30 21:44:52 -08:00
Mitchell Hashimoto
4c1300ab69 apprt/gkt: a lot of things are broken 2023-11-30 21:44:51 -08:00
Mitchell Hashimoto
79a9d417d1 apprt/gtk: working on new Split 2023-11-30 21:44:51 -08:00
Mitchell Hashimoto
83b0096dfc apprt/gtk: get rid of one newsurface call 2023-11-30 21:44:51 -08:00
Mitchell Hashimoto
f1547465cc apprt/gtk: new surface options down to just a couple 2023-11-30 21:44:51 -08:00
Mitchell Hashimoto
97b9708dd1 apprt/gtk: remove tab option from surface 2023-11-30 21:44:16 -08:00
Mitchell Hashimoto
14570b8a6c apprt/gtk: get rid of title label option, we can infer it on container 2023-11-30 21:44:16 -08:00
Mitchell Hashimoto
00c02e88d2 apprt/gtk: remove Window from Surface, use container only 2023-11-30 21:44:16 -08:00
Mitchell Hashimoto
d65a804edd apprt/gtk: working on some reorg 2023-11-30 21:44:16 -08:00
Thorsten Ball
8cfa9297bf gtk: rework surface title buffer handling 2023-11-30 21:44:16 -08:00
Thorsten Ball
b60133fd34 gtk: keep buffer of surface title, update if focused 2023-11-30 21:44:15 -08:00
Thorsten Ball
f1e81563d9 gtk: always remember focused surface before grabbing focus 2023-11-30 21:44:04 -08:00
Thorsten Ball
a1fb74d8aa gtk: rework naming conflict after rebase 2023-11-30 21:44:03 -08:00
Thorsten Ball
8c58bf222d gtk: move logic of splitting surface in a tab to Tab 2023-11-30 21:43:39 -08:00
Thorsten Ball
9ddf097a03 gtk: Refactor how a new split is created 2023-11-30 21:43:38 -08:00
Thorsten Ball
0add9de0eb gtk: handle closing of surfaces with sibling being a Paned 2023-11-30 21:43:38 -08:00
Thorsten Ball
142a2f4cb0 gtk: refactor how Paned is created 2023-11-30 21:43:38 -08:00
Thorsten Ball
19f7b37bb3 gtk: move Child/Parent/Position into same file 2023-11-30 21:43:38 -08:00
Thorsten Ball
5e789bf152 gtk: allow splitting when already split 2023-11-30 21:43:38 -08:00
Thorsten Ball
2ed841145b gtk: take direction into account when creating a new split 2023-11-30 21:43:38 -08:00
Thorsten Ball
98a5016598 gtk: simplify code when creating new split 2023-11-30 21:43:38 -08:00
Thorsten Ball
d88898fc61 gtk: get 1st version of GTK splits working 2023-11-30 21:43:37 -08:00
Nathan Fisher
aba1b85503 Add Parent and Child types for tracking splits; Add methods for
adding start and end children in `Paned` widget;
2023-11-30 21:41:34 -08:00
Mitchell Hashimoto
eac1731d9d apprt/gtk: translate modifier-only presses to proper modifier state 2023-11-29 20:37:56 -08:00
Mitchell Hashimoto
2ce3db7dc2 apprt/gtk: set default cursor to be "text" (ibeam)
Fixes #933

On startup, we'd set the cursor to "text" but we wouldn't store that as
our cursor so when the mouse was unhidden, we'd go back to "default".
This PR changes it so that on surface startup we set and store the
"text" cursor so as the cursor hides/shows it reverts to the proper
value.
2023-11-21 17:10:44 -08:00
Mitchell Hashimoto
f2c1e18647 apprt/gtk: support IME popups such as Asian language input
Fixes #882

This hooks up all the GTK.IMContext things properly so that we support
switching input methods, popups, etc. This should improve our support
for asian languages, emoji input, etc.
2023-11-20 18:08:23 -08:00
Mitchell Hashimoto
080789957a Merge pull request #903 from mitchellh/macos-update
Custom Shaders (Metal and OpenGL)
2023-11-17 22:06:38 -08:00
Mitchell Hashimoto
f2513e0825 Merge pull request #876 from gpanders/notifications
Add support for desktop notifications
2023-11-17 21:57:09 -08:00
Mitchell Hashimoto
389712a698 renderer/opengl: switch to new update vs draw 2023-11-17 21:50:34 -08:00
Tim Culverhouse
caf2252144 gtk: implement desktop notifications 2023-11-17 12:59:23 -06:00