mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 12:24:16 +00:00
Add sixtyfps::Window::request_redraw()
This allows scheduling a redraw of a Window explicitly. Unfortunately it comes with a winit caveat :(
This commit is contained in:
parent
8959eac3d0
commit
18bba6ede4
5 changed files with 34 additions and 4 deletions
|
|
@ -268,6 +268,7 @@ fn gen_corelib(
|
|||
"sixtyfps_windowrc_set_component",
|
||||
"sixtyfps_windowrc_show_popup",
|
||||
"sixtyfps_windowrc_set_rendering_notifier",
|
||||
"sixtyfps_windowrc_request_redraw",
|
||||
"sixtyfps_new_path_elements",
|
||||
"sixtyfps_new_path_events",
|
||||
"sixtyfps_color_brighter",
|
||||
|
|
|
|||
|
|
@ -158,6 +158,8 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void request_redraw() const { cbindgen_private::sixtyfps_windowrc_request_redraw(&inner); }
|
||||
|
||||
private:
|
||||
cbindgen_private::WindowRcOpaque inner;
|
||||
};
|
||||
|
|
@ -177,7 +179,8 @@ constexpr inline ItemTreeNode make_dyn_node(std::uintptr_t offset, std::uint32_t
|
|||
parent_index } };
|
||||
}
|
||||
|
||||
inline ItemRef get_item_ref(ComponentRef component, cbindgen_private::Slice<ItemTreeNode> item_tree, int index)
|
||||
inline ItemRef get_item_ref(ComponentRef component, cbindgen_private::Slice<ItemTreeNode> item_tree,
|
||||
int index)
|
||||
{
|
||||
const auto &item = item_tree.ptr[index].item.item;
|
||||
return ItemRef { item.vtable, reinterpret_cast<char *>(component.instance) + item.offset };
|
||||
|
|
@ -341,6 +344,9 @@ public:
|
|||
return inner.set_rendering_notifier(std::forward<F>(callback));
|
||||
}
|
||||
|
||||
/// This function issues a request to the windowing system to redraw the contents of the window.
|
||||
void request_redraw() const { inner.request_redraw(); }
|
||||
|
||||
/// \private
|
||||
private_api::WindowRc &window_handle() { return inner; }
|
||||
/// \private
|
||||
|
|
@ -429,7 +435,8 @@ inline SharedVector<float> solve_box_layout(const cbindgen_private::BoxLayoutDat
|
|||
cbindgen_private::Slice<int> repeater_indexes)
|
||||
{
|
||||
SharedVector<float> result;
|
||||
cbindgen_private::Slice<uint32_t> ri { reinterpret_cast<uint32_t *>(repeater_indexes.ptr), repeater_indexes.len };
|
||||
cbindgen_private::Slice<uint32_t> ri { reinterpret_cast<uint32_t *>(repeater_indexes.ptr),
|
||||
repeater_indexes.len };
|
||||
cbindgen_private::sixtyfps_solve_box_layout(&data, ri, &result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -467,7 +474,8 @@ inline SharedVector<float> solve_path_layout(const cbindgen_private::PathLayoutD
|
|||
cbindgen_private::Slice<int> repeater_indexes)
|
||||
{
|
||||
SharedVector<float> result;
|
||||
cbindgen_private::Slice<uint32_t> ri { reinterpret_cast<uint32_t *>(repeater_indexes.ptr), repeater_indexes.len };
|
||||
cbindgen_private::Slice<uint32_t> ri { reinterpret_cast<uint32_t *>(repeater_indexes.ptr),
|
||||
repeater_indexes.len };
|
||||
cbindgen_private::sixtyfps_solve_path_layout(&data, ri, &result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -490,7 +498,8 @@ struct AbstractRepeaterView
|
|||
using ModelPeer = std::weak_ptr<AbstractRepeaterView>;
|
||||
|
||||
template<typename M>
|
||||
auto access_array_index(const M &model, int index) {
|
||||
auto access_array_index(const M &model, int index)
|
||||
{
|
||||
model->track_row_data_changes(index);
|
||||
if (const auto v = model->row_data(index)) {
|
||||
return *v;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue