According to @kkeybbs, pressing the maximize button on Windows only
resizes the window up to its maximum bounds. That means we can leave the
button available, and only hide it when the window has a fixed size.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
There are two max window size settings on macOS, `contentMaxSize` and
`maxFullScreenContentSize`. Set the latter to avoid a window being
resized larger than its maximum in full screen mode.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Currently build fails as go.mod uses go 1.23.8 which doesn't have
strings.SplitSeq. Note: strings.SplitSeq was introduced in go 1.24.
Signed-off-by: Miles Alan <m@milesalan.com>
The Windows Pointer API
(https://learn.microsoft.com/en-us/windows/win32/api/_inputmsg/) was used
to allow the detection of events when interacting with touch screens. This
also opens the gates for supporting other types of input devices (e.g. pens
and touchpads). Mouse events are now part of the pointer events (primary
events trigger WM_POINTER<DOWN|UP>, whereas secondary ones vanilla
WM_POINTERUPDATE, and cancellations WM_POINTERCAPTURECHANGED).
A fourth and fifth button (usually found in modern mice) has also been added
for completeness, though their integration in other OS-es shall be the
objective of future patches.
Signed-off-by: Marc <marc.leroy@samantree.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Stack.Layout and Flex.Layout caused a lot of heap allocations / escapes. The
reason was that scratch space for dims and call and was inside Stack/FlexChild.
child.call.Add(gtx.Ops) confused the go escape analysis and caused the entired
children slice to escape to the heap, including all widgets in it. This caused a
lot of heap allocations. Now the scratch space is separate from children, and
for cases len(children) <= 32, we will allocate the scratch space on the stack.
For cases len(children) > 32, only the scratch space gets allocated from the
heap, during append.
Signed-off-by: vsariola <5684185+vsariola@users.noreply.github.com>
Previously, it was impossible to scroll a Axis == Horizontal using
ordinary mouse-wheel. Now, it's possible to set ScrollAnyAxis == True,
which combine scrolling from any direction. That makes possible
to scroll Horizontal lists with vertical mouse-wheel.
By default this option is false, keeping the old behaviour.
Signed-off-by: inkeliz <inkeliz@inkeliz.com>
Without this fix, two gestures that both issue GrabCmd on the same frame
will cancel each other. With the fix, the first will win the grab, and
the other ignored.
References: https://todo.sr.ht/~eliasnaur/gio/647
Signed-off-by: Elias Naur <mail@eliasnaur.com>
When the window is created position it *before* processing the actions
to perform (which may include system.ActionCenter). Note that the
actions are performed in the callback windowProc().
Fixes: https://todo.sr.ht/~eliasnaur/gio/646
Signed-off-by: Marcel Juffermans <mjuffermans@paradigmone.com.au>
The fix for #605 moved the disabling of event delivery from Source
to Context to enable disabled Contexts to still react to commands
(invalidate, focus etc.). However, that change in turn caused #641 where
the exported Context.Source field would no longer know not to deliver
events.
This change partially reverts the fix for #605 by moving disabledness
back to Source, fixing #641. Disabled Sources are left capable of
executing commands, thus keeping #605 fixed.
Thanks to Chris et al for keeping the use-cases straight enough for me
to come up with this (hopefully final) fix.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Fixes: https://todo.sr.ht/~eliasnaur/gio/641
References: https://todo.sr.ht/~eliasnaur/gio/605
An IME session must be discarded when its text content no longer matches
the underlying text component content. However, the check for matching
was too pessimistic; the IME session would be discarded if the new
snippet from the text component was not equal to the snippet reported to
the IME. This change implements a refined check that only discards a
session if the content of the overlap between the new and old snippets
don't match.
Fixes an IME issue reported by Zhang Zj.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit updates our typesetting dependency to a version that properly
bidi-orders truncator runs. This fixes an issue in which the truncator
symbol could appear on the wrong side of text.
Fixes: https://todo.sr.ht/~eliasnaur/gio/634
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit tries to ensure that trailing newlines do not introduce more vertical space below
the text than is occupied by a typical text run within the text.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Text Shaper set the last empty line height to ascent+decent
of the paragraph break glyph which causes the last visual empty
line to have a smaller line height. This commit tries to fix it
by setting the line height using the line height from the last line.
References: https://todo.sr.ht/~eliasnaur/gio/629
Signed-off-by: zjzhang <zhangzj33@gmail.com>
By propagation, we restore the system behaviour for shortcuts the program
don't want, for example the system beep.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The fix for #616 went to far by attempting to support macOS key bindings
through doCommandBySelector. Issue #625 is a consequence, but more
fundamentally, key bindings does not work with support for key.Release
events.
Remove key binding translation and fix#626, and add a check whether an
IME swallowed a key event, keeping #616 fixed.
While here, replace the KEY_ constants with ASCII codes.
Fixes: https://todo.sr.ht/~eliasnaur/gio/625
References: https://todo.sr.ht/~eliasnaur/gio/616
Signed-off-by: Elias Naur <mail@eliasnaur.com>
In order to avoid DLL preloading attacks, we should be careful about where we
load DLLs from. These packages load graphics DLLs, which may be provided by the
OS, by a graphics vendor, or even by individual applications. As such, we can't
restrict loading them to just system32-provided paths. Instead, we invoke
LoadLibraryEx [0] with the LOAD_LIBRARY_SEARCH_DEFAULT_DIRS path, which will search
system32, application-defined paths, and the path of the primary application
executable. This mode ignores the system %PATH% variable, which dramatically
reduces the attack surface of malicious or unintended DLLs.
Applications may add custom paths to the search list by calling the standard
windows AddDllDirectory function [1] prior to attempting to initialize GL.
Thanks to Mohsen Mirzakhani and Utkarsh Satya Prakash for bringing this to
our attention.
[0] https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa
[1] https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-adddlldirectory
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
It's currently failing, and upgrading it may fix it.
While here, track lates FreeBSD to avoid upgrade toil.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
In order to avoid DLL preloading attacks, we should always load our system
dependencies using the helper that only searches the system library path.
Thanks to Mohsen Mirzakhani and Utkarsh Satya Prakash for bringing this to
our attention.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit makes the editor widget suppress the trimming of trailing whitespace
so that the spaces can be selected intuitively.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit adds a shaping parameter that disables the trimming of trailing
whitespace from lines. Text editors and similar use-cases want trailing whitspace
glyphs to be selectable, which means they must occupy space.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
The typesetting package has smarter line wrapping now, which is making our
test text require fewer lines to display. We needed to update the expected
data accordingly.
I've also added a feature that takes a screenshot of the rendered output of
one of our most complex cursoring tests. This will make it much easier to
verify its behavior in the future. This feature currently only triggers if
the test case fails.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
We've migrated the processing of bidi run ordering into the upstream typesetting
package, so now we can just consume the already-ordered runs instead of computing
their ordering ourselves.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This change generates keypress and release events for modifier keys in macOS.
Specifically the Control, Alt, Shift and Command keys.
Signed-off-by: Jeff Williams <kanobe@gmail.com>