Olivier Goffart
f117cb77cc
NativeSpinBox: Handle the key press in native code
2022-04-19 11:27:19 +02:00
Tobias Hunger
df9f86ba4a
janitor: cspell fixes
2022-04-13 14:42:32 +02:00
Tobias Hunger
2c82fd7618
Tab: Make tab accept keyboard
2022-04-13 14:42:32 +02:00
Simon Hausmann
a881922dd2
Replace touch point workaround with winit patch
...
Commit c85e1b6d25
added a workaround for a
winit issue, which has been fixed upstream. Until a new release is
available, let's patch in winit from a branch that has the fix
cherry-picked.
This way we don't have to remember to remove the workaround with the
next update and this has been verified on the device.
2022-04-13 11:43:24 +02:00
Olivier Goffart
f5baef4262
MCU: fix drawing of clipped rounded rectangle with border
2022-04-12 16:15:33 +02:00
Olivier Goffart
cc1aad8ce9
MCU: fix panic in the renderer
...
Sometimes, BorderRectangle clips can get negative if the intersection
of two rectangle leads to a rectangle that is smaller than the previous
rectangle, but because of floating point error while computing the max
position, the resulting clip may still be negative.
Add a small value to compensate that error
2022-04-12 16:12:41 +02:00
Olivier Goffart
8327ab3e52
MCU renderer: query the geometry of items we do not support
...
So that we can register dependencies and refresh when it moves, even
if we don't draw anything for them
2022-04-12 13:02:58 +02:00
Olivier Goffart
1b91158b46
corelib: allow to use i32 for coordinate instead of f32
2022-04-11 17:46:50 +02:00
Simon Hausmann
c85e1b6d25
Fix touch position reported on touch release with wayland
...
Work around https://github.com/rust-windowing/winit/issues/1996 by tracking
touch positions ourselves
2022-04-11 15:56:34 +02:00
Olivier Goffart
14d251e63a
winit backend: preserve the value of the scale_factor set programmatically
2022-04-11 14:23:28 +02:00
Simon Hausmann
56ead8689c
Enable dark-light mode detection for WASM builds
...
The new dark-light release supports it
2022-04-10 10:45:58 +02:00
Simon Hausmann
afb59cba29
mcu: fix popups not visibly closing
...
When closing a popup, notify the platform window, so that the mcu
backend can remember that region and start the dirty region with it.
Also, free all the rendering cache items of deleted items, to avoid accidental re-use
when re-opening a popup.
2022-04-08 19:32:33 +02:00
Simon Hausmann
db54da2064
mcu: Don't panic when opening popups
...
Implement popups as inline components. The dirty region handling however
is still missing when closing a popup.
2022-04-08 16:46:12 +02:00
Simon Hausmann
70f3f50359
mcu: Add support for automatic font size detection
...
Continue to support specififying logical font sizes in the compile step
via SLINT_FONT_SIZES, but additionally look for Text/TextInput/Window elements
and extract any constant font sizes
found.
This makes it work out of the box with the printer demo.
2022-04-08 15:11:26 +02:00
Tobias Hunger
57e120509d
qt: Handle focus in checkbox
2022-04-08 08:32:05 +02:00
Tobias Hunger
70cfc33659
qt: Handle focus in native button
2022-04-08 08:32:05 +02:00
Simon Hausmann
335502be3f
Upgrade to femtovg 0.3.4
...
The GL optimizations are in this release now and this also fixes #843
2022-04-07 13:56:23 +02:00
Simon Hausmann
063a292327
GL backend: add shortcut for zero opacity
...
If the global opacity is zero, we don't need to paint rectangles, etc.
This shortcut is a compromise between opting out much later on femtovg
level and too early before querying properties of the rectangle. We
still want to do the latter as somebody might depend on that.
2022-04-07 11:37:51 +02:00
Simon Hausmann
206b765d5d
Remove font-kit dependency on Windows
...
Use directwrite APIs directly to determine the font fallbacks for a given piece of text.
2022-04-06 17:30:30 +02:00
Simon Hausmann
d29f834e57
GL backend: minor optimization for image rendering
...
When colorizing or drawing images, it's not necessary to apply the extra edge anti-aliasing.
2022-04-06 11:33:18 +02:00
Simon Hausmann
6116bcb35d
Minor memory usage optimization for clip layers in the GL backend
...
If a clipped rectangle transitions from having a border radius to none, then we can
delete the clip layer.
2022-04-06 11:32:57 +02:00
Simon Hausmann
f836322ca1
Speed up rendering of clip elements
...
When a clip element is enabled and it does not intersect with the current clip region,
then we don't even have to bother rendering any child elements.
2022-04-06 11:32:44 +02:00
Simon Hausmann
e06e99a4b9
GL backend: avoid triangle strip for stroke when filling plain rectangles
...
Similar to commit a329f052ea
, we can apply the same
optimization to rectangles.
2022-04-06 11:32:23 +02:00
Simon Hausmann
a87f2abfd3
Fix font fallback determination on Windows with the GL backend
...
IDWriteFontFallback::MapCharacters only returns one single font that tries to cover
as much of the input string as possible. We need to continue processing the remaining parts of the text,
in order to get a complete list for all fonts we need.
Fixes #1139
2022-04-05 13:14:33 +02:00
Olivier Goffart
40c98d6d05
Update cbindgen and enable MouseCursor::move
...
cbindgen 0.21 was released which contains https://github.com/eqrion/cbindgen/pull/724
which allow to use raw identifier in enums shared with C++.
So now we can have `MouseCursor.move` in slint despite it being a rust keyword
Note that the strum macro also have trouble with the raw identifier, so we
take that in account in the conversion functions in the interpreter
2022-04-05 06:39:50 +02:00
Olivier Goffart
8eddeb6a80
Qt: Fix text_input_byte_offset_for_position when at the end of the last line
2022-04-04 15:36:43 +02:00
Olivier Goffart
d7616ae03b
Qt backend: fix text_input_byte_offset_for_position at end of lines
...
We must include the trailing spaces in the lines, and if we are past that
we must always go back to the last character of the line
2022-04-04 14:57:44 +02:00
Olivier Goffart
054144c236
text_input_byte_offset_for_position: clicking past the end should return the last position
...
Instead of 0.
(But passing a negative y coordinate should return 0)
2022-04-04 14:57:44 +02:00
Olivier Goffart
1891e4489a
GL backend: update the resizable flag
...
I only tested on X11 plasma, and there this doesn't have any effect,
But this might be needed because i removed it a few commit ago in another
function.
I think the reason it is there is that it allow changing from a fixed size
to a custom size
2022-04-01 16:18:59 +02:00
Olivier Goffart
16a0f28449
Keep the existing size re-using a window
...
Eg, in the viewer or in the preview.
The preferred size is still set as the size when the window is first open
2022-04-01 16:18:59 +02:00
Simon Hausmann
a329f052ea
GL backend: avoid stroke when blitting textures
...
When blitting a rectangular texture, we can disable the anti-aliasing on the edges
that femtovg applies by default. That avoids an extra triangle strip for
this stroke to apply anti-aliasing.
2022-04-01 13:32:25 +02:00
Simon Hausmann
143167f82f
Bump up the SPI frequency for the display controller ( #1115 )
...
* Bump up the SPI frequency for the display controller
2022-03-30 15:40:59 +02:00
Lukas Jung
b6171530ab
replace text_input_position_for_byte_offset with text_input_cursor_rect_for_byte_offset
2022-03-28 10:07:07 +02:00
Simon Hausmann
b4f7d135d6
Fix cargo fmt
2022-03-25 11:52:37 +01:00
Olivier Goffart
e6619438c6
Janitor: update a comment to match the implementation
2022-03-25 10:50:33 +01:00
Simon Hausmann
033cf3721e
Improve performance of opacity rendering
...
Avoid an opacity layer also in the case where it is applied to an element with no children.
2022-03-25 10:50:02 +01:00
Simon Hausmann
d6a569b8f8
Make rendering_metrics_collector a public module
...
... instead of pulling it entirely into the graphics module.
2022-03-24 21:20:28 +01:00
Simon Hausmann
f3b1ba6717
Collect statistics about the number of layers created in the GL and Qt renderer
2022-03-24 21:20:28 +01:00
Simon Hausmann
7b194b3f8c
Rename FPSCounter to RenderingMetricsCollector
...
In preparation for collecting additional data
2022-03-24 21:20:28 +01:00
Olivier Goffart
b4bbe0b6df
Wasm: Hack to get input working despite composition ( #1101 )
...
Since we don't have yet support for IME in Slint, simulate that by inserting
the text anyway, and rollback using backspaces.
2022-03-24 21:08:44 +01:00
Olivier Goffart
8984eadc05
Wasm: polish the mobile keyboard input
...
ensure that we don't add the text twice in firefox, and that not every
word is capitalized in chrome
2022-03-24 18:48:24 +01:00
Simon Hausmann
fee858271c
Fix the frame per second counter when using refresh_full_speed
...
After commit 575665994a
we need to explictly schedule a repaint,
so that we draw and call `measure_frame_rendered`.
2022-03-24 14:49:20 +01:00
Olivier Goffart
cf49568373
Compiler: make the image processing an enum in the config
2022-03-24 13:16:21 +01:00
Olivier Goffart
41b20fdd59
MCU build system: pass information about embedding images and glyph to the compiler
...
... using metadata from the build script send with the DEP_I_SLINT_BACKEND_MCU
Saves two environment variable that we don't have to pass
2022-03-24 13:16:21 +01:00
Simon Hausmann
60bb30df8f
Hide the cursor on mobile Safari
2022-03-24 11:55:56 +01:00
Simon Hausmann
e719357ffa
janitor: Remove unnecessary clone
2022-03-24 09:10:29 +01:00
Olivier Goffart
575665994a
GL backend: don't force every window to be redrawn in case of animation
...
When the animation tick occurs, the tracker will tell winit to repaint
the relevant window already.
2022-03-23 17:43:48 +01:00
Olivier Goffart
bd44afdbf4
Wasm: When getting native callback, make sure to call the winit event loop
...
Otherwise it won't be woken up if the window needs a redraw
2022-03-23 17:43:48 +01:00
Simon Hausmann
caca532ada
Released unused opacity layers
2022-03-23 17:37:27 +01:00
Simon Hausmann
4799ac9ce8
Don't create layers for opacity if it's not needed
...
More could be done towards this, but after literally seeing `opacity: 1;` in
.slint files, this seems worth doing.
2022-03-23 17:37:27 +01:00