mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00
Use Point2D in the C++ ffi when setting the window position
This commit is contained in:
parent
94b4f81be6
commit
d6f8048232
3 changed files with 10 additions and 4 deletions
|
@ -185,7 +185,7 @@ public:
|
|||
|
||||
void set_position(const slint::Point<int> &pos)
|
||||
{
|
||||
cbindgen_private::slint_windowrc_set_position(&inner, pos.x, pos.y);
|
||||
cbindgen_private::slint_windowrc_set_position(&inner, &pos);
|
||||
}
|
||||
|
||||
slint::Size<unsigned int> size() const { return cbindgen_private::slint_windowrc_size(&inner); }
|
||||
|
|
|
@ -19,4 +19,11 @@ struct Point
|
|||
bool operator==(const Point &other) const = default;
|
||||
};
|
||||
|
||||
namespace cbindgen_private {
|
||||
// The Size types are expanded to the Point2D<...> type from the euclid crate which
|
||||
// is binary compatible with Point<T>
|
||||
template<typename T>
|
||||
using Point2D = Point<T>;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -945,11 +945,10 @@ pub mod ffi {
|
|||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_windowrc_set_position(
|
||||
handle: *const WindowRcOpaque,
|
||||
x: i32,
|
||||
y: i32,
|
||||
pos: &euclid::default::Point2D<i32>,
|
||||
) {
|
||||
let window = &*(handle as *const WindowRc);
|
||||
window.set_position([x, y].into());
|
||||
window.set_position(euclid::Point2D::from_untyped(*pos));
|
||||
}
|
||||
|
||||
/// Returns the size of the window on the screen, in physical screen coordinates and excluding
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue