Commit graph

62 commits

Author SHA1 Message Date
b9999a3d1e
Merge branch 'master' into zig-0.14 2025-02-07 22:21:55 +01:00
38d76eb811
refactor: remove a very lonely C file 2025-02-07 22:20:57 +01:00
d503f3c197
fix: windows build with zig 0.14.0-dev.3039 2025-02-04 23:32:40 +01:00
75b3caebfc
feat(win32): tweak flow win32 icon
To be even uglier I guess.
2025-01-30 17:54:34 +01:00
8b69cfddd3
fix(win32 gui): add middle mouse support and fix right mouse button mapping 2025-01-25 17:39:07 +01:00
Jonathan Marler
99aefc8d22 remove direct2d dependency and update zigwin32
Since we removed the direct2d renderer we no longer need to reference
the direct2d-zig repository.  Instead we now directly reference the
zigwin32 repository.  I've also updated that repository with a few fixes
and additions which allowed us to remove some code from flow.
2025-01-21 08:40:44 +01:00
4842002136
fix(win32 gui): translate mouse wheel events from screen to window coordinates 2025-01-20 19:55:18 +01:00
91eba39019
fix(win32 gui): prevent index out of bounds in d3d11.paint 2025-01-20 19:46:22 +01:00
5b5fd26bdf
feat(win32 gui): add tracy zones to win32 gui renderer 2025-01-20 15:07:42 +01:00
Jonathan Marler
620e44ef02 win32 gui: fix high cpu usage, validate window in WM_PAINT
Looks like I probably accidently removed the calls to BeginPaint and
EndPaint in WM_PAINT, which, would cause the OS to think that the
window contents are never validated and will continuously send us WM_PAINT
messages.  I've added these back in and now flow is back to low CPU usage
especially when idle.
2025-01-20 14:56:32 +01:00
e1b1591167
feat(win32 gui): add font selection palette
closes #102
2025-01-17 20:32:20 +01:00
Jonathan Marler
3e953981fe win32 gui: add Fonts type to get list of available fonts
Adds a Fonts type the render interface.  Here's an example of how
you could use this in `gui.zig`:

```zig
    const fonts = render.Fonts.init();
    defer fonts.deinit();
    const count = fonts.count();
    std.log.info("{} fonts", .{count});
    for (0..count) |font_index| {
        const name = fonts.getName(font_index);
        std.log.info("font {} '{}'", .{ font_index, std.unicode.fmtUtf16Le(name.slice()) });
    }
```
2025-01-17 16:19:19 +01:00
Jonathan Marler
7558a63819 win32 gui: decouple screen renderer from text renderer
I tried adding Andrew's TrueType renderer as an option, however, I
realized it doesn't work with zig 0.13.0, so it'll have to wait.

Until then here's the changes needed to decouple the screen/text rendering
which would make it easier to add more text renderers and just cleans
things up a bit more in general.
2025-01-15 21:16:51 -07:00
Jonathan Marler
ce068ee0dc direct3d: hoist flow types out, provide cell type, don't block GPU
Changes d3d11 to accept an array of cells to render that have already been
rendered to a texture and converted to texture coordinates.  This minimizes
the time we have to map the shader cell buffer which blocks the GPU from
using it.
2025-01-15 22:40:37 +01:00
Jonathan Marler
96c56c7124 win32 gui: get correct window size even when maximized 2025-01-15 22:32:45 +01:00
Jonathan Marler
0f08b3930f win32 gui: fallback to non-debug d3d if create fails (requires sdk) 2025-01-14 23:37:28 +01:00
6530a7a51c
feat(win32 gui): add reset_fontsize and rest_fontface commands 2025-01-14 19:54:51 +01:00
Jonathan Marler
a5622af68d win32 gui: keep window aspect ratio during resizing
Now instead of snapping to a size after releasing the mouse from resizing
the window, the window will incrementally snap to a good size while the
window is being resized.
2025-01-14 17:55:44 +01:00
Jonathan Marler
eb1caf5237 remove Direct2D renderer
Removes the old slow Direct2D renderer which has become obselete with
the new Direct3D11 renderer.  Note that Direct2D is built on top of
Direct3D so there's really no reason to keep it around.
2025-01-14 17:17:34 +01:00
9cc5c9711b
fix(win32 gui): avoid a panic on invalid utf-8 2025-01-14 13:08:27 +01:00
Jonathan Marler
27f256a7c5 switch to a monochrome texture for the font rendering 2025-01-13 22:15:11 -07:00
Jonathan Marler
5b83619f7a win32 gui: replace D2D renderer with D3d11 shader 2025-01-13 05:06:57 -07:00
Jonathan Marler
157dc3d47c win32 gui: a few fixes 2025-01-12 17:44:06 +01:00
Jonathan Marler
e542ccb8f1 win32 gui: track and use window bounds to prevent infinite shrinkage 2025-01-10 23:11:28 +01:00
7d138a742c feat(win32 gui): add set_fontface and set_fontsize commands 2025-01-10 23:10:59 +01:00
Jonathan Marler
a0cee00f66 win32 gui: make an effort to bring window to the top/foreground 2025-01-10 22:35:50 +01:00
5300e3346d feat(win32 gui): add adjust_fontsize command to zoom in/out 2025-01-09 20:08:12 +01:00
Jonathan Marler
fd86653db1 win32 gui: more fixes/edge cases 2025-01-09 17:17:50 +01:00
Jonathan Marler
87a355b854 win32 gui: shrink window to be a multiple of size width
Let the win32 voodoo flow...
2025-01-09 17:17:50 +01:00
5b2198b313
feat(win32 gui): read initial window placement from config and tweak defaults 2025-01-08 16:12:42 +01:00
9e4e81eb0d
feat(win32 gui): read fontface and size from gui_config 2025-01-08 15:57:38 +01:00
eaa7ad87b7
feat(win32 gui): add gui_config.json config file 2025-01-08 14:36:43 +01:00
5c6c9acaa9
fix(win32 gui): round down CellSize to avoid gaps between cells 2025-01-08 12:12:57 +01:00
Jonathan Marler
337b6ce626 win32 gui: rework startup/hwnd sync 2025-01-07 22:02:16 +01:00
Jonathan Marler
ff7bdeef6b win32 gui: render unicode replacement_char on invalid chars 2025-01-07 19:02:33 +01:00
0c7f19b5dd feat: support matching of shifted keybindings
This allows us to bind things like alt+F and ctrl+?. Binding
with and explicit shift modifier is still allowed, such as alt+shift+f.
2025-01-07 14:53:34 +01:00
689b2ca410 feat(win32 gui): send both shifted and un-shifted input keycodes/codepoints
Also, send input text only for non-modified events.
2025-01-07 14:53:34 +01:00
Jonathan Marler
d90d82a4b7 win32 gui: remove bespoke/incorrect key translation
I played around with the API a bit and I tried out the other approach
where instead of trying to implement our own keyboard translation, instead
I just clear the "control key" before calling ToUnicode.  This fixes any
weird translation the OS was doing.

With this change, we no longer need to skip calling ToUnicode if the
control or alt keys are down, so keys will always work the same way whether
or not these modifiers are down.
2025-01-07 14:53:34 +01:00
4c73948068
feat(win32 gui): send terminal background updates to gui 2025-01-07 10:31:17 +01:00
Jonathan Marler
c7d6bd6805 win32 gui: unbreak window icon
woops, accidently broke the window icon by moving the code that loads
it after calling RegisterClass, here's the fix
2025-01-06 20:27:56 +01:00
cd2aba6a74
fix(win32 gui): don't panic on bad unicode result and reduce info logging 2025-01-06 17:03:02 +01:00
93d6ee2626
fix(win32 gui): set window title after gui window is created 2025-01-06 16:49:57 +01:00
e4fef98fcd
fix(win32 gui): add mapping for left_super 2025-01-06 16:00:17 +01:00
a6b29e4fe9
feat(win32 gui): issue quit command on window close and exit cleanly 2025-01-06 10:56:36 +01:00
Jonathan Marler
21a7106fe3 win32 gui: mouse drag
initial implementation for left mouse drag
2025-01-06 08:35:16 +01:00
Jonathan Marler
592e812bf4 win32 gui: implement window placement and higher DPI icons 2025-01-06 07:42:18 +01:00
Jonathan Marler
2af5cc9774 win32 gui: don't center text 2025-01-06 07:40:58 +01:00
Jonathan Marler
67613c5bc4 win32 gui: decide on aligning cells to pixel boundary 2025-01-06 07:40:58 +01:00
Jonathan Marler
456ec8535b win32 gui: fix some issues with cell sizing/alignment 2025-01-06 07:40:58 +01:00
Jonathan Marler
f2a9cb0d6a win32 gui: performance fix, don't call DrawText for space characters 2025-01-05 22:11:58 +01:00