Commit graph

489 commits

Author SHA1 Message Date
Tobias Hunger
c443bb43cf Implement focus movement on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
36421b193e Implement Component-wide default focus traversal helpers 2022-03-28 14:13:36 +02:00
Tobias Hunger
be43b648e1 Make visibility status of an item available on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
d24906e2c2 Implement navigation of logical item tree on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
ee68716d07 Component: Add information to stich together ItemTrees
Add accessors to the information necessary to stitch together the
Component-wide ItemTrees (which include DynamicNodes) into one logical
tree of Items.
2022-03-28 14:13:36 +02:00
Tobias Hunger
c1bb22bd00 Add helper struct to work with the ItemTree reported by the Component
Just a bit of convenience code to walk the ItemTree.
2022-03-28 14:13:36 +02:00
Lukas Jung
a3cb8c1200 remove redundant setting of preferred_x_pos in mouse events 2022-03-28 10:07:07 +02:00
Lukas Jung
3818b09626 reset the preferred_x_pos in set_cursor_position() 2022-03-28 10:07:07 +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
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
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
Lukas Jung
8ca915d9bd add comment to TextInput's preferred_x_pos 2022-03-23 13:23:58 +01:00
Lukas Jung
8f3ab66de5 Add up and down cursor movement to TextInput 2022-03-23 13:23:58 +01:00
Olivier Goffart
e017d5118b Wasm GL backend: use a <input> element so it show the keyboard on mobile
cc #215

Handle Input event from the input directly instead of going through winit
for the TextInput.

Note that this doesn't handle the composition event well, so the text is
only considered written when it is accepted
2022-03-22 13:33:31 +01:00
Simon Hausmann
bef31d3169 Rename the layer boolean property to cache-rendering-hit 2022-03-21 20:22:43 +01:00
Simon Hausmann
535e134223 Add a Layer element that's created when using a layer boolean property
For now no backend implements this optimization hint.
2022-03-21 20:22:43 +01:00
Simon Hausmann
cd932d8cf9
MCU: fix text being cut in the printer demo sometimes being cut off (#1083)
* MCU: fix text being cut in the printer demo sometimes being cut off

When a text element is rendered at exactly the width it reports,
then last letter would be cut off.

* Adjust elision test
2022-03-21 18:47:35 +01:00
Simon Hausmann
d97710f3f9 Implement correct opacity for the GL backend
This also separates the blend-to-screen part of render_layer into a
helper function, as that will be useful in the future with public layer
elements.

Relates to #725
2022-03-18 16:35:26 +01:00
Simon Hausmann
91b3765e97 Improve method naming in ItemRenderer
Use `visit_` for the pattern where the trait offers a default implementation that calls other
methods to do the actual work.
2022-03-18 15:42:49 +01:00
Simon Hausmann
f04f0a3e48 GL backend: use direct layers for non-rectangular clips
Delegate the decision how to implement the Clip element entirely into the backend,
where the GL backend can now explicitly render
children into a layer, instead of the hack with a layer in the renderer's
state and the extra save/restore pair.
2022-03-18 15:42:49 +01:00
Simon Hausmann
6a6a26569d Add support for rendering complex clip paths into cached layers
If the renderer supports it, clip elements with a complex clip render
the sub-tree into a cached layer.
2022-03-18 15:42:49 +01:00
Simon Hausmann
75949e702c Prepare item rendering for children self-handling
The render function now takes a self_rc and returns a enum that permits
the implementation to handle rendering of children on its own and
thus make the caller skip that traversal step.
2022-03-18 15:42:49 +01:00
Olivier Goffart
fa1fad931b Properties: Save one usize for each binding
Use a Cell instead of a RefCell
2022-03-18 09:23:52 +01:00
Olivier Goffart
ca5151de11 C++: implement Window::on_close_requested 2022-03-17 14:49:12 +01:00
Olivier Goffart
fd2d82e0a3 Flickable: adjust the thresholds
There must be a high enough threshold because the driver
of our screen is fuzzy and report changing numbers. We
don't want to be moving the Flickable too fast.
2022-03-17 14:12:31 +01:00
Simon Hausmann
3a3ce15970 Add a unit test that verifies that VecModel::set_vec notifies the view correctly 2022-03-17 09:47:10 +01:00
Ray Redondo
b265f721f2 add a test 2022-03-17 09:15:58 +01:00
Ray Redondo
94cbaa55d7 add VecModel::set_vec 2022-03-17 09:15:58 +01:00
Lukas Jung
9a0f67575b remove redundant sentence in doc for on_close_requested()
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-03-17 08:51:00 +01:00
Lukas Jung
e6b39aea40 remove unnecessary derive macros from CloseRequestResponse 2022-03-17 08:51:00 +01:00
Lukas Jung
0046c1a754 run rustfmt on api.rs and window.rs 2022-03-17 08:51:00 +01:00
Lukas Jung
17066615bb remove mut from on_close_requested() to remove warning 2022-03-17 08:51:00 +01:00
Lukas Jung
3ce937f4df Add documentation to functions for close callback handling 2022-03-17 08:51:00 +01:00
Lukas Jung
a7e798842a add close_requested() closure and request_close() function to Window 2022-03-17 08:51:00 +01:00
Simon Hausmann
a3830e785a janitor: remove unused return value from render_item_children 2022-03-16 09:28:33 +01:00
Simon Hausmann
c94c223c3b Simplify item rendering loop
Instead of using the generic visitor, call `visit_children_item` directly on the Component.

This way we avoid the RefCell for the renderer and this will make it
easier to introduce items that decide to render the children themselves, with
their own property tracker.
2022-03-16 09:18:09 +01:00
Tobias Hunger
ea684fa4de Add item_tree function to Component VTable 2022-03-14 17:19:31 +01:00
Tobias Hunger
bdc3778cec Rename init/free item functions back 2022-03-14 09:43:50 +01:00
Tobias Hunger
095537e3fd Remove item from ItemTreeNode
... and make ItemTreeNode non-generic this way.

The Item is now only in the extra ItemArray struct and we are free to
expose the ItemTree further.
2022-03-14 09:43:50 +01:00
Tobias Hunger
1240c1d0b8 Remove the Component functions that initialize and free items
... based in the ItemTree. Leave only the variants that take the
ItemArray.
2022-03-14 09:43:50 +01:00
Tobias Hunger
1fd14272cf Use item_array in C++ 2022-03-14 09:43:50 +01:00
Tobias Hunger
b95342551b Add index into item_array into ItemTreeNode 2022-03-14 09:43:50 +01:00
Tobias Hunger
99364e26a9 Add helper functions to init/free arrays of items 2022-03-14 09:43:50 +01:00
Tobias Hunger
227ce31992 Use component::get_item_ref to access items 2022-03-14 09:43:50 +01:00
Lukas Jung
4c61a16c08 add From<&str> and From<SharedString> to StandardListViewItem 2022-03-11 15:45:59 +01:00
Simon Hausmann
cfe2bc1329 Fix comment 2022-03-10 10:51:32 +01:00
Simon Hausmann
20597a0296 Simplify line layout callback signature
The last argumen is unused
2022-03-10 10:51:32 +01:00