put WindowHandle back into platform-specific code
This commit is contained in:
parent
a91a5a1126
commit
ad12985d08
2 changed files with 12 additions and 11 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -35,16 +35,6 @@ pub enum Parent {
|
||||||
|
|
||||||
unsafe impl Send for 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, ()>;
|
type WindowOpenResult = Result<WindowInfo, ()>;
|
||||||
|
|
||||||
pub trait WindowHandler {
|
pub trait WindowHandler {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use raw_window_handle::{
|
||||||
use super::XcbConnection;
|
use super::XcbConnection;
|
||||||
use crate::{
|
use crate::{
|
||||||
Event, KeyboardEvent, MouseButton, MouseCursor, MouseEvent, Parent, ScrollDelta, WindowEvent,
|
Event, KeyboardEvent, MouseButton, MouseCursor, MouseEvent, Parent, ScrollDelta, WindowEvent,
|
||||||
WindowHandle, WindowHandler, WindowInfo, WindowOpenOptions, WindowOpenResult,
|
WindowHandler, WindowInfo, WindowOpenOptions, WindowOpenResult,
|
||||||
WindowScalePolicy, PhyPoint, PhySize,
|
WindowScalePolicy, PhyPoint, PhySize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,17 @@ pub struct Window {
|
||||||
new_physical_size: Option<PhySize>
|
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 {
|
impl Window {
|
||||||
pub fn open<H: WindowHandler>(options: WindowOpenOptions) -> Result<(WindowHandle, WindowInfo), ()> {
|
pub fn open<H: WindowHandler>(options: WindowOpenOptions) -> Result<(WindowHandle, WindowInfo), ()> {
|
||||||
let (tx, rx) = mpsc::sync_channel::<WindowOpenResult>(1);
|
let (tx, rx) = mpsc::sync_channel::<WindowOpenResult>(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue