api unification: return shared WindowHandle in platform code
This commit is contained in:
parent
a8c7c707d2
commit
1ddd6fa47e
|
@ -56,7 +56,10 @@ impl WindowHandle {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
pub fn open<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
|
||||
pub fn open<H, B>(
|
||||
options: WindowOpenOptions,
|
||||
build: B
|
||||
) -> crate::WindowHandle
|
||||
where H: WindowHandler,
|
||||
B: FnOnce(&mut crate::Window) -> H,
|
||||
B: Send + 'static
|
||||
|
@ -195,7 +198,7 @@ impl Window {
|
|||
)
|
||||
}
|
||||
|
||||
WindowHandle
|
||||
crate::WindowHandle(WindowHandle)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,10 @@ impl WindowHandle {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
pub fn open<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
|
||||
pub fn open<H, B>(
|
||||
options: WindowOpenOptions,
|
||||
build: B
|
||||
) -> crate::WindowHandle
|
||||
where H: WindowHandler,
|
||||
B: FnOnce(&mut crate::Window) -> H,
|
||||
B: Send + 'static
|
||||
|
@ -252,7 +255,7 @@ impl Window {
|
|||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, Box::into_raw(window_state) as *const _ as _);
|
||||
SetTimer(hwnd, 4242, 13, None);
|
||||
|
||||
WindowHandle { hwnd }
|
||||
crate::WindowHandle(WindowHandle { hwnd })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::x11 as platform;
|
|||
use crate::macos as platform;
|
||||
|
||||
|
||||
pub struct WindowHandle(platform::WindowHandle);
|
||||
pub struct WindowHandle(pub(crate) platform::WindowHandle);
|
||||
|
||||
|
||||
impl WindowHandle {
|
||||
|
@ -31,6 +31,6 @@ impl <'a>Window<'a> {
|
|||
B: FnOnce(&mut Window) -> H,
|
||||
B: Send + 'static
|
||||
{
|
||||
WindowHandle(platform::Window::open::<H, B>(options, build))
|
||||
platform::Window::open::<H, B>(options, build)
|
||||
}
|
||||
}
|
|
@ -44,7 +44,10 @@ impl WindowHandle {
|
|||
type WindowOpenResult = Result<(), ()>;
|
||||
|
||||
impl Window {
|
||||
pub fn open<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
|
||||
pub fn open<H, B>(
|
||||
options: WindowOpenOptions,
|
||||
build: B
|
||||
) -> crate::WindowHandle
|
||||
where H: WindowHandler,
|
||||
B: FnOnce(&mut crate::Window) -> H,
|
||||
B: Send + 'static
|
||||
|
@ -60,7 +63,7 @@ impl Window {
|
|||
// FIXME: placeholder types for returning errors in the future
|
||||
let _ = rx.recv();
|
||||
|
||||
WindowHandle { thread }
|
||||
crate::WindowHandle(WindowHandle { thread })
|
||||
}
|
||||
|
||||
fn window_thread<H, B>(options: WindowOpenOptions, build: B,
|
||||
|
|
Loading…
Reference in a new issue