1
0
Fork 0

put WindowHandle back into platform-specific code

This commit is contained in:
Billy Messenger 2020-10-20 15:52:09 -05:00
parent a91a5a1126
commit ad12985d08
2 changed files with 12 additions and 11 deletions

View file

@ -35,16 +35,6 @@ pub enum Parent {
unsafe impl Send for Parent {}
pub struct WindowHandle {
thread: std::thread::JoinHandle<()>,
}
impl WindowHandle {
pub fn app_run_blocking(self) {
let _ = self.thread.join();
}
}
type WindowOpenResult = Result<WindowInfo, ()>;
pub trait WindowHandler {

View file

@ -12,7 +12,7 @@ use raw_window_handle::{
use super::XcbConnection;
use crate::{
Event, KeyboardEvent, MouseButton, MouseCursor, MouseEvent, Parent, ScrollDelta, WindowEvent,
WindowHandle, WindowHandler, WindowInfo, WindowOpenOptions, WindowOpenResult,
WindowHandler, WindowInfo, WindowOpenOptions, WindowOpenResult,
WindowScalePolicy, PhyPoint, PhySize,
};
@ -28,6 +28,17 @@ pub struct Window {
new_physical_size: Option<PhySize>
}
// FIXME: move to outer crate context
pub struct WindowHandle {
thread: std::thread::JoinHandle<()>,
}
impl WindowHandle {
pub fn app_run_blocking(self) {
let _ = self.thread.join();
}
}
impl Window {
pub fn open<H: WindowHandler>(options: WindowOpenOptions) -> Result<(WindowHandle, WindowInfo), ()> {
let (tx, rx) = mpsc::sync_channel::<WindowOpenResult>(1);